[Mapbender-commits] r9335 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Dec 10 01:03:01 PST 2015


Author: armin11
Date: 2015-12-10 01:03:01 -0800 (Thu, 10 Dec 2015)
New Revision: 9335

Modified:
   trunk/mapbender/http/classes/class_metadata_new.php
Log:
Fix for serving categories, keywords and tagclouds from searchinterface and resources dataset and wfs

Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php	2015-12-09 12:02:26 UTC (rev 9334)
+++ trunk/mapbender/http/classes/class_metadata_new.php	2015-12-10 09:03:01 UTC (rev 9335)
@@ -921,8 +921,8 @@
 			}
 			if ($this->resultTarget == 'webclient') {
 				$this->allJSON = new stdClass;
-				$this->allJSON->categories = $this->json->decode($this->keyJSON);
-				$this->allJSON->keywords =  $this->json->decode($this->catJSON);
+				$this->allJSON->categories = $this->json->decode($this->catJSON);
+				$this->allJSON->keywords =  $this->json->decode($this->keyJSON);
 				//load filter from file getFromStorage
 				$admin = new administration();
 				$filename = $this->tempFolder."/".$this->searchId."_filter.json";
@@ -982,6 +982,32 @@
 			if ($this->resultTarget == 'internal') {
 				$this->internalResult = $this->wfsJSON;
 			}
+			if ($this->resultTarget == 'webclient') {
+				$this->allJSON = new stdClass;
+				$this->allJSON->categories = $this->json->decode($this->catJSON);
+				$this->allJSON->keywords =  $this->json->decode($this->keyJSON);
+				//load filter from file getFromStorage
+				$admin = new administration();
+				$filename = $this->tempFolder."/".$this->searchId."_filter.json";
+				$fileExists = $admin->getFromStorage($filename,TMP_SEARCH_RESULT_STORAGE);
+				if ($fileExists == false) {
+					$e = new mb_exception("class_metadata_new.php: No filter json exists!");
+				} else {
+					$filterJSON = $fileExists;
+					$filterJSON = $this->json->decode($filterJSON);
+					$this->allJSON->filter = $filterJSON;
+				}
+				$this->allJSON->wfs = $this->json->decode($this->wfsJSON);
+				//$e = new mb_exception("originFromHeader: ".$this->originFromHeader);
+				if ($this->originFromHeader != false) {
+					header('Access-Control-Allow-Origin: '.$this->originFromHeader);
+				}
+				//if (defined("CORS_WHITELIST") && CORS_WHITELIST != "") {
+				//	header('Access-Control-Allow-Origin: '.CORS_WHITELIST);
+				//}
+				echo  $this->json->encode($this->allJSON);
+				//echo "test";
+			}
 		}
 		
 		$e = new mb_notice("Time to generate WFS-Metadata: ".$usedTime);
@@ -1011,6 +1037,32 @@
 			if ($this->resultTarget == 'web' or $this->resultTarget == 'debug') {
 				echo $this->wmcJSON;
 			}
+						if ($this->resultTarget == 'webclient') {
+				$this->allJSON = new stdClass;
+				$this->allJSON->categories = $this->json->decode($this->catJSON);
+				$this->allJSON->keywords =  $this->json->decode($this->keyJSON);
+				//load filter from file getFromStorage
+				$admin = new administration();
+				$filename = $this->tempFolder."/".$this->searchId."_filter.json";
+				$fileExists = $admin->getFromStorage($filename,TMP_SEARCH_RESULT_STORAGE);
+				if ($fileExists == false) {
+					$e = new mb_exception("class_metadata_new.php: No filter json exists!");
+				} else {
+					$filterJSON = $fileExists;
+					$filterJSON = $this->json->decode($filterJSON);
+					$this->allJSON->filter = $filterJSON;
+				}
+				$this->allJSON->wmc = $this->json->decode($this->wmcJSON);
+				//$e = new mb_exception("originFromHeader: ".$this->originFromHeader);
+				if ($this->originFromHeader != false) {
+					header('Access-Control-Allow-Origin: '.$this->originFromHeader);
+				}
+				//if (defined("CORS_WHITELIST") && CORS_WHITELIST != "") {
+				//	header('Access-Control-Allow-Origin: '.CORS_WHITELIST);
+				//}
+				echo  $this->json->encode($this->allJSON);
+				//echo "test";
+			}
 		}
 		$usedTime2 = $this->microtime_float() - $starttime;
 		//echo "<br>used time: ".$usedTime."<br>";
@@ -1042,6 +1094,32 @@
 			if ($this->resultTarget == 'web' or $this->resultTarget == 'debug') {
 				echo $this->datasetJSON;
 			}
+			if ($this->resultTarget == 'webclient') {
+				$this->allJSON = new stdClass;
+				$this->allJSON->categories = $this->json->decode($this->catJSON);
+				$this->allJSON->keywords =  $this->json->decode($this->keyJSON);
+				//load filter from file getFromStorage
+				$admin = new administration();
+				$filename = $this->tempFolder."/".$this->searchId."_filter.json";
+				$fileExists = $admin->getFromStorage($filename,TMP_SEARCH_RESULT_STORAGE);
+				if ($fileExists == false) {
+					$e = new mb_exception("class_metadata_new.php: No filter json exists!");
+				} else {
+					$filterJSON = $fileExists;
+					$filterJSON = $this->json->decode($filterJSON);
+					$this->allJSON->filter = $filterJSON;
+				}
+				$this->allJSON->dataset = $this->json->decode($this->datasetJSON);
+				//$e = new mb_exception("originFromHeader: ".$this->originFromHeader);
+				if ($this->originFromHeader != false) {
+					header('Access-Control-Allow-Origin: '.$this->originFromHeader);
+				}
+				//if (defined("CORS_WHITELIST") && CORS_WHITELIST != "") {
+				//	header('Access-Control-Allow-Origin: '.CORS_WHITELIST);
+				//}
+				echo  $this->json->encode($this->allJSON);
+				//echo "test";
+			}
 		}
 		$usedTime2 = $this->microtime_float() - $starttime;
 		//echo "<br>used time: ".$usedTime."<br>";



More information about the Mapbender_commits mailing list