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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Feb 25 02:53:44 EST 2010


Author: armin11
Date: 2010-02-25 02:53:44 -0500 (Thu, 25 Feb 2010)
New Revision: 5645

Modified:
   trunk/mapbender/http/classes/class_cswrecord.php
   trunk/mapbender/http/javascripts/mod_searchCSW_ajax.php
   trunk/mapbender/http/php/mod_searchCatQueryBuilder_server.php
Log:
bugfixing csw client

Modified: trunk/mapbender/http/classes/class_cswrecord.php
===================================================================
--- trunk/mapbender/http/classes/class_cswrecord.php	2010-02-24 16:56:50 UTC (rev 5644)
+++ trunk/mapbender/http/classes/class_cswrecord.php	2010-02-25 07:53:44 UTC (rev 5645)
@@ -30,6 +30,8 @@
 class cswrecord{
 	
 	var $getrecords_status;
+	var $getrecords_exception;
+	var $getrecords_exception_text;
 	var $elementSet;
 	var $numberOfRecordsMatched;
 	
@@ -76,6 +78,8 @@
 			$e = new mb_exception("class_cswrecord.php: responded data: ".$data);
 		}
         
+		
+		
 		if(!$data){
 			$this->getrecords_status=false;
 			$e = new mb_exception("CAT getrecords returned no result: " . $url . "\n" . $postData);
@@ -84,6 +88,18 @@
 		else {
 			$this->getrecords_status=true;
 		}
+		//check if returned string has an exeption defined
+		$testException = strpos($data, "ows:Exception");
+		if ($testException === false) {
+			
+		}
+		else {
+			$this->getrecords_status=true;
+			$this->getrecords_exception=true;
+			$this->getrecords_exception_text = urlencode($data);
+			$e = new mb_exception("CAT getrecords returned an ows:exception!");
+			return false;
+		}
 		
 		//arrays to hold xml struct values and index
 		$value_array = null;

Modified: trunk/mapbender/http/javascripts/mod_searchCSW_ajax.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_searchCSW_ajax.php	2010-02-24 16:56:50 UTC (rev 5644)
+++ trunk/mapbender/http/javascripts/mod_searchCSW_ajax.php	2010-02-25 07:53:44 UTC (rev 5645)
@@ -74,7 +74,7 @@
 
 	//defaults
 	var getrecords_media = 'GET';
-	var getrecords_query = 'CQL'; //FILTER
+	var getrecords_query = 'CQL'; //CQL FILTER
 	
 	//set server side URL for query builder
 	var phpUrl  = '../php/mod_searchCatQueryBuilder_server.php?<?php echo $urlParameters;?>';
@@ -168,8 +168,8 @@
 
 		html = html + "<label for='opt_getrecords_query'><?php echo _mb('Query Language'); ?>:</label>";
 		html = html + "<select id='opt_getrecords_query' name='opt_getrecords_query'>";
-		html = html + "<option value='cql'><?php echo _mb("CQL"); ?></option>";
 		html = html + "<option value='filter'><?php echo _mb("Filter"); ?></option>";
+		html = html + "<option value='CQL'><?php echo _mb("CQL"); ?></option>";
 		html = html + "</select>";
 		html = html + "<br /><br />";
 		

Modified: trunk/mapbender/http/php/mod_searchCatQueryBuilder_server.php
===================================================================
--- trunk/mapbender/http/php/mod_searchCatQueryBuilder_server.php	2010-02-24 16:56:50 UTC (rev 5644)
+++ trunk/mapbender/http/php/mod_searchCatQueryBuilder_server.php	2010-02-25 07:53:44 UTC (rev 5645)
@@ -94,18 +94,22 @@
 		array_push($resultObj['cats'],array("id"=>$catalog_id,"title"=>$getrecordsurl));
 		//array_push($resultObj['cats'],array("title"=>$catalog_id.'url',"abstractt"=>$getrecordsurl));
 		//Create Record Objects
-		$RecordObj = new cswrecord();
+		$RecordObj = new cswrecord();		
+		//$RecordObj->getrecords_exception;
 		$RecordObj->createCSWRecordFromXML($getrecordsurl,$getrecordsxml);
-		
-		//Populate JSON for each summary record for each catalog
-		//Loop for each Summary Record
-		foreach ($RecordObj->SummaryRecordsArray as $SummaryRecordObj){
-			$title = $SummaryRecordObj->getTitle();
-			$abstract = $SummaryRecordObj->getAbstract();
-		
+		if ($RecordObj->getrecords_exception == false & $RecordObj->getrecords_status == true){
+			//Populate JSON for each summary record for each catalog
+			//Loop for each Summary Record
+			foreach ($RecordObj->SummaryRecordsArray as $SummaryRecordObj){
+				$title = $SummaryRecordObj->getTitle();
+				$abstract = $SummaryRecordObj->getAbstract();
 				array_push($resultObj['cats'],array("title"=>$title,"abstractt"=>$abstract));
+			}
 		}
-		
+		else {
+			$e = new mb_exception("php/mod_searchCatQueryBuilder_server.php: CAT getrecords returned an ows:exception!");
+		    array_push($resultObj['cats'],array("title"=>"OWS Exception","abstractt"=>$RecordObj->getrecords_exception_text));
+		}
 	}
 }
 
@@ -115,19 +119,15 @@
  * @return array URL and XML
  */
 function getrecords_build_query($getrecords_url,$type,$command){
-	
 	//CHECK FOR COMMAND, GET POST. HANDLE THINGS HERE
-	
 	$url = null;
 	$xml = null;
-	
 	$request = 'GetRecords';
 	$version = '2.0.2';
 	$resulttype = 'results';
 	$typename = 'csw:Record';
 	$service='CSW';
 	global $simplesearch;
-	
 	switch(strtolower($type)){
 		case 'get':
 			$url = $getrecords_url.'?request='.$request.'&service='.$service.'&ResultType='.$resulttype.'&TypeNames='.$typename.'&version='.$version;



More information about the Mapbender_commits mailing list