|
|
@@ -26,6 +26,12 @@ class Route_Storage_AclReinstall extends RouteBase {
|
|
|
'href' => Router::getRoute('Storage_AclStruct')->getLink('', [ 'namespace' => $namespace ]),
|
|
|
'class' => "btn btn-md btn-link",
|
|
|
], "<i class=\"glyphicon glyphicon-arrow-left\"></i> Wróć do struktury"),
|
|
|
+ " | ",
|
|
|
+ UI::h('a', [
|
|
|
+ 'href' => $this->getLink('viewXsdSource', [ 'namespace' => $namespace ]),
|
|
|
+ 'class' => "btn btn-md btn-link",
|
|
|
+ 'target' => "_blank",
|
|
|
+ ], "Otwórz plik xsd (źródłowy)"),
|
|
|
]);
|
|
|
|
|
|
if ('reinstall' == V::get('_postTask', '', $_POST)) {
|
|
|
@@ -217,4 +223,38 @@ class Route_Storage_AclReinstall extends RouteBase {
|
|
|
throw new Exception("TODO: Podgląd zmian dla tabeli {$item['namespace']} ...");
|
|
|
}
|
|
|
|
|
|
+ public function viewXsdSourceAction() {
|
|
|
+ try {
|
|
|
+ $namespace = V::get('namespace', '', $_GET);
|
|
|
+ if (empty($namespace)) throw new Exception("Missing param namespace");
|
|
|
+ $objectItem = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace, [ 'propertyName' => "*,field" ]);
|
|
|
+ switch ($objectItem['_type']) {
|
|
|
+ case 'AntAcl': $this->viewXsdSource($objectItem); break;
|
|
|
+ // case 'TableAcl': $this->viewXsdSource($objectItem); break;
|
|
|
+ default: throw new Exception("TODO: Not Implemented type '{$objectItem['_type']}'");
|
|
|
+ }
|
|
|
+ } catch (Exception $e) {
|
|
|
+ DBG::log($e);
|
|
|
+ echo "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function viewXsdSource($objectItem) {
|
|
|
+ if (empty($objectItem)) throw new Exception("Missing objectItem in viewXsdSource");
|
|
|
+ DBG::log($objectItem, "viewXsdSource \$objectItem");
|
|
|
+
|
|
|
+ Lib::loadClass('Schema_SystemObjectFieldStorageAcl');
|
|
|
+ $antAclPath = Schema_SystemObjectFieldStorageAcl::getAntAclXsdBasePath($objectItem['typeName']);
|
|
|
+ if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
|
|
|
+ DBG::log(str_replace(APP_PATH_ROOT, '~', $antAclPath), "viewXsdSource \$antAclPath");
|
|
|
+
|
|
|
+ $xsdFile = "{$antAclPath}/{$objectItem['name']}.xsd";
|
|
|
+ if (!file_exists($xsdFile)) throw new Exception("Xsd file not exists");
|
|
|
+ DBG::log(str_replace(APP_PATH_ROOT, '~', $xsdFile), "viewXsdSource \$xsdFile");
|
|
|
+
|
|
|
+ header('Content-Type: application/xml; charset=utf-8');
|
|
|
+ $fd = fopen($xsdFile, 'r');
|
|
|
+ fpassthru($fd);
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
}
|