|
|
@@ -1,5 +1,8 @@
|
|
|
<?php
|
|
|
|
|
|
+// use Monolog\Handler\StreamHandler;
|
|
|
+// use Monolog\Formatter\JsonFormatter;
|
|
|
+
|
|
|
Lib::loadClass('RouteBase');
|
|
|
Lib::loadClass('P5');
|
|
|
Lib::loadClass('Core_AclHelper');
|
|
|
@@ -10,40 +13,116 @@ class Route_WfsJsRequestPanel extends RouteBase {
|
|
|
public function defaultAction() {
|
|
|
UI::gora();
|
|
|
try {
|
|
|
- $exampleWfsRequestBody = "<wfs:Query>
|
|
|
- <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</wfs:PropertyName>
|
|
|
- <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_BENEFIT_INFO</wfs:PropertyName> -->
|
|
|
- <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_GROUP_1</wfs:PropertyName> -->
|
|
|
- <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_GROUP_2</wfs:PropertyName> -->
|
|
|
- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_INIT/*</wfs:PropertyName>
|
|
|
- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_INIT/**</wfs:PropertyName>
|
|
|
- <wfs:PropertyName>default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK/*</wfs:PropertyName>
|
|
|
- <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>
|
|
|
- </wfs:Query>";
|
|
|
- echo '...';
|
|
|
+ $exampleFltr = [
|
|
|
+ " <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>",
|
|
|
+ ];
|
|
|
+ $listExampleProp = [];
|
|
|
+ $listExampleProp['lvl1'] = [
|
|
|
+ " <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>",
|
|
|
+ ];
|
|
|
+ $listExampleProp['lvl2'] = [
|
|
|
+ " <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>",
|
|
|
+ ];
|
|
|
+ $listExampleProp['lvl2wsk'] = [
|
|
|
+ " <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_PROCES:PROCES_INIT/*</wfs:PropertyName>",
|
|
|
+ " <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_INIT/**</wfs:PropertyName> -->",
|
|
|
+ " <wfs:PropertyName>default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK/*</wfs:PropertyName>",
|
|
|
+ ];
|
|
|
+ $listExampleProp['lvl3'] = [
|
|
|
+ " <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_PROCES:PROCES_INIT/*</wfs:PropertyName>",
|
|
|
+ " <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_INIT/**</wfs:PropertyName> -->",
|
|
|
+ " <wfs:PropertyName>default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK/*</wfs:PropertyName>",
|
|
|
+ ];
|
|
|
+ $exampleWfsRequestBody = "<wfs:Query>" . implode("\n", array_merge($listExampleProp['lvl1'], $exampleFltr)) . "</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' ] ]);
|
|
|
+
|
|
|
echo UI::h('textarea', [ 'id' => 'wfsRequestBody', 'style' => "width:100%; height:300px" ], htmlspecialchars($exampleWfsRequestBody));
|
|
|
echo UI::h('button', [ 'class' => "btn btn-primary", 'onClick' => "return sendWfsRequest(this)" ], "Wyslij");
|
|
|
+ echo UI::h('div', [ 'style' => "display:inline", 'id' => "wfs-example-btns" ]);
|
|
|
echo UI::h('pre', [ 'id' => 'wfsResponse' ], 'loading...');
|
|
|
UI::endContainer();
|
|
|
+ $examples = array_map(function ($props) use ($exampleFltr) {
|
|
|
+ return "<wfs:Query>" . implode("\n", array_merge($props, $exampleFltr)) . "</wfs:Query>";
|
|
|
+ }, $listExampleProp);
|
|
|
+ echo UI::h('script', [], "
|
|
|
+ var examples = " . json_encode($examples) . ";
|
|
|
+ console.log('examples', examples)
|
|
|
+ function setWfsExample(i) {
|
|
|
+ document.getElementById('wfsRequestBody').value = examples[i]
|
|
|
+ sendWfsRequest()
|
|
|
+ }
|
|
|
+ for (var i in examples) {
|
|
|
+ jQuery(document.getElementById('wfs-example-btns')).append('<button class=\"btn btn-default\" style=\"margin-left:12px\" onClick=\"setWfsExample(\''+i+'\')\">'+i+'</button>')
|
|
|
+ }
|
|
|
+ ");
|
|
|
echo UI::h('script', [], "
|
|
|
function sendWfsRequest() {
|
|
|
document.getElementById('wfsResponse').innerHTML = 'loading...'
|