[Mapbender-commits] r9104 - in trunk/mapbender/http/extensions/mobilemap: . _build mod_mapbender

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 21 02:04:42 PDT 2014


Author: armin11
Date: 2014-10-21 02:04:42 -0700 (Tue, 21 Oct 2014)
New Revision: 9104

Modified:
   trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.js
   trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.min.js
   trunk/mapbender/http/extensions/mobilemap/map.php
   trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js
Log:
Bugfix for loading mobilemap from wmc with multiple feature info activated

Modified: trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.js	2014-10-21 08:48:40 UTC (rev 9103)
+++ trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.js	2014-10-21 09:04:42 UTC (rev 9104)
@@ -748,7 +748,7 @@
 		onClick: function( evt ) {
 		// click funktion
 			var lonlat = map.getLonLatFromViewPortPx(evt.xy); 
-			//var querylayer = $('#ownlist').find('.query_checked').parent();
+			var querylayer = $('#ownlist').find('.query_checked').parent();
 			var actuallang = $('#select-lang').val();
 			//Punkt erzeugen
 			var geompoint = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
@@ -1211,6 +1211,32 @@
 	}
 }
 
+//SP: Queryable eines Layers umschalten
+function setQueryable(layer, queryable)
+{
+	if (queryable)
+	{
+		$(layer).find('.query_queryable').addClass('query_checked').removeClass('query_noinfo');
+	}
+	else
+	{
+		$(layer).find('.query_queryable').addClass('query_noinfo').removeClass('query_checked').removeClass('query_unchecked');
+	}	
+}
+
+//SP: Abfragbarkeit eines Layers umschalten
+function setQueryCheck(layer, checked)
+{
+	if (checked)
+	{
+		$(layer).find('.query_queryable').addClass('query_checked').removeClass('query_unchecked');	
+	}
+	else
+	{
+		$(layer).find('.query_queryable').addClass('query_unchecked').removeClass('query_checked');
+	}
+}
+
 // Validierung der Baselayer-Auswahl
 function base_check(item){
 	$('#baselayers').find('.base_checked').addClass('base_unchecked').removeClass('base_checked');
@@ -1345,6 +1371,16 @@
 				if(!layerlist[i].active){ // Auswahl umschalten
 					switchVisibility(layer);
 				}
+				//SP: Layer Abfragbarkeit setzen
+				if (layerlist[i].layerQueryable)
+				{
+					setQueryable(layer, true);
+					setQueryCheck(layer, layerlist[i].queryLayer);
+				}
+				else
+				{
+					setQueryable(layer, false);
+				}
 				break;
 			}
 		}

Modified: trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.min.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.min.js	2014-10-21 08:48:40 UTC (rev 9103)
+++ trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.min.js	2014-10-21 09:04:42 UTC (rev 9104)
@@ -26,12 +26,12 @@
 return m}
 function FeatureResult(a,b,c,d){this.layername=a;this.position=b;this.url=c;this.html=$("<div>",{"data-sort":b});b=$('<div class="collapsible unselected" data-role="collapsible" data-collapsed="true" data-theme="a" data-content-theme="c" data-inline="true" data-inset="true"></div>');b.append("<h3>"+a+"</h3>");b.append($('<div class="legendcontainer" data-role="content"><img src="'+d+'"></div>'));a=$('<a data-role="button" data-icon="arrow-r" data-iconpos="right" target="_blank" href="'+c+'">Info</a>');
 c=$('<div class="ui-grid-a">');d=$('<div class="ui-block-a">');d.append(b);b=$('<div class="ui-block-b">');b.append(a);c.append(d);c.append(b);this.html.append(c)}var templayer,maxlayers=5,maxresults=40,baseinfo=[];searchUrl="mod_mapbender/search_proxy.php?languageCode=de&resultTarget=web&maxResults="+maxresults;
