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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Mar 2 08:10:42 EST 2010


Author: armin11
Date: 2010-03-02 08:10:41 -0500 (Tue, 02 Mar 2010)
New Revision: 5707

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

Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php	2010-03-02 11:25:51 UTC (rev 5706)
+++ trunk/mapbender/http/classes/class_connector.php	2010-03-02 13:10:41 UTC (rev 5707)
@@ -212,8 +212,8 @@
 	           		 "Pragma: no-cache",
 	           		 "Content-length: ".strlen($this->httpPostData)
 			); 
-			$e = new mb_notice("connector: CURL POST: ".$this->httpPostData); 
-			#$e = new mb_notice("connector: CURL POST HEADER: ".print_r($headers));
+			$e = new mb_exception("connector: CURL POST: ".$this->httpPostData); 
+			#$e = new mb_exception("connector: CURL POST HEADER: ".print_r($headers));
 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
 			curl_setopt($ch, CURLOPT_POST, 1);
 			curl_setopt($ch, CURLOPT_POSTFIELDS, $this->httpPostData);	

Modified: trunk/mapbender/http/javascripts/mod_searchCSW_ajax.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_searchCSW_ajax.php	2010-03-02 11:25:51 UTC (rev 5706)
+++ trunk/mapbender/http/javascripts/mod_searchCSW_ajax.php	2010-03-02 13:10:41 UTC (rev 5707)
@@ -200,29 +200,38 @@
 		}
 	}
 
