Weekly sync 2022-07-04

This commit is contained in:
Pavel Dmitriev 2022-07-04 15:46:25 +03:00
parent eab59a060b
commit 6cbf608b94
8 changed files with 93 additions and 119 deletions

View File

@ -581,6 +581,9 @@ class baseClass extends dbStoredBase implements \JsonSerializable, jsonImportabl
$where = (empty($where)?"":"(".$where.") AND ")."`".static::$deletedFieldName."` = 0";
}
$pageSize=is_numeric($pageSize)?((int)$pageSize):null;
$page=is_numeric($page)?((int)$page):null;
if ($pageSize!==null) {
if ($page<1) { $page=1;}
$limit = "LIMIT ".($pageSize*($page-1)).", ".$pageSize;

View File

@ -25,7 +25,7 @@ class s3client implements objectStorageClient
protected string $prefix = "";
protected \Aws\S3\S3Client $s3;
protected ?\Aws\S3\S3Client $s3;
public function __construct($endpoint = null, $accessKey = null, $secretKey = null, $regionId = null, $prefix = null)
{
@ -78,6 +78,7 @@ class s3client implements objectStorageClient
"Key" => $key,
"Body" => $data
]);
gc_collect_cycles();
}
public function deleteObject($bucket, $key)
@ -88,13 +89,34 @@ class s3client implements objectStorageClient
]);
}
public function listObjects($bucket)
public function listObjects($bucket, $marker=0)
{
return $this->s3->listObjects([
"Bucket" => $this->prefix . $bucket
"Bucket" => $this->prefix . $bucket,
"Marker"=>$marker
])["Contents"];
}
public function listAllObjects($bucket)
{
$rv=[];
$cnt=0;
$marker=null;
while(true) {
$cx=0;
$list = $this->listObjects($bucket,$marker);
if ($list==null) { break; }
foreach ($list as $key=>$obj) {
$cnt++;
$cx++;
$rv[]=$obj;
$marker=$obj["Key"];
}
if ($cx==0) { break; }
}
return $rv;
}
public function exec($method, $args = [])
{
return $this->s3->{$method}($args);
@ -113,6 +135,10 @@ class s3client implements objectStorageClient
"Bucket" => $this->prefix . $bucket
]);
}
public function __destruct() {
$this->s3=null;
}
}
?>

View File