-function addmyLayer(){OpenLayers.Control.Click=OpenLayers.Class(OpenLayers.Control,{defaultHandlerOptions:{single:!0,pixelTolerance:0,stopSingle:!1},initialize:function(a){this.handlerOptions=OpenLayers.Util.applyDefaults((a||{}).handlerOptions||{},this.defaultHandlerOptions);OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Click(this,{click:this.onClick},this.handlerOptions)},onClick:function(a){var b=map.getLonLatFromViewPortPx(a.xy),c=$("#select-lang").val(),
-d=new OpenLayers.Geometry.Point(b.lon,b.lat),e=new OpenLayers.Geometry.Point(b.lon,b.lat);vector_marker.removeAllFeatures();vector_marker.addFeatures([new OpenLayers.Feature.Vector(d,{},olSearchSymbol),new OpenLayers.Feature.Vector(e,{},olFeaturequerySymbol)]);d="p"===$("#select-feature-info").val()?!0:!1;!0==d?setMarkerhint(window.lang.convert("Meldung:"),window.lang.convert("bitte warten...")):0==querylayer.length?setMarkerhint(window.lang.convert("Meldung:"),window.lang.convert("bitte warten...")):
-$.mobile.changePage($("#featureinforesult"),pageTransition);$("#featurelist").empty();if(0<querylayer.length)for(b=0;b<querylayer.length;b++){if(c=querylayer,1<querylayer.length&&(c=$(querylayer[b])),0<c.find(".layer_checked").length){var e=c.attr("getmapurl")+"&SERVICE=WMS&REQUEST=getFeatureInfo&VERSION=1.1.1&mapfile="+c.attr("name")+"&layers="+c.attr("name")+"&QUERY_LAYERS="+c.attr("name")+"&SRS="+featurequerySrc+"&BBOX="+map.getExtent().toBBOX()+"&WIDTH="+map.size.w+"&HEIGHT="+map.size.h+"&X="+
-a.xy.x+"&Y="+a.xy.y+"&INFO_FORMAT=text/html&FORMAT=image/png&STYLES=",f=c.attr("getmapurl")+"service=wms&version=1.1.1&request=GetLegendGraphic&format=image/png&layer="+c.attr("name");featureValid(new FeatureResult(c.attr("title"),layerInList($("#ownlist"),c.attr("layerid")),e,f));d?(c=$('<iframe src="'+e+'" class="query_iframe"><p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'),setMarkerhint("Abfrageergebnis:",c)):(c=$('<iframe src="'+e+'" class="query_iframe_full"><p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'),
-$("#ficontentdiv").text(""),$("#ficontentdiv").append(c))}}else e="query/rasterqueryWms.php?coord="+b.lon+", "+b.lat+"&lang="+c,loadFeature(e)},CLASS_NAME:"OpenLayers.Control.Click"});$("#mapbenderbut").click(function(){$.mobile.changePage($("#mod_mapbender"),pageTransition);refresh()});$("#mapbendersearchformbut").click(function(){searchMaps(searchUrl+"&searchText="+$("#mapbendersearchfield").val())});$(document).on("keypress","#mapbendersearchfield",function(a){13===a.keyCode&&searchMaps(searchUrl+
-"&searchText="+$("#mapbendersearchfield").val())});$(document).on("expand","div[data-role=collapsible]",function(){$("div[data-role=collapsible]").not($(this)).trigger("collapse")});$(".addToMapBut").click(function(){$("div[data-role=collapsible]").not(".ui-collapsible-collapsed").trigger("collapse");$.mobile.changePage($("#mappage"),pageTransition)});addBaselayers()}function addFeatureCallback(a){$("#featurelist").append(a.html);refreshFeatureResults()}
+function addmyLayer(){OpenLayers.Control.Click=OpenLayers.Class(OpenLayers.Control,{defaultHandlerOptions:{single:!0,pixelTolerance:0,stopSingle:!1},initialize:function(a){this.handlerOptions=OpenLayers.Util.applyDefaults((a||{}).handlerOptions||{},this.defaultHandlerOptions);OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Click(this,{click:this.onClick},this.handlerOptions)},onClick:function(a){var b=map.getLonLatFromViewPortPx(a.xy),c=$("#ownlist").find(".query_checked").parent(),
+d=$("#select-lang").val(),e=new OpenLayers.Geometry.Point(b.lon,b.lat),f=new OpenLayers.Geometry.Point(b.lon,b.lat);vector_marker.removeAllFeatures();vector_marker.addFeatures([new OpenLayers.Feature.Vector(e,{},olSearchSymbol),new OpenLayers.Feature.Vector(f,{},olFeaturequerySymbol)]);e="p"===$("#select-feature-info").val()?!0:!1;!0==e?setMarkerhint(window.lang.convert("Meldung:"),window.lang.convert("bitte warten...")):0==c.length?setMarkerhint(window.lang.convert("Meldung:"),window.lang.convert("bitte warten...")):
+$.mobile.changePage($("#featureinforesult"),pageTransition);$("#featurelist").empty();if(0<c.length)for(b=0;b<c.length;b++){if(d=c,1<c.length&&(d=$(c[b])),0<d.find(".layer_checked").length){var f=d.attr("getmapurl")+"&SERVICE=WMS&REQUEST=getFeatureInfo&VERSION=1.1.1&mapfile="+d.attr("name")+"&layers="+d.attr("name")+"&QUERY_LAYERS="+d.attr("name")+"&SRS="+featurequerySrc+"&BBOX="+map.getExtent().toBBOX()+"&WIDTH="+map.size.w+"&HEIGHT="+map.size.h+"&X="+a.xy.x+"&Y="+a.xy.y+"&INFO_FORMAT=text/html&FORMAT=image/png&STYLES=",
+g=d.attr("getmapurl")+"service=wms&version=1.1.1&request=GetLegendGraphic&format=image/png&layer="+d.attr("name");featureValid(new FeatureResult(d.attr("title"),layerInList($("#ownlist"),d.attr("layerid")),f,g));e?(d=$('<iframe src="'+f+'" class="query_iframe"><p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'),setMarkerhint("Abfrageergebnis:",d)):(d=$('<iframe src="'+f+'" class="query_iframe_full"><p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'),$("#ficontentdiv").text(""),
+$("#ficontentdiv").append(d))}}else f="query/rasterqueryWms.php?coord="+b.lon+", "+b.lat+"&lang="+d,loadFeature(f)},CLASS_NAME:"OpenLayers.Control.Click"});$("#mapbenderbut").click(function(){$.mobile.changePage($("#mod_mapbender"),pageTransition);refresh()});$("#mapbendersearchformbut").click(function(){searchMaps(searchUrl+"&searchText="+$("#mapbendersearchfield").val())});$(document).on("keypress","#mapbendersearchfield",function(a){13===a.keyCode&&searchMaps(searchUrl+"&searchText="+$("#mapbendersearchfield").val())});
+$(document).on("expand","div[data-role=collapsible]",function(){$("div[data-role=collapsible]").not($(this)).trigger("collapse")});$(".addToMapBut").click(function(){$("div[data-role=collapsible]").not(".ui-collapsible-collapsed").trigger("collapse");$.mobile.changePage($("#mappage"),pageTransition)});addBaselayers()}function addFeatureCallback(a){$("#featurelist").append(a.html);refreshFeatureResults()}
 function featureValid(a){$.ajax({url:"map.php",type:"POST",data:{feature_url:a.url},success:function(b){"true"==b.split("\n")[0]&&addFeatureCallback(a)}})}
 function preview(a,b,c){$.ajax({previewurl:a,layerid:b,bbox:c,success:function(){$("#preview").find("div[data-role=content]").empty();$("#preview").find("div[data-role=content]").append('<img src="'+$(this).attr("previewurl")+'" alt="image" style="width:200px;">');var a=$(this).attr("bbox"),b=$(this).attr("layerid");$("#preview_zoom").click(function(){getOpenlayersIndex(b);zoomToBbox(a);$.mobile.changePage($("#mappage"),pageTransition)});$("#preview").popup("open")}})}
 getInfo=function(a){$("#info_content").empty();$("#info_content").append(a);$("#info").popup("open")};function getOpenlayersIndex(a){for(var b=0;b<map.layers.length;b++)if(map.layers[b].name==a)return b;return-1}function addOpenlayer(a,b,c){a=new OpenLayers.Layer.WMS(a,c,{layers:b,format:"image/png",transparent:"TRUE",transitionEffect:"resize"},{projection:mapProj,units:projUnits,opacity:0.8,singleTile:!0,isBaseLayer:!1,visibility:!0,alwaysInRange:!0});map.addLayer(a);map.setLayerIndex(a,0)}
