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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jul 1 07:53:58 EDT 2011


Author: armin11
Date: 2011-07-01 04:53:58 -0700 (Fri, 01 Jul 2011)
New Revision: 7894

Modified:
   trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php
Log:
Enhancement of the metadata module for showing iso19139 metadata from portalu csw. Some translations need to be done.

Modified: trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php	2011-06-30 14:26:39 UTC (rev 7893)
+++ trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php	2011-07-01 11:53:58 UTC (rev 7894)
@@ -1,16 +1,90 @@
 <?php
 #http://localhost/mapbender/geoportal/mod_readOpenSearchResultsDetail.php?osid=1&...
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
+#$con = db_connect(DBSERVER,OWNER,PW);
+#db_select_db(DB,$con);
 require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once dirname(__FILE__) . "/../../tools/wms_extent/extent_service.conf";
+$languageCode = "de";
+$layout = "tabs";
+//get language parameter out of mapbender session if it is set else set default language to de_DE
+if (isset($_SESSION['mb_lang']) && ($_SESSION['mb_lang']!='')) {
+	$e = new mb_notice("mod_readOpenSearchResultsDetail.php: language found in session: ".$_SESSION['mb_lang']);
+	$language = $_SESSION["mb_lang"];
+	$langCode = explode("_", $language);
+	$langCode = $langCode[0]; # Hopefully de or s.th. else
+	$languageCode = $langCode; #overwrite the GET Parameter with the SESSION information
+}
 
+if (isset($_REQUEST["languageCode"]) & $_REQUEST["languageCode"] != "") {
+	//validate to csv integer list
+	$testMatch = $_REQUEST["languageCode"];
+	if (!($testMatch == 'de' or $testMatch == 'fr' or $testMatch == 'en')){ 
+		echo 'languageCode: <b>'.$testMatch.'</b> is not valid.<br/>'; 
+		die(); 		
+ 	}
+	$languageCode = $testMatch;
+	$testMatch = NULL;
+}
+
+if(!isset($_REQUEST["osid"])) {
+	echo "no opensearch id set";
+	die();
+} else {
+	#if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') ) {	
+	#	echo "opensearch interface no.: ".$_REQUEST["osid"]." will be requested<br>";
+	#}
+}
+
+if(!isset($_REQUEST["docuuid"])) {
+	echo "No uuid of dataset given!";
+	die();
+} else {
+	$docuuid = $_REQUEST["docuuid"];
+}
+
+function getExtentGraphic($layer_4326_box) {
+		$rlp_4326_box = array(6.05,48.9,8.6,50.96);
+		if ($layer_4326_box[0] <= $rlp_4326_box[0] || $layer_4326_box[2] >= $rlp_4326_box[2] || $layer_4326_box[1] <= $rlp_4326_box[1] || $layer_4326_box[3] >= $rlp_4326_box[3]) {
+			if ($layer_4326_box[0] < $rlp_4326_box[0]) {
+				$rlp_4326_box[0] = $layer_4326_box[0]; 
+			}
+			if ($layer_4326_box[2] > $rlp_4326_box[2]) {
+				$rlp_4326_box[2] = $layer_4326_box[2]; 
+			}
+			if ($layer_4326_box[1] < $rlp_4326_box[1]) {
+				$rlp_4326_box[1] = $layer_4326_box[1]; 
+			}
+			if ($layer_4326_box[3] > $rlp_4326_box[3]) {
+				$rlp_4326_box[3] = $layer_4326_box[3]; 
+			}
+
+			$d_x = $rlp_4326_box[2] - $rlp_4326_box[0]; 
+			$d_y = $rlp_4326_box[3] - $rlp_4326_box[1];
+			
+			$new_minx = $rlp_4326_box[0] - 0.05*($d_x);
+			$new_maxx = $rlp_4326_box[2] + 0.05*($d_x);
+			$new_miny = $rlp_4326_box[1] - 0.05*($d_y);
+			$new_maxy = $rlp_4326_box[3] + 0.05*($d_y);
+
+			if ($new_minx < -180) $rlp_4326_box[0] = -180; else $rlp_4326_box[0] = $new_minx;
+			if ($new_maxx > 180) $rlp_4326_box[2] = 180; else $rlp_4326_box[2] = $new_maxx;
+			if ($new_miny < -90) $rlp_4326_box[1] = -90; else $rlp_4326_box[1] = $new_miny;
+			if ($new_maxy > 90) $rlp_4326_box[3] = 90; else $rlp_4326_box[3] = $new_maxy;
+		}
+		$getMapUrl = EXTENTSERVICEURL."VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=".EXTENTSERVICELAYER."&STYLES=&SRS=EPSG:4326&BBOX=".$rlp_4326_box[0].",".$rlp_4326_box[1].",".$rlp_4326_box[2].",".$rlp_4326_box[3]."&WIDTH=120&HEIGHT=120&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage&minx=".$layer_4326_box[0]."&miny=".$layer_4326_box[1]."&maxx=".$layer_4326_box[2]."&maxy=".$layer_4326_box[3];
+		return $getMapUrl;
+}
+
+
+
 function display_text($string) {
     $string = eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);   
     $string = eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);   
     $string = eregi_replace("\n", "<br>", $string);
     return $string;
