[Mapbender-commits] r5795 - in trunk/mapbender/http: classes php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Mar 16 16:50:31 EDT 2010


Author: armin11
Date: 2010-03-16 16:50:30 -0400 (Tue, 16 Mar 2010)
New Revision: 5795

Modified:
   trunk/mapbender/http/classes/class_metadata_new.php
   trunk/mapbender/http/php/mod_callMetadata.php
Log:
small changes in the new search module - push the search classes in the filter file so that the client knows which resource types are searched

Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php	2010-03-16 17:53:13 UTC (rev 5794)
+++ trunk/mapbender/http/classes/class_metadata_new.php	2010-03-16 20:50:30 UTC (rev 5795)
@@ -177,7 +177,7 @@
 				$this->generateWFSMetadata($this->wfsDoc);
 			}
 			if (isset($this->searchResources) & strtolower($this->searchResources) === "wms") {
-				$this->searchView = 'search_wms_view';
+				$this->searchView = 'wms_search_table_test';
 				$this->orderBy = " ORDER BY load_count DESC";
 				$this->resourceClasses = array(0,1,2);
 				$this->generateWMSMetadata($this->wmsDoc);
@@ -468,6 +468,12 @@
 				else {
 					$this->wmsJSON->wms->srv[$j]->layer[0]->loadable = 1;
 				}
+				if ($subLayers[$rootIndex]['layer_pos'] == '0'){
+					$this->wmsJSON->wms->srv[$j]->layer[0]->isRoot = true;
+				}
+				else {
+					$this->wmsJSON->wms->srv[$j]->layer[0]->isRoot = false;
+				}
 				//give info for inspire categories - not relevant for other services or instances of mapbender TODO: comment it if the mapbender installation is not used to generate inspire output
 				if ($subLayers[$rootIndex]['md_inspire_cats'] == ''){
 					$this->wmsJSON->wms->srv[$j]->layer[0]->inspire = 0;
@@ -519,7 +525,7 @@
 			$this->wmsJSON = $this->json->encode($this->wmsJSON);
 			if ($this->resultTarget == 'file') {
 				if($wmsFileHandle = fopen($this->tempFolder."/".$this->searchId."_".$this->searchResources."_".$this->searchPages.".json","w")){
-					fwrite($wmsFileHandle,$this->wfsJSON);
+					fwrite($wmsFileHandle,$this->wmsJSON);
 					fclose($wmsFileHandle);
 				}
 			}

Modified: trunk/mapbender/http/php/mod_callMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callMetadata.php	2010-03-16 17:53:13 UTC (rev 5794)
+++ trunk/mapbender/http/php/mod_callMetadata.php	2010-03-16 20:50:30 UTC (rev 5795)
@@ -38,8 +38,8 @@
 $languageCode = "de";
 $outputFormat = 'json';
 #$searchResources = "wms,wfs,wmc,georss";
-$searchResources = "wms";
-$searchPages = "1,1,1,1";
+#$searchResources = "wms";
+$searchPages = "1";
 $resultTarget = "debug";
 $searchEPSG = "EPSG:31466";
 $classJSON = new Mapbender_JSON;
@@ -248,14 +248,7 @@
 	}
 	$searchPages = $testMatch;
 	$testMatch = NULL;
-
-
-
-
-
-
-
-$searchPages = $_REQUEST["searchPages"];
+#$searchPages = $_REQUEST["searchPages"];
 	#$searchPages = split(',',$searchPages);
 	
 }
@@ -282,14 +275,9 @@
 #$searchPages = array(1,1,1,1);
 
 //TODO: if class is called directly
-	#$registratingDepartments = explode(",",$registratingDepartments);
-	#$isoCategories = explode(",",$isoCategories);
-	#$inspireThemes = explode(",",$inspireThemes);
-	#$searchBbox = explode(",",$searchBbox);
-	$searchResources = explode(",",$searchResources);
-	$searchPages = explode(",",$searchPages);
 
-//*****************************************************************
+
+
 //read the whole query string:
 $searchURL = $_SERVER['QUERY_STRING'];
 if ($resultTarget == 'debug') {
@@ -298,8 +286,25 @@
 }
 
 
+if ($resultTarget == 'file') {
+	if (!isset($searchResources) OR ($searchResources == "")) {
+		$searchResources = "wms,wfs";
+		$searchPages = "1,1";
+	}
 
+}
+if ($resultTarget == 'web' or $resultTarget == 'debug') {
+	if (!isset($searchResources) OR ($searchResources == "")) {
+		$searchResources = "wms";
+		$searchPages = "1";
+	}
 
+}
+
+//convert the respources and the pagenumbers into arrays
+$searchResources = explode(",",$searchResources);
+$searchPages = explode(",",$searchPages);
+
 //Generate search filter file. This file holds the defined search filter to allow the user to see how he searched 
 //The user should become the possibility to drop the search filters by clicking in some buttons
 //list of options to display:
