svn commit: r87 - trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php

arnulf at osgeo.org arnulf at osgeo.org
Wed Apr 19 04:23:50 EDT 2006


Author: arnulf
Date: 2006-04-19 08:23:49+0000
New Revision: 87

Modified:
   trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php   (contents, props changed)

Log:
code cleaning in progress

Modified: trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php?view=diff&rev=87&p1=trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php&p2=trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php&r1=86&r2=87
==============================================================================
--- trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php	(original)
+++ trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList.php	2006-04-19 08:23:49+0000
@@ -1,6 +1,5 @@
 <?php
-#$Id: mod_addWMSfromfilteredList.php,v 1.14 2006/03/10 12:53:25 astrid_emde Exp $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_addWMSfromfilteredList.php,v 1.14 2006/03/10 12:53:25 astrid_emde Exp $
+# $Id$
 # Copyright (C) 2002 CCGIS 
 #
 # This program is free software; you can redistribute it and/or modify
@@ -34,48 +33,31 @@
 <link rel="stylesheet" type="text/css" href="../css/administration_alloc.css">
 
 <STYLE TYPE="text/css">
-		<!--
-   body{
-   	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-      font-size:10pt
-   }    
+<!--
+	body{
+		font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size:10pt
+	}    
    
-   table{
-   	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-      font-size:11;
-   }   
+	table{
+		font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size:11;
+	}   
    
 	.wms_button{
-         color: black;
-         border: solid thin;
-         height:22px;
-         width:60px;
-   }
+		color: black;
+		border: solid thin;
+		height:22px;
+		width:60px;
+	}
 
-	-->
+-->
 </STYLE>
 
 
 <script type="text/javascript">
 <!--
 <?php
-#$con = db_connect($DBSERVER,$OWNER,$PW);
-#db_select_db(DB,$con);
-#$sql = "SELECT e_requires, e_target FROM gui_element WHERE e_id = 'addWMSfromfilteredList' AND fkey_gui_id = '".$gui_id."'";
-#echo "var sql_x = ".$sql.";";
-#$res = db_query($sql);
-#$cnt = 0;
-#while($row = db_fetch_array($res)){ 
-#   $e_target = $row["e_target"];
-#   $e_require = $row["e_requires"];
-#   $cnt++;
-#}
-
-#if($cnt > 1){ echo "alert('addWMSfromfilteredList: ID not unique!');";}
-#echo "var mod_addWMSfromfilteredList_data = 'loadData';";
-#$target = explode(",", $e_target);
-#echo "var mod_addWMSfromfilteredList_target1 = 'treeGDE';";
-#echo "var mod_addWMSfromfilteredList_target2 = 'mapframe1';";
 
 /*get infos from gui_element ********************************************************************************************/
 
@@ -84,9 +66,9 @@
 $res_target = db_query($sql_target);
 $cnt_target = 0;
 while($row = db_fetch_array($res_target)){ 
-   $e_target = $row["e_target"];
-   $e_require = $row["e_requires"];
-   $cnt_target++;
+	$e_target = $row["e_target"];
+	$e_require = $row["e_requires"];
+	$cnt_target++;
 }
 if($cnt_target > 1){ echo "alert('addWMS: ID not unique!');";}
 echo "<script language='Javascript'>";
@@ -99,66 +81,48 @@
 */
 ?>
 
-function mod_addWMSfromfilteredList(pointer_name,version)
-{
- 		//alert(pointer_name);
-      //alert(version);
-      
-      var mywms = pointer_name; 
-      if(mywms.indexOf("?") > -1){pointer_name += "&";}
-	  if(mywms.indexOf("?") == -1){pointer_name += "?";}
+function mod_addWMSfromfilteredList(pointer_name,version){
+	var mywms = pointer_name; 
+	if(mywms.indexOf("?") > -1){pointer_name += "&";}
+	if(mywms.indexOf("?") == -1){pointer_name += "?";}
       	
-	 if (version == '1.0.0')
-	 {
-	 	var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
-	 	var load = cap;
-	 }
-	 else if (version == '1.1.0')
-	 {
-	 	var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
-	 	var load = cap;
-	 }
-	 else if (version == '1.1.1')
-	 {
-	 	var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
-	 	var load = cap;
-	 }
-	 	 
-   
-	 if(load)
-	 {
-	 	 // if the mapfile WMS ONLINE RESOURCE is set relative, without any host
-//	 	if(rest.charAt(0) == '/' && rest.charAt(1) == 'c')
-	 	if(load.charAt(0) == '/' && load.charAt(1) == 'c')
-         	{
-         		window.opener.mod_addWMS_load('http://localhost' + load);
-        	}
-        	else
-        	{
-          		window.opener.mod_addWMS_load(load);
-        	}     
-   	}
-}
+	if (version == '1.0.0'){
+		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
+		var load = cap;
+	}
+	else if (version == '1.1.0'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
+		var load = cap;
+	}
+	else if (version == '1.1.1'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
+		var load = cap;
+	}  
 
+	if(load){
+		if(load.charAt(0) == '/' && load.charAt(1) == 'c'){
+			window.opener.mod_addWMS_load('http://localhost' + load);
+		}
+		else{
+			window.opener.mod_addWMS_load(load);
+		}     
+	}
+}
 