-}  
+} 
+ 
 function guid(){
     if (function_exists('com_create_guid')){
         return com_create_guid();
@@ -28,51 +102,42 @@
         return $uuid;
     }
 }
-	//function to validate against the inspire validation service
-	function validateInspireMetadataFromData($iso19139Xml){
-		$validatorUrl = 'http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire';
-		#$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php';
-		//send inspire xml to validator and push the result to requesting user
-		$validatorInterfaceObject = new connector();
-		$validatorInterfaceObject->set('httpType','POST');
-		$validatorInterfaceObject->set('httpContentType','multipart/form-data'); # maybe given automatically
-		//first test with data from ram - doesn't function 
-		$fields = array(
-			'dataFile'=>urlencode($iso19139Xml)
-			);
-		//generate file identifier:
-		$fileId = guid();
-		//generate temporary file under tmp
-		 if($h = fopen(TMPDIR."/".$fileId."iso19139_validate_tmp.xml","w")){
-			if(!fwrite($h,$iso19139Xml)){
-				$e = new mb_exception("mod_layerISOMetadata: cannot write to file: ".TMPDIR."iso19139_validate_tmp.xml");
-			}
-		fclose($h);
+
+//function to validate against the inspire validation service
+function validateInspireMetadataFromData($iso19139Xml){
+	$validatorUrl = 'http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire';
+	#$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php'; //for debugging purposes
+	//send inspire xml to validator and push the result to requesting user
+	$validatorInterfaceObject = new connector();
+	$validatorInterfaceObject->set('httpType','POST');
+	$validatorInterfaceObject->set('httpContentType','multipart/form-data'); # maybe given automatically
+	//first test with data from ram - doesn't function :-(
+	$fields = array(
+		'dataFile'=>urlencode($iso19139Xml)
+		);
+	//generate file identifier:
+	$fileId = guid();
+	//generate temporary file under tmp
+	 if($h = fopen(TMPDIR."/".$fileId."iso19139_validate_tmp.xml","w")){
+		if(!fwrite($h,$iso19139Xml)){
+			$e = new mb_exception("geoportal/mod_readOpenSearchResultsDetail.php: cannot write to file: ".TMPDIR."iso19139_validate_tmp.xml");
 		}
-		//send file as post like described under http://www.tecbrat.com/?itemid=13&catid=1
-		$fields['dataFile']='@'.TMPDIR.'/'.$fileId.'iso19139_validate_tmp.xml';
-		#if we give a string with parameters
-		#foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
-		#rtrim($fields_string,'&');
-		#$postData = $fields_string;
-		$postData = $fields;
-		#$e = new mb_exception("mod_layerISOMetadata: postData: ".$postData['dataFile']);
-		//number of post fields:
-		//curl_setopt($ch,CURLOPT_POST,count($fields));
-		$validatorInterfaceObject->set('httpPostFieldsNumber',count($postData));
-		$validatorInterfaceObject->set('curlSendCustomHeaders',false);
-		//$validatorInterfaceObject->set('httpPostData', $postData);
-		$validatorInterfaceObject->set('httpPostData', $postData); #give an array
-		$validatorInterfaceObject->load($validatorUrl);
-		header("Content-type: text/html; charset=UTF-8");
-		echo $validatorInterfaceObject->file;
-		//delete file in tmp 
-		//TODO - this normally done by a cronjob
-		die();
+	fclose($h);
 	}
+	//send file as post like described under http://www.tecbrat.com/?itemid=13&catid=1
+	$fields['dataFile']='@'.TMPDIR.'/'.$fileId.'iso19139_validate_tmp.xml';
+	$postData = $fields;
+	$validatorInterfaceObject->set('httpPostFieldsNumber',count($postData));
+	$validatorInterfaceObject->set('curlSendCustomHeaders',false);
+	$validatorInterfaceObject->set('httpPostData', $postData); #give an array
+	$validatorInterfaceObject->load($validatorUrl);
+	header("Content-type: text/html; charset=UTF-8");
+	echo $validatorInterfaceObject->file;
+	//delete file in tmp 
+	//TODO - this normally done by a cronjob
+	die();
+}
 
-
-
 //INSPIRE Mapping
 $md_ident = array(
 //Metadata Identifier - not neccessary?
@@ -89,7 +154,7 @@
 	),
 //B 1.1
 	array(	ibus => "rtitle",
-		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString",
+		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString",
 		iso19139explode => "false" ,
 		inspire => "resource title",
 		inspiremandatory => "true",
@@ -101,7 +166,7 @@
 	),
 //B 1.2
 	array(	ibus => "abstract",
-		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract/gco:CharacterString",
+		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:abstract/gco:CharacterString",
 		iso19139explode => "false" ,
 		inspire => "resource abstract",
 		inspiremandatory => "true",
@@ -149,8 +214,6 @@
 		description => _mb("A value uniquely identifying the resource. The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner.")
 	),
 //Part 2 - namespace
-
-//B 
 	array(	ibus => "t01_object.obj_id",
 		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString",
 		iso19139explode => "false" ,
@@ -163,8 +226,9 @@
 		description => _mb("A character string namespace uniquely identifying the context of the identifier code (for example, the data owner)")
 	),
 //B 1.6 Coupled resource
+//NOTICE: simplexml has problems with namespaced attributes! So we choose a alias for xlink:href which is xlinkhref and exchange this attributes from xml before parsing the xml!
 	array(	ibus => "t01_object.obj_id",
-		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:operatesOn/@xlink:href",
+		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/srv:operatesOn/@xlinkhref",
 		iso19139explode => "false" ,
 		inspire => "coupled resource",
 		inspiremandatory => "true",
@@ -186,7 +250,6 @@
 		category => "identification",
 		description => _mb("The language(s) used within the resource. The value domain of this metadata element is limited to the languages defined in ISO 639-2.")
 	),
-
 //B 2.1 Topic category
 	array(	ibus => "t01_object.obj_id",
 		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode",
@@ -332,7 +395,7 @@
 //B 7.1. Specification
 //B 7.1.1 Title
 	array(	ibus => "t01_object.obj_id",
-		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:title/gco:CharacterString",
+		iso19139 => "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:title/gco:CharacterString",
 		iso19139explode => "false" ,
 		inspire => "Specification title",
 		inspiremandatory => "true",
@@ -344,7 +407,7 @@
 	),
 //B 7.1.2 Reference Date
 	array(	ibus => "t01_object.obj_id",
-		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/*",
+		iso19139 => "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/*",
 		iso19139explode => "false" ,
 		inspire => "specification reference date",
 		inspiremandatory => "true",
@@ -356,7 +419,7 @@
 	),
 //B 7.2. Degree
 	array(	ibus => "t01_object.obj_id",
-		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:pass/gco:Boolean",
+		iso19139 => "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:pass/gco:Boolean",
 		iso19139explode => "false" ,
 		inspire => "deegree of conformance",
 		inspiremandatory => "true",
@@ -405,7 +468,6 @@
 		category => "useconstraints",
 		description => _mb("Other constraints")
 	),
-
 //B 9. Organisations responsible for the establishment, management, maintance and distribution of spatial data sets and services
 //B 9.1. Responsible party
 //B 9.1.1 Responsible party name
@@ -494,7 +556,6 @@
 		category => "metadata",
 		description => _mb("This is the language in which the metadata elements are expressed. The value domain of this metadata element is limited to the official languages of the Community expressed in conformity with ISO 639-2.")
 	),
-
 //Additional Metadata Elements from the Data Specs
 //Metadata required for interoperability
 //TODO!!
@@ -550,10 +611,7 @@
         </gmd:referenceSystemIdentifier>
     </gmd:MD_ReferenceSystem>
 </gmd:referenceSystemInfo>
-
 */
-
-
 //1. Coordinate Reference System
 	array(	ibus => "t01_object.obj_id",
 		iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:RS_Identifier/gmd:code/gco:CharacterString",
@@ -566,7 +624,6 @@
 		category => "dataspec",
 		description => _mb("Description of the coordinate reference system(s) used in the data set.")
 	),
-
 /*
 //2. Temporal Reference System - only mandatory if not the standard system!
 	array(	ibus => "t01_object.obj_id",
@@ -582,7 +639,6 @@
 	),
 */
 //3. Encoding
-
 	array(	ibus => "t01_object.obj_id",
 		iso19139 => "/gmd:MD_Metadata/gmd:MD_DataIdentification/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name/gco:CharacterString",
 		iso19139explode => "false" ,
@@ -626,26 +682,8 @@
 		category => "dataspec",
 		description => _mb("The character encoding used in the data set. This element is mandatory only if an encoding is used that is not based on UTF-8.")
 	)
-
 );
 
-
-if(!isset($_REQUEST["osid"]) ) {
-	echo "no opensearch id set";
-	die();
-} else {
-	if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') ) {	
-		echo "opensearch interface no.: ".$_REQUEST["osid"]." will be requested<br>";
-	}
-}
-
-if(!isset($_REQUEST["docuuid"]) ) {
-	echo "No uuid of dataset given!";
-	die();
-} else {
-	$docuuid = $_REQUEST["docuuid"];
-}
-
 #***get the information out of the mapbender-db
 #get url to search interface (opensearch):
 $sql_os = "SELECT * from gp_opensearch where os_id = $1";
@@ -687,21 +725,18 @@
 	break;
 }
 
-if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') ) {
-	echo "<br> REQUEST: ".$url."<br>";
-}
-
 #create connector object
 $openSearchObject = new connector($url);
 #get results
 $openSearchDetail = $openSearchObject->file;
 
 
