[Mapbender-commits] r8771 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Feb 7 04:46:44 PST 2014


Author: armin11
Date: 2014-02-07 04:46:44 -0800 (Fri, 07 Feb 2014)
New Revision: 8771

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
   trunk/mapbender/http/javascripts/mod_featureInfo.php
Log:
Bugfix for empty legend_urls

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2014-02-06 15:21:10 UTC (rev 8770)
+++ trunk/mapbender/http/javascripts/map_obj.js	2014-02-07 12:46:44 UTC (rev 8771)
@@ -994,7 +994,11 @@
 				featureInfoRequest = changeURLParameterValue(featureInfoRequest,"LAYERS", this.wms[i].objLayer[j].layer_name);
 				featureInfoObj.request = featureInfoRequest;
 				//get url to legend
-				featureInfoObj.legendurl = this.wms[i].objLayer[j].layer_style[0].legendurl;
+				if (typeof(this.wms[i].objLayer[j].layer_style[0].legendurl) !== 'undefined') {
+					featureInfoObj.legendurl = this.wms[i].objLayer[j].layer_style[0].legendurl;
+				} else {
+					featureInfoObj.legendurl = "empty";
+				}
 				//return new request!
 		    		allRequests.push(featureInfoObj);
 			} 

Modified: trunk/mapbender/http/javascripts/mod_featureInfo.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_featureInfo.php	2014-02-06 15:21:10 UTC (rev 8770)
+++ trunk/mapbender/http/javascripts/mod_featureInfo.php	2014-02-07 12:46:44 UTC (rev 8771)
@@ -171,7 +171,11 @@
 			}
 			featureInfoList = "<table border='1'>";
 			for(var i=0;i<urls.length;i++){
-				featureInfoList += "<tr><td><a href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td><img src='"+urls[i].legendurl+"' alt='<?php echo _mb("No legend available");?>!'/></td></tr>";
+				if (urls[i].legendurl !== "empty" ) {
+					featureInfoList += "<tr><td><a href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td><img src='"+urls[i].legendurl+"' alt='<?php echo _mb("No legend available");?>!'/></td></tr>";
+				} else {
+					featureInfoList += "<tr><td><a href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td><img src='' alt='<?php echo _mb("No legend available");?>!'/></td></tr>";
+				}
 			}
 			featureInfoList += "</table>";
 			$("<div id='featureInfo_preselect'></div>").dialog({



More information about the Mapbender_commits mailing list