[Mapbender-commits] r10360 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Nov 28 23:36:46 PST 2019


Author: armin11
Date: 2019-11-28 23:36:45 -0800 (Thu, 28 Nov 2019)
New Revision: 10360

Modified:
   trunk/mapbender/http/php/mod_dataISOMetadata.php
Log:
Define dummy keyword, if no other keyword is defined - empty keywords don't validate!!!!

Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php	2019-11-28 14:02:34 UTC (rev 10359)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php	2019-11-29 07:36:45 UTC (rev 10360)
@@ -1063,10 +1063,12 @@
 	$res = db_prep_query($sql,$v,$t);
 	$descriptiveKeywords=$iso19139->createElement("gmd:descriptiveKeywords");
 	$MD_Keywords=$iso19139->createElement("gmd:MD_Keywords");
-        $countNormalKeywords = 0;
+        //$countNormalKeywords = 0;
+	$keywordExist = false;
 	while ($row = db_fetch_array($res)) {
 		if (isset($row['keyword']) && $row['keyword'] != "") {
-			$countNormalKeywords++;
+			//$countNormalKeywords++;
+                        $keywordExist = true;
 			$keyword=$iso19139->createElement("gmd:keyword");
 			$keyword_cs=$iso19139->createElement("gco:CharacterString");
 			$keywordText = $iso19139->createTextNode($row['keyword']);
@@ -1075,6 +1077,15 @@
 			$MD_Keywords->appendChild($keyword);
 		}
 	}
+	//add dummy keyword, cause it is needed for validation!!!!
+	if ($keywordExist == false) {
+            	$keyword=$iso19139->createElement("gmd:keyword");
+		$keyword_cs=$iso19139->createElement("gco:CharacterString");
+		$keywordText = $iso19139->createTextNode("DummyKeyword");
+		$keyword_cs->appendChild($keywordText);
+		$keyword->appendChild($keyword_cs);
+		$MD_Keywords->appendChild($keyword);
+	}
 	//pull special keywords from custom categories:
 	//$e = new mb_notice("layer: ".$layerId);	
 
@@ -1115,10 +1126,10 @@
 	}
 	$e = new mb_notice("count custom categories: ".$countCustom);
 	//close decriptive keywords and generate a new entry for inspire themes:
-        if (($countCustom + $countNormalKeywords) > 0) {
+        //if (($countCustom + $countNormalKeywords) > 0) {
 	    $descriptiveKeywords->appendChild($MD_Keywords);
 	    $MD_DataIdentification->appendChild($descriptiveKeywords);
-	}
+	//}
 	//new entry - with gemet thesaurus referenced
 	$descriptiveKeywords=$iso19139->createElement("gmd:descriptiveKeywords");
 	//****************************************************************************************************************************************************************************************



More information about the Mapbender_commits mailing list