@ -333,14 +333,6 @@ class user extends baseClass implements externalCallable
$opts
);
if (! $request->user->checkAccess("adminUsers", "core")) {
throw new foxException("Forbidden", 403);
}
$pageSize=common::clearInput($request->requestBody->pageSize,"0-9");
if (empty($pageSize)) { $pageSize=$request->user->config["pageSize"];}
return static::search(common::clearInput($request->requestBody->pattern), $pageSize)->result;
}
public static function APIX_GET_sendEMailConfirmation(request $request) {

View File

@ -1,6 +1,12 @@
import * as UI from './ui.js';
import { langPack } from './langpack.js';
export function loadModule(modPath) {
import(modPath).then(function(mod) {
mod.load();
})
}
// errDict
export function exec(requestType, method , data, onSuccess,noblank,onError,version)
{

View File

@ -97,23 +97,7 @@ async function compEdit_Click(el) {
buttons[langPack.core.iface.dialodCloseButton]=function() { UI.closeDialog('ItemAdd'); }
UI.createDialog(
UI.addFieldGroup([
UI.addField({title: langPack.core.iface.title, item: "cao_name", type: "input",reqx: true}),
UI.addField({title: langPack.core.iface.comps.qName, item: "cao_qName", type: "input",reqx: true}),
UI.addField({title: langPack.core.iface.desc, item: "cao_description", type: "input"}),
UI.addField({title: langPack.core.iface.type, item: "cao_type", type: "select", reqx: true, args: [
{val:"",title: ""},
{val:"company",title: langPack.core.iface.comps.company},
{val:"client",title: langPack.core.iface.comps.client},
{val:"supplier",title: langPack.core.iface.comps.supplier},
{val:"parner",title: langPack.core.iface.comps.partner},
]}),
]),
langPack.core.iface.edit,
buttons,
350,1,'ItemAdd'
);
compAddEditDialog_Create(langPack.core.iface.edit, buttons);
await API.exec("GET",UI.parceURL().module+"/company/"+id,{}, function onAjaxSuccess(json,_textStatus) {
$("#cao_name").val(json.data.name);
@ -126,6 +110,25 @@ async function compEdit_Click(el) {
UI.openDialog('ItemAdd');
}
function compAddEditDialog_Create(title, buttons) {
UI.createDialog(
UI.addFieldGroup([
UI.addField({title: langPack.core.iface.title, item: "cao_name", type: "input",reqx: true}),
UI.addField({title: langPack.core.iface.comps.qName, item: "cao_qName", type: "input",reqx: true}),
UI.addField({title: langPack.core.iface.desc, item: "cao_description", type: "input"}),
UI.addField({title: langPack.core.iface.type, item: "cao_type", type: "select", reqx: true, args: [
{val:"",title: ""},
{val:"company",title: langPack.core.iface.comps.company},
{val:"client",title: langPack.core.iface.comps.client},
{val:"supplier",title: langPack.core.iface.comps.supplier},
{val:"parner",title: langPack.core.iface.comps.partner},
]}),
]),
title,
buttons,
350,1,'ItemAdd'
);
}
function btnCmpAdd_Click(ref) {
var buttons={};
buttons[langPack.core.iface.dialodAddButton]=function() {
@ -145,23 +148,7 @@ function btnCmpAdd_Click(ref) {
buttons[langPack.core.iface.dialodCloseButton]=function() { UI.closeDialog('ItemAdd'); }
UI.createDialog(
UI.addFieldGroup([
UI.addField({title: langPack.core.iface.title, item: "cao_name", type: "input",reqx: true}),
UI.addField({title: langPack.core.iface.comps.qName, item: "cao_qName", type: "input",reqx: true}),
UI.addField({title: langPack.core.iface.desc, item: "cao_description", type: "input"}),
UI.addField({title: langPack.core.iface.type, item: "cao_type", type: "select", reqx: true, args: [
{val:"",title: ""},
{val:"company",title: langPack.core.iface.comps.company},
{val:"client",title: langPack.core.iface.comps.client},
{val:"supplier",title: langPack.core.iface.comps.supplier},
{val:"parner",title: langPack.core.iface.comps.partner},
]}),
]),
langPack.core.iface.add,
buttons,
350,1,'ItemAdd'
);
compAddEditDialog_Create(langPack.core.iface.add, buttons);
UI.openDialog('ItemAdd');
}

View File

@ -1,8 +1,5 @@
import * as API from './api.js';
import * as UI from './ui.js';
import { langPack } from './langpack.js';
export var menuSelector={
"groups":"adminGrous",
@ -15,73 +12,29 @@ export var menuSelector={
comps: "adminComps"
};
export var modSelector={
"myprofile": "./coreMyProfile.js",
"modules": "./coreModules.js",
"module": "./coreModView.js",
"groups": "./coreGroups.js",
"group": "./coreGroup.js",
"users": "./coreUsers.js",
"userEmailConfirm": "./userMailConfirm.js",
"mailAccounts": "./coreMailAccounts.js",
"oauth": "./coreOAuthProfiles.js",
"comps": "./coreComps.js"
}
export function load() {
let ref=UI.parceURL();
switch (ref.function) {
case undefined:
break;
case "myprofile":
import("./coreMyProfile.js").then(function(mod) {
mod.load();
})
break;
case "modules":
import("./coreModules.js").then(function(mod) {
mod.load();
})
break;
case "module":
import("./coreModView.js").then(function(mod) {
mod.load();
})
break;
case "groups":
import("./coreGroups.js").then(function(mod) {
mod.load();
})
break;
case "group":
import("./coreGroup.js").then(function(mod) {
mod.load();
})
break;
case "users":
import("./coreUsers.js").then(function(mod) {
mod.load();
})
break;
case "userEmailConfirm":
import("./userMailConfirm.js").then(function(mod) {
mod.load();
})
break;
case "mailAccounts":
import("./coreMailAccounts.js").then(function(mod) {
mod.load();
})
break;
case "oauth":
import("./coreOAuthProfiles.js").then(function(mod) {
mod.load();
})
break;
case "comps":
import("./coreComps.js").then(function(mod) {
mod.load();
})
break;
default:
throw new Error(404);
if (isset(modSelector[ref.function])) {
API.loadModule(modSelector[ref.function]);
} else if (!isset(ref.function)) {
// TODO: Implement default start page for core module
return true;
} else {
throw new Error(404);
}
return true;
}

View File

@ -442,7 +442,13 @@ export function addField(ref)//title, item, blockstyle, fieldstyle, type, args,
title.append($("<span>",{ class: "dialogFieldTitle_Reqx",text: "*", title: langPack.core.iface.errReqx }));
}
var rv=$("<div>",{
let rvv=$("<div>",{
class: "crm_entity_field_value",
append: item,
style: ref.fieldstyle
});
let rv=$("<div>",{
class: "crm_entity_field_block",
style: ref.blockstyle,
append: $("<div>",{
@ -451,11 +457,7 @@ export function addField(ref)//title, item, blockstyle, fieldstyle, type, args,
append: title
})
.add($("<div>",{
class: "crm_entity_field_value",
append: item,
style: ref.fieldstyle
}))
.add(rvv)
});
if (type=="label") {
@ -464,9 +466,13 @@ export function addField(ref)//title, item, blockstyle, fieldstyle, type, args,
rv.addClass("clickable");
}
}
if (type=="label" || type=="href") {
if (typeof(ref.onContextMenu)=="function") {
rv.bind('contextmenu click', ref.onContextMenu);
rv.bind('contextmenu', ref.onContextMenu);
rv.addClass("withContextMenu");
rvv.append($("<i>",{style: "padding: 0 10px 0 10px; float: right;", class: "fas fa-ellipsis-v"}).bind('contextmenu click', ref.onContextMenu))
}
}

View File

@ -214,7 +214,7 @@ div.header_user
width: 100%;
height: 100%;
position: fixed;
z-index: 200;
z-index: 2000;
top: 0;
left: 0;
backdrop-filter: blur(1px);
@ -941,7 +941,8 @@ table.datatable.selm tr.ss.contextMenu,
table.datatable.sel tr.contextMenu a,
table.datatable.selm tbody.contextMenu a,
table.datatable.selm tr.ss.contextMenu a,
div.crm_entity_field_block.withContextMenu {
div.crm_entity_field_block.withContextMenu,
div.crm_entity_field_block.withContextMenu a {
cursor: context-menu;
}