+//solve problem with xlink namespace for href attributes:
+$openSearchDetail = str_replace('xlink:href', 'xlinkhref', $openSearchDetail);
+#http://forums.devshed.com/php-development-5/simplexml-namespace-attributes-problem-452278.html
+#http://www.leftontheweb.com/message/A_small_SimpleXML_gotcha_with_namespaces
 
 
-
-
-
 #$openSearchDetail = str_replace('xmlns=', 'ns=', $openSearchDetail);
 $openSearchDetailXML=simplexml_load_string($openSearchDetail);
 #extract objects to iso19139 elements
@@ -711,8 +746,9 @@
 $openSearchDetailXML->registerXPathNamespace("gmd", "http://www.isotc211.org/2005/gmd");
 $openSearchDetailXML->registerXPathNamespace("gts", "http://www.isotc211.org/2005/gts");
 $openSearchDetailXML->registerXPathNamespace("srv", "http://www.isotc211.org/2005/srv");
+$openSearchDetailXML->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
 
-
+//check if only iso19139 data is requested - if so - push the result automatically from the CSW getRecordById request to the user or the validator
 if ($_REQUEST['mdtype']=='iso19139' && $_REQUEST['validate'] != 'true') {
 	header("Content-type: application/xhtml+xml; charset=UTF-8");
 	//delete scw entries from response file
@@ -727,70 +763,359 @@
 	validateInspireMetadataFromData($MD_Metadata);
 }
 
