[Mapbender-commits] r5981 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Apr 20 04:54:58 EDT 2010


Author: christoph
Date: 2010-04-20 04:54:58 -0400 (Tue, 20 Apr 2010)
New Revision: 5981

Modified:
   trunk/mapbender/http/plugins/mb_background.js
Log:


Modified: trunk/mapbender/http/plugins/mb_background.js
===================================================================
--- trunk/mapbender/http/plugins/mb_background.js	2010-04-20 08:46:07 UTC (rev 5980)
+++ trunk/mapbender/http/plugins/mb_background.js	2010-04-20 08:54:58 UTC (rev 5981)
@@ -63,15 +63,30 @@
 				.addClass("container-background-wms");
 
 			var firstBackgroundWmsIsActivated = false;
-
+			var numBackgroundWms = 0;
+			
+			// set first background wms to visibility = 2
 			$(map.wms).each(function () {
 				var wms = this;
-				if (!firstBackgroundWmsIsActivated) {
-					wms.gui_wms_visible = 2;
-					firstBackgroundWmsIsActivated = true;
+				var isHidden = (wms.gui_wms_visible === 0) ? true : false;
+				if (isHidden) {
+					if (!firstBackgroundWmsIsActivated) {
+						wms.gui_wms_visible = 2;
+						firstBackgroundWmsIsActivated = true;
+					}
+					numBackgroundWms++;
 				}
+			});
+			// if less than two background wms are found, 
+			// do not display buttons
+			if (numBackgroundWms < 2) {
+				return;
+			}
+			// display buttons in map
+			$(map.wms).each(function () {
+				var wms = this;
+				var isHidden = (wms.gui_wms_visible === 0) ? true : false;
 				var isVisible = (wms.gui_wms_visible === 2) ? true : false;
-				var isHidden = (wms.gui_wms_visible === 0) ? true : false;
 				if (!isHidden && !isVisible) {
 					return;
 				}



More information about the Mapbender_commits mailing list