[Mapbender-commits] r4390 - branches/mifan_dev/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 20 08:28:04 EDT 2009


Author: mifan
Date: 2009-07-20 08:28:03 -0400 (Mon, 20 Jul 2009)
New Revision: 4390

Modified:
   branches/mifan_dev/mapbender/http/php/mod_loadCatalogToGUI.php
Log:
add a catalog to GUIs

Modified: branches/mifan_dev/mapbender/http/php/mod_loadCatalogToGUI.php
===================================================================
--- branches/mifan_dev/mapbender/http/php/mod_loadCatalogToGUI.php	2009-07-20 09:50:54 UTC (rev 4389)
+++ branches/mifan_dev/mapbender/http/php/mod_loadCatalogToGUI.php	2009-07-20 12:28:03 UTC (rev 4390)
@@ -45,41 +45,41 @@
   		font-size : 12px;
   		color: #808080;
   	}
-.text1{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:190px;
-}
-.select1{
-   position:absolute;
-   top:210px;
-   width:270px;
-}
-.text2{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:190px;
-   left:300px;
-}
-.select2{
-   position:absolute;
-   top:210px;
-   left:300px;
-}
-.getcapabilities{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:570px;
-}
+	.text1{
+	   font-family: Arial, Helvetica, sans-serif;
+	   font-size : 15px;
+	   position:absolute;
+	   top:190px;
+	}
+	.select1{
+	   position:absolute;
+	   top:210px;
+	   width:270px;
+	}
+	.text2{
+	   font-family: Arial, Helvetica, sans-serif;
+	   font-size : 15px;
+	   position:absolute;
+	   top:190px;
+	   left:300px;
+	}
+	.select2{
+	   position:absolute;
+	   top:210px;
+	   left:300px;
+	}
+	.getcapabilities{
+	   font-family: Arial, Helvetica, sans-serif;
+	   font-size : 15px;
+	   position:absolute;
+	   top:570px;
+	}
 
   	-->
 </style>
 <script language="JavaScript">
