|
|
@@ -7,6 +7,7 @@ Lib::loadClass('RouteBase');
|
|
|
Lib::loadClass('P5');
|
|
|
Lib::loadClass('Core_AclHelper');
|
|
|
Lib::loadClass('ACL');
|
|
|
+Lib::loadClass('Api_WfsNs');
|
|
|
|
|
|
class Route_WfsJsRequestPanel extends RouteBase {
|
|
|
|
|
|
@@ -195,9 +196,41 @@ class Route_WfsJsRequestPanel extends RouteBase {
|
|
|
// $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('input', [ 'id' => 'wfsRequestFeatureTypeName', 'class' => "form-control", 'value' => $examples['Procesy']['lvl1']['typeName'], 'title' => "Feature name" ]);
|
|
|
- echo UI::h('textarea', [ 'id' => 'wfsRequestBody', 'style' => "width:100%; height:300px" ], htmlspecialchars($examples['Procesy']['lvl1']['postBody']));
|
|
|
+ echo UI::h('table', [ 'style' => "width:100%; margin:0", 'class' => "table" ], [
|
|
|
+ UI::h('tr', [], [
|
|
|
+ UI::h('td', [ 'style' => "padding:0; border:none" ], [
|
|
|
+ UI::h('input', [ 'id' => 'wfsRequestFeatureTypeName', 'class' => "form-control", 'value' => $defaultTypeName, 'title' => "Feature name" ]),
|
|
|
+ ]),
|
|
|
+ UI::h('td', [ 'style' => "width:5%; line-height:18px; border:none" ], [
|
|
|
+ UI::h('a', [
|
|
|
+ 'id' => "typeNameStorageStructLink",
|
|
|
+ 'href' => "index.php?_route=Storage_AclStruct&namespace={$defaultNamespace}",
|
|
|
+ ], "Struktura")
|
|
|
+ ]),
|
|
|
+ ])
|
|
|
+ ]);
|
|
|
+ echo UI::h('label', [], [
|
|
|
+ " root ",
|
|
|
+ UI::h('input', [ 'type' => "checkbox", 'id' => 'wfsRequestParam.root', 'class' => "", 'value' => '1' ]),
|
|
|
+ ]);
|
|
|
+ echo UI::h('label', [ 'style' => "margin-left:8px" ], [
|
|
|
+ " maxFeatures: ",
|
|
|
+ UI::h('input', [ 'type' => "number", 'id' => 'wfsRequestParam.maxFeatures', 'class' => "", 'value' => '3' ]),
|
|
|
+ ]);
|
|
|
+ echo UI::h('label', [ 'style' => "margin-left:8px" ], [
|
|
|
+ " resolveDepth: ",
|
|
|
+ UI::h('input', [ 'type' => "number", 'id' => 'wfsRequestParam.resolveDepth', 'class' => "", 'value' => '' ]),
|
|
|
+ ]);
|
|
|
+ echo UI::h('textarea', [ 'id' => 'wfsRequestBody', 'style' => "width:100%; height:300px" ], $defaultRequestBody);
|
|
|
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('details', [ 'style' => "padding:6px; background-color:#333; color:#fff", 'open' => "open" ], [
|
|
|
@@ -239,7 +272,9 @@ class Route_WfsJsRequestPanel extends RouteBase {
|
|
|
console.log('examples', examples)
|
|
|
function setWfsExample(groupName, label) {
|
|
|
console.log('groupName', groupName, 'label', label)
|
|
|
- document.getElementById('wfsRequestFeatureTypeName').value = examples[groupName][label].typeName
|
|
|
+ var typeName = examples[groupName][label].typeName
|
|
|
+ document.getElementById('wfsRequestFeatureTypeName').value = typeName
|
|
|
+ document.getElementById('typeNameStorageStructLink').href = 'index.php?_route=Storage_AclStruct&namespace=' + typeName.replace('__x3A__', '/').replace(':', '/')
|
|
|
document.getElementById('wfsRequestBody').value = examples[groupName][label].postBody || ''
|
|
|
sendWfsRequest()
|
|
|
}
|
|
|
@@ -258,11 +293,17 @@ class Route_WfsJsRequestPanel extends RouteBase {
|
|
|
document.getElementById('wfsResponse').innerHTML = 'loading...'
|
|
|
var featureTypeName = document.getElementById('wfsRequestFeatureTypeName').value
|
|
|
var postBody = document.getElementById('wfsRequestBody').value.replace(/</g, '<').replace(/>/g, '>')
|
|
|
- console.log('wfsRequestBody:', postBody)
|
|
|
- var wfsParams = Object.assign({
|
|
|
- 'maxFeatures': 3,
|
|
|
- }, (!postBody) ? {} : { 'ogc:Filter': postBody }
|
|
|
- )
|
|
|
+ var wfsParams = {
|
|
|
+ 'maxFeatures': 3
|
|
|
+ }
|
|
|
+ if (document.getElementById('wfsRequestParam.root').checked) wfsParams['root'] = '1'
|
|
|
+ if (document.getElementById('wfsRequestParam.maxFeatures')) wfsParams['maxFeatures'] = parseInt(document.getElementById('wfsRequestParam.maxFeatures').value)
|
|
|
+ var resolveDepth = parseInt(document.getElementById('wfsRequestParam.resolveDepth').value)
|
|
|
+ if (resolveDepth > 0 && !isNaN(resolveDepth)) {
|
|
|
+ wfsParams['resolve'] = 'all'
|
|
|
+ wfsParams['resolveDepth'] = resolveDepth
|
|
|
+ }
|
|
|
+ if (postBody) wfsParams['ogc:Filter'] = postBody
|
|
|
console.log('p5WFS_GetFeature', featureTypeName, wfsParams)
|
|
|
p5WFS_GetFeature(featureTypeName, wfsParams).then(function (features) {
|
|
|
console.log('features', features)
|