[Mapbender-commits] r9700 - in trunk/mapbender/http: geoportal/metadata_templates php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Feb 24 04:09:12 PST 2017


Author: armin11
Date: 2017-02-24 04:09:12 -0800 (Fri, 24 Feb 2017)
New Revision: 9700

Modified:
   trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml
   trunk/mapbender/http/php/mod_featuretypeISOMetadata.php
   trunk/mapbender/http/php/mod_showMetadata.php
Log:
Some fixes for inspire wfs proxy

Modified: trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml
===================================================================
--- trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml	2017-02-22 16:39:30 UTC (rev 9699)
+++ trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml	2017-02-24 12:09:12 UTC (rev 9700)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
   <gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd">
     <gmd:fileIdentifier>
-      <!-- Identifier of service metadata record (featuretype_uuid) -->
+      <!-- fileIdentifier of service metadata record (should be featuretype_uuid) -->
       <gco:CharacterString>metadata_identifier_uuid</gco:CharacterString>
     </gmd:fileIdentifier>
     <gmd:language>

Modified: trunk/mapbender/http/php/mod_featuretypeISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_featuretypeISOMetadata.php	2017-02-22 16:39:30 UTC (rev 9699)
+++ trunk/mapbender/http/php/mod_featuretypeISOMetadata.php	2017-02-24 12:09:12 UTC (rev 9700)
@@ -33,7 +33,7 @@
 db_select_db(DB,$con);
 
 if (DEFINED("MAPBENDER_PATH") && MAPBENDER_PATH !== "") {
-	$mapbenderServiceUrl = MAPBENDER_PATH."/php/wfs.php?INSPIRE=1&&FEATURETYPE_ID=";
+	$mapbenderServiceUrl = MAPBENDER_PATH."/php/wfs.php?INSPIRE=1&FEATURETYPE_ID=";
 } else {
 	$mapbenderServiceUrl = $_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?INSPIRE=1&FEATURETYPE_ID=";
 }
