| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- <?php
- // use Monolog\Handler\StreamHandler;
- // use Monolog\Formatter\JsonFormatter;
- Lib::loadClass('RouteBase');
- Lib::loadClass('P5');
- Lib::loadClass('Core_AclHelper');
- Lib::loadClass('ACL');
- Lib::loadClass('Api_WfsNs');
- class Route_WfsJsRequestPanel extends RouteBase {
- public function defaultAction() {
- UI::gora();
- try {
- $jsFunction = [];
- $jsFunction['JS_FUNCTION_UPDATE_RESPONSE'] = 'updateWfsResponse';
- $jsFunction['JS_FUNCTION_GET_SELECTED_FORMAT'] = 'getWfsResponseFormat';
- $exampleProcesyFltr = [
- " <ogc:Filter>",
- " <ogc:Or>",
- " <ogc:PropertyIsEqualTo>",
- " <ogc:PropertyName>ID</ogc:PropertyName>",
- " <ogc:Literal>1003</ogc:Literal>",
- " </ogc:PropertyIsEqualTo>",
- " <ogc:PropertyIsEqualTo>",
- " <ogc:PropertyName>ID</ogc:PropertyName>",
- " <ogc:Literal>608</ogc:Literal>",
- " </ogc:PropertyIsEqualTo>",
- " </ogc:Or>",
- " </ogc:Filter>",
- ];
- $examples = [];
- $examples['Procesy'] = [];
- $examples['Procesy']['lvl1'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['Procesy']['lvl2-by-@-1'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName resolve=\"all\" resolveDepth=\"1\">default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['Procesy']['lvl2-by-@-2'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName resolve=\"all\" resolveDepth=\"2\">default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['Procesy']['lvl2-by-@-3'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName resolve=\"all\" resolveDepth=\"3\">default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['Procesy']['lvl2-by-@-*'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName resolve=\"all\" resolveDepth=\"*\">default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['Procesy']['lvl2'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/DESC</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['Procesy']['lvl2wsk'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName>OPIS</wfs:PropertyName>",
- " <wfs:PropertyName>path</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/DESC</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK/*</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['Procesy']['lvl3'] = [
- 'typeName' => 'default_db__x3A__CRM_PROCES:PROCES',
- 'postBody' => "<wfs:Query>" . "\n" . implode("\n", array_merge([
- " <wfs:PropertyName>ID</wfs:PropertyName>",
- " <wfs:PropertyName>PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>DESC</wfs:PropertyName>",
- " <wfs:PropertyName>OPIS</wfs:PropertyName>",
- " <wfs:PropertyName>path</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/DESC</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES/ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES/PARENT_ID</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES/TYPE</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES/DESC</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES/default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK/*</wfs:PropertyName>",
- " <wfs:PropertyName>default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK/*</wfs:PropertyName>",
- ], $exampleProcesyFltr)) . "\n" ."</wfs:Query>",
- ];
- $examples['BiAudit'] = [];
- $examples['BiAudit']['BiAudit'] = [
- 'typeName' => 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA',
- 'args' => [ 'primaryKey' => 1 ],
- ];
- $examples['BiAudit']['BiAudit lvl2'] = [
- 'typeName' => 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA',
- 'postBody' => "<wfs:Query>" . implode("\n\t", [
- "<wfs:PropertyName>A_ADM_COMPANY</wfs:PropertyName>",
- "<wfs:PropertyName>A_CLASSIFIED</wfs:PropertyName>",
- "<wfs:PropertyName>A_STATUS</wfs:PropertyName>",
- "<wfs:PropertyName>A_STATUS_INFO</wfs:PropertyName>",
- "<wfs:PropertyName>BI_analiza_maxDepth</wfs:PropertyName>",
- "<wfs:PropertyName>BI_analiza_reloadCache</wfs:PropertyName>",
- "<wfs:PropertyName>FILE_STATUS</wfs:PropertyName>",
- "<wfs:PropertyName>FILE_STATUS_info</wfs:PropertyName>",
- "<wfs:PropertyName>ID</wfs:PropertyName>",
- "<wfs:PropertyName>L_APPOITMENT_USER</wfs:PropertyName>",
- // "<wfs:PropertyName>default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY</wfs:PropertyName>",
- // "<wfs:PropertyName>default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI</wfs:PropertyName>",
- "<wfs:PropertyName resolve=\"all\" resolveDepth=\"2\">default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row</wfs:PropertyName>",
- // "<wfs:PropertyName resolve=\"all\" resolveDepth=\"2\">default_db__x3A__BI_audit_KW_requested_person:BI_audit_KW_requested_person</wfs:PropertyName>",
- ]) . "\n" . "</wfs:Query>",
- ];
- $examples['BiAudit']['BiAudit lvl3'] = [
- 'typeName' => 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA',
- 'postBody' => "<wfs:Query>" . implode("\n\t", [
- "<wfs:PropertyName>A_ADM_COMPANY</wfs:PropertyName>",
- "<wfs:PropertyName>A_CLASSIFIED</wfs:PropertyName>",
- "<wfs:PropertyName>A_STATUS</wfs:PropertyName>",
- "<wfs:PropertyName>A_STATUS_INFO</wfs:PropertyName>",
- "<wfs:PropertyName>BI_analiza_maxDepth</wfs:PropertyName>",
- "<wfs:PropertyName>BI_analiza_reloadCache</wfs:PropertyName>",
- "<wfs:PropertyName>FILE_STATUS</wfs:PropertyName>",
- "<wfs:PropertyName>FILE_STATUS_info</wfs:PropertyName>",
- "<wfs:PropertyName>ID</wfs:PropertyName>",
- "<wfs:PropertyName>L_APPOITMENT_USER</wfs:PropertyName>",
- "<wfs:PropertyName resolve=\"all\" resolveDepth=\"3\">default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY</wfs:PropertyName>",
- "<wfs:PropertyName resolve=\"all\" resolveDepth=\"3\">default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI</wfs:PropertyName>",
- "<wfs:PropertyName resolve=\"all\" resolveDepth=\"3\">default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row</wfs:PropertyName>",
- "<wfs:PropertyName resolve=\"all\" resolveDepth=\"3\">default_db__x3A__BI_audit_KW_requested_person:BI_audit_KW_requested_person</wfs:PropertyName>",
- ]) . "\n" . "</wfs:Query>",
- ];
- UI::startContainer();
- // Lib::loadClass('Vendor_Monolog');
- // $logger = new Vendor_Monolog('dbg-logger-name');
- // $logger->pushHandler(new StreamHandler('/tmp/monolog-test.log', Vendor_Monolog::WARNING));
- // $logger->warning('Foo');
- // $logger->error('Bar');
- //
- // $logFile = '/tmp/monolog-test-json.log';
- // $formatter = new JsonFormatter();
- // // Create a handler
- // $stream = new StreamHandler($logFile, Vendor_Monolog::INFO);
- // $stream->setFormatter($formatter);
- // // bind it to a logger object
- // $securityLogger = new Vendor_Monolog('View Info');
- // $securityLogger->pushHandler($stream);
- // $securityLogger->addInfo('debug message / label', [ 'dbg-object' => [ 'x' => 'y', 'z' ] ]);
- $namespace = V::get('namespace', '', $_GET);
- $defaultTypeName = ($namespace)
- ? Api_WfsNs::typeName($namespace)
- : $examples['Procesy']['lvl1']['typeName'];
- $defaultNamespace = Api_WfsNs::namespaceFromTypeName($defaultTypeName);
- $defaultRequestBody = ($namespace)
- ? ''
- : htmlspecialchars($examples['Procesy']['lvl1']['postBody']);
- // 'wfsRequestFeatureTypeName' = 'default_db__x3A__CRM_PROCES:PROCES'
- echo UI::h('form', [ 'id' => "wfs_request" ], [
- UI::h('div', [ 'style' => "margin-bottom:6px; padding:6px; background-color:#333; color:#fff" ], [
- UI::h('table', [ 'style' => "width:100%; margin:0 0 6px 0", 'class' => "table" ], [
- UI::h('tr', [], [
- UI::h('td', [ 'style' => "width:5%; padding:0 10px 0 0; border:none; line-height:22px; font-size:14px; white-space:nowrap" ], "WFS Request"),
- UI::h('td', [ 'style' => "padding:0; border:none" ], [
- UI::h('input', [ 'name' => "type_name", 'id' => 'wfsRequestFeatureTypeName', 'class' => "form-control input-xs", 'value' => $defaultTypeName, 'title' => "Feature name" ]),
- ]),
- UI::h('td', [ 'style' => "width:5%; padding:3px 0 0 6px; line-height:16px; border:none" ], [
- UI::h('a', [
- 'id' => "typeNameStorageStructLink",
- 'href' => "index.php?_route=Storage_AclStruct&namespace={$defaultNamespace}",
- 'style' => "color:#68cbfd"
- ], "Struktura")
- ]),
- ])
- ]),
- UI::h('div', [], [
- UI::h('label', [ 'style' => "font-weight:normal" ], [
- " root ",
- UI::h('input', [ 'name' => "root", 'type' => "checkbox", 'class' => "", 'value' => '1' ]),
- ]),
- UI::h('label', [ 'style' => "margin-left:8px; font-weight:normal" ], [
- " maxFeatures: ",
- UI::h('input', [ 'name' => "maxFeatures", 'type' => "number", 'class' => "form-control input-xs", 'style' => "display:inline-block; width:100px", 'value' => '3' ]),
- ]),
- UI::h('label', [ 'style' => "margin-left:8px; font-weight:normal" ], [
- " resolveDepth: ",
- UI::h('input', [ 'name' => "resolveDepth", 'type' => "number", 'class' => "form-control input-xs", 'style' => "display:inline-block; width:100px", 'value' => '' ]),
- ]),
- UI::h('label', [ 'style' => "margin-left:8px; font-weight:normal" ], [
- " primaryKey: ",
- UI::h('input', [ 'name' => "primaryKey", 'type' => "text", 'class' => "form-control input-xs", 'style' => "display:inline-block; width:100px", 'value' => '' ]),
- ]),
- ]),
- UI::h('details', [ 'style' => "padding:0; background-color:#333; color:#fff", 'open' => "open" ], [
- UI::h('summary', [ 'style' => "padding:0 3px; margin-bottom:6px; outline:none; cursor:pointer" ], [
- UI::h('span', [ 'style' => "margin-right:6px" ], "Request Body"),
- UI::h('label', [ 'style' => "margin-right:6px; cursor:pointer; font-weight:normal", 'onclick' => "return onClickBodyType(event, this, 'ogc:Filter')" ], [
- UI::h('input', [ 'type' => "radio", 'name' => "wfs_post_body_type", 'value' => "ogc:Filter", 'style' => "margin-right:6px", 'checked' => "checked" ]),
- UI::h('span', [ 'style' => "margin-right:6px" ], "ogc:Filter"),
- ]),
- UI::h('label', [ 'style' => "margin-right:6px; cursor:pointer; font-weight:normal", 'onclick' => "return onClickBodyType(event, this, 'graphql:query')" ], [
- UI::h('input', [ 'type' => "radio", 'name' => "wfs_post_body_type", 'value' => "graphql:query", 'style' => "margin-right:6px" ]),
- UI::h('span', [ 'style' => "margin-right:6px" ], "graphql:query"),
- ]),
- ]),
- UI::h('textarea', [ 'id' => 'wfsRequestBody', 'style' => "width:100%; height:300px; color:#000" ], $defaultRequestBody),
- ]),
- ]),
- ]);
- echo UI::h('div', [ 'style' => "margin-bottom:6px" ], [
- UI::h('button', [ 'class' => "btn btn-primary", 'onClick' => "return sendWfsRequest(this)" ], "Wyslij"),
- UI::h('div', [ 'style' => "display:inline", 'id' => "wfs-example-btns" ]),
- ]);
- echo UI::h('details', [ 'style' => "padding:6px; background-color:#333; color:#fff", 'open' => "open" ], [
- UI::h('summary', [ 'style' => "padding:0 3px; outline:none; cursor:pointer" ], [
- "WFS Response <i>(converted to JSON)</i> ",
- UI::h('form', [ 'id' => "wfs_response_format", 'style' => "display:inline" ], [
- UI::h('label', [ 'style' => "margin-right:6px; cursor:pointer; font-weight:normal", 'onclick' => "return onClickResponseFormat(event, this, 'text')" ], [
- UI::h('input', [ 'type' => "radio", 'name' => "wfs_post_response_format", 'value' => "text", 'style' => "margin-right:6px", 'checked' => "checked" ]),
- UI::h('span', [ 'style' => "margin-right:6px" ], "text"),
- ]),
- UI::h('label', [ 'style' => "margin-right:6px; cursor:pointer; font-weight:normal", 'onclick' => "return onClickResponseFormat(event, this, 'json')" ], [
- UI::h('input', [ 'type' => "radio", 'name' => "wfs_post_response_format", 'value' => "json", 'style' => "margin-right:6px" ]),
- UI::h('span', [ 'style' => "margin-right:6px" ], "json tree"),
- ]),
- ]),
- UI::h('button', [ 'class' => "btn btn-xs btn-default", 'onClick' => "return {$jsFunction['JS_FUNCTION_UPDATE_RESPONSE']}(this)" ], "toggle tree view"),
- ]),
- UI::h('pre', [ 'id' => 'wfsResponse', 'style' => "margin:0; font-size:x-small; border-radius:0" ], 'loading...'),
- ]);
- echo UI::h('details', [ 'style' => "padding:6px; background-color:#68cbfd; color:#fff" ], [
- UI::h('summary', [ 'style' => "padding:0 3px; outline:none; cursor:pointer" ], [
- UI::h('i',[ 'class' => "glyphicon glyphicon-question-sign" ]),
- " WFS 1.1, 2.0 fetch nested objects (traverse, resolve)",
- ]),
- UI::h('pre', ['style' => "margin:0; font-size:x-small; border-radius:0"], implode("\n", [
- "WFS 1.1 - traverseXlinkDepth, traverseXlinkExpiry " . UI::h('a', ['href'=>"http://docs.opengeospatial.org/is/04-094r1/04-094r1.html#50"], "http://docs.opengeospatial.org/is/04-094r1/04-094r1.html#50"),
- "WFS 2.0 - resolve, resolveDepth, resolveTimeout " . UI::h('a', ['href'=>"http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#57"], "http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#57"),
- "",
- "WFS 1.1 traverseXlinkDepth type=\"string\" ('*' or int > 0) - recurse limit ('*' - no limit)",
- "WFS 1.1 traverseXlinkExpiry type=\"xsd:positiveInteger\" - timeOut in minutes",
- "WFS 1.1 Note: traverse used in wfs:GetFeature or inside wfs:Query tag wfs:XlinkPropertyName (same like wfs:PropertyName but with @traverse* attributes)",
- "",
- "WFS 2.0 resolve type=\"wfs:ResolveValueType\" default=\"none\" (enum: 'local', 'remote', 'all', 'none')",
- " - resolve=\"local\" - operation shall only resolve local references",
- " - resolve=\"remote\" - operation shall only resolve remote resource references",
- " - resolve=\"all\" - means that an operation shall resolve all resource references",
- " - resolve=\"none\" - means that an operation shall not resolve any resource references",
- "WFS 2.0 resolveDepth type=\"wfs:positiveIntegerWithStar\" default=\"*\" ('*' or int > 0) - recurse limit ('*' - no limit)",
- "WFW 2.0 resolveTimeout type=\"xsd:positiveInteger\" default=\"300\" - timeOut in seconds",
- "WFS 2.0 Note: resolve used in wfs:GetFeature or inside wfs:Query tag wfs:PropertyName",
- " in wfs:PropertyName may use resolvePath - @see " . UI::h('a', ['href'=>"http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#103"], "http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#103"),
- "",
- "WFS 2.0 resolve, resolveDepth example " . UI::h('a', ['href'=>"http://grepcode.com/file/repo1.maven.org/maven2/org.jvnet.ogc/ogc-schemas/2.2.0/ogc/wfs/2.0/examples/GetFeature/GetFeature_12.xml"], "http://grepcode.com/file/repo1.maven.org/maven2/org.jvnet.ogc/ogc-schemas/2.2.0/ogc/wfs/2.0/examples/GetFeature/GetFeature_12.xml"),
- ])),
- ]);
- UI::endContainer();
- UI::inlineJS(__FILE__ . '.updateResponseView.js', [
- // 'NODE_ID_TREE_VIEW_FROM_TEXT' => "wfsResponseTreeView",
- 'NODE_ID_TREE_VIEW_FROM_JSON' => "jsonResponseTreeView",
- 'NODE_ID_WFS_RESPONSE' => "wfsResponse",
- 'JS_FUNCTION_UPDATE_RESPONSE' => $jsFunction['JS_FUNCTION_UPDATE_RESPONSE'],
- 'JS_FUNCTION_GET_SELECTED_FORMAT' => $jsFunction['JS_FUNCTION_GET_SELECTED_FORMAT'],
- ]);
- echo UI::h('script', [], "
- function onClickBodyType(event, n, setBodyType) {
- if ('INPUT' === event.target.tagName) {
- return true
- }
- n.form['wfs_post_body_type'].value = setBodyType
- return false
- }
- function onClickResponseFormat(event, n, setFormat) {
- if ('INPUT' === event.target.tagName) {
- return true
- }
- n.form['wfs_post_response_format'].value = setFormat
- {$jsFunction['JS_FUNCTION_UPDATE_RESPONSE']}()
- return false
- }
- function {$jsFunction['JS_FUNCTION_GET_SELECTED_FORMAT']}() {
- return document.getElementById('wfs_response_format')['wfs_post_response_format'].value
- }
- ");
- echo UI::h('script', [], "
- var examples = " . json_encode($examples) . ";
- console.log('examples', examples)
- function setWfsExample(groupName, label) {
- console.log('groupName', groupName, 'label', label)
- var example = examples[groupName][label]
- var typeName = example.typeName
- document.getElementById('wfsRequestFeatureTypeName').value = typeName
- document.getElementById('typeNameStorageStructLink').href = 'index.php?_route=Storage_AclStruct&namespace=' + typeName.replace('__x3A__', '/').replace(':', '/')
- document.getElementById('wfsRequestBody').value = example.postBody || ''
- var form = document.getElementById('wfs_request')
- form['root'].checked = (example.args && 'root' in example.args && 1 == example.args['root'])
- form['maxFeatures'].value = (example.args && 'maxFeatures' in example.args && example.args['maxFeatures'] > 0) ? example.args['maxFeatures'] : 3
- form['resolveDepth'].value = (example.args && 'resolveDepth' in example.args && example.args['resolveDepth'] > 0) ? example.args['resolveDepth'] : ''
- form['primaryKey'].value = (example.args && 'primaryKey' in example.args && example.args['primaryKey'].length > 0) ? example.args['primaryKey'] : ''
- sendWfsRequest()
- }
- for (var groupName in examples) {
- for (var label in examples[groupName]) {
- jQuery(document.getElementById('wfs-example-btns')).append('<button class=\"btn btn-default\" style=\"margin-left:12px\" onClick=\"setWfsExample(\''+groupName+'\', \''+label+'\')\">'+label+'</button>')
- }
- }
- ");
- echo UI::h('script', [], "
- function sendWfsRequest() {
- {$jsFunction['JS_FUNCTION_UPDATE_RESPONSE']}('loading...')
- var postBody = document.getElementById('wfsRequestBody').value.replace(/</g, '<').replace(/>/g, '>')
- var form = document.getElementById('wfs_request')
- var featureTypeName = form['type_name'].value
- var wfsParams = Object.assign({ maxFeatures: 3 },
- (form['root'] && form['root'].checked && '1' === form['root'].value) ? { root: 1 } : {},
- (postBody && form['wfs_post_body_type'] && 'ogc:Filter' === form['wfs_post_body_type'].value) ? {
- 'ogc:Filter': document.getElementById('wfsRequestBody').value.replace(/</g, '<').replace(/>/g, '>')
- } : {},
- (postBody && form['wfs_post_body_type'] && 'graphql:query' === form['wfs_post_body_type'].value) ? {
- 'graphql:query': document.getElementById('wfsRequestBody').value
- } : {},
- (form['maxFeatures'] && form['maxFeatures'].value > 0) ? { maxFeatures: parseInt(form['maxFeatures'].value) } : {},
- (form['resolveDepth'] && form['resolveDepth'].value > 0) ? {
- resolve: 'all',
- resolveDepth: ('*' === form['resolveDepth'].value) ? '*' : parseInt(form['resolveDepth'].value)
- } : {},
- (form['primaryKey'] && form['primaryKey'].value) ? { primaryKey: form['primaryKey'].value } : {}
- )
- console.log('p5WFS_GetFeature', featureTypeName, wfsParams)
- p5WFS_GetFeature(featureTypeName, wfsParams).then(function (features) {
- console.log('features', features)
- {$jsFunction['JS_FUNCTION_UPDATE_RESPONSE']}(features)
- }).catch(function (e) {
- console.warn(e)
- {$jsFunction['JS_FUNCTION_UPDATE_RESPONSE']}(''+e)
- p5UI__notifyAjaxCallback({ type: 'error', msg: e })
- })
- return false
- }
- (function () {
- console.log('p5WFS_GetFeature() ...')
- sendWfsRequest()
- })()
- ");
- } catch (Exception $e) {
- UI::alert('danger', $e);
- }
- UI::dol();
- }
- }
|