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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri May 11 08:17:58 EDT 2007


Author: christoph
Date: 2007-05-11 08:17:58 -0400 (Fri, 11 May 2007)
New Revision: 1318

Modified:
   trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php
Log:
shows correct wms selection on startup

Modified: trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php	2007-05-11 10:12:02 UTC (rev 1317)
+++ trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php	2007-05-11 12:17:58 UTC (rev 1318)
@@ -115,35 +115,60 @@
 	document.form1.submit();
 }			
 
-function setButtons() {
+function setButtons(wms_option, wms_option2, wms_option3, wms_option4) {
+	console.log("1: %s", wms_option);
+	console.log("2: %s", wms_option2);
+	console.log("3: %s", wms_option3);
+	console.log("4: %s", wms_option4);
 	if (typeof(option_all) == "undefined") {
 		option_all = '<?php echo $set_option_all;?>';
 	}
 	document.getElementById("set_option_all").value = option_all;
-	if (option_all == '0') {
-		removeChildNodes(document.getElementById("_option_all"));
-	}
 	if (typeof(option_group) == "undefined") {
 		option_group = '<?php echo $set_option_group;?>';
 	}
 	document.getElementById("set_option_group").value = option_group;
-	if (option_group == '0') {
-		removeChildNodes(document.getElementById("_option_group"));
-	}
 	if (typeof(option_gui) == "undefined") {
 		option_gui = '<?php echo $set_option_gui;?>';
 	}
 	document.getElementById("set_option_gui").value = option_gui;
-	if (option_gui == '0') {
-		removeChildNodes(document.getElementById("_option_gui"));
-	}
 	if (typeof(option_db) == "undefined") {
 		option_db = '<?php echo $set_option_db;?>';
 	}
 	document.getElementById("set_option_db").value = option_db;
-	if (option_db == '0') {
-		removeChildNodes(document.getElementById("_option_db"));
+
+	if (wms_option == '' && wms_option2 == '' && wms_option3 == '' && wms_option4 == '') {
+		if (option_all == '1') {
+			mod_show_wms(1);
+		}
+		else if (option_group == '1') {
+			mod_show_wms(2);
+		}
+		else if (option_gui == '1') {
+			mod_show_wms(3);
+		}
+		else if (option_db == '1') {
+			mod_show_wms(4);
+		}
 	}
+	else {
+		if (option_all == '0') {
+			var aNode = document.getElementById("_option_all");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+		if (option_group == '0') {
+			var aNode = document.getElementById("_option_group");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+		if (option_gui == '0') {
+			var aNode = document.getElementById("_option_gui");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+		if (option_db == '0') {
+			var aNode = document.getElementById("_option_db");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+	}
 }
 
 function removeChildNodes(node) {
@@ -156,7 +181,7 @@
 </script>
 
 </head>
-<body onLoad="window.focus();setButtons()">
+<body onLoad="window.focus();setButtons('<?php echo $wms_show;?>','<?php echo $show_gui_configured_wms;?>','<?php echo $show_group_wms;?>','<?php echo $show_gui_wms;?>')">
 
 <?php
 
@@ -285,7 +310,7 @@
 # Button
 echo "<table border='0' cellpadding='3'  rules='rows'>";
 echo "<tr>";
-if (isset($wms_show)){
+if (!empty($wms_show) || !empty($show_gui_configured_wms) || !empty($show_group_wms) || !empty($show_gui_wms)){
 	echo "<td id='_option_all'><input type='button' class='wms_button' name='wms1' value='all wms' onclick='mod_show_wms(1)'></td>";
 	echo "<td id='_option_group'><input type='button' class='wms_button' name='wms2' value='group' onclick = 'mod_show_wms(2)'></td>";	
 	echo "<td id='_option_gui'><input type='button' class='wms_button' name='wms3' value='gui' onclick = 'mod_show_wms(3)'></td>";
@@ -666,37 +691,8 @@
 		echo "</table>";
 	}
 }
-else{     #if (!isset($wms_show))
-echo "<td id='_option_all'><input type='button' class='wms_button' name='wms1' value='all wms' onclick='mod_show_wms(1)'></td>";
-echo "<td id='_option_group'><input type='button' class='wms_button' name='wms2' value='group' onclick = 'mod_show_wms(2)'></td>";	
-echo "<td id='_option_gui'><input type='button' class='wms_button' name='wms3' value='gui' onclick = 'mod_show_wms(3)'></td>";
-echo "<td id='_option_db'><input type='button' class='wms_button' name='wms4' value='db' onclick = 'mod_show_wms(4)'></td>";
 
-#	echo "<td><input type='button' class='wms_button' name='wms1' value='all wms' onclick='mod_show_wms(1)'></td>";
-#	echo "<td><input type='button' class='wms_button' name='wms2' value='group' onclick = 'mod_show_wms(2)'></td>";
-#	echo "<td><input type='button' class='wms_button' name='wms3' value='gui' onclick = 'mod_show_wms(3)'></td>";
-#	echo "<td><input type='button' class='wms_button' name='wms3' value='gui' onclick = 'mod_show_wms(3)'></td>";
-	echo "</tr>";
-	echo "</tbody>";							 						 
-	echo "</table>";
-	echo"<br>";
-	echo"<br>";
 
-	echo "<table border='1' width ='98%'   cellpadding='3' rules='rows'>";
-	echo " <thead bgcolor = '#FAEBD7' >";
-	echo "<tr><td width='200'  height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
-	echo " </thead>";
-	echo " <tbody >";
-	for($i=0; $i<$cnt_wms; $i++){
-		echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
-		echo "<td><div id ='id_".$wms_title[$i]."' class='even' name ='name_".$wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$wms_getcapabilities[$i]."\",\"".$wms_version[$i]."\")'>".$wms_title[$i]."</div></td>";
-		echo "<td><div  id ='id_".$wms_abstract[$i]."' class='even' name ='name_".$wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$wms_getcapabilities[$i]."\",\"".$wms_version[$i]."\")'>".$wms_abstract[$i]."</div></td>";
-		echo "</tr>";
-	}		
-	echo "  </tbody>";							 						 
-	echo "</table>";
-}
-
 ######   SHOW GUI OR GROUP OR ALL WMS   #####################################################################################
 
 



More information about the Mapbender_commits mailing list