[Mapbender-commits] r8468 - in trunk/mapbender: http/javascripts http/plugins resources/locale/de_DE/LC_MESSAGES

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Aug 22 03:41:06 PDT 2012


Author: armin11
Date: 2012-08-22 03:41:05 -0700 (Wed, 22 Aug 2012)
New Revision: 8468

Modified:
   trunk/mapbender/http/javascripts/mb_downloadFeedClient.js
   trunk/mapbender/http/plugins/mb_downloadFeedClient.php
   trunk/mapbender/http/plugins/mb_downloadFeedServer.php
   trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
Log:
Bugfixes for INSPIRE ATOM Download Feed V1.0

Modified: trunk/mapbender/http/javascripts/mb_downloadFeedClient.js
===================================================================
--- trunk/mapbender/http/javascripts/mb_downloadFeedClient.js	2012-08-22 10:34:01 UTC (rev 8467)
+++ trunk/mapbender/http/javascripts/mb_downloadFeedClient.js	2012-08-22 10:41:05 UTC (rev 8468)
@@ -53,6 +53,8 @@
 	mapframe_file_list = new OpenLayers.Map('mapframe_file_list');
 	var wms1 = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                 "http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map&", {layers: 'ATKIS-Praes'}, {singleTile: true});
+	//var wms_osm = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+        //        "http://osm.omniscale.net/proxy/service?", {layers: 'osm'}, {singleTile: true});
 	var wms2 = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                 "http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map&", {layers: 'ATKIS-Praes'}, {singleTile: true});
 	//Vector layer for the georss polygons of the service feed - maybe more than one 
@@ -90,6 +92,7 @@
 //central function to call server by ajax, result is a featureCollection which is generated by mapbenders server component
 function callServer(data,method,id) {
 	if (id === undefined) id = 0;
+	//alert("ajax call begin");
 	$.ajax({
   		url: '../plugins/mb_downloadFeedServer.php',
   		type: "post",
@@ -105,6 +108,7 @@
 			}
 			if (method == "getDatasetFeedObjectFromUrl") {
 				//function to draw bboxes of single link to data tile and the corresponding list of tiles 
+				//alert("ajax datasetfeed read!");				
 				showDatasetEntryList(result, id);
 				
 			}
@@ -120,7 +124,7 @@
 	$("#representation_select").css("display","none");
 	$("#representation_info").css("display","none");
 	//change size of outer fieldset
-	$("#client").css("height","400px");
+	$("#client").css("height","450px");
 }
 
 
@@ -166,6 +170,7 @@
 	//call second feed with first entry for default
         data = featureCollection.features[0].properties.datasetFeedLink;
 	datasetFeedObject = callServer(data,method);
+	//alert("ajax call started");
 	
 }
 
@@ -175,6 +180,7 @@
 		alert("No parseable content found");
 		return false;
 	}
+	//alert("test");
 	//remove select element for the different possible representations (formats, crs, ...)
 	$('#dataset_representation_select').remove();
 	//generate new select element 
@@ -207,7 +213,7 @@
 		//count number of links in representation
 		var numberOfLinks = featureCollection.features[0].properties.entry[k].link.length;
 		//alert("number of links: "+numberOfLinks);
