svn commit: r213 - trunk/mapbender/http/javascripts/mod_pan.php

vera_schulze at osgeo.org vera_schulze at osgeo.org
Tue May 9 09:59:16 EDT 2006


Author: vera_schulze
Date: 2006-05-09 13:59:16+0000
New Revision: 213

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

Log:
Code cleaning ready, 1 db_prep_query

Modified: trunk/mapbender/http/javascripts/mod_pan.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_pan.php?view=diff&rev=213&p1=trunk/mapbender/http/javascripts/mod_pan.php&p2=trunk/mapbender/http/javascripts/mod_pan.php&r1=212&r2=213
==============================================================================
--- trunk/mapbender/http/javascripts/mod_pan.php	(original)
+++ trunk/mapbender/http/javascripts/mod_pan.php	2006-05-09 13:59:16+0000
@@ -1,6 +1,6 @@
 <?php
-#$Id: mod_pan.php,v 1.9 2005/09/13 18:16:42 bjoern_heuser Exp $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_pan.php,v 1.9 2005/09/13 18:16:42 bjoern_heuser Exp $
+# $Id$
+# http://www.mapbender.org/index.php/mod_pan.php
 # Copyright (C) 2002 CCGIS 
 #
 # This program is free software; you can redistribute it and/or modify
@@ -21,15 +21,19 @@
 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 = 'pan1' AND fkey_gui_id = '".$gui_id."'";
-$res = db_query($sql);
+$sql = "SELECT e_src, e_target FROM gui_element WHERE e_id = 'pan1' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
 $cnt = 0;
 while($row = db_fetch_array($res)){ 
    $e_src = $row["e_src"];
    $e_target = $row["e_target"];
    $cnt++;
 }
-if($cnt > 1){ echo "alert('pan1: ID not unique!');";}
+if($cnt > 1){
+	echo "alert('pan1: ID not unique!');";
+}
 echo "var mod_pan_target = '".$e_target."';";
 ?>
 var mod_pan_elName = "pan1";
@@ -41,73 +45,76 @@
 var mod_pan_img_over = new Image(); mod_pan_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
 function init_mod_pan(ind){
-   mb_button[ind] = document.getElementById(mod_pan_elName);
-   mb_button[ind].img_over = mod_pan_img_over.src;
-   mb_button[ind].img_on = mod_pan_img_on.src;
-   mb_button[ind].img_off = mod_pan_img_off.src;
-   mb_button[ind].status = 0;
-   mb_button[ind].elName = mod_pan_elName;
-   mb_button[ind].fName = mod_pan_frameName;
-   mb_button[ind].go = new Function ("mod_pan_click()");
-   mb_button[ind].stop = new Function ("mod_pan_disable()");
+	mb_button[ind] = document.getElementById(mod_pan_elName);
+	mb_button[ind].img_over = mod_pan_img_over.src;
+	mb_button[ind].img_on = mod_pan_img_on.src;
+	mb_button[ind].img_off = mod_pan_img_off.src;
+	mb_button[ind].status = 0;
+	mb_button[ind].elName = mod_pan_elName;
+	mb_button[ind].fName = mod_pan_frameName;
+	mb_button[ind].go = new Function ("mod_pan_click()");
+	mb_button[ind].stop = new Function ("mod_pan_disable()");
 }
 function mod_pan_click(){   
-   var el = window.frames[mod_pan_target].document; 
-   el.onmousedown = mod_pan_start;
-   el.onmouseup = mod_pan_stop;
-   el.onmousemove = mod_pan_run;
+	var el = window.frames[mod_pan_target].document; 
+	el.onmousedown = mod_pan_start;
+	el.onmouseup = mod_pan_stop;
+	el.onmousemove = mod_pan_run;
 }
 function mod_pan_disable(){
-   var el = window.frames[mod_pan_target].document; 
-   el.onmousedown = null;
-   el.onmouseup = null;
-   el.onmousemove = null;
+	var el = window.frames[mod_pan_target].document; 
+	el.onmousedown = null;
+	el.onmouseup = null;
+	el.onmousemove = null;
 }
 function mod_pan_start(e){
-   mb_panActive = true;
-   mb_getMousePos(e,mod_pan_target);
-   mb_start_x=clickX;
-   mb_start_y=clickY;
-   mb_end_x = clickX;
-   mb_end_y = clickY; 
-   return false;
+	mb_panActive = true;
+	mb_getMousePos(e,mod_pan_target);
+	mb_start_x=clickX;
+	mb_start_y=clickY;
+	mb_end_x = clickX;
+	mb_end_y = clickY; 
+	return false;
 }
 function mod_pan_run(e){
-   if(mb_panActive){
-     mb_getMousePos(e,mod_pan_target);
-     mb_end_x = clickX;
-     mb_end_y = clickY;
-     mod_pan_move_map();
-     if(ie){ return false;}
-     else{return true;}
-   }
+	if(mb_panActive){
+		mb_getMousePos(e,mod_pan_target);
+		mb_end_x = clickX;
+		mb_end_y = clickY;
+		mod_pan_move_map();
+		if(ie){
+			return false;
+		}
+		else{
+			return true;
+		}
+	}
 }
 function mod_pan_stop(e){
-   mb_panActive = false;
-   var dif_x = mb_end_x - mb_start_x;
-   var dif_y = mb_end_y - mb_start_y;
-   for(var i=0; i<mb_mapObj.length; i++){
-      if(mb_mapObj[i].frameName == mod_pan_target){
-         var width = mb_mapObj[i].width;
-         var height = mb_mapObj[i].height;      
-      }
-   } 
-   
-   var center_x = (width / 2)  - dif_x;
-   var center_y = (height / 2) - dif_y;
-   var real_center = makeClickPos2RealWorldPos(mod_pan_target,center_x, center_y);   
-   mb_arrangeElement(mod_pan_target, "maps", 0, 0);
-   for(var i=0; i<mb_PanSubElements.length; i++){
-      mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], 0, 0);
-   }
+	mb_panActive = false;
+	var dif_x = mb_end_x - mb_start_x;
+	var dif_y = mb_end_y - mb_start_y;
+	for(var i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == mod_pan_target){
+			var width = mb_mapObj[i].width;
+			var height = mb_mapObj[i].height;      
+		}
+	} 
+	var center_x = (width / 2)  - dif_x;
+	var center_y = (height / 2) - dif_y;
+	var real_center = makeClickPos2RealWorldPos(mod_pan_target,center_x, center_y);   
+	mb_arrangeElement(mod_pan_target, "maps", 0, 0);
+	for(var i=0; i<mb_PanSubElements.length; i++){
+		mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], 0, 0);
+	}
    zoom(mod_pan_target,false, 1.0, real_center[0], real_center[1]);   
 }
 function mod_pan_move_map(){
-   var dif_x = mb_end_x - mb_start_x;
-   var dif_y = mb_end_y - mb_start_y;
-   mb_arrangeElement(mod_pan_target, "maps", dif_x, dif_y);
-   for(var i=0; i<mb_PanSubElements.length; i++){
-      mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], dif_x, dif_y);
-   } 
-   return false;  
-}
+	var dif_x = mb_end_x - mb_start_x;
+	var dif_y = mb_end_y - mb_start_y;
+	mb_arrangeElement(mod_pan_target, "maps", dif_x, dif_y);
+	for(var i=0; i<mb_PanSubElements.length; i++){
+		mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], dif_x, dif_y);
+	} 
+	return false;  
+}
\ No newline at end of file




More information about the Mapbender_commits mailing list