svn commit: r99 - trunk/mapbender/http/javascripts/mod_back.php

arnulf at osgeo.org arnulf at osgeo.org
Wed Apr 19 09:41:33 EDT 2006


Author: arnulf
Date: 2006-04-19 13:41:32+0000
New Revision: 99

Modified:
   trunk/mapbender/http/javascripts/mod_back.php

Log:
code cleaned, added prepared statements

Modified: trunk/mapbender/http/javascripts/mod_back.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_back.php?view=diff&rev=99&p1=trunk/mapbender/http/javascripts/mod_back.php&p2=trunk/mapbender/http/javascripts/mod_back.php&r1=98&r2=99
==============================================================================
--- trunk/mapbender/http/javascripts/mod_back.php	(original)
+++ trunk/mapbender/http/javascripts/mod_back.php	2006-04-19 13:41:32+0000
@@ -1,6 +1,6 @@
 <?php
-#$Id: mod_back.php,v 1.9 2005/09/13 18:16:42 bjoern_heuser Exp $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_back.php,v 1.9 2005/09/13 18:16:42 bjoern_heuser Exp $
+# $Id$
+# http://www.mapbender.org/index.php/Back
 # Copyright (C) 2002 CCGIS 
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,18 +17,19 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-
 $gui_id = $_REQUEST["gui_id"];
 require_once("../../conf/mapbender.conf");
 $con = db_connect($DBSERVER,$OWNER,$PW);
 db_select_db(DB,$con);
-$sql = "SELECT e_src, e_target FROM gui_element WHERE e_id = 'back' AND fkey_gui_id = '".$gui_id."'";
-$res = db_query($sql);
+$sql = "SELECT e_src, e_target FROM gui_element WHERE e_id = 'back' AND fkey_gui_id = $1 ";
+$v = array($gui_id);
+$t = array('i');
+$res = db_prep_query($sql, $v, $t);
 $cnt = 0;
 while($row = db_fetch_array($res)){
-   $e_src = $row["e_src"];
-   $e_target = split(",",$row["e_target"]);
-   $cnt++;
+	$e_src = $row["e_src"];
+	$e_target = split(",",$row["e_target"]);
+	$cnt++;
 }
 if($cnt > 1){ echo "alert('back: ID not unique!');";}
 echo "var mod_back_map = '".$e_target[0]."';";
@@ -46,81 +47,80 @@
 mb_registerSubFunctions("mod_back_check(frameName)");
 
 function mod_back_check(frameName){
-   if(frameName == mod_back_map){
-      mod_back_cnt++;
-      //alert(mod_back_cnt);
-      if(mb_MapHistoryObj[mod_back_map].length > 1){
-         document.getElementById("back").src =  mod_back_img_off.src;
-      }
-      else{
-         document.getElementById("back").src =  mod_back_img_off_disabled.src;
-         mod_back_img_previous = document.getElementById("back").src;
-      }
-   }
+	if(frameName == mod_back_map){
+		mod_back_cnt++;
+		if(mb_MapHistoryObj[mod_back_map].length > 1){
+			document.getElementById("back").src =  mod_back_img_off.src;
+		}
+		else{
+			document.getElementById("back").src =  mod_back_img_off_disabled.src;
+			mod_back_img_previous = document.getElementById("back").src;
+		}
+	}
 }
 function mod_back_over(obj){
-  mod_back_img_previous = document.getElementById("back").src;
-  if(document.getElementById("back").src ==  mod_back_img_off.src){
-     document.getElementById("back").src = mod_back_img_over.src;
-  }
+	mod_back_img_previous = document.getElementById("back").src;
+	if(document.getElementById("back").src ==  mod_back_img_off.src){
+		document.getElementById("back").src = mod_back_img_over.src;
+	}
 }
 
 function mod_back_out(obj){
- document.getElementById("back").src  = mod_back_img_previous;
+	document.getElementById("back").src  = mod_back_img_previous;
 }