@@ -47,6 +47,7 @@
 validateArrows(),refresh(),addOpenlayer(a.attr("layerid"),a.attr("name"),a.attr("getMapUrl")),$.mobile.hidePageLoadingMsg(),!0;$.mobile.hidePageLoadingMsg()}return!1}function removeLayer(a){layerInList($("#ownlist"),$(a).attr("layerid"));$($("#ownlist").find(".layer")[layerInList($("#ownlist"),$(a).attr("layerid"))]).remove();validateLayers();validateArrows();refresh();removeOpenlayer($(a).attr("layerid"))}
 function switchLayer(a){0>layerInList($("#ownlist"),$(a).attr("layerid"))?addLayer(a):removeLayer(a)}function addService(a){for(var a=a.find(".layer"),b=0;b<a.length&&!(addLayer($(a[b])),numOwnlayers()>maxlayers);b++);}function removeService(a){$.each(a.find(".layer"),function(a,c){removeLayer($(c))})}
 function switchVisibility(a){$(a).hasClass("layer")?($(a).find(".layer_visibility").toggleClass("layer_checked").toggleClass("layer_unchecked"),selectOpenlayer($(a).attr("layerid"),$(a).find(".layer_visibility").hasClass("layer_checked"))):($("#baselayers").find(".base_checked").addClass("base_unchecked").removeClass("base_checked"),$(a).addClass("base_checked").removeClass("base_unchecked"),setOpenBaselayer($(a).attr("layerids")))}
