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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Apr 25 03:01:12 EDT 2007


Author: christoph
Date: 2007-04-25 03:01:08 -0400 (Wed, 25 Apr 2007)
New Revision: 1274

Modified:
   trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php
Log:
* added element vars
* added loading a configured wms from a gui


Modified: trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php	2007-04-23 13:27:48 UTC (rev 1273)
+++ trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php	2007-04-25 07:01:08 UTC (rev 1274)
@@ -26,6 +26,7 @@
 <head>
 <?php
 echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+include '../include/dyn_css.php';
 ?>
 <title>Add WMS from Filtered Catalog</title>
 <link rel="stylesheet" type="text/css" href="../css/administration_alloc.css">
@@ -55,6 +56,10 @@
 
 <script type="text/javascript">
 <!--
+function mod_addWMSfromDB(gui_id, wms_id) {
+	//alert("1/3 mod_addWMSfromDB: GUI ID = " + gui_id + ", WMS ID = " + wms_id);
+	window.opener.mod_addWMSById_load(gui_id, wms_id);
+}
 function mod_addWMSfromfilteredList(pointer_name,version){
 
 	pointer_name=pointer_name + window.opener.mb_getConjunctionCharacter(pointer_name);
@@ -93,16 +98,64 @@
 	document.form1.submit();
 }
 			
+function mod_show_gui_configured_wms(wert2){
+	document.form1.show_gui_configured_wms.value = wert2;
+	document.form1.submit();
+}
+			
 function mod_show_wms(wert3){
 	document.form1.wms_show.value = wert3;
+	if (wert3 == 4) {
+		document.form1.wmsSource = "db";
+	}
+	else {
+		document.form1.wmsSource = "capabilities";
+	}
 	document.form1.submit();
 }			
 
+function setButtons() {
+	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"));
+	}
+}
+
+function removeChildNodes(node) {
+	while (node.childNodes.length > 0) {
+		var childNode = node.firstChild;
+		node.removeChild(childNode);
+	}
+}
 // -->
 </script>
 
 </head>
-<body onLoad="window.focus()">
+<body onLoad="window.focus();setButtons()">
 
 <?php
 