+
 function mod_back_set(){
-   if(mod_back_img_previous ==  mod_back_img_off.src){
-     //FutureObj
-     if(mb_MapFutureObj){
-        mb_setFutureObj(mod_back_map);
-     }
-     var ind = getMapObjIndexByName(mod_back_map);
-     var cnt = mb_MapHistoryObj[mod_back_map].length - 2;
-     if(mb_mapObj[ind].epsg != mb_MapHistoryObj[mod_back_map][cnt].epsg){
-       var oind = getMapObjIndexByName(mod_back_overview);
-       for(var i=0; i<mb_MapHistoryObj[mod_back_overview].length; i++){
-         if(mb_MapHistoryObj[mod_back_overview][i].epsg == mb_MapHistoryObj[mod_back_map][cnt].epsg){
-            mb_mapObj[oind].epsg = mb_MapHistoryObj[mod_back_overview][i].epsg;
-            mb_mapObj[oind].extent = mb_MapHistoryObj[mod_back_overview][i].extent;
-            setMapRequest(mod_back_overview);
-            break;
-         }
-       }
-     }
-     document.getElementById(mod_back_map).style.width = mb_MapHistoryObj[mod_back_map][cnt].width;
-     document.getElementById(mod_back_map).style.height = mb_MapHistoryObj[mod_back_map][cnt].height;     
-     mb_mapObj[ind].width = mb_MapHistoryObj[mod_back_map][cnt].width;
-     mb_mapObj[ind].height = mb_MapHistoryObj[mod_back_map][cnt].height;     
-     mb_mapObj[ind].epsg = mb_MapHistoryObj[mod_back_map][cnt].epsg;
-     mb_mapObj[ind].extent = mb_MapHistoryObj[mod_back_map][cnt].extent;
-     mb_mapObj[ind].layers = mb_MapHistoryObj[mod_back_map][cnt].layers;
-     mb_mapObj[ind].styles = mb_MapHistoryObj[mod_back_map][cnt].styles;
-     mb_mapObj[ind].querylayers = mb_MapHistoryObj[mod_back_map][cnt].querylayers;
-     mb_MapHistoryObj[mod_back_map].length = (mb_MapHistoryObj[mod_back_map].length - 2);
-     setMapRequest(mod_back_map);
-   }
+	if(mod_back_img_previous ==  mod_back_img_off.src){
+		if(mb_MapFutureObj){
+			mb_setFutureObj(mod_back_map);
+		}
+		var ind = getMapObjIndexByName(mod_back_map);
+		var cnt = mb_MapHistoryObj[mod_back_map].length - 2;
+		if(mb_mapObj[ind].epsg != mb_MapHistoryObj[mod_back_map][cnt].epsg){
+			var oind = getMapObjIndexByName(mod_back_overview);
+			for(var i=0; i < mb_MapHistoryObj[mod_back_overview].length; i++){
+				if(mb_MapHistoryObj[mod_back_overview][i].epsg == mb_MapHistoryObj[mod_back_map][cnt].epsg){
+					mb_mapObj[oind].epsg = mb_MapHistoryObj[mod_back_overview][i].epsg;
+					mb_mapObj[oind].extent = mb_MapHistoryObj[mod_back_overview][i].extent;
+					setMapRequest(mod_back_overview);
+					break;
+				}
+			}
+		}
+		document.getElementById(mod_back_map).style.width = mb_MapHistoryObj[mod_back_map][cnt].width;
+		document.getElementById(mod_back_map).style.height = mb_MapHistoryObj[mod_back_map][cnt].height;     
+		mb_mapObj[ind].width = mb_MapHistoryObj[mod_back_map][cnt].width;
+		mb_mapObj[ind].height = mb_MapHistoryObj[mod_back_map][cnt].height;     
+		mb_mapObj[ind].epsg = mb_MapHistoryObj[mod_back_map][cnt].epsg;
+		mb_mapObj[ind].extent = mb_MapHistoryObj[mod_back_map][cnt].extent;
+		mb_mapObj[ind].layers = mb_MapHistoryObj[mod_back_map][cnt].layers;
+		mb_mapObj[ind].styles = mb_MapHistoryObj[mod_back_map][cnt].styles;
+		mb_mapObj[ind].querylayers = mb_MapHistoryObj[mod_back_map][cnt].querylayers;
+		mb_MapHistoryObj[mod_back_map].length = (mb_MapHistoryObj[mod_back_map].length - 2);
+		setMapRequest(mod_back_map);
+	}
 }
 function mb_setHistoryObj(frameName){
-   if(mb_MapHistoryObj[frameName] == null){
-      mb_MapHistoryObj[frameName] = new Array();
-   }
-   var ind = getMapObjIndexByName(frameName);
-   var cnt = mb_MapHistoryObj[frameName].length;
-   mb_MapHistoryObj[frameName][cnt] = new Object();
-   mb_MapHistoryObj[frameName][cnt].width = mb_mapObj[ind].width;
-   mb_MapHistoryObj[frameName][cnt].height = mb_mapObj[ind].height;
-   mb_MapHistoryObj[frameName][cnt].epsg = mb_mapObj[ind].epsg;
-   mb_MapHistoryObj[frameName][cnt].extent = mb_mapObj[ind].extent;
-   mb_MapHistoryObj[frameName][cnt].layers = new Array();
-   for(var i=0; i<mb_mapObj[ind].layers.length;i++){
-      mb_MapHistoryObj[frameName][cnt].layers[i] = mb_mapObj[ind].layers[i];
-   }
-   mb_MapHistoryObj[frameName][cnt].styles = new Array();
-   for(var i=0; i<mb_mapObj[ind].styles.length;i++){
-           mb_MapHistoryObj[frameName][cnt].styles[i] = mb_mapObj[ind].styles[i];
-   }
-   mb_MapHistoryObj[frameName][cnt].querylayers = new Array();
-   for(var i=0; i<mb_mapObj[ind].querylayers.length;i++){
-      mb_MapHistoryObj[frameName][cnt].querylayers[i] = mb_mapObj[ind].querylayers[i];
-   }
+	if(mb_MapHistoryObj[frameName] == null){
+		mb_MapHistoryObj[frameName] = new Array();
+	}
+	var ind = getMapObjIndexByName(frameName);
+	var cnt = mb_MapHistoryObj[frameName].length;
+	mb_MapHistoryObj[frameName][cnt] = new Object();
+	mb_MapHistoryObj[frameName][cnt].width = mb_mapObj[ind].width;
+	mb_MapHistoryObj[frameName][cnt].height = mb_mapObj[ind].height;
+	mb_MapHistoryObj[frameName][cnt].epsg = mb_mapObj[ind].epsg;
+	mb_MapHistoryObj[frameName][cnt].extent = mb_mapObj[ind].extent;
+	mb_MapHistoryObj[frameName][cnt].layers = new Array();
+	for(var i=0; i<mb_mapObj[ind].layers.length;i++){
+		mb_MapHistoryObj[frameName][cnt].layers[i] = mb_mapObj[ind].layers[i];
+	}
+	mb_MapHistoryObj[frameName][cnt].styles = new Array();
+	for(var i=0; i<mb_mapObj[ind].styles.length;i++){
+		mb_MapHistoryObj[frameName][cnt].styles[i] = mb_mapObj[ind].styles[i];
+	}
+	mb_MapHistoryObj[frameName][cnt].querylayers = new Array();
+	for(var i=0; i<mb_mapObj[ind].querylayers.length;i++){
+		mb_MapHistoryObj[frameName][cnt].querylayers[i] = mb_mapObj[ind].querylayers[i];
+	}
 }




More information about the Mapbender_commits mailing list