+$j=0;
+switch ($os_list[0] ['version']) {
+    	case 2:
+//register namespaces: 
+/* <gmd:MD_Metadata xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:srv="http://www.isotc211.org/2005/srv" id="_ingrid-group_iplug-rp-udk-db_263">*/
+		for($a = 0; $a < count($md_ident); $a++) {
+			$resultOfXpath = $openSearchDetailXML->xpath('/csw:GetRecordByIdResponse'.$md_ident[$a]['iso19139']);
+			for ($i = 0; $i < count($resultOfXpath); $i++) {
+				$md_ident[$a]['value'] = $md_ident[$a]['value'].",".$resultOfXpath[$i];
+			}
+			$md_ident[$a]['value'] = ltrim($md_ident[$a]['value'],',');
+		}
+	break;
+	default:
+	foreach ( $openSearchDetailXML->channel->item->details->detail as $detail) { 
+		$detail_key=(string)$detail->{'detail-key'};		#cast explicitly to string
+		$detail_value=(string)$detail->{'detail-value'};
+		$detail_array[$detail_key] = $detail_value;
+		$detail_keys[$j]=$detail_key;	
+		if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') ) {
+			if (in_array($detail_key, $ibus_names)) {
+				echo "Key <b>".$detail_key."</b> exists in lookup table!<br>";
+				$i++;
+			}
+		}
+		$j++;			
+	} 
+	break;
+}
 
+//generate output for different parameters mdtype
 