@@ -106,7 +106,8 @@
 }
 //some needfull functions to pull metadata out of the database!
 function fillISO19139(XmlBuilder $xmlBuilder, $recordId) {
-    global $wmsView;
+    	global $wmsView;
+	global $mapbenderServiceUrl;
 	global $admin;
 	//read out relevant information from mapbender database:
 	if ($wmsView != '') {
@@ -137,8 +138,7 @@
 	$t = array('i');
 	$res = db_prep_query($sql,$v,$t);
 	$mbMeta = db_fetch_array($res);
-        //add version to service url
-	
+
 	//infos about the registrating department, check first if a special metadata point of contact is defined in the service table - function from mod_showMetadata - TODO: should be defined in admin class
 	if (!isset($mbMeta['fkey_mb_group_id']) || is_null($mbMeta['fkey_mb_group_id']) || $mbMeta['fkey_mb_group_id'] == 0){
 		$e = new mb_notice("mod_featuretypeISOMetadata.php: fkey_mb_group_id not found!");
@@ -409,7 +409,7 @@
 	//connectPoint **********************************
     $xmlBuilder->addValue($MD_Metadata,
             './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:connectPoint/gmd:CI_OnlineResource/gmd:linkage/gmd:URL',
-            "http://".$_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?inspire=1&featuretype_id=".$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS&VERSION=".$mbMeta['wfs_version']);
+            "http://".$_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?inspire=1&featuretype_id=".$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS");
 
 	//fill in operatesOn fields with datasetid if given
 	/*INSPIRE example: <srv:operatesOn xlink:href="http://image2000.jrc.it#image2000_1_nl2_multi"/>*/
@@ -459,11 +459,12 @@
     
 	//Check if anonymous user has rights to access this featyretype - if not ? which resource should be advertised? TODO
     $url = '';
-	if ($hasPermission) {
+	//GetCapabilities is always available
+	//if ($hasPermission) {
 		$url = $mapbenderServiceUrl.$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS&VERSION=".$mbMeta['wfs_version'];
-	} else {
-		$url = "https://".$_SERVER['HTTP_HOST']."/registry/wfs/".$mbMeta['featuretype_id']."?REQUEST=GetCapabilities&SERVICE=WFS&VERSION=".$mbMeta['wfs_version'];
-	}
+	/*} else {
+		$url = "https://".$_SERVER['HTTP_HOST']."/registry/wfs/".$mbMeta['featuretype_id']."?REQUEST=GetCapabilities&SERVICE=WFS&VERSION=".$version;
+	}*/
     $xmlBuilder->addValue($MD_Metadata,
             './gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL',
             $url);

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2017-02-22 16:39:30 UTC (rev 9699)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2017-02-24 12:09:12 UTC (rev 9700)
@@ -1123,20 +1123,17 @@
 //Check if owsproxy is enabled for resource
 if ($resource == 'featuretype' or $resource == 'wfs-conf' or $resource == "wfs") {
 	if ($admin->getWFSOWSstring($resourceMetadata['serviceid']) == false) {
-		//
-		//$e = new mb_exception("no proxy");
 		$describeFeaturetypeUrl = $resourceMetadata['wfs_describefeaturetype'];
 		$wfsGetCapabilitiesUrl = $resourceMetadata['wfs_getcapabilities'];
 	} else {
 		//
 		$describeFeaturetypeUrl = $mapbenderServerUrl."/registry/wfs/".$resourceMetadata['serviceid']."?";
 		$wfsGetCapabilitiesUrl = $describeFeaturetypeUrl;
-		//$e = new mb_exception("proxy");
 	}
 }
  
 if (isset($resourceMetadata['wfs_describefeaturetype']) && ($resourceMetadata['wfs_describefeaturetype'] != '')) {
-	$html .= $t_a.$translation['describeFeaturetype'].$t_b."<a href='".$describeFeaturetypeUrl."SERVICE=WFS&VERSION=".$resourceMetadata['serviceversion']."&REQUEST=DescribeFeaturetype&typename=".$resourceMetadata['contentname']."' >Link</a>".$t_c;
+	$html .= $t_a.$translation['describeFeaturetype'].$t_b."<a href='".$describeFeaturetypeUrl."SERVICE=WFS&VERSION=".$resourceMetadata['serviceversion']."&REQUEST=DescribeFeatureType&typename=".$resourceMetadata['contentname']."' >Link</a>".$t_c;
 	#$html .= $t_a.$translation['describeFeaturetype'].$t_b."<a href='".$resourceMetadata['wfs_describefeaturetype']."&REQUEST=DescribeFeaturetype&typename=".$resourceMetadata['contentname']."' >Link</a>".$t_c;
 }
 
@@ -1146,18 +1143,31 @@
 }
 //$html .= $tableEnd;
 
-if ($resource == 'wms' or $resource == 'layer'){
+if ($resource == 'wms' or $resource == 'layer' or $resource == 'featuretype'){
 	//$html .= $tableBegin;
 	//part for coupled resources - if they exists (first this is realized only for layers):
 	//get metadata entries
 	//get MetadataURLs from md_metadata table
-	$sql = <<<SQL
+	switch ($resource) {
+		case "featuretype":
+$sql = <<<SQL
 	SELECT metadata_id, uuid, link, linktype, md_format, origin FROM mb_metadata 
 	INNER JOIN (SELECT * from ows_relation_metadata 
+	WHERE fkey_featuretype_id = $featuretypeId ) as relation ON 
+	mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.origin
+	IN('capabilities','external','metador','upload')
+SQL;
+			break;
+		case "layer":
+$sql = <<<SQL
+	SELECT metadata_id, uuid, link, linktype, md_format, origin FROM mb_metadata 
+	INNER JOIN (SELECT * from ows_relation_metadata 
 	WHERE fkey_layer_id = $layerId ) as relation ON 
 	mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.origin
 	IN('capabilities','external','metador','upload')
 SQL;
+			break;
+	}
 	$res = db_query($sql);
 	$i = 0;
 	$metadataList = "";



More information about the Mapbender_commits mailing list