[Mapbender-commits] r8671 - trunk/mapbender/http/geoportal

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jul 16 03:46:36 PDT 2013


Author: armin11
Date: 2013-07-16 03:46:36 -0700 (Tue, 16 Jul 2013)
New Revision: 8671

Modified:
   trunk/mapbender/http/geoportal/mod_readCSWResults.php
   trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php
Log:
Allow integration of terra catalogue csw - there are other options than in geonetwork for getrecords operation :-(

Modified: trunk/mapbender/http/geoportal/mod_readCSWResults.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readCSWResults.php	2013-07-15 13:48:40 UTC (rev 8670)
+++ trunk/mapbender/http/geoportal/mod_readCSWResults.php	2013-07-16 10:46:36 UTC (rev 8671)
@@ -135,7 +135,7 @@
 $e = new mb_notice("q= : ".$_REQUEST["q"]);
 $e = new mb_notice("ranking: ".$ranking);
 $e = new mb_notice("coord: ".$coord);
-$e = new mb_exception("geoportal/mod_readCSWResults.php queryText: ".$queryText);
+//$e = new mb_exception("geoportal/mod_readCSWResults.php queryText: ".$queryText);
 if (isset($x1) && isset($x2) && isset($y1) && isset($y2) && isset($coord)) {
 /*	<BBOX>
             <PropertyName>ows:BoundingBox</PropertyName>
@@ -215,16 +215,45 @@
 	//get urls for getrecords and getrecordbyid from table cat
         $v = $row_csw["fkey_cat_id"];
 	$t = 'i';
-	$sql_gr = "select param_value from cat_op_conf where fk_cat_id = $1 and param_type = 'getrecords' and param_name='get'";
+	$sql_gr = "select param_value, param_name from cat_op_conf where fk_cat_id = $1 and param_type = 'getrecords'";
 	$res_gr = db_prep_query($sql_gr, $v, $t);
-        $row_gr = db_fetch_array($res_gr);
-	$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
-	echo "<br>getrecordsurl: ".$csw_list[$cnt_csw]['getrecordsurl']."<br>";
+	//look after the values preference get/post/post_xml
+	while ($row_gr = db_fetch_array($res_gr)) {
+		switch ($row_gr['param_name']) {
+			case "get" :
+				$csw_list[$cnt_csw] ['getrecordsurl_param_name'] = "get";
+				if (isset($row_gr['param_value']) || $row_gr['param_value'] != '') {
+					$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
+					break 2;
+				}
+			break 1;	
+			case "post" :
+				$csw_list[$cnt_csw] ['getrecordsurl_param_name'] = "post";
+				if (isset($row_gr['param_value']) || $row_gr['param_value'] != '') {
+					$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
+					break 2;
+				}
+			break 1;
+			case "post_xml" :
+				$csw_list[$cnt_csw] ['getrecordsurl_param_name'] = "post_xml";
+				if (isset($row_gr['param_value']) || $row_gr['param_value'] != '' ) {
+					$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
+					break 2;
+				}
+			break 1;
+		}
+		
+	}
+	$e = new mb_notice("<br>getrecords param type: ".$csw_list[$cnt_csw]['getrecordsurl_param_name']."<br>");
+	$csw_list[$cnt_csw] ['getrecordsurl'] = rtrim($csw_list[$cnt_csw] ['getrecordsurl'], "?");
+	$e = new mb_notice("mod_readCSWResults.php: getrecordsurl: ".$csw_list[$cnt_csw]['getrecordsurl']);
 	$sql_grbi = "select param_value from cat_op_conf where fk_cat_id = $1 and param_type = 'getrecordbyid' and param_name='get'";
 	$res_grbi = db_prep_query($sql_grbi, $v, $t);
         $row_grbi = db_fetch_array($res_grbi);
 	$csw_list[$cnt_csw] ['getrecordbyidurl'] = $row_grbi['param_value'];
-	echo "<br>getrecordbyidurl: ".$csw_list[$cnt_csw]['getrecordbyidurl']."<br>";
+	//Delete question marks from end of url
+	$csw_list[$cnt_csw] ['getrecordbyidurl'] = rtrim($csw_list[$cnt_csw] ['getrecordbyidurl'], "?");
+	$e = new mb_notice("mod_readCSWResults.php: getrecordbyidurl: ".$csw_list[$cnt_csw]['getrecordbyidurl']);
 	$csw_list[$cnt_csw] ['h'] = $row_csw["csw_h"];
 	$csw_list[$cnt_csw] ['p'] = $row_csw["csw_p"];
 	$cnt_csw++;
@@ -421,10 +450,9 @@
 	//echo $openSearchUrl[$i_si]."<br>";
 	$cswInterfaceObject->load($openSearchUrl[$i_si]);
 	#echo "<br>Results: ".htmlentities($cswInterfaceObject->file)."<br><br>";
-
 	$openSearchResult = $cswInterfaceObject->file;
 	$openSearchUrlDetail[$i_si]=$csw_list[$i_si] ['getrecordbyidurl']."?";
-	
+	$e = new mb_notice("mod_readCSWResults.php: detailurl: ".$openSearchUrlDetail[$i_si]);
 	//get resultlists
 	//$url=$openSearchUrlSearch[$i_si]."q=".$queryText.$csw_list[$i_si] ['standardfilter']."&h=".$csw_list[$i_si] ['h']."&p=".$request_p;
 	$url = $openSearchUrl[$i_si];
@@ -567,7 +595,7 @@
 			//generate link to original csw
 			$cswSearchUrlDetail = $openSearchUrlDetail[$i_si];
 			$cswSearchUrlDetail = $cswSearchUrlDetail."request=GetRecordById&service=CSW&version=2.0.2&Id=".$uuid."&ElementSetName=full&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd";
-			$e = new mb_notice("URL for calling full iso19139 service record over csw api: ".$cswSearchUrlDetail);
+			$e = new mb_notice("mod_readCSWResults.php: URL for calling full iso19139 service record over csw api: ".$cswSearchUrlDetail);
 
 
 			//extract title from iso19139 record

Modified: trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php	2013-07-15 13:48:40 UTC (rev 8670)
+++ trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php	2013-07-16 10:46:36 UTC (rev 8671)
@@ -689,11 +689,37 @@
 	//get urls for getrecords and getrecordbyid from table cat
         $v = (integer)$row_csw["fkey_cat_id"];
 	$t = 'i';
-	$sql_gr = "select * from cat_op_conf where fk_cat_id = $1 and param_type = 'getrecords' and param_name='get'";
+	$sql_gr = "select param_value, param_name from cat_op_conf where fk_cat_id = $1 and param_type = 'getrecords'";
 	$res_gr = db_prep_query($sql_gr, $v, $t);
-        $row_gr = db_fetch_array($res_gr);
-	#var_dump($row_gr);
-	$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
+	//look after the values preference get/post/post_xml
+	while ($row_gr = db_fetch_array($res_gr)) {
+		switch ($row_gr['param_name']) {
+			case "get" :
+				$csw_list[$cnt_csw] ['getrecordsurl_param_name'] = "get";
+				if (isset($row_gr['param_value']) || $row_gr['param_value'] != '') {
+					$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
+					break 2;
+				}
+			break 1;	
+			case "post" :
+				$csw_list[$cnt_csw] ['getrecordsurl_param_name'] = "post";
+				if (isset($row_gr['param_value']) || $row_gr['param_value'] != '') {
+					$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
+					break 2;
+				}
+			break 1;
+			case "post_xml" :
+				$csw_list[$cnt_csw] ['getrecordsurl_param_name'] = "post_xml";
+				if (isset($row_gr['param_value']) || $row_gr['param_value'] != '' ) {
+					$csw_list[$cnt_csw] ['getrecordsurl'] = $row_gr['param_value'];
+					break 2;
+				}
+			break 1;
+		}
+		
+	}
+	$e = new mb_notice("<br>getrecords param type: ".$csw_list[$cnt_csw]['getrecordsurl_param_name']."<br>");
+	$csw_list[$cnt_csw] ['getrecordsurl'] = rtrim($csw_list[$cnt_csw] ['getrecordsurl'], "?");
 	#echo "count csw: ".$cnt_csw;
 	#echo "<br>getrecordsurl: ".$csw_list[$cnt_csw]['getrecordsurl']."<br>";
 
@@ -701,7 +727,7 @@
 	$res_grbi = db_prep_query($sql_grbi, $v, $t);
         $row_grbi = db_fetch_array($res_grbi);
 	$csw_list[$cnt_csw] ['getrecordbyidurl'] = $row_grbi['param_value'];
-	
+	$csw_list[$cnt_csw] ['getrecordbyidurl'] = rtrim($csw_list[$cnt_csw] ['getrecordbyidurl'], "?");
 	#echo "<br>getrecordbyidurl: ".$csw_list[$cnt_csw]['getrecordbyidurl']."<br>";
 	$csw_list[$cnt_csw] ['h'] = $row_csw["csw_h"];
 	$csw_list[$cnt_csw] ['p'] = $row_csw["csw_p"];



More information about the Mapbender_commits mailing list