|
@@ -582,14 +582,18 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
// 'opis' => $item['description'],
|
|
// 'opis' => $item['description'],
|
|
|
'active?' => ($item['isActive']) ? '<span class="label label-success">TAK</span>' : '<span class="text text-muted">nie</span>',
|
|
'active?' => ($item['isActive']) ? '<span class="label label-success">TAK</span>' : '<span class="text text-muted">nie</span>',
|
|
|
'struktura' => UI::h('a', [ 'href' => $this->getLink('tableStruct', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "struktura"),
|
|
'struktura' => UI::h('a', [ 'href' => $this->getLink('tableStruct', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "struktura"),
|
|
|
|
|
+ 'struktura OBJ' => UI::h('a', [ 'href' => $this->getLink('objectStruct', [ 'idStorage' => $idStorage, 'namespace' => $item['namespace'] ]) ], "obj struct"),
|
|
|
'raw info' => UI::h('a', [ 'href' => $this->getLink('rawInfo', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "raw info"),
|
|
'raw info' => UI::h('a', [ 'href' => $this->getLink('rawInfo', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "raw info"),
|
|
|
|
|
+ 'reinstall' => UI::h('a', [ 'href' => $item['reinstallLink'] ], "reinstall"),
|
|
|
// 'xsd' => UI::h('a', [ 'href' => $this->getLink('xsd', [ 'idStorage' => $idStorage ]) ], "xsd"),
|
|
// 'xsd' => UI::h('a', [ 'href' => $this->getLink('xsd', [ 'idStorage' => $idStorage ]) ], "xsd"),
|
|
|
];
|
|
];
|
|
|
}, $objectStorage->getItems([
|
|
}, $objectStorage->getItems([
|
|
|
'#refFrom' => [
|
|
'#refFrom' => [
|
|
|
'namespace' => 'default_objects/SystemSource',
|
|
'namespace' => 'default_objects/SystemSource',
|
|
|
'primaryKey' => $sourceItem['idZasob']
|
|
'primaryKey' => $sourceItem['idZasob']
|
|
|
- ]
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'order_by' => 'namespace',
|
|
|
|
|
+ 'order_dir' => 'asc'
|
|
|
]))
|
|
]))
|
|
|
]);
|
|
]);
|
|
|
echo UI::h('script', [], "
|
|
echo UI::h('script', [], "
|
|
@@ -637,13 +641,46 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
UI::menu();
|
|
UI::menu();
|
|
|
$this->navView();
|
|
$this->navView();
|
|
|
try {
|
|
try {
|
|
|
-
|
|
|
|
|
|
|
+ $namespace = V::get('namespace', '', $_GET);
|
|
|
|
|
+ if (empty($namespace)) throw new Exception("Missing param namespace");
|
|
|
|
|
+ $item = $this->getObjectAclRow($namespace);
|
|
|
|
|
+ DBG::nicePrint($item, '$item');
|
|
|
|
|
+ // DBG::log($item, 'array', '$item');
|
|
|
|
|
+ switch ($item['_type']) {
|
|
|
|
|
+ case 'TableAcl': $this->structTableAclView($item); break;
|
|
|
|
|
+ default: throw new Exception("Not implemented struct view for '{$namespace}'");
|
|
|
|
|
+ }
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
DBG::log($e);
|
|
DBG::log($e);
|
|
|
}
|
|
}
|
|
|
UI::dol();
|
|
UI::dol();
|
|
|
}
|
|
}
|
|
|
|
|
+ public function structTableAclView($item) {
|
|
|
|
|
+ UI::table([
|
|
|
|
|
+ 'caption' => UI::h('h3', [], "Struktura obiektu '{$item['namespace']}'"),
|
|
|
|
|
+ 'rows' => array_map(function ($field) {
|
|
|
|
|
+ return $field;
|
|
|
|
|
+ }, $this->getObjectFields($item))
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ public function getObjectFields($namespace) {
|
|
|
|
|
+ Lib::loadClass('Schema_SystemObjectFieldStorageAcl');
|
|
|
|
|
+ $acl = new Schema_SystemObjectFieldStorageAcl();
|
|
|
|
|
+ $items = $acl->getItems([
|
|
|
|
|
+ '#refFrom' => [
|
|
|
|
|
+ 'namespace' => 'default_objects/SystemObject',
|
|
|
|
|
+ 'primaryKey' => $namespace
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'order_by' => 'namespace',
|
|
|
|
|
+ 'order_dir' => 'asc'
|
|
|
|
|
+ ]);
|
|
|
|
|
+ if (empty($items)) throw new Exception("SystemObject '{$namespace}' not found");
|
|
|
|
|
+ $item = reset($items);
|
|
|
|
|
+ if (empty($item)) throw new Exception("SystemObject '{$namespace}' not found");
|
|
|
|
|
+ return $item;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function tableStructAction() {
|
|
public function tableStructAction() {
|
|
|
UI::gora();
|
|
UI::gora();
|
|
|
UI::menu();
|
|
UI::menu();
|
|
@@ -1276,18 +1313,18 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
$sTypeResMinInclusive->setAttribute('value', $restrictionValue);
|
|
$sTypeResMinInclusive->setAttribute('value', $restrictionValue);
|
|
|
}
|
|
}
|
|
|
/* TODO: xsd restrictions:
|
|
/* TODO: xsd restrictions:
|
|
|
- enumeration Defines a list of acceptable values
|
|
|
|
|
- fractionDigits Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero
|
|
|
|
|
- length Specifies the exact number of characters or list items allowed. Must be equal to or greater than zero
|
|
|
|
|
- maxExclusive Specifies the upper bounds for numeric values (the value must be less than this value)
|
|
|
|
|
- maxInclusive Specifies the upper bounds for numeric values (the value must be less than or equal to this value)
|
|
|
|
|
- maxLength Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero
|
|
|
|
|
- minExclusive Specifies the lower bounds for numeric values (the value must be greater than this value)
|
|
|
|
|
- minInclusive Specifies the lower bounds for numeric values (the value must be greater than or equal to this value)
|
|
|
|
|
- minLength Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero
|
|
|
|
|
- pattern Defines the exact sequence of characters that are acceptable
|
|
|
|
|
- totalDigits Specifies the exact number of digits allowed. Must be greater than zero
|
|
|
|
|
- whiteSpace Specifies how white space (line feeds, tabs, spaces, and carriage returns) is handled
|
|
|
|
|
|
|
+ enumeration Defines a list of acceptable values
|
|
|
|
|
+ fractionDigits Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero
|
|
|
|
|
+ length Specifies the exact number of characters or list items allowed. Must be equal to or greater than zero
|
|
|
|
|
+ maxExclusive Specifies the upper bounds for numeric values (the value must be less than this value)
|
|
|
|
|
+ maxInclusive Specifies the upper bounds for numeric values (the value must be less than or equal to this value)
|
|
|
|
|
+ maxLength Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero
|
|
|
|
|
+ minExclusive Specifies the lower bounds for numeric values (the value must be greater than this value)
|
|
|
|
|
+ minInclusive Specifies the lower bounds for numeric values (the value must be greater than or equal to this value)
|
|
|
|
|
+ minLength Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero
|
|
|
|
|
+ pattern Defines the exact sequence of characters that are acceptable
|
|
|
|
|
+ totalDigits Specifies the exact number of digits allowed. Must be greater than zero
|
|
|
|
|
+ whiteSpace Specifies how white space (line feeds, tabs, spaces, and carriage returns) is handled
|
|
|
*/
|
|
*/
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -1353,6 +1390,7 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
case 'viewList': $currentLabel = "Widoki [{$idStorage}]"; break;
|
|
case 'viewList': $currentLabel = "Widoki [{$idStorage}]"; break;
|
|
|
case 'rawInfo': $currentLabel = "Raw info [{$idStorage}]"; break;
|
|
case 'rawInfo': $currentLabel = "Raw info [{$idStorage}]"; break;
|
|
|
case 'tableStruct': $currentLabel = "Struktura tabeli '{$tblName}'"; break;
|
|
case 'tableStruct': $currentLabel = "Struktura tabeli '{$tblName}'"; break;
|
|
|
|
|
+ case 'objectStruct': $currentLabel = "Obiekt '{$namespace}'"; break;
|
|
|
case 'coreObjectList': $currentLabel = "Obiekty podstawowe"; break;
|
|
case 'coreObjectList': $currentLabel = "Obiekty podstawowe"; break;
|
|
|
case 'coreObjectStruct': $currentLabel = "Obiekt '{$objName}'"; break;
|
|
case 'coreObjectStruct': $currentLabel = "Obiekt '{$objName}'"; break;
|
|
|
case 'objectList': $currentLabel = "Obiekty z aktualnej domeny"; break;// TODO: domain from $_GET
|
|
case 'objectList': $currentLabel = "Obiekty z aktualnej domeny"; break;// TODO: domain from $_GET
|
|
@@ -1570,22 +1608,22 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
$this->navView();
|
|
$this->navView();
|
|
|
try {
|
|
try {
|
|
|
throw new Exception("TODO: F." . __FUNCTION__ . ' L.' . __LINE__);
|
|
throw new Exception("TODO: F." . __FUNCTION__ . ' L.' . __LINE__);
|
|
|
- // $coreObjlist = OBJXSD::getSystemObjectsStruct();
|
|
|
|
|
- // $objectList = array();
|
|
|
|
|
- // foreach ($coreObjlist as $objName) {
|
|
|
|
|
- // $objItem = array();
|
|
|
|
|
- // $objItem['name'] = $objName;
|
|
|
|
|
- // $objItem['struktura'] = '<a href="index.php?_route=Storage&_task=systemObjectsStruct&object=' . $objName . '">' . "struct" . '</a>';
|
|
|
|
|
- // // $objItem['label'] = "";// TODO: read from json
|
|
|
|
|
- // $objectList[] = $objItem;
|
|
|
|
|
- // }
|
|
|
|
|
- // usort($objectList, function($rowA, $rowB) {
|
|
|
|
|
- // $a = $rowA['nazwa']; $b = $rowB['nazwa'];
|
|
|
|
|
- // if ($a == $b) return 0;
|
|
|
|
|
- // return ($a < $b) ? -1 : 1;
|
|
|
|
|
- // });
|
|
|
|
|
- //
|
|
|
|
|
- // DBG::table("objectList", $objectList, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
|
|
+ // $coreObjlist = OBJXSD::getSystemObjectsStruct();
|
|
|
|
|
+ // $objectList = array();
|
|
|
|
|
+ // foreach ($coreObjlist as $objName) {
|
|
|
|
|
+ // $objItem = array();
|
|
|
|
|
+ // $objItem['name'] = $objName;
|
|
|
|
|
+ // $objItem['struktura'] = '<a href="index.php?_route=Storage&_task=systemObjectsStruct&object=' . $objName . '">' . "struct" . '</a>';
|
|
|
|
|
+ // // $objItem['label'] = "";// TODO: read from json
|
|
|
|
|
+ // $objectList[] = $objItem;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // usort($objectList, function($rowA, $rowB) {
|
|
|
|
|
+ // $a = $rowA['nazwa']; $b = $rowB['nazwa'];
|
|
|
|
|
+ // if ($a == $b) return 0;
|
|
|
|
|
+ // return ($a < $b) ? -1 : 1;
|
|
|
|
|
+ // });
|
|
|
|
|
+ //
|
|
|
|
|
+ // DBG::table("objectList", $objectList, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
}
|
|
}
|
|
@@ -1624,20 +1662,25 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
UI::dol();
|
|
UI::dol();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getObjectAclRow($namespace) {
|
|
|
|
|
+ Lib::loadClass('Schema_SystemObjectStorageAcl');
|
|
|
|
|
+ $acl = new Schema_SystemObjectStorageAcl();
|
|
|
|
|
+ $items = $acl->getItems([
|
|
|
|
|
+ 'f_namespace' => "={$namespace}",
|
|
|
|
|
+ ]);
|
|
|
|
|
+ if (empty($items)) throw new Exception("SystemObject '{$namespace}' not found");
|
|
|
|
|
+ $item = reset($items);
|
|
|
|
|
+ if (empty($item)) throw new Exception("SystemObject '{$namespace}' not found");
|
|
|
|
|
+ return $item;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function objectReinstallAction() {
|
|
public function objectReinstallAction() {
|
|
|
UI::gora();
|
|
UI::gora();
|
|
|
UI::startContainer();
|
|
UI::startContainer();
|
|
|
try {
|
|
try {
|
|
|
$namespace = V::get('namespace', '', $_GET);
|
|
$namespace = V::get('namespace', '', $_GET);
|
|
|
if (empty($namespace)) throw new Exception("Missing param namespace");
|
|
if (empty($namespace)) throw new Exception("Missing param namespace");
|
|
|
- Lib::loadClass('Schema_SystemObjectStorageAcl');
|
|
|
|
|
- $acl = new Schema_SystemObjectStorageAcl();
|
|
|
|
|
- $items = $acl->getItems([
|
|
|
|
|
- 'f_namespace' => "={$namespace}",
|
|
|
|
|
- ]);
|
|
|
|
|
- if (empty($items)) throw new Exception("SystemObject '{$namespace}' not found");
|
|
|
|
|
- $item = reset($items);
|
|
|
|
|
- if (empty($item)) throw new Exception("SystemObject '{$namespace}' not found");
|
|
|
|
|
|
|
+ $item = $this->getObjectAclRow($namespace);
|
|
|
DBG::log($item, 'array', '$item');
|
|
DBG::log($item, 'array', '$item');
|
|
|
|
|
|
|
|
switch ($item['_type']) {
|
|
switch ($item['_type']) {
|
|
@@ -1656,38 +1699,46 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
Lib::loadClass('AntAclBase');
|
|
Lib::loadClass('AntAclBase');
|
|
|
$antAclPath = APP_PATH_SCHEMA . DS . 'ant-object' . DS . str_replace(['__x3A__', ':'], ['.', '/'], $item['typeName']);
|
|
$antAclPath = APP_PATH_SCHEMA . DS . 'ant-object' . DS . str_replace(['__x3A__', ':'], ['.', '/'], $item['typeName']);
|
|
|
if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
|
|
if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
|
|
|
- DBG::log($antAclPath, 'string', '$antAclPath');
|
|
|
|
|
- $antBin = APP_PATH_WWW . DS . 'stuff' . DS . 'dita-ot-2.3.3' . DS . 'bin' . DS . 'ant';
|
|
|
|
|
- $cmd = "cd {$antAclPath} && {$antBin} DescribeFeatureType 2>&1";
|
|
|
|
|
- V::exec($cmd, $out, $ret);
|
|
|
|
|
- DBG::log($out, 'array', "DescribeFeatureType ret({$ret})");
|
|
|
|
|
- $outputType = 'XML';
|
|
|
|
|
- $html = []; $startRead = false;
|
|
|
|
|
- foreach ($out as $line) {
|
|
|
|
|
- // $line = " [echo] OUTPUT__TYPE__XML"
|
|
|
|
|
- if ('[echo]' == substr(trim($line), 0, 6)) {
|
|
|
|
|
- $line = trim(substr(trim($line), 7));
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- if (!$startRead) {
|
|
|
|
|
- if ('OUTPUT__TYPE__XML' == $line) $outputType = 'XML';
|
|
|
|
|
- if ('OUTPUT__TYPE__HTML' == $line) $outputType = 'HTML';
|
|
|
|
|
- if ('OUTPUT__START' == $line) {
|
|
|
|
|
- $startRead = true;
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+ if (file_exists("{$antAclPath}/{$item['name']}.xsd")) {
|
|
|
|
|
+ DBG::log("{$antAclPath}/{$item['name']}.xsd", 'string', 'xsd file exists');
|
|
|
|
|
+ $outputType = 'XML';
|
|
|
|
|
+ $html = file_get_contents("{$antAclPath}/{$item['name']}.xsd");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ DBG::log($antAclPath, 'string', '$antAclPath');
|
|
|
|
|
+ $antBin = APP_PATH_WWW . DS . 'stuff' . DS . 'dita-ot-2.3.3' . DS . 'bin' . DS . 'ant';
|
|
|
|
|
+ $cmd = "cd {$antAclPath} && {$antBin} DescribeFeatureType 2>&1";
|
|
|
|
|
+ V::exec($cmd, $out, $ret);
|
|
|
|
|
+ DBG::log($out, 'array', "DescribeFeatureType ret({$ret})");
|
|
|
|
|
+ $outputType = 'XML';
|
|
|
|
|
+ $html = []; $startRead = false;
|
|
|
|
|
+ foreach ($out as $line) {
|
|
|
|
|
+ // $line = " [echo] OUTPUT__TYPE__XML"
|
|
|
|
|
+ if ('[echo]' == substr(trim($line), 0, 6)) {
|
|
|
|
|
+ $line = trim(substr(trim($line), 7));
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- if ('<!DOCTYPE' == substr($line, 0, strlen('<!DOCTYPE'))) continue;
|
|
|
|
|
- if ('OUTPUT__END' == $line) {
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!$startRead) {
|
|
|
|
|
+ if ('OUTPUT__TYPE__XML' == $line) $outputType = 'XML';
|
|
|
|
|
+ if ('OUTPUT__TYPE__HTML' == $line) $outputType = 'HTML';
|
|
|
|
|
+ if ('OUTPUT__START' == $line) {
|
|
|
|
|
+ $startRead = true;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ('<!DOCTYPE' == substr($line, 0, strlen('<!DOCTYPE'))) continue;
|
|
|
|
|
+ if ('OUTPUT__END' == $line) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ $html[]= $line;
|
|
|
}
|
|
}
|
|
|
- $html[]= $line;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!empty($html)) $html = implode("\n", $html);
|
|
|
}
|
|
}
|
|
|
if (empty($html)) UI::alert('danger', "Empty output!");
|
|
if (empty($html)) UI::alert('danger', "Empty output!");
|
|
|
else {
|
|
else {
|
|
|
if ('XML' == $outputType) {
|
|
if ('XML' == $outputType) {
|
|
|
- echo UI::h('pre', [], htmlspecialchars(implode("\n", $html)));
|
|
|
|
|
|
|
+ echo UI::h('pre', [], htmlspecialchars($html));
|
|
|
} else if ('HTML' == $outputType) {
|
|
} else if ('HTML' == $outputType) {
|
|
|
echo UI::h('div', ['class'=>"container", 'style'=>"padding:12px; border:1px solid #ddd"], $html);
|
|
echo UI::h('div', ['class'=>"container", 'style'=>"padding:12px; border:1px solid #ddd"], $html);
|
|
|
}
|
|
}
|