|
|
@@ -6,6 +6,7 @@ Lib::loadClass('Schema_TableFactory');
|
|
|
Lib::loadClass('Response');
|
|
|
Lib::loadClass('UI');
|
|
|
Lib::loadClass('OBJ');
|
|
|
+Lib::loadClass('SchemaFactory');
|
|
|
|
|
|
/*
|
|
|
# Storage:
|
|
|
@@ -28,60 +29,73 @@ class Route_Storage extends RouteBase {
|
|
|
UI::gora();
|
|
|
UI::menu();
|
|
|
$this->navView();
|
|
|
+ UI::startContainer();
|
|
|
try {
|
|
|
- $storageList = $this->getStorageList();
|
|
|
- if (empty($storageList)) throw new Exception("No storage defined");
|
|
|
- $storageMenu = array();
|
|
|
- foreach ($storageList as $storage) {
|
|
|
- $menuItem = array();
|
|
|
- $menuItem['id'] = $id = $storage['ID'];
|
|
|
- $menuItem['nazwa'] = $storage['DESC'];
|
|
|
- $menuItem['typ'] = $storage['TYPE'];
|
|
|
- $menuItem['tabele i widoki'] = '<a href="index.php?_route=Storage&_task=tableList&idStorage=' . $id . '">' . "tabele" . '</a>';
|
|
|
- //$menuItem['views'] = '<a href="index.php?_route=Storage&_task=viewList&idStorage=' . $id . '">' . "views" . '</a>';
|
|
|
- $menuItem['raw info'] = '<a href="index.php?_route=Storage&_task=rawInfo&idStorage=' . $id . '">' . "raw info" . '</a>';
|
|
|
- $menuItem['xsd'] = '<a href="index.php?_route=Storage&_task=xsd&idStorage=' . $id . '" target="_blank">' . "xsd" . '</a>';
|
|
|
- $storageMenu[] = $menuItem;
|
|
|
- }
|
|
|
- {// core object list
|
|
|
- $menuItem = array();
|
|
|
- //$menuItem['id'] = 'Obiekty';
|
|
|
- $menuItem['nazwa'] = 'Obiekty podstawowe';
|
|
|
- $menuItem['typ'] = 'OBJECTS';
|
|
|
- $menuItem['tabele i widoki'] = '<a href="index.php?_route=Storage&_task=coreObjectList">' . "obiekty" . '</a>';
|
|
|
- //$menuItem['views'] = '<a href="index.php?_route=Storage&_task=viewList&idStorage=' . $id . '">' . "views" . '</a>';
|
|
|
- $menuItem['raw info'] = '<a href="index.php?_route=Storage&_task=coreObjectParseAll">' . "parse All" . '</a>';
|
|
|
- // TODO: $menuItem['xsd'] = '<a href="index.php?_route=Storage&_task=xsd&idStorage=' . $id . '" target="_blank">' . "xsd" . '</a>';
|
|
|
- $storageMenu[] = $menuItem;
|
|
|
- }
|
|
|
- {// object list - for current company
|
|
|
- $hostName = $_SERVER['SERVER_NAME'];
|
|
|
- $cleanHostName = str_replace(array(".", "-"), '_', $hostName);
|
|
|
- $menuItem = array();
|
|
|
- //$menuItem['id'] = 'Obiekty';
|
|
|
- $menuItem['nazwa'] = "Obiekty dla domeny '{$cleanHostName}'";
|
|
|
- $menuItem['typ'] = 'OBJECTS';
|
|
|
- $menuItem['tabele i widoki'] = '<a href="index.php?_route=Storage&_task=objectList">' . "obiekty" . '</a>';
|
|
|
- //$menuItem['views'] = '<a href="index.php?_route=Storage&_task=viewList&idStorage=' . $id . '">' . "views" . '</a>';
|
|
|
- //$menuItem['raw info'] = '<a href="index.php?_route=Storage&_task=objectRawInfo">' . "raw info" . '</a>';
|
|
|
- // TODO: $menuItem['xsd'] = '<a href="index.php?_route=Storage&_task=xsd&idStorage=' . $id . '" target="_blank">' . "xsd" . '</a>';
|
|
|
- $storageMenu[] = $menuItem;
|
|
|
+ $sourceStorage = SchemaFactory::loadDefaultObject('SystemSource');
|
|
|
+ try {
|
|
|
+ $sourceStorage->getTotal();
|
|
|
+ } catch (Exception $e) {
|
|
|
+ UI::alert('warning', $e->getMessage());
|
|
|
+ $sourceStorage->updateCache();
|
|
|
+ UI::alert('info', "Lista dostępnych baz danych zaktualizowana");
|
|
|
}
|
|
|
- {// core object list
|
|
|
- $menuItem = array();
|
|
|
- //$menuItem['id'] = 'Obiekty';
|
|
|
- $menuItem['nazwa'] = 'SystemObjects';
|
|
|
- $menuItem['typ'] = 'OBJECTS';
|
|
|
- $menuItem['tabele i widoki'] = '<a href="index.php?_route=Storage&_task=systemObjects">' . "SystemObjects" . '</a>';
|
|
|
- //$menuItem['views'] = '<a href="index.php?_route=Storage&_task=viewList&idStorage=' . $id . '">' . "views" . '</a>';
|
|
|
- // $menuItem['raw info'] = '<a href="index.php?_route=Storage&_task=coreObjectParseAll">' . "parse All" . '</a>';
|
|
|
- // TODO: $menuItem['xsd'] = '<a href="index.php?_route=Storage&_task=xsd&idStorage=' . $id . '" target="_blank">' . "xsd" . '</a>';
|
|
|
- $storageMenu[] = $menuItem;
|
|
|
+ if ('1' == V::get('refreshSourceList', '', $_POST)) {
|
|
|
+ $sourceStorage->updateCache();
|
|
|
+ UI::alert('info', "Lista dostępnych baz danych zaktualizowana");
|
|
|
}
|
|
|
- DBG::table("storageMenu", $storageMenu, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
+ UI::table([
|
|
|
+ 'caption' => "Bazy danych " .
|
|
|
+ UI::hButtonPost('<i class="glyphicon glyphicon-refresh"></i>' . " odśwież", [
|
|
|
+ 'class' => "btn btn-xs btn-link",
|
|
|
+ 'data' => [
|
|
|
+ 'refreshSourceList' => '1'
|
|
|
+ ]
|
|
|
+ ]),
|
|
|
+ 'rows' => array_merge(
|
|
|
+ array_map(function ($item) {
|
|
|
+ return [
|
|
|
+ 'Nr zasobu' => $item['idZasob'],
|
|
|
+ 'nazwa' => $item['name'],
|
|
|
+ 'opis' => $item['description'],
|
|
|
+ 'config?' => ($item['hasConfig']) ? '<span class="label label-success">TAK</span>' : '<span class="text text-muted">brak</span>',
|
|
|
+ 'obiekty' => UI::h('a', [ 'href' => $this->getLink('tableList', [ 'idStorage' => $item['idZasob'] ]) ], "obiekty"),
|
|
|
+ 'raw info' => UI::h('a', [ 'href' => $this->getLink('rawInfo', [ 'idStorage' => $item['idZasob'] ]) ], "raw info"),
|
|
|
+ 'xsd' => UI::h('a', [ 'href' => $this->getLink('xsd', [ 'idStorage' => $item['idZasob'] ]) ], "xsd"),
|
|
|
+ ];
|
|
|
+ }, $sourceStorage->getItems())
|
|
|
+ , [
|
|
|
+ [
|
|
|
+ 'Nr zasobu' => '',
|
|
|
+ 'nazwa' => "Obiekty",
|
|
|
+ 'opis' => "SystemObjects",
|
|
|
+ 'config?' => '<span class="text text-muted">brak</span>',
|
|
|
+ 'obiekty' => UI::h('a', [ 'href' => $this->getLink('systemObjects') ], "obiekty"),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'Nr zasobu' => '',
|
|
|
+ 'nazwa' => "Obiekty Test",
|
|
|
+ 'opis' => "Obiekty podstawowe (test json)",
|
|
|
+ 'config?' => '<span class="text text-muted">brak</span>',
|
|
|
+ 'obiekty' => UI::h('a', [ 'href' => $this->getLink('coreObjectList') ], "obiekty"),
|
|
|
+ 'raw info' => UI::h('a', [ 'href' => $this->getLink('coreObjectParseAll') ], "raw info"),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'Nr zasobu' => '',
|
|
|
+ 'nazwa' => "Obiekty Test",
|
|
|
+ 'opis' => "Obiekty dla domeny '" . str_replace(array(".", "-"), '_', $_SERVER['SERVER_NAME']) . "' (test json)",
|
|
|
+ 'config?' => '<span class="text text-muted">brak</span>',
|
|
|
+ 'obiekty' => UI::h('a', [ 'href' => $this->getLink('objectList') ], "obiekty"),
|
|
|
+ // 'raw info' => UI::h('a', [ 'href' => $this->getLink('objectRawInfo') ], "raw info"),
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ ]);
|
|
|
+ // $sourceStorage = SchemaFactory::loadDefaultObject('SystemObject');
|
|
|
+ // $sourceStorage->updateCache();
|
|
|
} catch (Exception $e) {
|
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
}
|
|
|
+ UI::endContainer();
|
|
|
UI::dol();
|
|
|
}
|
|
|
|