[Mapbender-commits] r10200 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Aug 8 00:02:34 PDT 2019
Author: armin11
Date: 2019-08-08 00:02:34 -0700 (Thu, 08 Aug 2019)
New Revision: 10200
Modified:
trunk/mapbender/http/php/mod_linkedDataProxy.php
Log:
Fix for Linked Open Data Proxy
Modified: trunk/mapbender/http/php/mod_linkedDataProxy.php
===================================================================
--- trunk/mapbender/http/php/mod_linkedDataProxy.php 2019-08-07 09:58:45 UTC (rev 10199)
+++ trunk/mapbender/http/php/mod_linkedDataProxy.php 2019-08-08 07:02:34 UTC (rev 10200)
@@ -4,6 +4,7 @@
require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
require_once(dirname(__FILE__)."/../classes/class_gml_3_factory.php");
require_once(dirname(__FILE__)."/../classes/class_owsConstraints.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");//for resolving external @context content
//http://localhost/mapbender/devel_tests/wfsClientTest.php?wfsid=16&ft=vermkv:fluren_rlp&bbox=7.9,50.8,8.0,52
//initialize some parameter
$limit = 10;
@@ -11,7 +12,7 @@
//$maxObjectsPerPage = 10;
//default page
$page = 0;
-//default format f
+//default format f is html
$f = "html";
//parameter to control if the native json should be requested from the server, if support for geojson is available!
$nativeJson = false;
@@ -224,9 +225,9 @@
if (!isset($wfsid) || $wfsid == "") {
//list all public available wfs which are classified as opendata!
$returnObject->service = array();
- $sql = "SELECT * FROM (SELECT wfs_id, wfs_version, wfs_abstract, wfs_title, wfs_owsproxy, fkey_termsofuse_id, wfs_getcapabilities, providername, fees FROM wfs INNER JOIN wfs_termsofuse ON wfs_id = fkey_wfs_id) AS wfs_tou INNER JOIN termsofuse ON fkey_termsofuse_id = termsofuse_id WHERE isopen = 1";
+ //$sql = "SELECT * FROM (SELECT wfs_id, wfs_version, wfs_abstract, wfs_title, wfs_owsproxy, fkey_termsofuse_id, wfs_getcapabilities, providername, fees FROM wfs INNER JOIN wfs_termsofuse ON wfs_id = fkey_wfs_id) AS wfs_tou INNER JOIN termsofuse ON fkey_termsofuse_id = termsofuse_id WHERE isopen = 1";
//all wfs - without open filter!
- //$sql = "SELECT wfs_id, wfs_abstract, wfs_version, wfs_title, wfs_owsproxy, wfs_getcapabilities, providername, fees FROM wfs";
+ $sql = "SELECT wfs_id, wfs_abstract, wfs_version, wfs_title, wfs_owsproxy, wfs_getcapabilities, providername, fees FROM wfs";
$v = array();
$t = array();
$res = db_prep_query($sql, $v, $t);
@@ -239,14 +240,6 @@
$returnObject->service[$i]->provider = $row['providername'];
$returnObject->service[$i]->license = $row['fees'];
$returnObject->service[$i]->accessUrl = $row['wfs_getcapabilities'];
- //get contraints
- $constraints = new OwsConstraints();
- $constraints->languageCode = "de";
- $constraints->asTable = true;
- $constraints->id = $returnObject->service[$i]->id;
- $constraints->type = "wfs";
- $constraints->returnDirect = false;
- //$returnObject->service[$i]->tou = json_encode($constraints->getDisclaimer());//TODO encoding problems occur!
$i++;
}
if ($i == 0) {
@@ -281,6 +274,17 @@
//$returnObject->providerHomepage = $wfs->homepage; //TODO add to ows class!
$returnObject->providerHomepage = "http://www.geoportal.rlp.de/";
$returnObject->license = $wfs->fees;
+
+ //get contraints
+ $constraints = new OwsConstraints();
+ $constraints->languageCode = "de";
+ $constraints->asTable = true;
+ $constraints->id = $wfsid;
+ $constraints->type = "wfs";
+ $constraints->returnDirect = false;
+ $tou = $constraints->getDisclaimer();//TODO encoding problems occur!
+ //$returnObject->license = $tou; - generate license info in json for json format!!!!!
+//
$returnObject->accessUrl = $wfs->getCapabilities;
//
$returnObject->links = array();
@@ -774,6 +778,15 @@
}
$usedProxyTime = microtime_float() - $proxyStartTime;
$returnObject = $geojsonList->features[0];
+ //integrate json-ld @context if it is resovable!*******************************************************************************
+ /*$ldContextConnector = new Connector();
+ $url = "http://localhost/mapbender/geoportal/".str_replace(":","__",$ftName).".jsonld";
+ $file = $ldContextConnector->load($url);
+//$e = new mb_exception($file);
+ $contextObject = json_decode($file);
+//$e = new mb_exception(json_encode($contextObject));
+ $returnObject->properties->{'@context'} = $contextObject->{'@context'};*/
+ //integrate json-ld @context if it is resovable!*******************************************************************************
//add service title and collection title for navigation
//for rlp
$returnObject->serviceTitle = $wfs->title;
@@ -916,19 +929,19 @@
$html .= '</ol>';
} else {
if (!isset($collection) || $collections == 'all') {
- $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery("wfsid", $_SERVER['REQUEST_URI']).'">Datasets</a></li>'.$newline; //TODO - use base uri
+ $html .= '<li class="breadcrumb-item"><a href="'.rtrim(delTotalFromQuery(array("f","wfsid"), $_SERVER['REQUEST_URI']),'?').'">Datasets</a></li>'.$newline; //TODO - use base uri
$html .= '<li class="breadcrumb-item active">'.$returnObject->title.'</li>'.$newline;
$html .= '</ol>';
} else {
if (!isset($item) || $items == 'all') {
- $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("wfsid","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">Datasets</a></li>'.$newline; //TODO - use base uri
- $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">'.$returnObject->serviceTitle.'</a></li>'.$newline;
+ $html .= '<li class="breadcrumb-item"><a href="'.rtrim(delTotalFromQuery(array("f","wfsid","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']),'?').'">Datasets</a></li>'.$newline; //TODO - use base uri
+ $html .= '<li class="breadcrumb-item"><a href="'.rtrim(delTotalFromQuery(array("f","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']),'?').'">'.$returnObject->serviceTitle.'</a></li>'.$newline;
$html .= '<li class="breadcrumb-item active">'.$returnObject->collectionTitle.'</li>'.$newline;
$html .= '</ol>';
} else {
- $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("wfsid","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">Datasets</a></li>'.$newline; //TODO - use base uri
- $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">'.$returnObject->serviceTitle.'</a></li>'.$newline;
- $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("item","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'&items=all'.'">'.$returnObject->collectionTitle.'</a></li>'.$newline;
+ $html .= '<li class="breadcrumb-item"><a href="'.rtrim(delTotalFromQuery(array("f","wfsid","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']),'?').'">Datasets</a></li>'.$newline; //TODO - use base uri
+ $html .= '<li class="breadcrumb-item"><a href="'.rtrim(delTotalFromQuery(array("f","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']),'?').'">'.$returnObject->serviceTitle.'</a></li>'.$newline;
+ $html .= '<li class="breadcrumb-item"><a href="'.rtrim(delTotalFromQuery(array("f","item","limit","offset","bbox"), $_SERVER['REQUEST_URI']),'?').'&items=all'.'">'.$returnObject->collectionTitle.'</a></li>'.$newline;
$html .= '<li class="breadcrumb-item active">'.$returnObject->id.'</li>'.$newline;
$html .= '</ol>';
}
@@ -936,11 +949,11 @@
// other formats ! for collection, item, ...
//if (!isset($item)) {
$html .= '<ul class="list-separated m-0 p-0 text-muted">'.$newline;
- $html .= ' <li><a href="'.delTotalFromQuery("f", $_SERVER['REQUEST_URI']).'&f=json" target="_blank">GeoJSON</a></li>'.$newline;
+ $html .= ' <li><a href="'.rtrim(delTotalFromQuery("f", $_SERVER['REQUEST_URI']),'?').'&f=json" target="_blank">GeoJSON</a></li>'.$newline;
if (isset($collection) || $collections == 'all') {
- $html .= ' <li><a href="'.delTotalFromQuery("f", $_SERVER['REQUEST_URI']).'&f=xml" target="_blank">GML</a></li>'.$newline;
+ $html .= ' <li><a href="'.rtrim(delTotalFromQuery("f", $_SERVER['REQUEST_URI']),'?').'&f=xml" target="_blank">GML</a></li>'.$newline;
} else {
- $html .= ' <li><a href="'.delTotalFromQuery("f", $_SERVER['REQUEST_URI']).'&f=xml" target="_blank">XML</a></li>'.$newline;
+ $html .= ' <li><a href="'.rtrim(delTotalFromQuery("f", $_SERVER['REQUEST_URI']),'?').'&f=xml" target="_blank">XML</a></li>'.$newline;
}
$html .= '</ul> '.$newline;
//}
@@ -973,7 +986,7 @@
foreach ($returnObject->service as $service) {
$html .= ' <li itemprop="dataset" itemscope itemtype="http://schema.org/Dataset">'.$newline;
$html .= ' <h2>'.$newline;
- $html .= ' <a itemprop="url" href="'.$_SERVER['REQUEST_URI'].'&wfsid='.$service->id.'">'.$newline;
+ $html .= ' <a itemprop="url" href="'.rtrim($_SERVER['REQUEST_URI'],'?').'?wfsid='.$service->id.'">'.$newline;
$html .= ' <span itemprop="name">'.$service->title.'</span>'.$newline;
$html .= ' </a>'.$newline;
$html .= ' </h2>'.$newline;
@@ -1174,7 +1187,11 @@
foreach($feature->properties as $key=>$value) {
$html .= ' <div class="row my-1">'.$newline;
$html .= ' <div class="col-md-6 font-weight-bold text-truncate" title="'.$key.'">'.$key.'</div>'.$newline;
- $html .= ' <div class="col-md-6" >'.string2html($value).'</div>'.$newline;
+ if (gettype($value) == "string") {
+ $html .= ' <div class="col-md-6" >'.string2html($value).'</div>'.$newline;
+ } else {
+ $html .= ' <div class="col-md-6" >'.json_encode($value).'</div>'.$newline;
+ }
$html .= ' </div>'.$newline;
}
$html .= ' </div>'.$newline;
@@ -1193,7 +1210,11 @@
foreach($feature->properties as $key=>$value) {
$html .= ' <div class="row my-1">'.$newline;
$html .= ' <div class="col-md-6 font-weight-bold text-truncate" title="'.$key.'">'.$key.'</div>'.$newline;
- $html .= ' <div class="col-md-6" >'.string2html($value).'</div>'.$newline;
+ if (gettype($value) == "string") {
+ $html .= ' <div class="col-md-6" >'.string2html($value).'</div>'.$newline;
+ } else {
+ $html .= ' <div class="col-md-6" >'.json_encode($value).'</div>'.$newline;
+ }
$html .= ' </div>'.$newline;
}
$html .= ' </div>'.$newline;
More information about the Mapbender_commits
mailing list