[Mapbender-commits] r9548 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 18 05:10:18 PDT 2016


Author: verenadiewald
Date: 2016-07-18 05:10:18 -0700 (Mon, 18 Jul 2016)
New Revision: 9548

Modified:
   trunk/mapbender/http/plugins/mb_metadata_server.php
Log:
use correct identifier for switching layers and featuretypes

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2016-07-15 12:08:04 UTC (rev 9547)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2016-07-18 12:10:18 UTC (rev 9548)
@@ -482,6 +482,7 @@
 FROM layer WHERE layer_id = $resourceId;
 SQL;
 				$tablename = "layer";
+				$identierName = "layer";
 			break;
 			case "featuretype":
 				$featuretypeId = $ajaxResponse->getParameter("resourceId");
@@ -491,6 +492,7 @@
 FROM wfs_featuretype WHERE featuretype_id = $featuretypeId;
 SQL;
 				$tablename = "wfs_featuretype";
+				$identierName = "featuretype";
 			break;
 		}
 		$res = db_query($sql);
@@ -501,26 +503,26 @@
 				$e = new mb_notice("plugins/mb_metadata_server.php: get ".$value." for ".$key);
 			}
 		}
-		$sql = "SELECT fkey_md_topic_category_id FROM ".$tablename."_md_topic_category WHERE fkey_".$tablename."_id = ".$resourceId." AND fkey_metadata_id ISNULL";
+		$sql = "SELECT fkey_md_topic_category_id FROM ".$tablename."_md_topic_category WHERE fkey_".$identierName."_id = ".$resourceId." AND fkey_metadata_id IS NULL";
 		$res = db_query($sql);
 		while ($row = db_fetch_assoc($res)) {
-			$resultObj[$tablename."_md_topic_category_id"][]= $row["fkey_md_topic_category_id"];
+			$resultObj[$identierName."_md_topic_category_id"][]= $row["fkey_md_topic_category_id"];
 		}
-		$sql = "SELECT fkey_inspire_category_id FROM ".$tablename."_inspire_category WHERE fkey_layer_id = ".$resourceId." AND fkey_metadata_id ISNULL";
+		$sql = "SELECT fkey_inspire_category_id FROM ".$tablename."_inspire_category WHERE fkey_".$identierName."_id = ".$resourceId." AND fkey_metadata_id IS NULL";
 		$res = db_query($sql);
 		while ($row = db_fetch_assoc($res)) {
-			$resultObj[$tablename."_inspire_category_id"][]= $row["fkey_inspire_category_id"];
+			$resultObj[$identierName."_inspire_category_id"][]= $row["fkey_inspire_category_id"];
 		}
-		$sql = "SELECT fkey_custom_category_id FROM ".$tablename."_custom_category WHERE fkey_layer_id = ".$resourceId." AND fkey_metadata_id ISNULL";
+		$sql = "SELECT fkey_custom_category_id FROM ".$tablename."_custom_category WHERE fkey_".$identierName."_id = ".$resourceId." AND fkey_metadata_id IS NULL";
 		$res = db_query($sql);
 		while ($row = db_fetch_assoc($res)) {
-			$resultObj[$tablename."_custom_category_id"][]= $row["fkey_custom_category_id"];
+			$resultObj[$identierName."_custom_category_id"][]= $row["fkey_custom_category_id"];
 		}
-		$sql = "SELECT keyword FROM keyword, ".$tablename."_keyword WHERE keyword_id = fkey_keyword_id AND fkey_layer_id = ".$resourceId;
+		$sql = "SELECT keyword FROM keyword, ".$tablename."_keyword WHERE keyword_id = fkey_keyword_id AND fkey_".$identierName."_id = ".$resourceId;
 		$res = db_query($sql);
-		$resultObj[$tablename."_keyword"] = array();
+		$resultObj[$identierName."_keyword"] = array();
 		while ($row = db_fetch_assoc($res)) {
-			$resultObj[$tablename."_keyword"][]= $row["keyword"];
+			$resultObj[$identierName."_keyword"][]= $row["keyword"];
 		}
 		$resultObj['inspire_download'] = $resultObj['inspire_download'] == 1 ? true : false;
 		//get wgs84Bbox for relevant layer - to be bequeathed to the metadata



More information about the Mapbender_commits mailing list