[Mapbender-commits] r10236 - in trunk/mapbender/http: classes frames javascripts php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Sep 6 01:34:32 PDT 2019
Author: armin11
Date: 2019-09-06 01:34:32 -0700 (Fri, 06 Sep 2019)
New Revision: 10236
Modified:
trunk/mapbender/http/classes/class_connector.php
trunk/mapbender/http/classes/class_csw.php
trunk/mapbender/http/classes/class_cswClient.php
trunk/mapbender/http/classes/class_gml_3_factory.php
trunk/mapbender/http/classes/class_wfs.php
trunk/mapbender/http/frames/index.php
trunk/mapbender/http/javascripts/mod_copyright.php
trunk/mapbender/http/php/mod_callMetadata.php
trunk/mapbender/http/php/mod_exportIso19139.php
trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php
trunk/mapbender/http/php/mod_loadWFSCapabilities.php
trunk/mapbender/http/php/mod_syncCkan_server.php
Log:
Improve csw interface
Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/classes/class_connector.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -68,6 +68,7 @@
//an internet connection. It can be that some requests are done thru this class to the urls of
//HTTP_AUTH_PROXY or OWSPROXY. If some of those are part of the url they must be exchanged with 127.0.0.1 - //which hopefully should work.
$testMatch = $url;
+$e = new mb_exception("url: ".$url);
$localTmpFolder = 'file://'.str_replace('classes',ltrim(TMPDIR,'../'),dirname(__FILE__)).'/';
$pattern = '/^http:|https:|'.str_replace('/','\/',$localTmpFolder).'/';
//$e = new mb_exception('file://'.str_replace('classes',ltrim(TMPDIR,'../'),dirname(__FILE__)).'/');
@@ -314,7 +315,7 @@
curl_setopt($ch, CURLOPT_POST, 1);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->httpPostData);
- //$e = new mb_exception($this->httpPostData);
+//$e = new mb_exception($this->httpPostData);
}
$useragent=CONNECTION_USERAGENT;
//Build own headers for GET Requests - maybe needful?
@@ -333,7 +334,7 @@
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
#curl_setopt($ch, CURLOPT_HEADER, true);
- $e = new mb_notice("class_connector.php: CURL connect to:".$url);
+//$e = new mb_exception("class_connector.php: CURL connect to:".$url);
//curl_setopt ($ch,CURLOPT_USERAGENT,$useragent);
curl_setopt($ch,CURLOPT_DNS_USE_GLOBAL_CACHE, false);
curl_setopt($ch,CURLINFO_HEADER_OUT, true);
@@ -374,7 +375,7 @@
if ($tmpHttpProxy != '') {
putenv("http_proxy=$tmpHttpProxy");
}
- //$e = new mb_notice("class_connector.php: CURL give back: ".$file);
+//$e = new mb_exception("class_connector.php: CURL give back: ".$file);
return $file;
}
Modified: trunk/mapbender/http/classes/class_csw.php
===================================================================
--- trunk/mapbender/http/classes/class_csw.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/classes/class_csw.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -146,9 +146,10 @@
$xml = str_replace('xlink:href', 'xlinkhref', $this->cat_getcapabilities_doc);
#http://forums.devshed.com/php-development-5/simplexml-namespace-attributes-problem-452278.html
#http://www.leftontheweb.com/message/A_small_SimpleXML_gotcha_with_namespaces
-
+//test without replace:
+ $xml = $this->cat_getcapabilities_doc;
$csw202Cap = new SimpleXMLElement($xml);
-
+ $namespaces = $csw202Cap->getNamespaces(true);
if ($csw202Cap === false) {
foreach(libxml_get_errors() as $error) {
$e = new mb_exception($error->message);
@@ -159,7 +160,7 @@
catch (Exception $e) {
$e = new mb_exception($e->getMessage());
}
-
+//xmlns:ns2="http://www.w3.org/1999/xlink"
if ($csw202Cap !== false) {
//read all relevant information an put them into the mapbender csw object
//xmlns="http://www.opengis.net/csw"
@@ -213,15 +214,15 @@
//for op_types
$op_types = array("GetCapabilities","DescribeRecord","GetRecords","GetRecordById");
foreach ($op_types as $op_type) {
- $this->cat_op_values[mb_strtolower($op_type)]['get']['dflt'] = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:DCP/ows:HTTP/ows:Get/@xlinkhref');
+ $this->cat_op_values[mb_strtolower($op_type)]['get']['dflt'] = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:DCP/ows:HTTP/ows:Get/@xlink:href');
$this->cat_op_values[mb_strtolower($op_type)]['get']['dflt'] = html_entity_decode($this->cat_op_values[mb_strtolower($op_type)]['get']['dflt'][0]);
//$e = new mb_exception("class_csw: operationurl: ".$this->cat_op_values[mb_strtolower($op_type)]['get']['dflt']);
- $this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'] = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:DCP/ows:HTTP/ows:Post/@xlinkhref');
+ $this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'] = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:DCP/ows:HTTP/ows:Post/@xlink:href');
$this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'] = html_entity_decode($this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'][0]);
//extract constraints for this operation
$constraints = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:Constraint[@name="PostEncoding"]/ows:Value');
foreach ($constraints as $constraint) {
- $this->cat_op_values[mb_strtolower($op_type)]['post'][mb_strtolower($constraint)]=$this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'];
+ $this->cat_op_values[mb_strtolower($op_type)]['post'][mb_strtolower($constraint)]=$this->cat_op_values[mb_strtolower($op_type)]['post'][$constraint];
//$e = new mb_exception("class_csw: constraint: ".mb_strtolower($constraint));
}
}
Modified: trunk/mapbender/http/classes/class_cswClient.php
===================================================================
--- trunk/mapbender/http/classes/class_cswClient.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/classes/class_cswClient.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -344,7 +344,9 @@
//$e = new mb_exception("test: ".$csw->cat_op_values[$operationNameCsw]['post']);
if ($cswId != false) {
$this->operationResult = $this->getResult($csw->cat_op_values[$operationNameCsw]['post'], $postRequest);
+ //csw not from database but from capabilities!
} else {
+$e = new mb_exception(json_encode($csw->cat_op_values[$operationNameCsw]));
$this->operationResult = $this->getResult($csw->cat_op_values[$operationNameCsw]['post']['dflt'], $postRequest);
}
//Also give back url of operation
@@ -353,6 +355,7 @@
} else {
$this->operationUrl = $csw->cat_op_values[$operationNameCsw]['post']['dflt'];
}
+$e = new mb_exception($this->operationUrl);
} else {
$this->operationResult = $this->getResult($csw->cat_op_values["transaction"]['post'], $postRequest);
//$this->operationUrl = $csw->cat_op_values[$operationNameCsw]['post'];
Modified: trunk/mapbender/http/classes/class_gml_3_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_3_factory.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/classes/class_gml_3_factory.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -386,7 +386,7 @@
$srs = $geomNode->getAttribute("srsName");
}
}
-
+//$e = new mb_exception("classes/class_gml_3_factory: found srs: ".$srs);
//if srsName of featureMember is empty, use the srsName of node //gml:boundedBy/gml:Envelope
if($srs == "") {
$srs = $gmlBoundedBySrs;
Modified: trunk/mapbender/http/classes/class_wfs.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/classes/class_wfs.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -508,6 +508,7 @@
$getRequest .= "&FILTER=".urlencode($filter);
}
//$e = new mb_exception("classes/class_wfs.php: getfeature-GET-url: ".$getRequest);
+//$e = new mb_exception("classes/class_wfs.php: getfeature-GET-result: ".$this->get($getRequest));
return $this->get($getRequest);
break;
}
Modified: trunk/mapbender/http/frames/index.php
===================================================================
--- trunk/mapbender/http/frames/index.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/frames/index.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -296,6 +296,8 @@
}
$mapPhpParameters = htmlentities($urlParameters, ENT_QUOTES, CHARSET);
$mapPhpParameters .= "&".htmlentities($_SERVER["QUERY_STRING"]);
+
+$e = new mb_exception("index.php: mapPhpParameters: ".$mapPhpParameters);
if ($representationType == "htmlComplete") {
$html .= "<script type='text/javascript' src='../javascripts/map.php?".$mapPhpParameters."'></script>".$linebreak;
} else {
Modified: trunk/mapbender/http/javascripts/mod_copyright.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_copyright.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/javascripts/mod_copyright.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -36,7 +36,7 @@
function mod_copyright(){
var myMapObj = Mapbender.modules[mod_copyright_target];
- var str_c = "<div style='z-index:70;font-family:" + mod_copyright_font + ";font-size:" + mod_copyright_fontsize + ";color:" + mod_copyright_color2 + ";position:absolute;bottom:5px;right:5px'>"+mod_copyright_text+"</div>";
+ var str_c = "<div style='z-index:110;font-family:" + mod_copyright_font + ";font-size:" + mod_copyright_fontsize + ";color:" + mod_copyright_color2 + ";position:absolute;bottom:5px;right:5px'>"+mod_copyright_text+"</div>";
var map_el = myMapObj.getDomElement();
if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_copyright")){
@@ -47,4 +47,4 @@
map_el.appendChild(el_top);
}
writeTag(myMapObj.frameName, myMapObj.elementName+"_copyright", str_c);
-}
\ No newline at end of file
+}
Modified: trunk/mapbender/http/php/mod_callMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callMetadata.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/php/mod_callMetadata.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -686,7 +686,7 @@
$classificationElements[10]['name2show'] = 'Datenaktualität von:';
$classificationElements[11]['name2show'] = 'Datenaktualität bis:';
- $resourceCategories['wms'] = 'Darstellungsdienste';
+ $resourceCategories['wms'] = 'Kartenebenen';
$resourceCategories['wfs'] = 'Such- und Download- und Erfassungsmodule';
$resourceCategories['wmc'] = 'Kartenzusammenstellungen';
$resourceCategories['dataset'] = 'Datensätze';
@@ -716,7 +716,7 @@
$classificationElements[10]['name2show'] = 'Actuality of dataset from:';
$classificationElements[11]['name2show'] = 'Actuality of dataset to:';
- $resourceCategories['wms'] = 'Viewingservices';
+ $resourceCategories['wms'] = 'Maplayers';
$resourceCategories['wfs'] = 'Search- and Downloadservices';
$resourceCategories['wmc'] = 'Combined Maps';
$resourceCategories['dataset'] = 'Datasets';
@@ -774,7 +774,7 @@
$classificationElements[10]['name2show'] = 'Actuality of dataset from:';
$classificationElements[11]['name2show'] = 'Actuality of dataset to:';
- $resourceCategories['wms'] = 'Darstellungsdienste';
+ $resourceCategories['wms'] = 'Kartenebenen';
$resourceCategories['wfs'] = 'Such- und Downloaddienste';
$resourceCategories['wmc'] = 'Kartenzusammenstellungen';
$resourceCategories['dataset'] = 'Datasets';
Modified: trunk/mapbender/http/php/mod_exportIso19139.php
===================================================================
--- trunk/mapbender/http/php/mod_exportIso19139.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/php/mod_exportIso19139.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -78,8 +78,8 @@
//TODO: test if this ok - maybe not everything is parsed by class? instead we could use $mbMetadata->readFromUrl($url);
$mbMetadata->createFromUrl($url);
-$e = new mb_exception("php/mod_exportIso19139.php: url for getrecordbyid: ".$url);
-$e = new mb_exception("php/mod_exportIso19139.php: datasetid from getrecordbyid: ".$mbMetadata->datasetIdCodeSpace.$mbMetadata->datasetId);
+//$e = new mb_exception("php/mod_exportIso19139.php: url for getrecordbyid: ".$url);
+//$e = new mb_exception("php/mod_exportIso19139.php: datasetid from getrecordbyid: ".$mbMetadata->datasetIdCodeSpace.$mbMetadata->datasetId);
//$e = new mb_exception("datasetId: ".$mbMetadata->datasetId);
//$e = new mb_exception("datasetIdCodeSpace: ".$mbMetadata->datasetIdCodeSpace);
@@ -97,8 +97,11 @@
//$e = new mb_exception("parse csw capabilities!");
//parse url
$urlArray = parse_url($url);
- $urlWithoutRequest = $urlArray['scheme']."://".$urlArray['host'].":".$urlArray['port']."/".$urlArray['path'];
+//$e = new mb_exception(json_encode($urlArray));
+ //$urlWithoutRequest = $urlArray['scheme']."://".$urlArray['host'].":".$urlArray['port']."/".$urlArray['path'];
+ $urlWithoutRequest = $urlArray['scheme']."://".$urlArray['host'].$urlArray['path'];
$csw->createCatObjFromXML($urlWithoutRequest."?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetCapabilities");
+ //$e = new mb_exception($urlWithoutRequest."?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetCapabilities");
$cswClient = new cswClient();
$operation = "getrecordsresolvecoupling";
$getrecordId = $mbMetadata->fileIdentifier;
Modified: trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php
===================================================================
--- trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -215,7 +215,8 @@
//$e = new mb_exception("php/mod_getCoupledResourcesForDataset.php: datasetid from getrecordbyid: ".$mbMetadata->datasetId);
$operation = "getrecordsresolvecoupling";
$getrecordId = $mbMetadata->fileIdentifier;
- $datasetId = str_replace('&','&',$mbMetadata->datasetIdCodeSpace.$mbMetadata->datasetId);
+ $datasetId = str_replace('&','&',$mbMetadata->datasetIdCodeSpace.'/'.$mbMetadata->datasetId);
+
$recordType = 'service';
$cswResponseObject = $cswClient->doRequest(false, $operation, $getrecordId, false, $recordType, false, false, false, $datasetId, $csw);
$serviceMetadataUrls = array();
Modified: trunk/mapbender/http/php/mod_loadWFSCapabilities.php
===================================================================
--- trunk/mapbender/http/php/mod_loadWFSCapabilities.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/php/mod_loadWFSCapabilities.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -158,6 +158,7 @@
echo "REQUEST=GetCapabilities&VERSION=1.0.0&SERVICE=WFS<br>";
echo "REQUEST=GetCapabilities&VERSION=1.1.0&SERVICE=WFS<br>";
echo "REQUEST=GetCapabilities&VERSION=2.0.0&SERVICE=WFS<br>";
+//echo "REQUEST=GetCapabilities&VERSION=2.0.2&SERVICE=WFS<br>";
echo "<br><br>";
echo "Link to WFS Capabilities URL:<br>";
Modified: trunk/mapbender/http/php/mod_syncCkan_server.php
===================================================================
--- trunk/mapbender/http/php/mod_syncCkan_server.php 2019-09-03 11:02:23 UTC (rev 10235)
+++ trunk/mapbender/http/php/mod_syncCkan_server.php 2019-09-06 08:34:32 UTC (rev 10236)
@@ -198,6 +198,8 @@
echo "You are not root user and therefor not allowed to sync organizations with ckan!";
die();
}
+
+
$sql = <<<SQL
select opendata.*, mb_group.uuid, mb_group_id, mb_group_title, mb_group_description, mb_group_homepage, mb_group_logo_path, mb_group_address, mb_group_postcode, mb_group_city, mb_group_email, timestamp, mb_group.mb_group_ckan_uuid from mb_group, (select (sum(count_wms_layer)+sum(count_metadata)) as number_of_opendata_ressources, group_id,mb_group_name from (
@@ -213,6 +215,9 @@
SQL;
+if (isset($orgaId)){
+ $sql .= " AND mb_group_id = ".$orgaId."";
+}
$sql2 = <<<SQL
@@ -225,6 +230,10 @@
SQL;
+if (isset($orgaId)){
+ $sql2 .= " AND mb_group_id = ".$orgaId."";
+}
+
$sql3 = <<<SQL
select opendata.*, mb_group.uuid, mb_group_id, mb_group_title, mb_group_description, mb_group_homepage, mb_group_logo_path, mb_group_address, mb_group_postcode, mb_group_city, mb_group_email, timestamp, mb_group.mb_group_ckan_uuid from mb_group, (select (sum(count_wms_layer)+sum(count_metadata)) as number_of_opendata_ressources, group_id,mb_group_name from (
@@ -240,7 +249,11 @@
SQL;
+if (isset($orgaId)){
+ $sql3 .= " AND mb_group_id = ".$orgaId."";
+}
+
$sql4 = <<<SQL
select opendata.*, mb_group.uuid, mb_group_id, mb_group_title, mb_group_description, mb_group_homepage, mb_group_logo_path, mb_group_address, mb_group_postcode, mb_group_city, mb_group_email, timestamp, mb_group.mb_group_ckan_uuid from mb_group, (select (sum(count_wms_layer)+sum(count_metadata)) as number_of_opendata_ressources, group_id, mb_group_name from (
@@ -252,6 +265,11 @@
SQL;
+if (isset($orgaId)){
+ $sql4 .= " AND mb_group_id = ".$orgaId."";
+}
+
+
switch ($showOnlyDatasetMetadata) {
case "true":
if ($showOnlyUnlinkedOrganizations == "true") {
More information about the Mapbender_commits
mailing list