-	function setTableHeader(text,titleLeft,titleRight) {
+	function setTableHeader(text,titleLeft,titleRight,titleRecord) {
 		document.getElementById('resultString').innerHTML = text;
 		document.getElementById('titleLeft').innerHTML    = titleLeft;
 		document.getElementById('titleRight').innerHTML   = titleRight;
+		document.getElementById('titleRecord').innerHTML   = titleRecord;
 		
 		removeChildNodes(document.getElementById('resultTableBody'));
 	}
 
-	function addTableRow(leftText,rightText,onClick) {
+	function addTableRow(leftText,rightText,idText,onClick) {
 		var resultTableBoy        = document.getElementById('resultTableBody');
 		var leftTableCell         = document.createElement('td');
 		var rightTableCell        = document.createElement('td');
+		var idTableCell        = document.createElement('td');
+		
 		var leftTableCellContent  = document.createElement('strong');
 		var rightTableCellContent = document.createElement('em');
+		var idTableCellContent = document.createElement('em');
+		
 		var tableRow              = document.createElement('tr');
 				
 		leftTableCellContent.innerHTML  = leftText;
 		rightTableCellContent.innerHTML = rightText;
-
+		idTableCellContent.innerHTML = idText;
+		
 		leftTableCell.appendChild(leftTableCellContent);
 		rightTableCell.appendChild(rightTableCellContent);
+		idTableCell.appendChild(idTableCellContent);
+		
 		tableRow.appendChild(leftTableCell);
 		tableRow.appendChild(rightTableCell);
+		tableRow.appendChild(idTableCell);
 		
 		tableRow.onclick = function () {
 			eval(onClick);
@@ -263,130 +272,22 @@
 		document.getElementById("resultString").innerHTML = noResultText+val;
 	}
 
-	function setButtons() {
-		var containerCapabilities = document.getElementById('container_capabilities');
-		var containerButtons      = document.getElementById('container_buttons');
-		var optionButton          = false;
 
-		// If only one is active load list imidiately
-		if(
-			parseInt(option_dbgui) + 
-			parseInt(option_dbgroup) + 
-			parseInt(option_dball)
-		=== 1) {
-			if(option_dball === '1'){
-				optionButton = document.getElementById('button_dbAll');
-			}
-			if(option_dbgroup === '1') {
-				optionButton = document.getElementById('button_dbGroup');
-			}
-			if(option_dbgui === '1') {
-				optionButton = document.getElementById('button_dbGui');
-			}
 
-			if(optionButton) {
-				optionButton.onclick();
-				containerButtons.parentNode.removeChild(containerButtons);
-				
-				return;
-			}
-		}
-
-		if(option_dball === '0') {
-			optionButton = document.getElementById('button_dbAll');
-			optionButton.parentNode.removeChild(optionButton);
-		}
-		if(option_dbgroup === '0') {
-			optionButton = document.getElementById('button_dbGroup');
-			optionButton.parentNode.removeChild(optionButton);
-		}
-		if(option_dbgui === '0') {
-			optionButton = document.getElementById('button_dbGui');
-			optionButton.parentNode.removeChild(optionButton);
-		}
-		
-		if(capabilitiesInput === '0') {
-			optionButton = document.getElementById('capabilitiesForm');
-			optionButton.parentNode.removeChild(optionButton);
-			containerCapabilities.parentNode.removeChild(containerCapabilities);
-		}
-	}
-
-	function displayGroups (groupArray) {
-		if (groupArray.length > 0) {
-			setTableHeader(selectGroupText, groupNameText, groupAbstractText);
-			
-			for (var i = 0; i < groupArray.length; i++) {
-				var onClick = "getWMSByGroup('" + groupArray[i].id + "')";
-				addTableRow(groupArray[i].name, groupArray[i].description, onClick);	
-			}
-		}
-		else {
-			noResult();
-		}
-	}
-
-	function displayGUIs (guiArray) {
-		if (guiArray.length > 0) {
-			setTableHeader(selectGuiText, guiNameText, guiAbstractText);
-			
-			for (var i = 0; i < guiArray.length; i++) {
-				var onClick = "getWMSByGUI('" + guiArray[i].id + "')";
-				if(guis.length>0){
-					for(var j=0; j < guis.length; j++){
-						if(guiArray[i].id==guis[j]){
-							addTableRow(guiArray[i].name, guiArray[i].description, onClick);	
-							break;
-						}
-					}
-				}
-				else
-					addTableRow(guiArray[i].name, guiArray[i].description, onClick);	
-			}
-		}
-		else {
-			noResult();
-		}
-	}
-
-	function displayWMS (wmsArray, guiId) {
-		if (wmsArray.length > 0) {
-			setTableHeader(selectWmsText, wmsNameText, wmsAbstractText);
-
-			for (var i = 0; i < wmsArray.length; i++) {
-
-				if (global_source == "db" && typeof(guiId) !== "undefined" ) {
-					var onClick = "mod_addWMSfromDB('" + guiId + "', '" + wmsArray[i].id + "')";
-				}		
-				else {
-					var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
-				}
-				addTableRow(wmsArray[i].title, wmsArray[i].abstract, onClick);
-			}
-		}
-		else {
-			noResult();
-		}
-	}
-
-
 	// Display Catalog records returned by getrecords
 	function displayRecords(catarray){
 	
 		if (catarray.length > 0) {
-			setTableHeader(CatTitle, CatName, CatAbstract);
+			setTableHeader(CatTitle, CatName, CatAbstract, RecId);
 
 			for (var i = 0; i < catarray.length; i++) {
+				var recordLink = '<a href=\''+catarray[i].url+'?request=GetRecordById&service=CSW&version=2.0.2&Id=';
+				//var recordLink = '<a href=\''+catarray[i].url+'?request=GetRecordById&id=';
 
-				/*
-				if (global_source == "db" && typeof(guiId) !== "undefined" ) {
-					var onClick = "mod_addWMSfromDB('" + guiId + "', '" + wmsArray[i].id + "')";
-				}		
-				else {
-					var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
-				}
-				*/
-				addTableRow(catarray[i].title, catarray[i].abstractt);
+				recordLink = recordLink+catarray[i].identifier+'';
+				recordLink = recordLink+'>'+catarray[i].identifier+'<a>';
+				
+				addTableRow(catarray[i].title, catarray[i].abstractt, recordLink);
 			}
 		}
 		else {
@@ -429,19 +330,19 @@
 			catch(err){
 				
 			}
-			//imageOn();
+			
 			parent.mb_ajax_json(phpUrl, {"command":"getrecordsadvanced","adv_title":adv_title,"adv_abstract":adv_abstract,"adv_keyword":adv_keyword,"latmin":latmin,"latmax":latmax,"lonmin":lonmin,"lonmax":lonmax}, function (json, status) {
-				//imageOff();
+				
 				displayRecords(json.cats);
-				//displayGroups(json.group);
+				
 			});
 				
 		}
 		else{
 			//handle simple search
-			//imageOff();
+			
 			parent.mb_ajax_json(phpUrl, {"command":"getrecordssimple", "search":simplesearchterm, "getrecordsmedia":getrecords_media,"getrecordsquery":getrecords_query }, function (json, status) {
-			//imageOn();	
+			
 			displayRecords(json.cats);
 			imageOff();
 			});
@@ -459,9 +360,9 @@
 	var CatName = '<?php echo _mb("Record Title");?>';
 	var CatAbstract = '<?php echo _mb("Record Abstract");?>';
 	var CatTitle = '<?php echo _mb("Returned Results...");?>';
+	var RecId = '<?php echo _mb("Record ID");?>';
 
 
-
 	</script>
 
 </head>
@@ -514,8 +415,8 @@
 	<thead>
 		<tr>
 			<th id="titleLeft" name="titleLeft"></th>
-			<th id="titleMiddle" name="titleMiddle"></th>
 			<th id="titleRight" name="titleRight"></th>
+			<th id="titleRecord" name="titleRecord"></th>
 		</tr>
 	</thead>
 	<tbody id="resultTableBody" name="resultTableBody">

Modified: trunk/mapbender/http/php/mod_searchCatQueryBuilder_server.php
===================================================================
--- trunk/mapbender/http/php/mod_searchCatQueryBuilder_server.php	2010-03-02 11:25:51 UTC (rev 5706)
+++ trunk/mapbender/http/php/mod_searchCatQueryBuilder_server.php	2010-03-02 13:10:41 UTC (rev 5707)
@@ -81,19 +81,24 @@
 			break;
 		default:
 			$catalogIDs = get_catalogs_by_supported_type(get_catalogs_for_gui($guiId),'getrecords','get');
+		#$e = new mb_exception("catalogids: ".print_r($catalogIDs['getrecords']));
 	}
 	
 	//main controller
 	//loop for each catalog
+	#$error = var_dump($catalogIDs['getrecordbyid']);
+	#$e = new mb_exception("catalogids: ".$error);
 	foreach($catalogIDs as $catalog_id=>$url){
+		#$e = new mb_exception("url: ".$url['getrecords']);
 		//$cat_obj = new csw();
 		//$cat_obj->createCatObjFromDB($catalogs);
 		//list($getrecordsurl,$getrecordsxml) = getrecords_get_build_query($url,$simplesearch);
-		list($getrecordsurl,$getrecordsxml) = getrecords_build_query($url,$getrecords_type,$command);
+		list($getrecordsurl,$getrecordsxml) = getrecords_build_query($url['getrecords'],$getrecords_type,$command);
 		if($DEBUG_)
 		array_push($resultObj['cats'],array("id"=>$catalog_id,"title"=>$getrecordsurl));
 		//array_push($resultObj['cats'],array("title"=>$catalog_id.'url',"abstractt"=>$getrecordsurl));
 		//Create Record Objects
+		$e = new mb_exception('getrecordbyid'.$url['getrecordbyid']);
 		$RecordObj = new cswrecord();		
 		//$RecordObj->getrecords_exception;
 		$RecordObj->createCSWRecordFromXML($getrecordsurl,$getrecordsxml);
@@ -103,7 +108,9 @@
 			foreach ($RecordObj->SummaryRecordsArray as $SummaryRecordObj){
 				$title = $SummaryRecordObj->getTitle();
 				$abstract = $SummaryRecordObj->getAbstract();
-				array_push($resultObj['cats'],array("title"=>$title,"abstractt"=>$abstract));
+				$identifier = $SummaryRecordObj->getIdentifier();
+				#new mb_exception("mod_searchCatQueryBuilder.php: Identifier: ".$identifier);
+				array_push($resultObj['cats'],array("title"=>$title,"abstractt"=>$abstract, "identifier"=>$identifier,"url"=>$url['getrecordbyid']));
 			}
 		}
 		else {
@@ -234,6 +241,7 @@
 	
 				//array_push($resultObj['cats'],array("id"=>'id5',"title"=>$operation_type));
 	$cat_supported = array();
+	
 	$sql = "select fk_cat_id,param_value from cat_op_conf where param_name=$1 and param_type=$2";
 	$v = array($fetch_mode,$operation_type);	
 	$t = array('s','s');
@@ -246,7 +254,18 @@
 				array_push($resultObj['cats'],array("id"=>'id4',"title"=>$row));
 		if(in_array($row['fk_cat_id'],$cat_array,true)){
 			//array_push($cat_supported,$row['fk_cat_id']);
-			$cat_supported[$row['fk_cat_id']] = $row['param_value'];
+			$cat_supported[$row['fk_cat_id']]['getrecords'] = $row['param_value'];
+			//get url entry for getrecordbyid:
+			$sql2 = "select fk_cat_id,param_value from cat_op_conf where fk_cat_id=$1 and param_type=$2 and param_name='get'";
+	        $v2 = array($row['fk_cat_id'],'getrecordbyid');	
+	        $t2 = array('i','s');
+	        $res2 = db_prep_query($sql2,$v2,$t2);
+	        while($row2 = db_fetch_array($res2)){
+	            $e = new mb_exception("mod_searchCatQueryBuilder.php: getrecordbyidurl:  ".$row2['param_value']);
+				$getrecordbyidurl = $row2['param_value'];
+	        }
+			$cat_supported[$row['fk_cat_id']]['getrecordbyid'] = $getrecordbyidurl;
+			
 		}
 	}
 	return $cat_supported;



More information about the Mapbender_commits mailing list