[Mapbender-commits] r9096 - in trunk/mapbender/http/extensions/mobilemap: . _build css mod_mapbender
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Oct 15 06:04:48 PDT 2014
Author: armin11
Date: 2014-10-15 06:04:48 -0700 (Wed, 15 Oct 2014)
New Revision: 9096
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/css/ngstyle.css
trunk/mapbender/http/extensions/mobilemap/map.php
trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.css
trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js
trunk/mapbender/http/extensions/mobilemap/mod_mapbender/searchobjects.js
Log:
New features for mobilemap extension: Multiple featureInfo & show legends
Modified: trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.js 2014-10-15 09:34:56 UTC (rev 9095)
+++ trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.js 2014-10-15 13:04:48 UTC (rev 9096)
@@ -638,15 +638,51 @@
collaps.append(table);
+ //SP: Legende
+ var legendurl = getMapUrl + 'service=wms&version=1.1.1&request=GetLegendGraphic&format=image/png&layer=' + name;
+ collaps.append($('<br><p><b>Legende:</b></p>'));
+ collaps.append($('<div class="legendcontainer" data-role="content"><img src="' + legendurl + '"></div>'));
+
layer.append(collaps);
return layer;
}
+//SP: Feature Info Result
+function FeatureResult(layername, position, featureurl, legendurl)
+{
+ // Public variables
+ this.layername = layername;
+ this.position = position;
+ this.url = featureurl;
+ this.html = $('<div>', {'data-sort':position});
+ // Collapsible
+ var collaps = $('<div class="collapsible unselected" data-role="collapsible" data-collapsed="true" data-theme="a" data-content-theme="c" data-inline="true" data-inset="true"></div>');
+ collaps.append('<h3>'+layername+'</h3>');
+
+ // Legende
+ collaps.append($('<div class="legendcontainer" data-role="content"><img src="' + legendurl + '"></div>'));
+ // Button
+ var button = $('<a data-role="button" data-icon="arrow-r" data-iconpos="right" target="_blank" href="'+featureurl+'">Info</a>');
+
+ // Grid Layout
+ var grid = $('<div class="ui-grid-a">');
+ var block_left = $('<div class="ui-block-a">');
+ block_left.append(collaps);
+ var block_right = $('<div class="ui-block-b">');
+ block_right.append(button);
+ grid.append(block_left);
+ grid.append(block_right);
+
+ // Fertig
+ this.html.append(grid);
+}
+
+
/*
Anmerkungen:
############
@@ -677,7 +713,7 @@
*/
-
+var templayer;
var maxlayers = 5;
var maxresults = 40;
@@ -712,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);
@@ -736,49 +772,70 @@
setMarkerhint(window.lang.convert('Meldung:'),window.lang.convert('bitte warten...'));
} else {
$.mobile.changePage($("#featureinforesult"),pageTransition);
- $("#ficontentdiv").text(window.lang.convert("Bitte warten..."));
+ //$("#ficontentdiv").text(window.lang.convert("Bitte warten..."));
}
}
+ //SP: Reset Feature List
+ $("#featurelist").empty();
//
- if(querylayer.length>0){
- // Abfrage des ausgewählten Layers
- //if abfrage ob ? vorkommt dann & sonst Fragezeichen
- var featureurl = querylayer.attr('getmapurl')
- + '&SERVICE=WMS&REQUEST=getFeatureInfo&VERSION=1.1.1'
- + '&mapfile='+ querylayer.attr('name')
- + '&layers=' + querylayer.attr('name') + '&QUERY_LAYERS=' + querylayer.attr('name')
- + '&SRS=' + featurequerySrc
- + '&BBOX=' + map.getExtent().toBBOX()
- + '&WIDTH=' + map.size.w + '&HEIGHT=' + map.size.h
- + '&X=' + evt.xy.x + '&Y=' + evt.xy.y
- + '&INFO_FORMAT=text/html'
- + '&FORMAT=image/png' //only for some wms that have problems if this parameter is not given
- + '&STYLES='; //only for some wms that have problems if this parameter is not given
-
- if (fiPopUp) {
- var iframe=$('<iframe src="'+featureurl+'" class="query_iframe">'
- +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
- );
- setMarkerhint('Abfrageergebnis:',iframe);
- } else {
- var iframe=$('<iframe src="'+featureurl+'" class="query_iframe_full">'
- +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
- );
- //alert(featureurl);
- //$.mobile.changePage($("#featureinforesult"),pageTransition);
- $("#ficontentdiv").text("");
- $("#ficontentdiv").append(iframe);
- //add onclick delete iframe from page
-
- }
+ if(querylayer.length>0) {
+ //SP: alle queryable layers iterieren
+ for (var i = 0; i < querylayer.length; i++) {
+ //SP: bei nur einem Feature direkte Referenz, ansonsten array
+ var ql = querylayer;
+ if (querylayer.length > 1) ql = $(querylayer[i]);
+ //SP: check layer visible
+ if (ql.find('.layer_checked').length > 0) {
+ // Abfrage des ausgewählten Layers
+ //if abfrage ob ? vorkommt dann & sonst Fragezeichen
+ var featureurl = ql.attr('getmapurl')
+ + '&SERVICE=WMS&REQUEST=getFeatureInfo&VERSION=1.1.1'
+ + '&mapfile='+ ql.attr('name')
+ + '&layers=' + ql.attr('name') + '&QUERY_LAYERS=' + ql.attr('name')
+ + '&SRS=' + featurequerySrc
+ + '&BBOX=' + map.getExtent().toBBOX()
+ + '&WIDTH=' + map.size.w + '&HEIGHT=' + map.size.h
+ + '&X=' + evt.xy.x + '&Y=' + evt.xy.y
+ + '&INFO_FORMAT=text/html'
+ + '&FORMAT=image/png' //only for some wms that have problems if this parameter is not given
+ + '&STYLES='; //only for some wms that have problems if this parameter is not given
+
+ // Legende für Feature Info
+ var legendurl = ql.attr('getmapurl')
+ + 'service=wms&version=1.1.1'
+ + '&request=GetLegendGraphic'
+ + '&format=image/png'
+ + '&layer=' + ql.attr('name');
+
+ //SP: check empty feature result!
+ featureValid(new FeatureResult(ql.attr('title'), layerInList($('#ownlist'), ql.attr('layerid')), featureurl, legendurl));
+
+ //SP: alter Code überflüssig, Popup ???
+ if (fiPopUp) {
+ var iframe=$('<iframe src="'+featureurl+'" class="query_iframe">'
+ +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
+ );
+ setMarkerhint('Abfrageergebnis:',iframe);
+ } else {
+ var iframe=$('<iframe src="'+featureurl+'" class="query_iframe_full">'
+ +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
+ );
+ //alert(featureurl);
+ //$.mobile.changePage($("#featureinforesult"),pageTransition);
+ $("#ficontentdiv").text("");
+ $("#ficontentdiv").append(iframe);
+ //add onclick delete iframe from page
+ }
+ } //end if layer checked
+ } //end for
} else {
- // Standardabfrage, falls keiner ausgewählt ist
- //d.h. dhm!
- var featureurl = 'query/rasterqueryWms.php?coord='+lonlat.lon+ ', '+lonlat.lat+'&lang='+actuallang;
- //alert(featureurl);
+ // Standardabfrage, falls keiner ausgewählt ist
+ //d.h. dhm!
+ var featureurl = 'query/rasterqueryWms.php?coord='+lonlat.lon+ ', '+lonlat.lat+'&lang='+actuallang;
+ //alert(featureurl);
loadFeature(featureurl);
- }
- },
+ }
+ },
CLASS_NAME: "OpenLayers.Control.Click"
});
@@ -817,7 +874,28 @@
}
+//SP: add feature to query results
+function addFeatureCallback(feature)
+{
+ $('#featurelist').append(feature.html);
+ refreshFeatureResults();
+}
+//SP: Is feature url valid, call php (PHP Interface über Ajax)
+function featureValid(feature)
+{
+ $.ajax(
+ {
+ url: 'map.php', //TODO: alter url ----
+ type: 'POST',
+ data: {feature_url:feature.url},
+ success: function(data)
+ {
+ var valid_url = data.split('\n')[0];
+ if (valid_url == "true") addFeatureCallback(feature);
+ }
+ });
+}
// ---------------
// Popupfenster:
@@ -999,6 +1077,28 @@
$('a[data-role=button]').button();
}
+//SP: Erneuern Feature List Results
+function refreshFeatureResults()
+{
+ $($('#featurelist').parent()).listview('refresh');
+ $('div[data-role=collapsible]').collapsible();
+ $('a[data-role=button]').button();
+
+ // Sortieren
+ $('#featurelist').append(getSorted($('#featurelist').children(), 'data-sort'));
+}
+
+//SP: JQuery Objekte nach Attribut sortieren
+function getSorted(selector, attrName)
+{
+ return $($(selector).toArray().sort(function(a, b)
+ {
+ var aVal = parseInt(a.getAttribute(attrName)),
+ bVal = parseInt(b.getAttribute(attrName));
+ return aVal - bVal;
+ }));
+}
+
// Layerauswahl kennntlich machen
function validateLayers(){
layers=$('#resultlist').find('.layer');
@@ -1026,7 +1126,7 @@
// Validierung der Queryable-Auswahl
function query_check(item){
if($(item).hasClass('query_unchecked')){
- $('#ownlist').find('.query_checked').addClass('query_unchecked').removeClass('query_checked');
+ //$('#ownlist').find('.query_checked').addClass('query_unchecked').removeClass('query_checked');
$(item).addClass('query_checked').removeClass('query_unchecked');
} else {
$(item).addClass('query_unchecked').removeClass('query_checked');
@@ -1600,24 +1700,17 @@
map.zoomOut();
});
- //Popup für erweitertes Popup-Menü initialisieren und öffnen
- $("#popupMenu").popup();
+ //Nachrichtenfenster schließen
+ $("#xheader").click(function(){
+ $('#markerhint').css('visibility','hidden');
+ vector_marker.removeAllFeatures();
+ });
- $("#menubut").click(function(){
- $("#popupMenu").popup( "open" );
- });
-
//Nachrichtenfenster schließen
- $("#xheader").click(function(){
- $('#markerhint').css('visibility','hidden');
- vector_marker.removeAllFeatures();
- });
-
- //Nachrichtenfenster schließen
$("#mheader").click(function(){
- $('#measurehint').css('visibility','hidden');
+ $('#measurehint').css('visibility','hidden');
toggleMeasure('off');
- });
+ });
//Suchbutton
$('#searchformbut').click(function() {
@@ -1625,7 +1718,7 @@
});
//Suchfeld
- $(document).on('keypress', '#searchfield', function(e) {
+ $(document).on('keydown', '#searchfield', function(e) {
if(e.keyCode === 13){
searchCall();
}
Modified: trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.min.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.min.js 2014-10-15 09:34:56 UTC (rev 9095)
+++ trunk/mapbender/http/extensions/mobilemap/_build/ngms_event.min.js 2014-10-15 13:04:48 UTC (rev 9096)
@@ -20,23 +20,29 @@
function BaseLayer(a,b){return $("<div>",{text:a,title:a,layerids:b,"class":"baselayer base_unchecked"}).click(function(){switchVisibility($(this))})}
function ResultLayer(a,b,c,d,e,f,g,h){a=$("<div>",{layerid:a,name:c,"class":"layer",title:b,desc:d,previewUrl:e,queryable:f,getMapURL:g,bbox:h});a.append($("<div>",{"class":"icon query_preview "+(f?"query_info":"query_noinfo"),text:" "}));a.append($("<div>",{"class":"layer_icon icon layer_add",text:" "}).click(function(){switchLayer($(this).parent())}));a.append('<div class="collapsible unselected" data-role="collapsible" data-collapsed="true" data-theme="a" data-content-theme="c" data-inset="true"><h3>'+
b+"</h3><h3>"+b+"</h3><p>"+d+"</p></div>");return a}
-function OwnLayer(a,b,c,d,e,f,g,h,j,k,l){c=$("<div>",{layerid:a,name:c,servicetitle:e,servicedesc:f,"class":"layer",title:b,desc:d,previewUrl:g,queryable:h,getMapURL:j,bbox:k,avail:l});c.append($("<div>",{"class":"layer_icon icon layer_remove",text:" "}).click(function(){removeLayer($(this).parent())}));h?c.append($("<div>",{"class":"icon query_queryable query_unchecked",text:" "}).click(function(){query_check($(this))})):c.append($("<div>",{"class":"icon query_queryable query_noinfo",text:" "}));
-c.append($("<div>",{"class":"icon layer_visibility layer_checked",text:" "}).click(function(){switchVisibility($(this).parent())}));c.append($("<div>",{"class":"icon move arrow_up",text:" "}).click(function(){up(a)}));h=$('<div class="collapsible unselected" data-role="collapsible" data-collapsed="true" data-theme="a" data-content-theme="c" data-inset="true"></div>');h.append("<h3>"+b+"</h3>");var j=$("<table></table>"),m=$("<tr></tr>"),n=$('<td class="layerinfo"></td>');g&&n.append($("<div>",{"class":"icon layer_preview",
-text:" "}).click(function(){zoomToBbox(k);$.mobile.changePage($("#mappage"),pageTransition)}));n.append("</br><p>"+l+"%</p>");g=$("<td></td>");g.append("<p><b>"+e+"</b></p><p>"+f+"</p>");g.append("<p><b>"+b+"</b></p><p>"+d+"</p>");m.append(n);m.append(g);j.append(m);h.append(j);c.append(h);return c}var 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=$("#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),$("#ficontentdiv").text(window.lang.convert("Bitte warten...")));0<c.length?(a=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=",e?(a=$('<iframe src="'+a+'" class="query_iframe"><p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'),
-setMarkerhint("Abfrageergebnis:",a)):(a=$('<iframe src="'+a+'" class="query_iframe_full"><p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'),$("#ficontentdiv").text(""),$("#ficontentdiv").append(a))):(a="query/rasterqueryWms.php?coord="+b.lon+", "+b.lat+"&lang="+d,loadFeature(a))},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 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")}})}
+function OwnLayer(a,b,c,d,e,f,g,h,j,k,l){var m=$("<div>",{layerid:a,name:c,servicetitle:e,servicedesc:f,"class":"layer",title:b,desc:d,previewUrl:g,queryable:h,getMapURL:j,bbox:k,avail:l});m.append($("<div>",{"class":"layer_icon icon layer_remove",text:" "}).click(function(){removeLayer($(this).parent())}));h?m.append($("<div>",{"class":"icon query_queryable query_unchecked",text:" "}).click(function(){query_check($(this))})):m.append($("<div>",{"class":"icon query_queryable query_noinfo",text:" "}));
+m.append($("<div>",{"class":"icon layer_visibility layer_checked",text:" "}).click(function(){switchVisibility($(this).parent())}));m.append($("<div>",{"class":"icon move arrow_up",text:" "}).click(function(){up(a)}));h=$('<div class="collapsible unselected" data-role="collapsible" data-collapsed="true" data-theme="a" data-content-theme="c" data-inset="true"></div>');h.append("<h3>"+b+"</h3>");var p=$("<table></table>"),n=$("<tr></tr>"),o=$('<td class="layerinfo"></td>');g&&o.append($("<div>",{"class":"icon layer_preview",
+text:" "}).click(function(){zoomToBbox(k);$.mobile.changePage($("#mappage"),pageTransition)}));o.append("</br><p>"+l+"%</p>");g=$("<td></td>");g.append("<p><b>"+e+"</b></p><p>"+f+"</p>");g.append("<p><b>"+b+"</b></p><p>"+d+"</p>");n.append(o);n.append(g);p.append(n);h.append(p);b=j+"service=wms&version=1.1.1&request=GetLegendGraphic&format=image/png&layer="+c;h.append($("<br><p><b>Legende:</b></p>"));h.append($('<div class="legendcontainer" data-role="content"><img src="'+b+'"></div>'));m.append(h);
+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 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)}
function removeOpenlayer(a){a=getOpenlayersIndex(a);0<=a&&map.removeLayer(map.layers[a])}function setOpenBaselayer(a){a=getOpenlayersIndex(a);0<=a&&map.setBaseLayer(map.layers[a])}function selectOpenlayer(a,b){var c=getOpenlayersIndex(a);0<=c&&map.layers[c].setVisibility(b)}
function addOpenBaselayer(a,b){$.getJSON("mod_mapbender/search_proxy.php?languageCode=de&resultTarget=web&resourceIds="+b,function(b){$.each(b.wms.srv,function(b,c){$.each(c.layer,function(b,d){d.layer&&(d=d.layer[0]);var h=new OpenLayers.Layer.WMS(a,c.getMapUrl,{layers:d.name,format:"image/png",transparent:"false",transitionEffect:"resize"},{projection:mapProj,units:projUnits,singleTile:!0,isBaseLayer:!0,alwaysInRange:!0});map.addLayers([h])})})})}
function zoomToBbox(a){var b=a.split(","),a=(new OpenLayers.LonLat(b[0],b[1])).transform(wgs84Proj,mapProj),b=(new OpenLayers.LonLat(b[2],b[3])).transform(wgs84Proj,mapProj);map.zoomToExtent(new OpenLayers.Bounds(a.lon,a.lat,b.lon,b.lat))}function numServices(){return $("#resultlist").find(".service").length}function numResultLayers(a){return a.find(".layer").length}function layerInList(a,b){for(var c=a.find(".layer"),d=0;d<c.length;d++)if($(c[d]).attr("layerid")==b)return d;return-1}
function up(a){var b=layerInList($("#ownlist"),a);0<b&&($($("#ownlist").find(".layer")[b]).after($($("#ownlist").find(".layer")[b-1])),console.log("todo: layerreihenfolge"),map.raiseLayer(map.layers[getOpenlayersIndex(a)],1),validateArrows(),refresh())}function numOwnlayers(){return $("#ownlist").find(".layer").length}
-function refresh(){$("#resultlist").listview("refresh");$($("#ownlist").parent()).listview("refresh");$("div[data-role=collapsible]").collapsible();$("a[data-role=button]").button()}
+function refresh(){$("#resultlist").listview("refresh");$($("#ownlist").parent()).listview("refresh");$("div[data-role=collapsible]").collapsible();$("a[data-role=button]").button()}function refreshFeatureResults(){$($("#featurelist").parent()).listview("refresh");$("div[data-role=collapsible]").collapsible();$("a[data-role=button]").button();$("#featurelist").append(getSorted($("#featurelist").children(),"data-sort"))}
+function getSorted(a,b){return $($(a).toArray().sort(function(a,d){var e=parseInt(a.getAttribute(b)),f=parseInt(d.getAttribute(b));return e-f}))}
function validateLayers(){layers=$("#resultlist").find(".layer");$.each(layers,function(a,b){0<=layerInList($("#ownlist"),$(b).attr("layerid"))?($(b).find(".layer_icon").first().attr("class","layer_icon icon layer_remove"),$(b).find(".collapsible").first().removeClass("unselected").addClass("selected")):($(b).find(".layer_icon").first().attr("class","layer_icon icon layer_add"),$(b).find(".collapsible").first().removeClass("selected").addClass("unselected"))})}
-function validateArrows(){var a=$("#ownlist").find(".move");$(a[0]).attr("class","icon move arrow_empty");1<a.length&&$(a[1]).attr("class","icon move arrow_up")}function query_check(a){$(a).hasClass("query_unchecked")?($("#ownlist").find(".query_checked").addClass("query_unchecked").removeClass("query_checked"),$(a).addClass("query_checked").removeClass("query_unchecked")):$(a).addClass("query_unchecked").removeClass("query_checked")}
+function validateArrows(){var a=$("#ownlist").find(".move");$(a[0]).attr("class","icon move arrow_empty");1<a.length&&$(a[1]).attr("class","icon move arrow_up")}function query_check(a){$(a).hasClass("query_unchecked")?$(a).addClass("query_checked").removeClass("query_unchecked"):$(a).addClass("query_unchecked").removeClass("query_checked")}
function addLayer(a){if(numOwnlayers()>=maxlayers)getInfo("Es können nicht mehr als "+maxlayers+" Ebenen zur Auswahl hinzugefügt werden.");else{$.mobile.showPageLoadingMsg();if(0>layerInList($("#ownlist"),$(a).attr("layerid")))return $("#ownlist").append(OwnLayer(a.attr("layerid"),a.attr("title"),a.attr("name"),a.attr("desc"),a.parent().attr("title"),a.parent().attr("desc"),a.attr("previewUrl"),"true"==a.attr("queryable"),a.attr("getMapUrl"),a.attr("bbox"),a.parent().attr("avail"))),validateLayers(),
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))})}
@@ -57,12 +63,12 @@
polygon:new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{persist:!0,handlerOptions:{layerOptions:{styleMap:a}}})};for(var b in measureControls)a=measureControls[b],a.events.on({measure:handleMeasurements,measurepartial:handleMeasurements}),map.addControl(a)};
$(document).ready(function(){window.location.hash&&"#mappage"!=window.location.hash&&$.mobile.changePage($("#mappage"),pageTransition);initmap();zoomSelect&&($("#zoomscale").css("visibility","visible"),createZoomselect(),map.events.register("moveend",null,displayZoom));clickCtrl=new OpenLayers.Control.Click;map.addControl(clickCtrl);clickCtrl.activate();checkLayers();$("#autolayerchange").change(function(){directLayerChange=this.value});$("#layerbut").click(function(){$.mobile.changePage($("#layerpage"),
pageTransition)});$("#searchbut").click(function(){$.mobile.changePage($("#searchpage"),pageTransition)});$("#helpbut").click(function(){$.mobile.changePage($("#helppage"),pageTransition)});$("#gearbut").click(function(){$.mobile.changePage($("#gearpage"),pageTransition)});$("#measurelinebut").click(function(){toggleMeasure("line")});$("#measurepolybut").click(function(){toggleMeasure("polygon")});$("#ovbut").click(function(){map.zoomToExtent(map.maxExtent)});$("#zoominbut").click(function(){map.zoomIn()});
-$("#zoomoutbut").click(function(){map.zoomOut()});$("#popupMenu").popup();$("#menubut").click(function(){$("#popupMenu").popup("open")});$("#xheader").click(function(){$("#markerhint").css("visibility","hidden");vector_marker.removeAllFeatures()});$("#mheader").click(function(){$("#measurehint").css("visibility","hidden");toggleMeasure("off")});$("#searchformbut").click(function(){searchCall()});$(document).on("keypress","#searchfield",function(a){13===a.keyCode&&searchCall()});$(".mapbackbut").click(function(){$.mobile.changePage($("#mappage"),
-pageTransition);$("body").css("overflow","hidden")});$("#popupMenu").popup();$("#menubut").click(function(){$("#popupMenu").popup("open")});$("#popupMenu_gps").popup();$("#locatebut").click(function(){$("#popupMenu_gps").popup("open")});$("#gpsstatus").change(function(){"on"===this.value?startgpsWatch():stopgpsWatch()});$(".baselayer_check").click(function(){$(".baselayer_check").css("background-image","url(img/ico_basecheck.png)");$(this).css("background-image","url(img/ico_basecheck_active.png)");
-for(var a=0;a<map.layers.length;a++)$(this).attr("id")===map.layers[a].name&&map.setBaseLayer(map.layers[a]);clearanimation();checktranspage()});$(".layer_check").click(function(){for(var a=0;a<map.layers.length;a++)if($(this).attr("id")===map.layers[a].name)var b=a;map.layers[b].getVisibility()?(map.layers[b].setVisibility(!1),$(this).css("background-image","url(img/ico_check.png)")):(map.layers[b].setVisibility(!0),$(this).css("background-image","url(img/ico_check_active.png)"));clearanimation();
-checktranspage()});$(".poi_check").click(function(){var a=poilayer.params.LAYERS,b=[];""!=a&&(b=a.split(","));if(-1!=jQuery.inArray($(this).attr("id"),b)){for(a=0;a<b.length;a++)$(this).attr("id")===b[a]&&b.splice(a,1);$(this).css("background-image","url(img/ico_check.png)")}else b.push($(this).attr("id")),$(this).css("background-image","url(img/ico_check_active.png)");a=b.join(",");poilayer.mergeNewParams({layers:a});0<b.length&&poilayer.setVisibility(!0);poilayer.redraw();clearanimation();checktranspage()});
-$(".query_check").click(function(){$(".query_check").css("background-image","url(img/ico_checkop.png)");$(this).css("background-image","url(img/ico_checkop_active.png)");var a=$(this).attr("id"),a=a.substring(0,a.length-6);$("#queryselect").val(a);clearanimation()});$(".query_check").touchstart(function(){$(this).css("background-color","#808080")});$(".layer_check").touchstart(function(){$(this).css("background-color","#808080");$(this).css("color","#FFFFFF")});$(".baselayer_check").touchstart(function(){$(this).css("background-color",
-"#808080");$(this).css("color","#FFFFFF")});$(".navbuttons").touchstart(function(){$(this).css("border","2px solid #808080")});$(".navbuttons").touchend(function(){$(this).css("border","2px solid "+toolColor)});$(document).on("touchstart",".searchbutton",function(){$(this).css("border","2px solid #808080")});changeHand(defaultHand);$("#autolayerchange").val(directLayerChange);hideAddressBar()});
+$("#zoomoutbut").click(function(){map.zoomOut()});$("#xheader").click(function(){$("#markerhint").css("visibility","hidden");vector_marker.removeAllFeatures()});$("#mheader").click(function(){$("#measurehint").css("visibility","hidden");toggleMeasure("off")});$("#searchformbut").click(function(){searchCall()});$(document).on("keydown","#searchfield",function(a){13===a.keyCode&&searchCall()});$(".mapbackbut").click(function(){$.mobile.changePage($("#mappage"),pageTransition);$("body").css("overflow",
+"hidden")});$("#popupMenu").popup();$("#menubut").click(function(){$("#popupMenu").popup("open")});$("#popupMenu_gps").popup();$("#locatebut").click(function(){$("#popupMenu_gps").popup("open")});$("#gpsstatus").change(function(){"on"===this.value?startgpsWatch():stopgpsWatch()});$(".baselayer_check").click(function(){$(".baselayer_check").css("background-image","url(img/ico_basecheck.png)");$(this).css("background-image","url(img/ico_basecheck_active.png)");for(var a=0;a<map.layers.length;a++)$(this).attr("id")===
+map.layers[a].name&&map.setBaseLayer(map.layers[a]);clearanimation();checktranspage()});$(".layer_check").click(function(){for(var a=0;a<map.layers.length;a++)if($(this).attr("id")===map.layers[a].name)var b=a;map.layers[b].getVisibility()?(map.layers[b].setVisibility(!1),$(this).css("background-image","url(img/ico_check.png)")):(map.layers[b].setVisibility(!0),$(this).css("background-image","url(img/ico_check_active.png)"));clearanimation();checktranspage()});$(".poi_check").click(function(){var a=
+poilayer.params.LAYERS,b=[];""!=a&&(b=a.split(","));if(-1!=jQuery.inArray($(this).attr("id"),b)){for(a=0;a<b.length;a++)$(this).attr("id")===b[a]&&b.splice(a,1);$(this).css("background-image","url(img/ico_check.png)")}else b.push($(this).attr("id")),$(this).css("background-image","url(img/ico_check_active.png)");a=b.join(",");poilayer.mergeNewParams({layers:a});0<b.length&&poilayer.setVisibility(!0);poilayer.redraw();clearanimation();checktranspage()});$(".query_check").click(function(){$(".query_check").css("background-image",
+"url(img/ico_checkop.png)");$(this).css("background-image","url(img/ico_checkop_active.png)");var a=$(this).attr("id"),a=a.substring(0,a.length-6);$("#queryselect").val(a);clearanimation()});$(".query_check").touchstart(function(){$(this).css("background-color","#808080")});$(".layer_check").touchstart(function(){$(this).css("background-color","#808080");$(this).css("color","#FFFFFF")});$(".baselayer_check").touchstart(function(){$(this).css("background-color","#808080");$(this).css("color","#FFFFFF")});
+$(".navbuttons").touchstart(function(){$(this).css("border","2px solid #808080")});$(".navbuttons").touchend(function(){$(this).css("border","2px solid "+toolColor)});$(document).on("touchstart",".searchbutton",function(){$(this).css("border","2px solid #808080")});changeHand(defaultHand);$("#autolayerchange").val(directLayerChange);hideAddressBar()});
var clearanimation=function(){$(".query_check").css("background-color","#808080");$(".layer_check, .baselayer_check, .poi_check").css("background-color","#FFFFFF");$(".layer_check, .baselayer_check, .poi_check").css("color","#000000")},checktranspage=function(){"on"===directLayerChange&&$.mobile.changePage($("#mappage"),pageTransition)},checkLayers=function(){$(".baselayer_check").each(function(){for(var a=0;a<map.layers.length;a++)map.layers[a].name===$(this).attr("id")&&map.layers[a].visibility&&
$(this).css("background-image","url(img/ico_basecheck_active.png)")});$(".layer_check").each(function(){for(var a=0;a<map.layers.length;a++)map.layers[a].name===$(this).attr("id")&&map.layers[a].visibility&&$(this).css("background-image","url(img/ico_check_active.png)")});$(".poi_check").each(function(){var a=poilayer.params.LAYERS,b=[];""!=a&&(b=a.split(","));-1!=jQuery.inArray($(this).attr("id"),b)&&$(this).css("background-image","url(img/ico_check.png)")});$(".query_check").each(function(){var a=
$(this).attr("id");a.substring(0,a.length-6)===$("#queryselect").val()&&$(this).css("background-image","url(img/ico_checkop_active.png)")})};function searchCall(){"google"===searchMode?codeAddress():"streetsearch"===searchMode?searchStreet($("#searchfield").val()):"mapbendersearch"===searchMode?searchMapbender($("#searchfield").val()):alert("kein Suchmodus konfiguriert!")}function setMarkerhint(a,b){$("#xheader").html(a);$("#xcontent").html(b);$("#markerhint").css("visibility","visible")}
Modified: trunk/mapbender/http/extensions/mobilemap/css/ngstyle.css
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/css/ngstyle.css 2014-10-15 09:34:56 UTC (rev 9095)
+++ trunk/mapbender/http/extensions/mobilemap/css/ngstyle.css 2014-10-15 13:04:48 UTC (rev 9096)
@@ -458,3 +458,12 @@
max-width: 24px;
top: 1.6em;
}
+
+/* //SP: Container für Legend-Graphic */
+.legendcontainer
+{
+ width: 100%;
+ max-height: 300px;
+ overflow-x: auto;
+ overflow-y: auto;
+}
Modified: trunk/mapbender/http/extensions/mobilemap/map.php
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/map.php 2014-10-15 09:34:56 UTC (rev 9095)
+++ trunk/mapbender/http/extensions/mobilemap/map.php 2014-10-15 13:04:48 UTC (rev 9096)
@@ -1,6 +1,7 @@
<?php
//Basic configuration of mapserver client
require_once(dirname(__FILE__)."/../../../conf/mobilemap.conf");
+require_once(dirname(__FILE__)."/../../classes/class_connector.php");
//Fixes IPhone, Android 2.x
if(strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'Android 2.')) {
@@ -38,6 +39,43 @@
die();
}
}
+
+//SP: Content data from url TODO - exchange with mapbender class!
+function get_data($url)
+{
+ $connector = new connector($url);
+ return $connector->file;
+}
+
+//SP: Feature Url Validierung
+function feature_valid($feature_url)
+{
+ $myhtml = get_data($feature_url);
+
+ // get body von featureinfo
+ $DOM = new DOMDocument;
+ @$DOM->loadHTML($myhtml);
+ $items = $DOM->getElementsByTagName('body');
+ for ($i = 0; $i < $items->length; $i++)
+ {
+ $controlstring = $items->item($i)->nodeValue;
+ }
+ $controlstring = trim($controlstring);
+ $controlstring = str_replace("\t", '', $controlstring);
+
+ if (strlen($controlstring) > 80)
+ {
+ echo "true\n";
+ }
+ exit;
+}
+
+//SP: JS Interface
+if (isset($_POST['feature_url']))
+{
+ feature_valid($_POST['feature_url']);
+}
+
?>
<!DOCTYPE html>
<html>
@@ -323,8 +361,15 @@
<h1><span lang="de">Sachdatenanzeige</span></h1>
</div>
<!-- /header -->
+ <!-- //SP: Feature Info Liste -->
+ <div data-role="content" style="padding: 10px; overflow:hidden;">
+ <ul data-role="listview" data-inset="true">
+ <li data-theme="b">Objekte</li>
+ <li id="featurelist"></li>
+ </ul>
+ </div>
<!-- <div data-role="content" style="padding: 10px" >-->
- <div id="ficontentdiv" style="height: 500px"> </div>
+ <!-- <div id="ficontentdiv" style="height: 500px"> </div>-->
<!-- </div>-->
</div>
<!-- /FeatureInfo Seite Ende-->
Modified: trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.css
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.css 2014-10-15 09:34:56 UTC (rev 9095)
+++ trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.css 2014-10-15 13:04:48 UTC (rev 9096)
@@ -293,3 +293,12 @@
height: 100%;
border:none;
}
+/* //SP: Button Container für Feature Results */
+.ui-block-a
+{
+ width: 70% !important;
+}
+.ui-block-b
+{
+ width: 30% !important;
+}
Modified: trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js 2014-10-15 09:34:56 UTC (rev 9095)
+++ trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search.js 2014-10-15 13:04:48 UTC (rev 9096)
@@ -28,7 +28,7 @@
*/
-
+var templayer;
var maxlayers = 5;
var maxresults = 40;
@@ -87,49 +87,70 @@
setMarkerhint(window.lang.convert('Meldung:'),window.lang.convert('bitte warten...'));
} else {
$.mobile.changePage($("#featureinforesult"),pageTransition);
- $("#ficontentdiv").text(window.lang.convert("Bitte warten..."));
+ //$("#ficontentdiv").text(window.lang.convert("Bitte warten..."));
}
}
+ //SP: Reset Feature List
+ $("#featurelist").empty();
//
- if(querylayer.length>0){
- // Abfrage des ausgewählten Layers
- //if abfrage ob ? vorkommt dann & sonst Fragezeichen
- var featureurl = querylayer.attr('getmapurl')
- + '&SERVICE=WMS&REQUEST=getFeatureInfo&VERSION=1.1.1'
- + '&mapfile='+ querylayer.attr('name')
- + '&layers=' + querylayer.attr('name') + '&QUERY_LAYERS=' + querylayer.attr('name')
- + '&SRS=' + featurequerySrc
- + '&BBOX=' + map.getExtent().toBBOX()
- + '&WIDTH=' + map.size.w + '&HEIGHT=' + map.size.h
- + '&X=' + evt.xy.x + '&Y=' + evt.xy.y
- + '&INFO_FORMAT=text/html'
- + '&FORMAT=image/png' //only for some wms that have problems if this parameter is not given
- + '&STYLES='; //only for some wms that have problems if this parameter is not given
-
- if (fiPopUp) {
- var iframe=$('<iframe src="'+featureurl+'" class="query_iframe">'
- +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
- );
- setMarkerhint('Abfrageergebnis:',iframe);
- } else {
- var iframe=$('<iframe src="'+featureurl+'" class="query_iframe_full">'
- +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
- );
- //alert(featureurl);
- //$.mobile.changePage($("#featureinforesult"),pageTransition);
- $("#ficontentdiv").text("");
- $("#ficontentdiv").append(iframe);
- //add onclick delete iframe from page
-
- }
+ if(querylayer.length>0) {
+ //SP: alle queryable layers iterieren
+ for (var i = 0; i < querylayer.length; i++) {
+ //SP: bei nur einem Feature direkte Referenz, ansonsten array
+ var ql = querylayer;
+ if (querylayer.length > 1) ql = $(querylayer[i]);
+ //SP: check layer visible
+ if (ql.find('.layer_checked').length > 0) {
+ // Abfrage des ausgewählten Layers
+ //if abfrage ob ? vorkommt dann & sonst Fragezeichen
+ var featureurl = ql.attr('getmapurl')
+ + '&SERVICE=WMS&REQUEST=getFeatureInfo&VERSION=1.1.1'
+ + '&mapfile='+ ql.attr('name')
+ + '&layers=' + ql.attr('name') + '&QUERY_LAYERS=' + ql.attr('name')
+ + '&SRS=' + featurequerySrc
+ + '&BBOX=' + map.getExtent().toBBOX()
+ + '&WIDTH=' + map.size.w + '&HEIGHT=' + map.size.h
+ + '&X=' + evt.xy.x + '&Y=' + evt.xy.y
+ + '&INFO_FORMAT=text/html'
+ + '&FORMAT=image/png' //only for some wms that have problems if this parameter is not given
+ + '&STYLES='; //only for some wms that have problems if this parameter is not given
+
+ // Legende für Feature Info
+ var legendurl = ql.attr('getmapurl')
+ + 'service=wms&version=1.1.1'
+ + '&request=GetLegendGraphic'
+ + '&format=image/png'
+ + '&layer=' + ql.attr('name');
+
+ //SP: check empty feature result!
+ featureValid(new FeatureResult(ql.attr('title'), layerInList($('#ownlist'), ql.attr('layerid')), featureurl, legendurl));
+
+ //SP: alter Code überflüssig, Popup ???
+ if (fiPopUp) {
+ var iframe=$('<iframe src="'+featureurl+'" class="query_iframe">'
+ +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
+ );
+ setMarkerhint('Abfrageergebnis:',iframe);
+ } else {
+ var iframe=$('<iframe src="'+featureurl+'" class="query_iframe_full">'
+ +'<p>Die Abfrage kann leider nicht angezeigt werden.</p></img>'
+ );
+ //alert(featureurl);
+ //$.mobile.changePage($("#featureinforesult"),pageTransition);
+ $("#ficontentdiv").text("");
+ $("#ficontentdiv").append(iframe);
+ //add onclick delete iframe from page
+ }
+ } //end if layer checked
+ } //end for
} else {
- // Standardabfrage, falls keiner ausgewählt ist
- //d.h. dhm!
- var featureurl = 'query/rasterqueryWms.php?coord='+lonlat.lon+ ', '+lonlat.lat+'&lang='+actuallang;
- //alert(featureurl);
+ // Standardabfrage, falls keiner ausgewählt ist
+ //d.h. dhm!
+ var featureurl = 'query/rasterqueryWms.php?coord='+lonlat.lon+ ', '+lonlat.lat+'&lang='+actuallang;
+ //alert(featureurl);
loadFeature(featureurl);
- }
- },
+ }
+ },
CLASS_NAME: "OpenLayers.Control.Click"
});
@@ -168,7 +189,28 @@
}
+//SP: add feature to query results
+function addFeatureCallback(feature)
+{
+ $('#featurelist').append(feature.html);
+ refreshFeatureResults();
+}
+//SP: Is feature url valid, call php (PHP Interface über Ajax)
+function featureValid(feature)
+{
+ $.ajax(
+ {
+ url: 'map.php', //TODO: alter url ----
+ type: 'POST',
+ data: {feature_url:feature.url},
+ success: function(data)
+ {
+ var valid_url = data.split('\n')[0];
+ if (valid_url == "true") addFeatureCallback(feature);
+ }
+ });
+}
// ---------------
// Popupfenster:
@@ -350,6 +392,28 @@
$('a[data-role=button]').button();
}
+//SP: Erneuern Feature List Results
+function refreshFeatureResults()
+{
+ $($('#featurelist').parent()).listview('refresh');
+ $('div[data-role=collapsible]').collapsible();
+ $('a[data-role=button]').button();
+
+ // Sortieren
+ $('#featurelist').append(getSorted($('#featurelist').children(), 'data-sort'));
+}
+
+//SP: JQuery Objekte nach Attribut sortieren
+function getSorted(selector, attrName)
+{
+ return $($(selector).toArray().sort(function(a, b)
+ {
+ var aVal = parseInt(a.getAttribute(attrName)),
+ bVal = parseInt(b.getAttribute(attrName));
+ return aVal - bVal;
+ }));
+}
+
// Layerauswahl kennntlich machen
function validateLayers(){
layers=$('#resultlist').find('.layer');
@@ -377,7 +441,7 @@
// Validierung der Queryable-Auswahl
function query_check(item){
if($(item).hasClass('query_unchecked')){
- $('#ownlist').find('.query_checked').addClass('query_unchecked').removeClass('query_checked');
+ //$('#ownlist').find('.query_checked').addClass('query_unchecked').removeClass('query_checked');
$(item).addClass('query_checked').removeClass('query_unchecked');
} else {
$(item).addClass('query_unchecked').removeClass('query_checked');
Modified: trunk/mapbender/http/extensions/mobilemap/mod_mapbender/searchobjects.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/mod_mapbender/searchobjects.js 2014-10-15 09:34:56 UTC (rev 9095)
+++ trunk/mapbender/http/extensions/mobilemap/mod_mapbender/searchobjects.js 2014-10-15 13:04:48 UTC (rev 9096)
@@ -91,12 +91,48 @@
collaps.append(table);
+ //SP: Legende
+ var legendurl = getMapUrl + 'service=wms&version=1.1.1&request=GetLegendGraphic&format=image/png&layer=' + name;
+ collaps.append($('<br><p><b>Legende:</b></p>'));
+ collaps.append($('<div class="legendcontainer" data-role="content"><img src="' + legendurl + '"></div>'));
+
layer.append(collaps);
return layer;
}
+//SP: Feature Info Result
+function FeatureResult(layername, position, featureurl, legendurl)
+{
+ // Public variables
+ this.layername = layername;
+ this.position = position;
+ this.url = featureurl;
+ this.html = $('<div>', {'data-sort':position});
+ // Collapsible
+ var collaps = $('<div class="collapsible unselected" data-role="collapsible" data-collapsed="true" data-theme="a" data-content-theme="c" data-inline="true" data-inset="true"></div>');
+ collaps.append('<h3>'+layername+'</h3>');
+
+ // Legende
+ collaps.append($('<div class="legendcontainer" data-role="content"><img src="' + legendurl + '"></div>'));
+ // Button
+ var button = $('<a data-role="button" data-icon="arrow-r" data-iconpos="right" target="_blank" href="'+featureurl+'">Info</a>');
+
+ // Grid Layout
+ var grid = $('<div class="ui-grid-a">');
+ var block_left = $('<div class="ui-block-a">');
+ block_left.append(collaps);
+ var block_right = $('<div class="ui-block-b">');
+ block_right.append(button);
+ grid.append(block_left);
+ grid.append(block_right);
+
+ // Fertig
+ this.html.append(grid);
+}
+
+
More information about the Mapbender_commits
mailing list