svn commit: r792 - trunk/mapbender/http/javascripts/mod_resize_mapsize.php

marko at osgeo.org marko at osgeo.org
Tue Oct 17 14:20:43 EDT 2006


Author: marko
Date: 2006-10-17 18:20:43+0000
New Revision: 792

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

Log:
added element vars for adjusting mapsize and choosing between automtic resizing onload or resizing by button 

Modified: trunk/mapbender/http/javascripts/mod_resize_mapsize.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_resize_mapsize.php?view=diff&rev=792&p1=trunk/mapbender/http/javascripts/mod_resize_mapsize.php&p2=trunk/mapbender/http/javascripts/mod_resize_mapsize.php&r1=791&r2=792
==============================================================================
--- trunk/mapbender/http/javascripts/mod_resize_mapsize.php	(original)
+++ trunk/mapbender/http/javascripts/mod_resize_mapsize.php	2006-10-17 18:20:43+0000
@@ -25,6 +25,9 @@
 $con = db_connect(DBSERVER,OWNER,PW);
 db_select_db(DB,$con);
 
+$e_id_css = "resizeMapsize";
+include("../include/dyn_js.php");
+
 $sqltarget = "SELECT e_target FROM gui_element WHERE e_id = 'resizeMapsize' AND fkey_gui_id = $1";
 $v = array($gui_id);
 $t = array('s');
@@ -51,19 +54,38 @@
 }
 
 ?>
+try{
+	if (resize_option){}
+}
+catch(e){
+	resize_option = "auto";
+}
+
+try{
+	if (adjust_width){}
+}
+catch(e){
+	adjust_width = "-45";
+}
 
+try{
+	if (adjust_height){}
+}
+catch(e){
+	adjust_height = "-35";
+}
 var map_frame = "<?php echo $e_target ?>";
 var map_frame_left = "<?php echo $e_left ?>";
 var map_frame_top = "<?php echo $e_top ?>";
 var legend_width = "<?php echo $leg_e_width ?>";
 
-function frameWidth() {
+function frameWidth(){
   	if (window.innerWidth) return window.innerWidth;
   	else if (document.body && document.body.offsetWidth)  return document.body.offsetWidth;
   	else return 0;
 }
 
-function frameHeight() {
+function frameHeight(){
   	if (window.innerHeight)return window.innerHeight;
 	else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
     else return 0;
@@ -71,8 +93,8 @@
 
 function adjustDimension(){
 	var ind = getMapObjIndexByName(map_frame);
-	var mapheight = frameHeight() - <?php echo $e_top ?> - 35;
-	var mapwidth = frameWidth() - map_frame_left - legend_width - 45 ;
+	var mapheight = frameHeight() - <?php echo $e_top ?> + parseInt(adjust_height);
+	var mapwidth = frameWidth() - map_frame_left - legend_width + parseInt(adjust_width) ;
 	var pos = makeClickPos2RealWorldPos(map_frame,mapwidth,mapheight);
 	var coords = mb_mapObj[ind].extent.split(",");
 
@@ -84,6 +106,7 @@
 	window.frames[map_frame].document.getElementById("maps").style.width = mb_mapObj[ind].width;
 	window.frames[map_frame].document.getElementById("maps").style.height = mb_mapObj[ind].height;
 	zoomFull();
+    if (document.getElementById("autoresize_option")=='auto'){alert('resize == true')};
 }
 
 function zoomFull(){
@@ -108,15 +131,17 @@
 function control(){
   	adjustDimension();
 	if (!window.width_temp && window.innerWidth) {
-  	window.onresize = rebuild;
-  	width_temp = frameWidth();
-  	height_temp = frameHeight();
-}
-
-if (!window.width_temp && document.body && document.body.offsetWidth) {
-  	window.onresize = rebuild;
-  	width_temp = frameWidth();
-  	height_temp = frameHeight();
+  	    window.onresize = rebuild;
+  	    width_temp = frameWidth();
+  	    height_temp = frameHeight();
+    }
+
+    if (!window.width_temp && document.body && document.body.offsetWidth) {
+  	    window.onresize = rebuild;
+  	    width_temp = frameWidth();
+  	    height_temp = frameHeight();
+    }
 }
+if (resize_option == 'auto'){
+    window.setTimeout('control()', 3000);
 }
-window.setTimeout('control()', 3000);
\ No newline at end of file




More information about the Mapbender_commits mailing list