-		if (numberOfLinks > 1) {
+		if (numberOfLinks >= 1) {
 			//show list 
 			$("#representation_select").css("display","block");
 			//deactivate mapframe2 by default
@@ -216,13 +222,6 @@
 			$("#representation_info").css("display","block");
 			//extent size of outer fieldset
 			$("#client").css("height","730px");
-			//test if the bbox attribute of the first link is set
-		        if (featureCollection.features[0].properties.entry[k].link[0]['@attributes'].bbox != '') {
-				//show mapframe
-				$("#mapframe_file_list").css("display","block");
-				//extent size of outer fieldset
-				$("#client").css("height","900px");
-			}
 		} else {
 			/*if (numberOfLinks == 1) {
 				//open single link for download!
@@ -231,19 +230,25 @@
 			}*/
 		}
                 for (var i = 0; i < featureCollection.features[0].properties.entry[k].link.length; i++) {
-                	ext = featureCollection.features[0].properties.entry[k].link[i]['@attributes'].bbox;
-			extArrayNew = new Array();
-			extArray = ext.split(",");
-			//sort array to lat lon
-			extArrayNew[0] = extArray[1];
-			extArrayNew[1] = extArray[0];
-			extArrayNew[2] = extArray[3];
-			extArrayNew[3] = extArray[2];
-                	bound = OpenLayers.Bounds.fromArray(extArrayNew);
-			attributes = {id: i, url:featureCollection.features[0].properties.entry[k].link[i]['@attributes'].href};
-                	box = new OpenLayers.Feature.Vector(bound.toGeometry(),attributes);
-                	bboxFiles.addFeatures(box);
-			selectFOptions = selectFOptions+"<option value='"+i+"' url='"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].href+"' title='"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].title+"' onclick='highlightFeatureIndexById("+i+",true);' onmouseover='highlightFeatureIndexById("+i+",false);'>"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].title+"</option>";	
+			if (featureCollection.features[0].properties.entry[k].link[i]['@attributes'].bbox == '' || featureCollection.features[0].properties.entry[k].link[i]['@attributes'].bbox === undefined) {
+				selectFOptions = selectFOptions+"<option value='"+i+"' url='"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].href+"' title='"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].title+"'  onclick='window.open(\""+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].href+"\");'>"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].title+"</option>";
+			} else {
+				
+                		ext = featureCollection.features[0].properties.entry[k].link[i]['@attributes'].bbox;
+				extArrayNew = new Array();
+				extArray = ext.split(",");
+				//sort array to lat lon
+				extArrayNew[0] = extArray[1];
+				extArrayNew[1] = extArray[0];
+				extArrayNew[2] = extArray[3];
+				extArrayNew[3] = extArray[2];
+                		bound = OpenLayers.Bounds.fromArray(extArrayNew);
+				attributes = {id: i, url:featureCollection.features[0].properties.entry[k].link[i]['@attributes'].href};
+                		box = new OpenLayers.Feature.Vector(bound.toGeometry(),attributes);
+                		bboxFiles.addFeatures(box);
+				selectFOptions = selectFOptions+"<option value='"+i+"' url='"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].href+"' title='"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].title+"' onclick='highlightFeatureIndexById("+i+",true);' onmouseover='highlightFeatureIndexById("+i+",false);'>"+featureCollection.features[0].properties.entry[k].link[i]['@attributes'].title+"</option>";
+			}
+				
                	}
 		//count features of bboxFiles
 		//bboxFiles if not available show error message
@@ -253,29 +258,36 @@
 		//add options 
 		selectFOptionsObject = $('#section_option').append(selectFOptions);
 		selectFOptionsObject.attr({'width': 300});