+function setQueryable(a,b){b?$(a).find(".query_queryable").addClass("query_checked").removeClass("query_noinfo"):$(a).find(".query_queryable").addClass("query_noinfo").removeClass("query_checked").removeClass("query_unchecked")}function setQueryCheck(a,b){b?$(a).find(".query_queryable").addClass("query_checked").removeClass("query_unchecked"):$(a).find(".query_queryable").addClass("query_unchecked").removeClass("query_checked")}
 function base_check(a){$("#baselayers").find(".base_checked").addClass("base_unchecked").removeClass("base_checked");$(a).addClass("base_checked").removeClass("base_unchecked")}
 function searchMaps(a){$.mobile.showPageLoadingMsg();$("#search_results").empty();$.getJSON(a,function(a){a=parseMapBenderJson(a);appendData(a.services,a.layers,a.nresults);$.mobile.hidePageLoadingMsg();a.nresults>maxresults&&getInfo("Es gab "+a.nresults+" Treffer, es k\u00f6nnen aber nur "+maxresults+" Ergebnisse angezeigt werden.</br><b>Schr\u00e4nken Sie Ihre Suche weiter ein.</b>")})}
 function searchWmc(a){$.mobile.showPageLoadingMsg();$("#search_results").empty();$.getJSON(a,function(a){appendWmc(a);$.mobile.hidePageLoadingMsg()})}
@@ -54,7 +55,7 @@
 function appendData(a,b,c){$("#resultlist").empty();for(var d=0;d<a.length;d++){var e=a[d];service=Service(e.id,e.title,$(e).attr("abstract"),e.getMapUrl,e.status,""==e.logoUrl?"mod_mapbender/img/defaulicon.png":e.logoUrl,e.symbolLink,e.avail);for(var f=0;f<b.length;f++){var g=b[f],h=g[1];g[0]==e.id&&service.append(ResultLayer(h.id,h.title,h.name,$(h).attr("abstract"),h.previewURL,"1"==h.queryable,e.getMapUrl,h.bbox))}$("#resultlist").append(service)}$("#resultlist").prepend('<li data-theme="b">Suchergebnis: '+
 numServices()+" Dienste, "+numResultLayers($("#resultlist"))+" Layer ("+c+" Treffer) </li>");validateLayers();refresh()}
 function appendWmcData(a,b,c,d,e){$("#ownlist").empty();for(var f=[],g=0;g<a.length;g++)for(var h=a[g],j=0;j<b.length;j++){var k=b[j],l=k[1];k[0]==h.id&&f.push(OwnLayer(l.id,l.title,l.name,$(l).attr("abstract"),h.title,$(h).attr("abstract"),l.previewURL,"1"==l.queryable,h.getMapUrl,l.bbox,h.avail))}for(g=0;g<c.length;g++)for(j=0;j<f.length;j++)if(c[g].layerId==f[j].attr("layerid")){k=f[j];$("#ownlist").append(k);addOpenlayer(k.attr("layerid"),k.attr("name"),k.attr("getMapUrl"));c[g].active||switchVisibility(k);
-break}validateLayers();validateArrows();b=d.split(",");a=(new OpenLayers.LonLat(b[0],b[1])).transform(e,mapProj);e=(new OpenLayers.LonLat(b[2],b[3])).transform(e,mapProj);map.zoomToExtent(new OpenLayers.Bounds(a.lon,a.lat,e.lon,e.lat))}function clearOwnlist(){for(var a=$("#ownlist").find(".layer"),b=0;b<a.length;b++)removeLayer(a[b])}
+c[g].layerQueryable?(setQueryable(k,!0),setQueryCheck(k,c[g].queryLayer)):setQueryable(k,!1);break}validateLayers();validateArrows();b=d.split(",");a=(new OpenLayers.LonLat(b[0],b[1])).transform(e,mapProj);e=(new OpenLayers.LonLat(b[2],b[3])).transform(e,mapProj);map.zoomToExtent(new OpenLayers.Bounds(a.lon,a.lat,e.lon,e.lat))}function clearOwnlist(){for(var a=$("#ownlist").find(".layer"),b=0;b<a.length;b++)removeLayer(a[b])}
 function appendWmc(a){for(var b=0;b<a.backGroundLayer.length;b++){var c=a.backGroundLayer[b];if(c.active)for(var d=$("#baselayers").find(".baselayer"),e=0;e<d.length;e++)if($(d[e]).attr("layerids")==c.name){switchVisibility(d[e]);break}}clearOwnlist();var f="";$.each(a.layerList,function(a,b){f=f+","+b.layerId});f=f.substr(1,f.length);$.getJSON(searchUrl+"&resourceIds="+f,function(b){b=parseMapBenderJson(b);appendWmcData(b.services,b.layers,a.layerList,a.wmc.bbox,a.wmc.crs);$.mobile.hidePageLoadingMsg()})}
 function addBaselayers(){$("#baselayers").empty();vector_marker=new OpenLayers.Layer.Vector("Vector Layer",{});gps_marker=new OpenLayers.Layer.Vector("gps_marker",{rendererOptions:{zIndexing:!0}});$("#baselayers").append(BaseLayer("RLP Zusammenstellung",atkis_praes_tms.name));$("#baselayers").append(BaseLayer("Luftbilder",luftbilder.name));$("#baselayers").append(BaseLayer("Keine Hintergrundkarte",grenze_leer.name));map.addLayers([atkis_praes_tms,luftbilder,grenze_leer,vector_marker,gps_marker]);
 for(i in baseinfo){var a=baseinfo[i][0],b=baseinfo[i][1];$("#baselayers").append(BaseLayer(a,b));addOpenBaselayer(a,b)}base_check($("#baselayers").find(".baselayer").first())}

