svn commit: r277 - trunk/mapbender/http/javascripts/mod_scaleText.php

vera_schulze at osgeo.org vera_schulze at osgeo.org
Mon May 15 06:12:02 EDT 2006


Author: vera_schulze
Date: 2006-05-15 10:12:02+0000
New Revision: 277

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

Log:
Code cleaning ready

Modified: trunk/mapbender/http/javascripts/mod_scaleText.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_scaleText.php?view=diff&rev=277&p1=trunk/mapbender/http/javascripts/mod_scaleText.php&p2=trunk/mapbender/http/javascripts/mod_scaleText.php&r1=276&r2=277
==============================================================================
--- trunk/mapbender/http/javascripts/mod_scaleText.php	(original)
+++ trunk/mapbender/http/javascripts/mod_scaleText.php	2006-05-15 10:12:02+0000
@@ -1,42 +1,60 @@
 <?php
-#$Id: mod_scaleText.php,v 1.8 2005/09/13 18:16:42 bjoern_heuser Exp $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_scaleText.php,v 1.8 2005/09/13 18:16:42 bjoern_heuser Exp $
+# $Id$
+# http://www.mapbender.org/index.php/mod_scaleText.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# 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 = 'scaleText' AND fkey_gui_id = '".$gui_id."'";
-$res = db_query($sql);
+$sql = "SELECT e_src, e_target FROM gui_element WHERE e_id = 'scaleText' 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_target = $row["e_target"];
    $cnt++;
 }
 echo "var mod_scaleText_target = '".$e_target."';";
-if($cnt > 1){ echo "alert('scaleSelect: ID not unique!');";}
+if($cnt > 1){
+	echo "alert('scaleSelect: ID not unique!');";
+}
 ?>
 function mod_scaleText(){
-   mod_scaleText_val(mod_scaleText_target);
-   return false;
+	mod_scaleText_val(mod_scaleText_target);
+	return false;
 }
 function mod_scaleText_val(frameName){
+	var scale = document.getElementById("scaleText").elements[0];
+	if(scale.value.search(/\D/) != -1 || scale.value == ""){
+		scale.value = "";
+		return;
+	}   
+	var ind = getMapObjIndexByName(frameName);
+	var arrayBBox = mb_mapObj[ind].extent.split(",");
+	var x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
+	var y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
 
-   var scale = document.getElementById("scaleText").elements[0];
-   if(scale.value.search(/\D/) != -1 || scale.value == ""){
-      scale.value = "";
-      return;
-   }   
-   var ind = getMapObjIndexByName(frameName);
-   var arrayBBox = mb_mapObj[ind].extent.split(",");
-   var x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
-   var y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
-
-   var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale.value);
-   var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale.value);
-   var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale.value);
-   var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale.value);     
-   mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-   setMapRequest(frameName);
-   scale.value = "";
+	var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale.value);
+	var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale.value);
+	var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale.value);
+	var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale.value);     
+	mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+	setMapRequest(frameName);
+	scale.value = "";
 }




More information about the Mapbender_commits mailing list