-		bound = bboxFiles.getDataExtent();
-		mapframe_file_list.zoomToExtent(bound);
-		bboxFiles.events.on({
-   			featureselected: function(event) {
-        			var feature = event.feature;
-        			var id = feature.attributes.id;
-				var url = feature.attributes.url;
-				$('#section_option option').removeAttr('selected')
-				$("#section_option option[value='"+id+"']").attr('selected',true);
-				//window.open(url,'download_window');
+		//alert(bboxFiles.features.length);
+		if (bboxFiles.features.length >= 1) {//TODO
+			//show mapframe
+			$("#mapframe_file_list").css("display","block");
+			//extent size of outer fieldset
+			$("#client").css("height","900px");
+			bound = bboxFiles.getDataExtent();
+			mapframe_file_list.zoomToExtent(bound);
+			bboxFiles.events.on({
+   				featureselected: function(event) {
+        				var feature = event.feature;
+        				var id = feature.attributes.id;
+					var url = feature.attributes.url;
+					$('#section_option option').removeAttr('selected')
+					$("#section_option option[value='"+id+"']").attr('selected',true);
+					//window.open(url,'download_window');
 
-				/*if ($('#multi_select').is(':checked')) {
-					alert("checked");
-				} else {
-					alert("un-checked");
-				}
-				alert(url);*/				
-    			}
-		});
+					/*if ($('#multi_select').is(':checked')) {
+						alert("checked");
+					} else {
+						alert("un-checked");
+					}
+					alert(url);*/				
+    				}
+			});
 		
-                sf = new OpenLayers.Control.SelectFeature(bboxFiles);
-                mapframe_file_list.addControl(sf);
-                sf.activate();
+                	sf = new OpenLayers.Control.SelectFeature(bboxFiles);
+                	mapframe_file_list.addControl(sf);
+                	sf.activate();
+		}
 }
 
 function drawMetadataPolygons(featureCollection) {

Modified: trunk/mapbender/http/plugins/mb_downloadFeedClient.php
===================================================================
--- trunk/mapbender/http/plugins/mb_downloadFeedClient.php	2012-08-22 10:34:01 UTC (rev 8467)
+++ trunk/mapbender/http/plugins/mb_downloadFeedClient.php	2012-08-22 10:41:05 UTC (rev 8468)
@@ -111,7 +111,7 @@
 <body onload="init()">
 
 <fieldset id="client">
-	<legend><?php echo _mb("INSPIRE Download Service ATOM Feed Client");?><!--<img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Client to download INSPIRE data on an easy way.");?>'}" src="../img/questionmark.png" alt="" />--></legend>
+	<legend><?php echo _mb("INSPIRE Download Service ATOM Feed Client");?><img src="../img/inspire_tr_36.png" /><!--<img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Client to download INSPIRE data on an easy way.");?>'}" src="../img/questionmark.png" alt="" />--></legend>
 	<div id="input_feed_url">
 	<p>    
 		<form id="service_feed_form">

Modified: trunk/mapbender/http/plugins/mb_downloadFeedServer.php
===================================================================
--- trunk/mapbender/http/plugins/mb_downloadFeedServer.php	2012-08-22 10:34:01 UTC (rev 8467)
+++ trunk/mapbender/http/plugins/mb_downloadFeedServer.php	2012-08-22 10:41:05 UTC (rev 8468)
@@ -189,12 +189,20 @@
 				}
 				$link = $feedXML->xpath('/defaultns:feed/defaultns:entry/defaultns:link[contains(@rel,\'section\')]/@bbox');
 				$feature->geometry = new geoRSSPolygon();
-				$feature->geometry->parsePolygon($bboxArray[0]);
+				$e = new mb_notice("mod_downloadFeedServer.php: bboxArray[0]: ".$bboxArray[0]);
+				if (!isset($bboxArray[0]) || $bboxArray[0] == "") {
+					$feature->geometry = null;
+				} else {
+					$feature->geometry->parsePolygon($bboxArray[0]);
+				}
+				
 				//$feature->geometry->targetEPSG = "EPSG:4326";
-				if (isset($feature->geometry) && $feature->geometry!==false) {
-					$featureCollection->addFeature($feature);
-					$e = new mb_notice("Feature added to collection!");
-				}
+				//set geometry to null if geometry is not given!
+				
+				//if (isset($feature->geometry) && $feature->geometry!==false) {
+				$featureCollection->addFeature($feature);
+				$e = new mb_notice("Feature added to collection!");
+				//}
 				/*$titleArray = (array)$title[$i];
 				$linkArray = (array)$link[$i];
 				$linkArray = $linkArray["@attributes"];

Modified: trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2012-08-22 10:34:01 UTC (rev 8467)
+++ trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2012-08-22 10:41:05 UTC (rev 8468)
@@ -3561,3 +3561,27 @@
 msgid "Search for addresses"
 msgstr "Suche nach Adressen"
 
+#plugins/mod_downloadFeedClient.php
+msgid "INSPIRE ATOM Feed Client"
+msgstr "INSPIRE ATOM Feed Client"
+
+msgid "ATOM Feed url"
+msgstr "URL zum ATOM Feed"
+
+msgid "Dataset title"
+msgstr "Bezeichnung"
+
+msgid "Dataset abstract"
+msgstr "Beschreibung"
+
+msgid "Rights"
+msgstr "Rechtliche Angaben"
+
+msgid "Available representations"
+msgstr "Verfügbare Varianten"
+
+msgid "Select to download dataset"
+msgstr "Auswahl zum Download"
+
+
+



More information about the Mapbender_commits mailing list