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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Feb 17 05:34:37 EST 2012


Author: armin11
Date: 2012-02-17 02:34:37 -0800 (Fri, 17 Feb 2012)
New Revision: 8256

Modified:
   trunk/mapbender/http/geoportal/gaz.php
   trunk/mapbender/http/geoportal/mod_readCSWResults.php
Log:
Enhance for sortby filter - not yet ready.

Modified: trunk/mapbender/http/geoportal/gaz.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz.php	2012-02-17 10:33:06 UTC (rev 8255)
+++ trunk/mapbender/http/geoportal/gaz.php	2012-02-17 10:34:37 UTC (rev 8256)
@@ -110,6 +110,9 @@
 	if ($orderBy == 'date') {
 		$openSearchFilter .= "+ranking:date";
 	}
+	if ($orderBy == 'title') {
+		$openSearchFilter .= "+ranking:title";
+	}
 	
 } else {
 	$openSearchFilter .= "+ranking:score";

Modified: trunk/mapbender/http/geoportal/mod_readCSWResults.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readCSWResults.php	2012-02-17 10:33:06 UTC (rev 8255)
+++ trunk/mapbender/http/geoportal/mod_readCSWResults.php	2012-02-17 10:34:37 UTC (rev 8256)
@@ -398,8 +398,38 @@
 
 	$getRecords .= '          </ogc:And>';
 	$getRecords .= '          </ogc:Filter>';
-
-	$getRecords .= '          </csw:Constraint>';          
+	$getRecords .= '          </csw:Constraint>'; 
+//insert the sortby constraint
+/*<ogc:SortBy xmlns:ogc="http://www.opengis.net/ogc">
+<ogc:SortProperty>
+<ogc:PropertyName>Denominator</ogc:PropertyName>
+<ogc:SortOrder>ASC</ogc:SortOrder>
+</ogc:SortProperty>
+</ogc:SortBy>*/
+	if (isset($ranking) && $ranking != "") {
+		switch ($ranking) {
+    			case ($ranking=='date'):
+				$getRecords .= '<ogc:SortBy>';
+				$getRecords .= '<ogc:SortProperty>';
+				$getRecords .= '<ogc:PropertyName>';
+				$getRecords .= 'dc:date';
+				$getRecords .= '</ogc:PropertyName>';
+				$getRecords .= '<ogc:SortOrder>ASC</ogc:SortOrder>';
+				$getRecords .= '</ogc:SortProperty>';
+				$getRecords .= '</ogc:SortBy>';
+			break;
+			case ($ranking=='title'):
+				$getRecords .= '<ogc:SortBy>';
+				$getRecords .= '<ogc:SortProperty>';
+				$getRecords .= '<ogc:PropertyName>';
+				$getRecords .= 'dc:title';
+				$getRecords .= '</ogc:PropertyName>';
+				$getRecords .= '<ogc:SortOrder>ASC</ogc:SortOrder>';
+				$getRecords .= '</ogc:SortProperty>';
+				$getRecords .= '</ogc:SortBy>';
+			break;
+		}
+	}         
 	$getRecords .= '          </csw:Query>';
 	$getRecords .= '</csw:GetRecords>';
 
@@ -544,7 +574,7 @@
 			unset($uuid);
 			unset($bbox);
 			unset($graphicURL);
-			unset($isViewService);
+			$isViewService = false;
 			//$uuid = $openSearchXml->xpath('/csw:GetRecordsResponse/gmd:MD_Metadata['.$i.']/gmd:fileIdentifier/gco:CharacterString');
 			$index = $i + 1 ;
 			//Check for type of record
@@ -584,6 +614,8 @@
 				case 'application':
 					$graphicURL = $openSearchXml->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$index.']/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:graphicOverview/gmd:MD_BrowseGraphic/gmd:fileName/gco:CharacterString');
 					$bbox = $openSearchXml->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$index.']/gmd:identificationInfo/*/*/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/*/gco:Decimal');
+					$title = $openSearchXml->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$index.']/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString');
+					$abstract = $openSearchXml->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$index.']/gmd:identificationInfo/*/gmd:abstract/gco:CharacterString');
 					break;
     				case 'service':
 
@@ -648,7 +680,8 @@
 			}
 			
 			//check for view service type
-			if (strtoupper($typeOfService) == 'WMS' || strtoupper($typeOfService) == 'VIEW'  || strpos(strtoupper($typeOfService,'WMS')) !== false) {
+			//if (strtoupper($typeOfService) == 'WMS' || strtoupper($typeOfService) == 'VIEW'  || strpos(strtoupper($typeOfService,'WMS')) !== false) {
+			if (strtoupper($typeOfService) == 'WMS' || strtoupper($typeOfService) == 'VIEW' ) {
 				$isViewService = true;	
 				echo "view service identified<br>";
 			}
@@ -706,10 +739,10 @@
 				fwrite($os_catalogs_file_handle,"</catalogtitlelink>\n");
 				#Tags for objecttitle and abstract
 				fwrite($os_catalogs_file_handle,"<title>");
-				fwrite($os_catalogs_file_handle, $title);
+				fwrite($os_catalogs_file_handle, urlencode($title));
 				fwrite($os_catalogs_file_handle,"</title>\n");
 				fwrite($os_catalogs_file_handle,"<abstract>");
-                               	fwrite($os_catalogs_file_handle, $abstractShort);
+                               	fwrite($os_catalogs_file_handle, urlencode($abstractShort));
 				fwrite($os_catalogs_file_handle,"</abstract>\n");
 				#Tag for link to original metadata view
 				fwrite($os_catalogs_file_handle,"<urlmdorig>");



More information about the Mapbender_commits mailing list