-
-
-
-
-
-
-	#count unidentified elements
-	$i=0;
-	#get list for ibus variables - cause php is row major
-	$ibus_names = array();
-	for($a = 0; $a < count($md_ident); $a++) {
-		$ibus_names[$a] = $md_ident[$a]["ibus"];
-		if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
-			{
-			echo "ibus_names[".$a."]=".$md_ident[$a]["ibus"]."<br>";
+switch ($_REQUEST["mdtype"]) {
+	case "html":
+		$html = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$languageCode.'">';
+		$html .= '<body>';
+		$metadataStr .= '<head>' . 
+		'<title>'._mb("Metadata").'</title>' . 
+		'<meta name="description" content="'._mb("Metadata").'" xml:lang="'.$languageCode.'" />'.
+		'<meta name="keywords" content="'._mb("Metadata").'" xml:lang="'.$languageCode.'" />'	.	
+		'<meta http-equiv="cache-control" content="no-cache">'.
+		'<meta http-equiv="pragma" content="no-cache">'.
+		'<meta http-equiv="expires" content="0">'.
+		'<meta http-equiv="content-language" content="'.$languageCode.'" />'.
+		'<meta http-equiv="content-style-type" content="text/css" />'.
+		'<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">' . 	
+		'</head>';
+		$html .= $metadataStr;
+		//define the javascripts to include
+		$html .= '<link type="text/css" href="../css/metadata.css" rel="Stylesheet" />';
+		if ($layout == 'tabs') {
+			$html .= '<link type="text/css" href="../extensions/jquery-ui-1.8.1.custom/css/custom-theme/jquery-ui-1.8.5.custom.css" rel="Stylesheet" />';	
+			$html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-1.4.2.min.js"></script>';
+			$html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-ui-1.8.1.custom.min.js"></script>';
+			//initialize tabs
+			$html .= '<script type="text/javascript">';
+			$html .= '$(function() {';
+			$html .= '	$("#tabs").tabs();';
+			$html .= '});';
+			$html .= '</script>';
+			//independently define the headers of the parts
+			$html .= '<div class="demo">';
+			$html .= '<div id="tabs">';
+			$html .= '<ul>';
+			$html .= 	'<li><a href="#tabs-1">'._mb("Overview").'</a></li>';
+			$html .= 	'<li><a href="#tabs-2">'._mb("Properties").'</a></li>';
+			$html .= 	'<li><a href="#tabs-3">'._mb("Contact").'</a></li>';
+			$html .= 	'<li><a href="#tabs-4">'._mb("Terms of use").'</a></li>';
+			$html .= 	'<li><a href="#tabs-5">'._mb("Quality").'</a></li>';
+			$html .= 	'<li><a href="#tabs-6">'._mb("Interfaces").'</a></li>';
+			$html .= '</ul>';
 		}
+		if ($layout == 'accordion') {
+			$html .= '<link type="text/css" href="../extensions/jquery-ui-1.8.1.custom/css/custom-theme/jquery-ui-1.8.4.custom.css" rel="Stylesheet" />';	
+			$html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-1.4.2.min.js"></script>';
+			$html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-ui-1.8.1.custom.min.js"></script>';
+			//define the javascript functions
+			$html .= '<script type="text/javascript">';
+			$html .= '	$(function() {';
+			$html .= '		$("#accordion").accordion();';
+			//$html .= '		$("#accordion").accordion({ autoHeight: false});';
+			//$html .= '		$("#accordion").accordion({ autoHeight: false , clearStyle: true });';
+			$html .= '	});';
+			$html .= '	</script>';
+			$html .= '<div class="demo">';
+			$html .= '<div id="accordion">';
+		}
+		if ($layout == 'plain') {
+			$html .= '<div class="demo">';
+			$html .= '<div id="plain">';
+		}
+		//some placeholders
+		$tableBegin =  "<table>\n";
+		$t_a = "\t<tr>\n\t\t<th>\n\t\t\t";
+		$t_b = "\n\t\t</th>\n\t\t<td>\n\t\t\t";
+		$t_c = "\n\t\t</td>\n\t</tr>\n";
+		$tableEnd = "</table>\n";
+		//**************************overview part begin******************************
+		//generate div tags for the content - the divs are defined in the array
+		if ($layout == 'accordion') {
+			$html .= '<h3><a href="#">'._mb("Overview").'</a></h3>';
+			$html .= '<div style="height:300px">';
+		}
+		if ($layout == 'tabs') {
+			$html .= '<div id="tabs-1">';
+		}
+		if ($layout == 'plain') {
+			$html .= '<h3>'._mb("overview").'</h3>';
+			$html .= '<div>';
+		}
+		$html .= '<p>';
+		$html .= '<fieldset><legend>'._mb("Metadata").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[0]['html']."</b>: ".$t_b.$md_ident[0]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[31]['html']."</b>: ".$t_b.$md_ident[31]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[32]['html']."</b>: ".$t_b.$md_ident[32]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Identification").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[1]['html']."</b>: ".$t_b.$md_ident[1]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[2]['html']."</b>: ".$t_b.$md_ident[2]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[3]['html']."</b>: ".$t_b.$md_ident[3]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[5]['html']."</b>: ".$t_b.$md_ident[5]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[6]['html']."</b>: ".$t_b.$md_ident[6]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[26]['html']."</b>: ".$t_b.$md_ident[26]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[27]['html']."</b>: ".$t_b.$md_ident[27]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		
+		$bbox = explode(',',$md_ident[12]['value']);
 
-	} 
-	$detail_array=array();
-	#read key-value pairs
-	$j=0;
-	switch ($os_list[0] ['version']) {
-    		case 2:
-			echo "<a href='".$url."'>GetRecordById URL</a><br><br>";
-			//register namespaces: 
-/* <gmd:MD_Metadata xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:srv="http://www.isotc211.org/2005/srv" id="_ingrid-group_iplug-rp-udk-db_263">*/
-			for($a = 0; $a < count($md_ident); $a++) {
-				$resultOfXpath = $openSearchDetailXML->xpath('/csw:GetRecordByIdResponse'.$md_ident[$a]['iso19139']);
-				for ($i = 0; $i < count($resultOfXpath); $i++) {
-					$md_ident[$a]['value'] = $md_ident[$a]['value'].",".$resultOfXpath[$i];
-				}
-				$md_ident[$a]['value'] = ltrim($md_ident[$a]['value'],',');
-				echo "<b>".$md_ident[$a]['html']."</b>: ".$md_ident[$a]['value']."<br><br>";
+		if (count($bbox) == 4) {
+			$wgs84Bbox = $bbox[0].",".$bbox[2].",".$bbox[1].",".$bbox[3];
+			$getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
+			$html .= '<fieldset><legend>'._mb("Extent").'</legend>';
+			if (defined('EXTENTSERVICEURL')) {
+				$html .= "<img src='".$getMapUrl."'>";
+			} else {
+				$html .= _mb('Graphic unavailable');
 			}
-			echo "Version of PortalU CSW interface is currently not yet full supported! We work on the new Interface.<br> Please use the link <b>Originäre Metadaten</b> instead.";
-			die();
-		break;
-		default:
-		foreach ( $openSearchDetailXML->channel->item->details->detail as $detail) { 
-			$detail_key=(string)$detail->{'detail-key'};		#cast explicitly to string
-			$detail_value=(string)$detail->{'detail-value'};
-			$detail_array[$detail_key] = $detail_value;
-			$detail_keys[$j]=$detail_key;	
-			if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') ) {
-				if (in_array($detail_key, $ibus_names)) {
-					echo "Key <b>".$detail_key."</b> exists in lookup table!<br>";
-					$i++;
-				}
-			}
-				$j++;			
-		} 
-		break;
-	}
+			$html .= '</fieldset>';
+			
+		}
+		
+		$html .= '<fieldset><legend>'._mb("Contact").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[26]['html']."</b>: ".$t_b.$md_ident[26]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[27]['html']."</b>: ".$t_b.$md_ident[27]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '</p>';
+		$html .= '</div>';//element
+		//***************************************************************************
+		//**************************properties part begin******************************
+		//generate div tags for the content - the divs are defined in the array
+		if ($layout == 'accordion') {
+			$html .= '<h3><a href="#">'._mb("Properties").'</a></h3>';
+			$html .= '<div style="height:300px">';
+		}
+		if ($layout == 'tabs') {
+			$html .= '<div id="tabs-2">';
+		}
+		if ($layout == 'plain') {
+			$html .= '<h3>'._mb("Properties").'</h3>';
+			$html .= '<div>';
+		}
+		$html .= '<p>';
+		$html .= '<fieldset><legend>'._mb("Common").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[8]['html']."</b>: ".$t_b.$md_ident[8]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[9]['html']."</b>: ".$t_b.$md_ident[9]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[11]['html']."</b>: ".$t_b.$md_ident[11]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Geographic extent").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[33]['html']."</b>: ".$t_b.$md_ident[33]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[12]['html']."</b>: ".$t_b.$md_ident[12]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Temporal extent").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[13]['html']."</b>: ".$t_b.$md_ident[13]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[14]['html']."</b>: ".$t_b.$md_ident[14]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[15]['html']."</b>: ".$t_b.$md_ident[15]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[16]['html']."</b>: ".$t_b.$md_ident[16]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Format").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[34]['html']."</b>: ".$t_b.$md_ident[34]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[35]['html']."</b>: ".$t_b.$md_ident[35]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Service information").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[10]['html']."</b>: ".$t_b.$md_ident[10]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[7]['html']."</b>: ".$t_b.$md_ident[7]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '</p>';
+		$html .= '</div>';//element
+		//***************************************************************************
+		//**************************contact part begin******************************
+		//generate div tags for the content - the divs are defined in the array
+		if ($layout == 'accordion') {
+			$html .= '<h3><a href="#">'._mb("Properties").'</a></h3>';
+			$html .= '<div style="height:300px">';
+		}
+		if ($layout == 'tabs') {
+			$html .= '<div id="tabs-3">';
+		}
+		if ($layout == 'plain') {
+			$html .= '<h3>'._mb("Properties").'</h3>';
+			$html .= '<div>';
+		}
+		$html .= '<p>';
+		$html .= '<fieldset><legend>'._mb("Data/Service provider").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[26]['html']."</b>: ".$t_b.$md_ident[26]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[28]['html']."</b>: ".$t_b.$md_ident[28]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[27]['html']."</b>: ".$t_b.$md_ident[27]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Metadata provider").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[29]['html']."</b>: ".$t_b.$md_ident[29]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[30]['html']."</b>: ".$t_b.$md_ident[30]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		
+		$html .= '</p>';
+		$html .= '</div>';//element
+		//***************************************************************************
+		//**************************terms of use part begin******************************
+		//generate div tags for the content - the divs are defined in the array
+		if ($layout == 'accordion') {
+			$html .= '<h3><a href="#">'._mb("Terms of use").'</a></h3>';
+			$html .= '<div style="height:300px">';
+		}
+		if ($layout == 'tabs') {
+			$html .= '<div id="tabs-4">';
+		}
+		if ($layout == 'plain') {
+			$html .= '<h3>'._mb("Terms of use").'</h3>';
+			$html .= '<div>';
+		}
+		$html .= '<p>';
+		$html .= '<fieldset><legend>'._mb("Conditions").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[23]['html']."</b>: ".$t_b.$md_ident[23]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Access Constraints").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[24]['html']."</b>: ".$t_b.$md_ident[24]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[25]['html']."</b>: ".$t_b.$md_ident[25]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		
+		$html .= '</p>';
+		$html .= '</div>';//element
+		//***************************************************************************
+		//**************************quality part begin******************************
+		//generate div tags for the content - the divs are defined in the array
+		if ($layout == 'accordion') {
+			$html .= '<h3><a href="#">'._mb("Quality").'</a></h3>';
+			$html .= '<div style="height:300px">';
+		}
+		if ($layout == 'tabs') {
+			$html .= '<div id="tabs-5">';
+		}
+		if ($layout == 'plain') {
+			$html .= '<h3>'._mb("Quality").'</h3>';
+			$html .= '<div>';
+		}
+		$html .= '<p>';
+		$html .= '<fieldset><legend>'._mb("Lineage").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[17]['html']."</b>: ".$t_b.$md_ident[17]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Resolution").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[18]['html']."</b>: ".$t_b.$md_ident[18]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[19]['html']."</b>: ".$t_b.$md_ident[19]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		$html .= '<fieldset><legend>'._mb("Validity").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>".$md_ident[20]['html']."</b>: ".$t_b.$md_ident[20]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[21]['html']."</b>: ".$t_b.$md_ident[21]['value'].$t_c;
+		$html .= $t_a."<b>".$md_ident[22]['html']."</b>: ".$t_b.$md_ident[22]['value'].$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		
+		$html .= '</p>';
+		$html .= '</div>';//element
+		//***************************************************************************
+//**************************quality part begin******************************
+		//generate div tags for the content - the divs are defined in the array
+		if ($layout == 'accordion') {
+			$html .= '<h3><a href="#">'._mb("Interfaces").'</a></h3>';
+			$html .= '<div style="height:300px">';
+		}
+		if ($layout == 'tabs') {
+			$html .= '<div id="tabs-6">';
+		}
+		if ($layout == 'plain') {
+			$html .= '<h3>'._mb("Interfaces").'</h3>';
+			$html .= '<div>';
+		}
+		$html .= '<p>';
+		$html .= '<fieldset><legend>'._mb("Metadata").'</legend>';
+		$html .= $tableBegin;
+		$html .= $t_a."<b>"._mb("ISO19139")."</b>: <a href='".$url."'>"._mb("metadata")."</a>".$t_c;
+		$html .= $tableEnd;
+		$html .= '</fieldset>';
+		
+		$html .= '</p>';
+		$html .= '</div>';//element
+		//***************************************************************************
+		$html .= '</div>'; //accordion
+		$html .= '</div>'; //demo
+		$html .= '</body>';
+		$html .= '</html>';
+		echo $html;
+		die();
+	break;
+	case "inspire":
+		echo "<a href='".$url."'>GetRecordById URL</a><br><br>";
+		for($a = 0; $a < count($md_ident); $a++) {
+			echo "<b>".$md_ident[$a]['html']."</b>: ".$md_ident[$a]['value']."<br><br>";
+		}
+		die();
+	break;
+	case "debug":
+		echo "<a href='".$url."'>GetRecordById URL</a><br><br>";
+		for($a = 0; $a < count($md_ident); $a++) {
+			echo "<b>".$md_ident[$a]['html']."</b>: ".$md_ident[$a]['value']."<br><br>";
+		}
+		die();
+	break;
+	default:
+		echo "<a href='".$url."'>GetRecordById URL</a><br><br>";
+		for($a = 0; $a < count($md_ident); $a++) {
+			echo "<b>".$md_ident[$a]['html']."</b>: ".$md_ident[$a]['value']."<br><br>";
+		}
+		die();
+	break;
+}
 