@@ -430,6 +435,10 @@
 //define where to become the information from - this is relavant for the information which must be pulled out of the database
 $classificationElements = array();
 
+
+
+
+
 $classificationElements[0]['name'] = 'searchText';
 $classificationElements[1]['name'] = 'registratingDepartments';
 $classificationElements[2]['name'] = 'isoCategories';
@@ -457,8 +466,14 @@
 $classificationElements[6]['list'] = false;
 $classificationElements[7]['list'] = false;
 
+//Defining of the different result categories		
+		$resourceCategories = array();
+		#$resourceCategories[0]['wms'] = 'WMS';
+		#$resourceCategories[1]['wfs'] = 'WFS';
+		#$resourceCategories[2]['wmc'] = 'WMC';
+		#$resourceCategories[3]['georss'] = 'GeoRSS';
+		
 
-
 switch($languageCode){
         case 'de':
         	$classificationElements[0]['name2show'] = 'Suchbegriff(e):';
@@ -469,6 +484,11 @@
 		$classificationElements[5]['name2show'] = 'Räumliche Einschränkung:';
 		$classificationElements[6]['name2show'] = 'Registrierung/Aktualisierung von:';
 		$classificationElements[7]['name2show'] = 'Registrierung/Aktualisierung bis:';
+
+		$resourceCategories['wms'] = 'Darstellungsdienste';
+		$resourceCategories['wfs'] = 'Such- und Downloaddienste';
+		$resourceCategories['wmc'] = 'Kartenzusammenstellungen';
+		$resourceCategories['georss'] = 'Geokodierte Newsfeeds';
 	
        	break;
         case 'en':
@@ -481,6 +501,11 @@
 		$classificationElements[6]['name2show'] = 'Registration/Update from:';
 		$classificationElements[7]['name2show'] = 'Registration/Update till:';
 
+		$resourceCategories['wms'] = 'Viewingservices';
+		$resourceCategories['wfs'] = 'Search- and Downloadservices';
+		$resourceCategories['wmc'] = 'Combined Maps';
+		$resourceCategories['georss'] = 'Geocodet Newsfeeds';
+
         break;
         case 'fr':
         	$classificationElements[0]['name2show'] = 'Suchbegriff(e):';
@@ -492,6 +517,11 @@
 		$classificationElements[6]['name2show'] = 'Registrierung/Aktualisierung von:';
 		$classificationElements[7]['name2show'] = 'Registrierung/Aktualisierung bis:';
 
+		$resourceCategories['wms'] = 'Viewingservices';
+		$resourceCategories['wfs'] = 'Search- and Downloadservices';
+		$resourceCategories['wmc'] = 'Combined Maps';
+		$resourceCategories['georss'] = 'Geocodet Newsfeeds';
+
        	break;
      	default:
         	$classificationElements[0]['name2show'] = 'Suchbegriff(e):';
@@ -503,11 +533,21 @@
 		$classificationElements[6]['name2show'] = 'Registrierung/Aktualisierung von:';
 		$classificationElements[7]['name2show'] = 'Registrierung/Aktualisierung bis:';
 
+		$resourceCategories['wms'] = 'Darstellungsdienste';
+		$resourceCategories['wfs'] = 'Such- und Downloaddienste';
+		$resourceCategories['wmc'] = 'Kartenzusammenstellungen';
+		$resourceCategories['georss'] = 'Geokodierte Newsfeeds';
+
 }	
 
 $queryJSON = new stdClass;
 $queryJSON->searchFilter = (object) array();
-
+#$queryJSON->searchFilter->classes = (object) array();
+for($i=0; $i<count($searchResources);$i++){
+//fill in the different search classes into the filter - the client can generate the headers out of this information
+	$queryJSON->searchFilter->classes[$i]->title = $resourceCategories[$searchResources[$i]];
+	$queryJSON->searchFilter->classes[$i]->name = $searchResources[$i];
+}
 //generate search filter file - if more categories are defined give 
 #echo "<br> number of filter elements: ".count($classificationElements)."<br>";
 for($i=0; $i < count($classificationElements); $i++){
@@ -630,6 +670,8 @@
 
 
 //call class_metadata - in case of file for all requested resources, in case of web only for one resource - cause there are different result files
+
+
 if ($resultTarget == 'file') {
 	for($i=0; $i<count($searchResources);$i++){
 		$str = "nohup php5 /data/mapbender/http/php/mod_metadataWrite.php ";



More information about the Mapbender_commits mailing list