+function mod_show_group_wms(wert){
+	document.form1.show_group_wms.value = wert;
+	document.form1.submit();
+}
 
-function mod_show_group_wms(wert)
-				 {
-								document.form1.show_group_wms.value = wert;
-								document.form1.submit();
-        }
-
-function mod_show_gui_wms(wert2)
-				 {
-								document.form1.show_gui_wms.value = wert2;
-								document.form1.submit();
-        }
+function mod_show_gui_wms(wert2){
+	document.form1.show_gui_wms.value = wert2;
+	document.form1.submit();
+}
 				
-function mod_show_wms(wert3)
-				 {
-								document.form1.wms_show.value = wert3;
-								document.form1.submit();
-        }				
+function mod_show_wms(wert3){
+	document.form1.wms_show.value = wert3;
+	document.form1.submit();
+}				
 
 // -->
 </script>
@@ -173,9 +137,7 @@
 require_once("../classes/class_wms.php"); 
 require_once("../php/mb_getGUIs.php");
 
-
 $fieldHeight = 20;
-
 $cnt_gui = 0;
 $cnt_gui_wms = 0;
 $cnt_wms = 0;
@@ -188,49 +150,45 @@
 $cnt_show_gui_wms = 0;
 $cnt_group_name = 0;
 $cnt_gui_table = 0;
-
 $exists = false;
-
 $logged_user_name=$_SESSION["mb_user_name"];
 $logged_user_id=$_SESSION["mb_user_id"];
 $logged_gui_id=$_SESSION["mb_user_gui"];
 
 ######   SQL   #####################################################################################
 
-
 /*get infos from gui_element ********************************************************************************************/
 
 /*get group from logged user  ********************************************************************************************/
-$sql_user_group = "SELECT * FROM mb_user_mb_group WHERE fkey_mb_user_id='".$logged_user_id."'";
-$res_user_group = db_query($sql_user_group);
-                 while($row = db_fetch_array($res_user_group)){
-                    $user_id[$cnt_user_group] = $row["fkey_mb_user_id"];
-                    $group_id[$cnt_user_group] = $row["fkey_mb_group_id"];
-                    $cnt_user_group++;
-                 }
+$sql_user_group = "SELECT * FROM mb_user_mb_group WHERE fkey_mb_user_id= $1 ";
+$array_values = array($logged_user_id);
+$array_types = array('s');
+$res_user_group = db_prep_query($sql_user_group, $array_values, $array_types);
+while($row = db_fetch_array($res_user_group)){
+	$user_id[$cnt_user_group] = $row["fkey_mb_user_id"];
+	$group_id[$cnt_user_group] = $row["fkey_mb_group_id"];
+	$cnt_user_group++;
+}
 /*get group from logged user  ********************************************************************************************/
 
+# recheck
 /*get group name  ********************************************************************************************/								 
-if(count($group_id) > 0)
-{
+if(count($group_id) > 0){
 	$sql_group = "SELECT mb_group_id, mb_group_name, mb_group_description FROM mb_group WHERE mb_group_id IN (";
-	
 	for($i=0; $i < count($group_id); $i++){
-		 if($i>0){ $sql_group .= ",";}
-		 $sql_group .= "'".$group_id[$i]."'";
-	
+		if($i>0){ $sql_group .= ",";}
+		$sql_group .= "'".$group_id[$i]."'";
 		$sql_group.= ") ORDER BY mb_group_name";
-		
 		$res_group = db_query($sql_group);
 		while($row = db_fetch_array($res_group)){
-		    $mb_group_description[$cnt_group] = $row["mb_group_description"];
+			$mb_group_description[$cnt_group] = $row["mb_group_description"];
 			$my_group_name[$cnt_group] = $row["mb_group_name"];
 			$my_group_id[$cnt_group] = $row["mb_group_id"];
-		    $cnt_group++;
-		 }			
+			$cnt_group++;
+		}			
 	}					 
 }
-/*get goup name  ********************************************************************************************/							 
+/*get group name  ********************************************************************************************/							 
 
 /*get allocated gui  ********************************************************************************************/
 




More information about the Mapbender_commits mailing list