-	if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') ) {
-		echo "<br>".$i." elements have been identified!<br>";
-	}
-
-	if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') ) {
-		var_dump($detail_keys);
-	}
-
 if ($_REQUEST['mdtype']=='debug'){
 		echo "DEBUG Metadatenanzeige<br>";
 		#define table
@@ -798,28 +1123,21 @@
 		echo "<tr>";
 		#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
 		foreach ($detail_keys as $detailkey) {
-
-			#echo "<td>";
-
 			if (in_array($detailkey, $ibus_names)==false){
-
 				echo  "<td >".$detailkey."</td>";
-
 				}
 				else {
 				echo "<td bgcolor=\"green\">".$md_ident[array_search($detailkey, $ibus_names)]['html']."(".$detailkey.")</td>";
-	
-
 				}
 			#echo "</td>";
 			echo "<td>";
-
 			echo $detail_array[$detailkey];
-
 			echo "</tr>";
 		}
 		echo "</table></html>";
 }
+
+
 if ($_REQUEST['mdtype']=='html'){
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
@@ -850,28 +1168,22 @@
 	
 	<div class="content">
 <?php
-
-
-
-		echo "<h1>Detailinformationen:</h1>";
-		#define table
-		echo "<html><table class='contenttable-0-wide'>";
-		echo "<tr>";
-		#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
-		foreach ($detail_keys as $detailkey) {
-			
-
-			if (in_array($detailkey, $ibus_names)==true){
-				echo "<td>".$md_ident[array_search($detailkey, $ibus_names)]['html']."</td>";
-				echo "<td>";
-				echo display_text($detail_array[$detailkey]);
-				echo "</td></tr>";
-			}
+	echo "<h1>Detailinformationen:</h1>";
+	#define table
+	echo "<html><table class='contenttable-0-wide'>";
+	echo "<tr>";
+	#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
+	foreach ($detail_keys as $detailkey) {	
+		if (in_array($detailkey, $ibus_names)==true){
+			echo "<td>".$md_ident[array_search($detailkey, $ibus_names)]['html']."</td>";
+			echo "<td>";
+			echo display_text($detail_array[$detailkey]);
+			echo "</td></tr>";
 		}
-		echo "</table></html>";
+	}
+	echo "</table></html>";
 }
 
-
 if ($_REQUEST['mdtype']=='inspire') {
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
@@ -891,47 +1203,30 @@
 		<link rel="stylesheet" type="text/css" href="../../../portal/fileadmin/design/css/print.css" media="print" />
 	</head>
 	<body id="top" class="popup">
-
-	
 	<div id="header_gray">
 	<a href="javascript:window.print()">Drucken <img src="../../../portal/fileadmin/design/images/icon_print.gif" width="14" height="14" alt="" /></a>
 	<a href="javascript:window.close()">Fenster schlie&szlig;en <img src="../../../portal/fileadmin/design/images/icon_close.gif" width="14" height="14" alt="" /></a>
 	</div>
 	<div id="header_redbottom"></div>
 	<div id="header_red"></div>
-	
 	<div class="content">
 <?php
-
-
-
-		echo "<img border=\"0\" src=\"img/inspire_tr_100.png\" alt=\"INSPIRE Logo\"><h1>INSPIRE Metadaten:</h1>";
-		#define table
-		echo "<html><table class='contenttable-0-wide'>";
-		echo "<tr>";
-		#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
-		foreach ($detail_keys as $detailkey) {
-			
-
-			if (in_array($detailkey, $ibus_names)==true){
-				if ($md_ident[array_search($detailkey, $ibus_names)]['inspiremandatory']=='true') {
-					echo "<td>".$md_ident[array_search($detailkey, $ibus_names)]['inspire']."</td>";
-					echo "<td>";
-					echo display_text($detail_array[$detailkey]);
-					echo "</td></tr>";
-				}
+	echo "<img border=\"0\" src=\"img/inspire_tr_100.png\" alt=\"INSPIRE Logo\"><h1>INSPIRE Metadaten:</h1>";
+	#define table
+	echo "<html><table class='contenttable-0-wide'>";
+	echo "<tr>";
+	#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
+	foreach ($detail_keys as $detailkey) {
+		if (in_array($detailkey, $ibus_names)==true){
+			if ($md_ident[array_search($detailkey, $ibus_names)]['inspiremandatory']=='true') {
+				echo "<td>".$md_ident[array_search($detailkey, $ibus_names)]['inspire']."</td>";
+				echo "<td>";
+				echo display_text($detail_array[$detailkey]);
+				echo "</td></tr>";
 			}
 		}
-		echo "</table></html>";
-
-
-
-
-
-
-
-
-echo '<br><b>INSPIRE output not completly implemented!<b><br>';
+	}
+	echo "</table></html>";
+	echo '<br><b>INSPIRE output not completly implemented!<b><br>';
 }
-
 ?>



More information about the Mapbender_commits mailing list