-function validate(wert){
-   if(wert == 'guiList'){
+function validate(vals){
+   if(vals == 'guiList'){
       var listIndex = document.form1.guiList.selectedIndex;
       if(listIndex<0){
 		   alert("Please select a GUI.");
@@ -87,40 +87,42 @@
       }
       else{
          var gui_id=document.form1.guiList.options[listIndex].value;
-			document.form1.action='../php/mod_loadwms.php<?php echo SID;?>';
+         	//LOAD CATALOG
+			document.form1.action='../php/mod_loadCatalog.php<?php echo SID;?>';
 			document.form1.submit();
       }
    }
 }
 function load(){
       if(document.form1.guiList.selectedIndex<0){
-		   alert("Please select a GUI.");
+		   alert("Please Select a GUI.");
 			return false;
       }
       var gui_ind = document.form1.guiList.selectedIndex;
-      var ind = document.form1.wmsID.selectedIndex;
+      var ind = document.form1.catID.selectedIndex;
       var ind2 = document.form1.guiID_.selectedIndex;
-			var indexWMSList = document.form1.wmsID.selectedIndex;
+			var indexCatList = document.form1.catID.selectedIndex;
 			var permission = true;
 
-			var selectedWmsId = document.form1.wmsID.options[document.form1.wmsID.selectedIndex].value;
-			for (i = 0; i < document.form1.wmsList.length; i++) {
-						if (document.form1.wmsList.options[i].value == selectedWmsId){
+			var selectedCatId = document.form1.catID.options[document.form1.catID.selectedIndex].value;
+			for (i = 0; i < document.form1.catList.length; i++) {
+						if (document.form1.catList.options[i].value == selectedCatId){
 							 permission = false;							 
-							 alert ('The WMS (' + selectedWmsId + ') is already loaded in this application.');
+							 alert ('The Catalog (' + selectedCatId + ') is already loaded in this application.');
 							 break;
 						}
 			}			 
 			
   			if (permission) { // only check if permission is not false 
-        	var loadConfirmed = confirm("Load " + document.form1.wmsID.options[ind].text + " FROM " + document.form1.guiID_.options[ind2].value + " INTO "+document.form1.guiList.options[gui_ind].value+" ?");
-          if(loadConfirmed){
+        	var loadConfirmed = confirm("Load " + document.form1.catID.options[ind].text + " FROM " + document.form1.guiID_.options[ind2].value + " INTO "+document.form1.guiList.options[gui_ind].value+" ?");
+
+            if(loadConfirmed){
              document.form1.submit();
-          }
-          else{
-             document.form1.guiID_.selectedIndex = -1;
-          }
-			}	
+          	}
+          	else{
+             	document.form1.guiID_.selectedIndex = -1;
+          	}
+		}	
 			
 }
 </script>
@@ -134,52 +136,15 @@
 $ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
 
 
-
-###INSERT
-if(isset($wmsID) && isset($guiID_)){
-	$sql_pos = "SELECT MAX(gui_wms_position) AS my_gui_wms_position FROM gui_wms WHERE fkey_gui_id = $1";
-	$v = array($guiList);
-	$t = array('s');
-	$res_pos = db_prep_query($sql_pos,$v,$t);
-	if(db_result($res_pos,0,"my_gui_wms_position") > -1){
-		$gui_wms_position = db_result($res_pos,0,"my_gui_wms_position") + 1;
-	}
-	else{
-		$gui_wms_position = 0;
-	}
-
-	$sql = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-	$v = array($guiID_,$wmsID);
+// insert values here
+if(isset($catID) && isset($guiID_)){
+	
+	$sql_ins = "INSERT INTO gui_cat (fkey_gui_id,fkey_cat_id) ";
+	$sql_ins .= "VALUES ($1,$2)";
+	$v = array($guiList,$catID);
 	$t = array('s','i');
-	$res = db_prep_query($sql,$v,$t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$sql_ins = "INSERT INTO gui_wms (fkey_gui_id,fkey_wms_id,gui_wms_position,gui_wms_mapformat,";
-		$sql_ins .= "gui_wms_featureinfoformat,gui_wms_exceptionformat,gui_wms_epsg,gui_wms_visible,gui_wms_opacity,gui_wms_sldurl) ";
-		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)";
-		$v = array($guiList,$wmsID,$gui_wms_position,$row["gui_wms_mapformat"],$row["gui_wms_featureinfoformat"],
-		$row["gui_wms_exceptionformat"],$row["gui_wms_epsg"],$row["gui_wms_visible"],$row["gui_wms_opacity"],$row["gui_wms_sldurl"]);
-		$t = array('s','i','i','s','s','s','s','i','i','s');
-		db_prep_query($sql_ins,$v,$t);
-		$cnt++;
-	}
+	db_prep_query($sql_ins,$v,$t);
 
-	$sql = "SELECT * FROM gui_layer WHERE fkey_gui_id = $1 AND gui_layer_wms_id = $2";
-	$v = array($guiID_, $wmsID);
-	$t = array("s", "i");
-	$res = db_prep_query($sql, $v, $t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$sql_ins = "INSERT INTO gui_layer (fkey_gui_id,fkey_layer_id,gui_layer_wms_id,gui_layer_status,gui_layer_selectable,";
-		$sql_ins .= "gui_layer_visible,gui_layer_queryable,gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale,gui_layer_priority,gui_layer_style,gui_layer_wfs_featuretype) ";
-		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)";
-		$v = array($guiList,$row["fkey_layer_id"],$wmsID,$row["gui_layer_status"],$row["gui_layer_selectable"],
-		$row["gui_layer_visible"],$row["gui_layer_queryable"],$row["gui_layer_querylayer"],$row["gui_layer_minscale"],
-		$row["gui_layer_maxscale"],$row["gui_layer_priority"],$row["gui_layer_style"],$row["gui_layer_wfs_featuretype"]);
-		$t = array('s','i','i','i','i','i','i','i','i','i','i','s','s');
-		db_prep_query($sql_ins,$v,$t);
-		$cnt++;
-	}
 }
 
 echo "<form name='form1' action='" . $self."' method='post'>";
@@ -232,7 +197,7 @@
 		$t = array('s');
 		$res = db_prep_query($sql,$v,$t);	
 		$count=0;
-		echo"<select size='8' name='wmsList' style='width:200px'>";
+		echo"<select size='8' name='catList' style='width:200px'>";
 	
 		while($row = db_fetch_array($res)){
 			if ($row["cat_title"]!=""){
@@ -243,7 +208,7 @@
 		}
 		echo "</select><br><br>";
 	}else{
-		echo"<select size='8' name='wmsList' style='width:200px' on Click='submit()'>";
+		echo"<select size='8' name='catList' style='width:200px' on Click='submit()'>";
 		echo "</select><br><br>";
 	}
 	echo "</td>";
@@ -263,7 +228,7 @@
 	}
 	$sql .= ") ORDER BY cat.cat_title";
 	$res = db_prep_query($sql, $v, $t);
-	echo "<select class='select1' name='wmsID' size='20' onchange='submit()'>";
+	echo "<select class='select1' name='catID' size='20' onchange='submit()'>";
 	$cnt = 0;
 	while($row = db_fetch_array($res)){
 		echo "<option value='".$row["cat_id"]."' ";
@@ -273,19 +238,19 @@
 		else{
 			echo "style='color:red' ";
 		}
-		if(isset($wmsID) && $wmsID == $row["cat_id"]){
+		if(isset($catID) && $catID == $row["cat_id"]){
 			echo "selected";
 			$wms_getcapabilities = $row["wms_getcapabilities"];
 		}
-		echo ">".$row["wms_title"]."</option>";
+		echo ">".$row["cat_title"]."</option>";
 		$cnt++;
 	}
 	echo "</select>";
 	
-	if(isset($wmsID)){
+	if(isset($catID)){
 		echo "<div class='text2'>FROM:</div>";
-		$sql = "SELECT * from gui_wms WHERE fkey_wms_id = $1 ORDER BY fkey_gui_id";
-		$v = array($wmsID);
+		$sql = "SELECT * from gui_cat WHERE fkey_cat_id = $1 ORDER BY fkey_gui_id";
+		$v = array($catID);
 		$t = array("s");
 		$res = db_prep_query($sql, $v, $t);
 		echo "<select class='select2' name='guiID_' size='20' onchange='load()'>";
@@ -299,7 +264,7 @@
 }
 echo "</form>";
 }else{
-	echo "There are no guis available for this user. Please create a gui first.";
+	echo "There are no GUIs available for this user. Please create a GUI first.";
 }
 echo "<div class='getcapabilities'>" . $wms_getcapabilities . "</div>";
 ?>



More information about the Mapbender_commits mailing list