Modified: trunk/mapbender/http/extensions/mobilemap/map.php
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/map.php	2014-10-21 08:48:40 UTC (rev 9103)
+++ trunk/mapbender/http/extensions/mobilemap/map.php	2014-10-21 09:04:42 UTC (rev 9104)
@@ -56,6 +56,7 @@
 	$DOM = new DOMDocument;
 	@$DOM->loadHTML($myhtml);
 	$items = $DOM->getElementsByTagName('body');
+	$controlstring = "false";
 	for ($i = 0; $i < $items->length; $i++)
 	{
 		$controlstring = $items->item($i)->nodeValue;
@@ -65,9 +66,9 @@
 
 	if (strlen($controlstring) > 80)
 	{
-		echo "true\n";		
+		exit("true\n");	
 	}
-	exit;
+	exit("false\n");
 }
 
 //SP: JS Interface

Modified: trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js	2014-10-21 08:48:40 UTC (rev 9103)
+++ trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js	2014-10-21 09:04:42 UTC (rev 9104)
@@ -526,6 +526,32 @@
 	}
 }
 
+//SP: Queryable eines Layers umschalten
+function setQueryable(layer, queryable)
+{
+	if (queryable)
+	{
+		$(layer).find('.query_queryable').addClass('query_checked').removeClass('query_noinfo');
+	}
+	else
+	{
+		$(layer).find('.query_queryable').addClass('query_noinfo').removeClass('query_checked').removeClass('query_unchecked');
+	}	
+}
+
+//SP: Abfragbarkeit eines Layers umschalten
+function setQueryCheck(layer, checked)
+{
+	if (checked)
+	{
+		$(layer).find('.query_queryable').addClass('query_checked').removeClass('query_unchecked');	
+	}
+	else
+	{
+		$(layer).find('.query_queryable').addClass('query_unchecked').removeClass('query_checked');
+	}
+}
+
 // Validierung der Baselayer-Auswahl
 function base_check(item){
 	$('#baselayers').find('.base_checked').addClass('base_unchecked').removeClass('base_checked');
@@ -660,6 +686,16 @@
 				if(!layerlist[i].active){ // Auswahl umschalten
 					switchVisibility(layer);
 				}
+				//SP: Layer Abfragbarkeit setzen
+				if (layerlist[i].layerQueryable)
+				{
+					setQueryable(layer, true);
+					setQueryCheck(layer, layerlist[i].queryLayer);
+				}
+				else
+				{
+					setQueryable(layer, false);
+				}
 				break;
 			}
 		}



More information about the Mapbender_commits mailing list