@@ -232,9 +285,10 @@
 echo "<table border='0' cellpadding='3'  rules='rows'>";
 echo "<tr>";
 if (isset($wms_show)){
-	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 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 "</tr>";
 	echo "</table>";
 
@@ -329,6 +383,7 @@
 	echo " <tbody >";
 		for($i=0; $i<$cnt_group_gui_wms; $i++){
 			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			
 			echo "<td><div id ='id_".$group_wms_title[$i]."' class='even' name ='name_".$group_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$group_wms_getcapabilities[$i]."\",\"".$group_wms_version[$i]."\")'>".$group_wms_title[$i]."</div></td>";
 			echo "<td><div id ='id_".$group_wms_abstract[$i]."' class='even' name ='name_".$group_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$group_wms_getcapabilities[$i]."\",\"".$group_wms_version[$i]."\")'>".$group_wms_abstract[$i]."</div></td>";
 			echo "</tr>";		
@@ -431,10 +486,118 @@
 
 } /*End: if(isset($show_gui_wms))   *********/
 
+
+
+/*show gui wms  ********************************************************************************************/
+if (!empty($show_gui_configured_wms)){
+	/*get group gui WMS  ********************************************************************************************/								 
+	$sql_fkey_show_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id ='".$show_gui_configured_wms."'";
+	#$sql_fkey_show_gui_wms.= ") ORDER BY fkey_wms_id";
+
+	$res_fkey_show_gui_wms = db_query($sql_fkey_show_gui_wms);
+	while($row = db_fetch_array($res_fkey_show_gui_wms)){
+		$fkey_show_gui_gui_id[$cnt_fkey_show_gui_wms] = $row["fkey_gui_id"];
+		$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms] = $row["fkey_wms_id"];
+		#echo"$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms]";
+		$cnt_fkey_show_gui_wms++;
+	}								 
+	/*get group gui WMS  ********************************************************************************************/		
+
+	/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
+	if(count($fkey_show_gui_wms_id)>0){
+		$sql_show_gui_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_id, wms_version FROM wms WHERE wms_id IN (";
+
+		for($i=0; $i<count($fkey_show_gui_wms_id); $i++){
+			if($i>0){ $sql_show_gui_wms .= ",";}
+			$sql_show_gui_wms .= "'".$fkey_show_gui_wms_id[$i]."'";
+		}
+		$sql_show_gui_wms.= ") ORDER BY wms_title";
+
+		$res_show_gui_wms = db_query($sql_show_gui_wms);
+		while($row = db_fetch_array($res_show_gui_wms)){
+			$gui_wms_id[$cnt_show_gui_wms] = $row["wms_id"];
+			$gui_wms_title[$cnt_show_gui_wms] = $row["wms_title"];
+			$gui_wms_abstract[$cnt_show_gui_wms] = $row["wms_abstract"];
+			$gui_wms_getcapabilities[$cnt_show_gui_wms] = $row["wms_getcapabilities"];
+			$gui_wms_version[$cnt_show_gui_wms] = $row["wms_version"];
+			#echo"$gui_wms_title[$cnt_show_gui_wms]";
+			$cnt_show_gui_wms++;
+		}							 
+		/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+
+		/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+		#if (isset($cnt_show_gui_wms > 0))
+	}
+
+	if ($cnt_show_gui_wms > 0){
+	/*get selected gui name for table caption ********************************************************************************************/  
+	$sql_gui_table = "SELECT * FROM gui WHERE gui_id ='".$show_gui_configured_wms."'";       
+	$res_gui_table = db_query($sql_gui_table);
+		while($row = db_fetch_array($res_gui_table)){
+			$gui_id_table[$cnt_gui_table] = $row["gui_id"];
+			$gui_name_table[$cnt_gui_table] = $row["gui_name"];							
+			$cnt_gui_table++;
+			#echo"$gui_id_table[0]";
+		}
+
+		/*get selected gui name for table caption ********************************************************************************************/
+
+		echo"<br>";
+		echo"<br>";
+			echo"wms from gui: $gui_name_table[0]";
+			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_show_gui_wms; $i++){
+			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			echo "<td><div id ='id_".$gui_wms_title[$i]."' class='even' name ='name_".$gui_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromDB(\"".$show_gui_configured_wms."\",\"".$gui_wms_id[$i]."\")'>".$gui_wms_title[$i]."</div></td>";
+			echo "<td><div  id ='id_".$gui_wms_abstract[$i]."' class='even' name ='name_".$gui_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromDB(\"".$show_gui_configured_wms."\",\"".$gui_wms_id[$i]."\")'>".$gui_wms_abstract[$i]."</div></td>";
+			echo "</tr>";	
+		}	
+		echo "  </tbody>";							 						 
+		echo "</table>";
+	}
+	else{
+		echo"<br>";
+		echo"<br>";
+		echo"<br>";
+
+		echo "no wms in this gui";
+  	}  /*End: if ($cnt_show_gui_wms > 0)  *********/
+	/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/	
+
+
+} /*End: if(isset($show_gui_configured_wms))   *********/
+
 ######   SHOW GUI WMS OR GROUP WMS   #####################################################################################
 
 ######   SHOW GUI OR GROUP OR ALL WMS   #####################################################################################
 
+	if ($wms_show == 4){ #gui
+		echo"<br>";
+		echo"<br>";
+		echo"Please select a gui:";
+		echo"<br>";
+		echo"<br>";	
+		echo "<table border='1' width='98%' cellpadding='3' rules='rows'>";
+		echo " <thead bgcolor = 'lightgrey' >";
+		echo "<tr><td width='200' height='10'>gui name</td><td  align = 'left' class='fieldnames_s'>description</td>";
+		echo " </thead>";
+		echo " <tbody >";
+		for($i=0; $i<$cnt_gui; $i++){
+			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			echo "<td><div id ='id_".$gui_name[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_name[$i]."'  style='cursor:pointer'  onclick = 'mod_show_gui_configured_wms(\"".$gui_id[$i]."\")'>".$gui_name[$i]."</div></td>";
+			echo "<td><div id ='id_".$gui_description[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_description[$i]."' style='cursor:pointer' onclick = 'mod_show_gui_configured_wms(\"".$gui_id[$i]."\")'>".$gui_description[$i]."</div></td>";
+			echo "</tr>";
+		}		
+		echo "  </tbody>";							 						 
+		echo "</table>";		
+
+	}
 	if ($wms_show == 3){ #gui
 		echo"<br>";
 		echo"<br>";
@@ -503,9 +666,15 @@
 	}
 }
 else{     #if (!isset($wms_show))
-	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 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>";
@@ -534,8 +703,14 @@
 echo "<input type='hidden' name='show_group_wms'>";
 /*show gui wms  ********************************************************************************************/
 echo "<input type='hidden' name='show_gui_wms'>";
+echo "<input type='hidden' name='show_gui_configured_wms'>";
 /*show button  ********************************************************************************************/
 echo "<input type='hidden' name='wms_show'>";
+echo "<input id='wmsSource' type='hidden' name='wmsSource'>";
+echo "<input name ='set_option_all' id='set_option_all' type='hidden'>";
+echo "<input name='set_option_group' id='set_option_group' type='hidden'>";
+echo "<input name='set_option_gui' id='set_option_gui' type='hidden'>";
+echo "<input name='set_option_db' id='set_option_db' type='hidden'>";
 echo "</form>";
 ?>
 <script type="text/javascript">



More information about the Mapbender_commits mailing list