svn commit: r358 - trunk/mapbender/http/javascripts/mod_legend.php
astrid_emde at osgeo.org
astrid_emde at osgeo.org
Mon May 29 11:26:05 EDT 2006
Author: astrid_emde
Date: 2006-05-29 15:26:05+0000
New Revision: 358
Modified:
trunk/mapbender/http/javascripts/mod_legend.php
Log:
mapd_legend bug fixed:
- don't show wms title if no legend for the wms is available
Modified: trunk/mapbender/http/javascripts/mod_legend.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_legend.php?view=diff&rev=358&p1=trunk/mapbender/http/javascripts/mod_legend.php&p2=trunk/mapbender/http/javascripts/mod_legend.php&r1=357&r2=358
==============================================================================
--- trunk/mapbender/http/javascripts/mod_legend.php (original)
+++ trunk/mapbender/http/javascripts/mod_legend.php 2006-05-29 15:26:05+0000
@@ -116,86 +116,102 @@
var layers;
var str = "";
+ var str_tmp = "";
//str += "<a href='' title='Legende anzeigen' target='_blank'>Legende</a>";
for(var i=0; i<parent.mb_mapObj[ind].wms.length; i++){
var img_format = parent.mb_mapObj[ind].wms[i].gui_wms_mapformat;
if(parent.mb_mapObj[ind].wms[i].wms_getlegendurl != ""){
-
+
//header
layers = parent.mb_checkScale(mod_legend_target,ind,i);
-
- if(layers[0] != ""){
- if (showwmstitle == 'true'){
- str += "<span class='header'>" +parent.mb_mapObj[ind].wms[i].wms_title+ "</span>";
- }
+
+ if(layers[0] != ""){
var layer = layers[0].split(",");
var titles = layers[2].split(",");
var legendurl = layers[3].split(",");
var layerparent= layers[4].split(",");
var tmp_name = "";
+
+
+
for(var j=0; j<layer.length; j++){
- var l = parent.mb_getchildsbyname(ind,i,layer[j]);
-
- //str += "test:"+ layer[j]+"/"+titles[j]+"<br>";
- // handle grouped layers
- if (l){
- if (showlayertitle == 'true'){
- str += "<div><span class='titles'>" + titles[j]+ "</span></div>";
- }
- for (var k=0; k<l["name"].length; k++){
- if (l["legendurl"][k]!='' && l["legendurl"][k]!=0){
- if (tmp_name != l["title"][k]){
- if (showgroupedlayertitle == 'true'){
- str += "<div><span class='titles'>" +l["title"][k]+ "</span></div>";
- }
- str += "<div>";
- if(legendlink == 'true'){
- str += "<a href='../php/result.php?lingo=deutsch&layer="+layer[j]+l["name"][k]+"' class='legendlink' title='Zeigt Liste zum Thema: "+titles[j]+"' target='result'>";
- }
- str += "<img border=0 src = '";
- str += l["legendurl"][k];
- str += "'></img>";
- //str += l["legendurl"][k];
- if (legendlink == 'true'){
- str += "</a>";
- }
- str += "</div>";
+
+ var l = parent.mb_getchildsbyname(ind,i,layer[j]);
+
+ //str_tmp += "test:"+ layer[j]+"/"+titles[j]+"<br>";
+ // handle grouped layers
+ if (l) {
+ if (showlayertitle == 'true'){
+ str_tmp += "<div><span class='titles'>" + titles[j]+ "</span></div>";
+ }
+ for (var k=0; k<l["name"].length; k++){
+ if (l["legendurl"][k]!='' && l["legendurl"][k]!=0){
+ if (tmp_name != l["title"][k]) {
+ if (showgroupedlayertitle == 'true'){
+ str_tmp += "<div><span class='titles'>" +l["title"][k]+ "</span></div>";
+ }
+ str_tmp += "<div>";
+ if(legendlink == 'true'){
+ str_tmp += "<a href='../php/result.php?lingo=deutsch&layer="+layer[j]+l["name"][k]+"' class='legendlink' title='Zeigt Liste zum Thema: "+titles[j]+"' target='result'>";
+ }
+ str_tmp += "<img border=0 src = '";
+ str_tmp += l["legendurl"][k];
+ str_tmp += "'></img>";
+ //str_tmp += l["legendurl"][k];
+ if (legendlink == 'true'){
+ str_tmp += "</a>";
+ }
+ str_tmp += "</div>";
tmp_name = l["title"][k];
- } // if
- } // if legendurl
- } // for var k=0
- } // if (l)
- else{
- if (legendurl[j]!='' && legendurl[j]!=0){
- if(layerparent[j] == 0){
- if(showlayertitle == 'true'){
- str += "<div><span class='titles'>" + titles[j]+ "</span></div>";
- }
- str += "<div>";
- if(legendlink == 'true'){
- str += "<a href='../php/result.php?lingo=deutsch&layer="+layer[j]+"' class='link_metadata' title='Zeigt Liste zum Thema: "+titles[j]+"' target='result'>";
+ } // if
+ } // if legendurl
+ } // for var k=0
+ } // if (l)
+ else {
+ if (legendurl[j]!='' && legendurl[j]!=0){
+ if(layerparent[j] == 0){
+ if(showlayertitle == 'true'){
+ str_tmp += "<div><span class='titles'>" + titles[j]+ "</span></div>";
}
- str += "<img border=0 src = '";
- str += legendurl[j];
- //str += parent.mb_mapObj[ind].wms[i].wms_getlegendurl + "&format=image/png&REQUEST=getlegendgraphic&VERSION=1.1.1&SERVICE=WMS&layer=";
- str += "'></img>";
-
- //str += "legend:"+legendurl[j];
+ str_tmp += "<div>";
+ if(legendlink == 'true'){
+ str_tmp += "<a href='../php/result.php?lingo=deutsch&layer="+layer[j]+"' class='link_metadata' title='Zeigt Liste zum Thema: "+titles[j]+"' target='result'>";
+ }
+ str_tmp += "<img border=0 src = '";
+ str_tmp += legendurl[j];
+ //str_tmp += parent.mb_mapObj[ind].wms[i].wms_getlegendurl + "&format=image/png&REQUEST=getlegendgraphic&VERSION=1.1.1&SERVICE=WMS&layer=";
+ str_tmp += "'></img>";
+
+ //str_tmp += "legend:"+legendurl[j];
if (legendlink == 'true'){
- str += "</a>";
- }
- str += "</div>";
- }//layerparent
- } // legendurl[j]!='' && legendurl[j]!=0
+ str_tmp += "</a>";
+ }
+ str_tmp += "</div>";
+ }//layerparent
+ } // legendurl[j]!='' && legendurl[j]!=0
} // else
+
+
+
+
}// for
} // if (layers[0...
} // if (parent.mb_mapObj[ind].wms[i].wms_getlegendurl != "")
+
+ if(str_tmp !=''){
+ if (showwmstitle == 'true'){
+ str += "<div><span class='header'>" +parent.mb_mapObj[ind].wms[i].wms_title+ "</span></div>";
+ }
+ str += str_tmp;
+ //prompt('',str_tmp);
+ str_tmp ='';
+ }
+
}// for
-
+
if(str != ""){
parent.writeTag("legend", "leg", str);
//prompt('',str);
More information about the Mapbender_commits
mailing list