[Mapbender-commits] r3848 - in trunk/mapbender: core
http/javascripts resources/db resources/db/update
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Apr 3 02:10:54 EDT 2009
Author: christoph
Date: 2009-04-03 02:10:52 -0400 (Fri, 03 Apr 2009)
New Revision: 3848
Added:
trunk/mapbender/resources/db/update/
trunk/mapbender/resources/db/update/update_2.7.sql
Modified:
trunk/mapbender/core/system.php
trunk/mapbender/http/javascripts/mod_navFrame.php
trunk/mapbender/http/javascripts/mod_pan.php
trunk/mapbender/http/javascripts/mod_selArea1.php
Log:
navFrame, pan1, selArea1 are now modularized
http://trac.osgeo.org/mapbender/ticket/343
Modified: trunk/mapbender/core/system.php
===================================================================
--- trunk/mapbender/core/system.php 2009-04-03 05:59:49 UTC (rev 3847)
+++ trunk/mapbender/core/system.php 2009-04-03 06:10:52 UTC (rev 3848)
@@ -36,4 +36,4 @@
define("ZOOM_MOUSEWHEEL", "1.1");
-define("MODULES_NOT_RELYING_ON_GLOBALS", "back,forward,zoomIn1,copyright,dependentDiv,dragMapSize,dynamicOverview,FeatureInfoRedirect,highlightPOI,navFrame,sandclock,scaleBar,scaleSel,setBBOX,setPOI2Scale");
+define("MODULES_NOT_RELYING_ON_GLOBALS", "back,forward,zoomIn1,zoomOut1,selArea1,pan1,copyright,dependentDiv,dragMapSize,dynamicOverview,FeatureInfoRedirect,highlightPOI,navFrame,sandclock,scaleBar,scaleSel,setBBOX,setPOI2Scale");
Modified: trunk/mapbender/http/javascripts/mod_navFrame.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_navFrame.php 2009-04-03 05:59:49 UTC (rev 3847)
+++ trunk/mapbender/http/javascripts/mod_navFrame.php 2009-04-03 06:10:52 UTC (rev 3848)
@@ -19,7 +19,12 @@
require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
include '../include/dyn_js.php';
+?>
+(function () {
+
+<?php
echo "var mod_navFrame_target = '".$e_target[0]."';";
+echo "var mod_navFrame_id = '".$e_id."';";
echo "var mod_navFrame_src = '".$e_src."';";
?>
@@ -30,19 +35,54 @@
mod_navFrame_ext = 10;
}
+eventInit.register(function () {
+<?php
+$html = <<<HTML
+<div id="mbN_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_n_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_n.gif" width="15" height="10">
+</div>
+<div id="mbNE_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_ne_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_ne.gif" width="10" height="10">
+</div>
+<div id="mbE_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_e_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_e.gif" width="10" height="15">
+</div>
+<div id="mbSE_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_se_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_se.gif" width="10" height="10">
+</div>
+<div id="mbS_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_s_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_s.gif" width="15" height="10">
+</div>
+<div id="mbSW_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_sw_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_sw.gif" width="10" height="10">
+</div>
+<div id="mbW_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_w_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_w.gif" width="10" height="15">
+</div>
+<div id="mbNW_$e_id" style="position:absolute;width:0;height:0;top:0;left:0;background-color:#B8C1C7;">
+<img id="arrow_nw_$e_id" style="position:relative;top:0;left:0" src="../img/arrows/arrow_nw.gif" width="10" height="10">
+</div>
+HTML;
+echo "var html = '" . str_replace("\n", "\\n", $html) . "';";
+?>
+ $("#" + mod_navFrame_id).html(html);
+
+ var directionArray = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
+ for (var i in directionArray) {
+ (function () {
+ var currentDirection = directionArray[i];
+// $("#mb"+currentDirection+"_"+mod_navFrame_id).click(function () {
+ $("#arrow_"+currentDirection.toLowerCase()+"_"+mod_navFrame_id).click(function () {
+ mod_navFrame(currentDirection);
+ });
+ }());
+ }
+});
+
eventAfterMapRequest.register(function () {
mod_navFrame_arrange();
});
-var directionArray = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
-for (var i in directionArray) {
- (function () {
- var currentDirection = directionArray[i];
- $("#mb"+currentDirection).click(function () {
- mod_navFrame(currentDirection);
- });
- }());
-}
function mod_navFrame_arrange(){
var el = document.getElementById(mod_navFrame_target).style;
@@ -53,26 +93,26 @@
var myHeight = parseInt(el.height);
//left,top,width,height
- mod_navFrame_pos("mbN",(myLeft),(myTop - ext),(myWidth),(ext));
- document.getElementById("arrow_n").style.left = myWidth/2 - document.getElementById("arrow_n").width/2;
- mod_navFrame_pos("mbNE",(myLeft + myWidth),(myTop - ext),(ext),(ext));
- mod_navFrame_pos("mbE",(myLeft + myWidth),(myTop),(ext),(myHeight));
- document.getElementById("arrow_e").style.top = myHeight/2 - document.getElementById("arrow_n").height/2;
- mod_navFrame_pos("mbSE",(myLeft + myWidth),(myTop + myHeight),(ext),(ext));
- mod_navFrame_pos("mbS",(myLeft),(myTop + myHeight),(myWidth),(ext));
- document.getElementById("arrow_s").style.left = myWidth/2 - document.getElementById("arrow_s").width/2;
- mod_navFrame_pos("mbSW",(myLeft - ext),(myTop + myHeight),(ext),(ext));
- mod_navFrame_pos("mbW",(myLeft - ext),(myTop),(ext),(myHeight));
- document.getElementById("arrow_w").style.top = myHeight/2 - document.getElementById("arrow_w").height/2;
- mod_navFrame_pos("mbNW",(myLeft - ext),(myTop -ext),(ext),(ext));
+ mod_navFrame_pos("mbN_"+mod_navFrame_id,(myLeft),(myTop - ext),(myWidth),(ext));
+ document.getElementById("arrow_n_"+mod_navFrame_id).style.left = myWidth/2 - document.getElementById("arrow_n_"+mod_navFrame_id).width/2;
+ mod_navFrame_pos("mbNE_"+mod_navFrame_id,(myLeft + myWidth),(myTop - ext),(ext),(ext));
+ mod_navFrame_pos("mbE_"+mod_navFrame_id,(myLeft + myWidth),(myTop),(ext),(myHeight));
+ document.getElementById("arrow_e_"+mod_navFrame_id).style.top = myHeight/2 - document.getElementById("arrow_n_"+mod_navFrame_id).height/2;
+ mod_navFrame_pos("mbSE_"+mod_navFrame_id,(myLeft + myWidth),(myTop + myHeight),(ext),(ext));
+ mod_navFrame_pos("mbS_"+mod_navFrame_id,(myLeft),(myTop + myHeight),(myWidth),(ext));
+ document.getElementById("arrow_s_"+mod_navFrame_id).style.left = myWidth/2 - document.getElementById("arrow_s_"+mod_navFrame_id).width/2;
+ mod_navFrame_pos("mbSW_"+mod_navFrame_id,(myLeft - ext),(myTop + myHeight),(ext),(ext));
+ mod_navFrame_pos("mbW_"+mod_navFrame_id,(myLeft - ext),(myTop),(ext),(myHeight));
+ document.getElementById("arrow_w_"+mod_navFrame_id).style.top = myHeight/2 - document.getElementById("arrow_w_"+mod_navFrame_id).height/2;
+ mod_navFrame_pos("mbNW_"+mod_navFrame_id,(myLeft - ext),(myTop -ext),(ext),(ext));
}
function mod_navFrame(val){
mb_panMap(mod_navFrame_target,val);
}
function mod_navFrame_pos(el,left,top,width,height){
-//alert(el + " , " +left + " , " +top + " , " +width + " , " +height)
document.getElementById(el).style.left = left;
document.getElementById(el).style.top = top;
document.getElementById(el).style.width = width;
document.getElementById(el).style.height = height;
}
+}());
\ No newline at end of file
Modified: trunk/mapbender/http/javascripts/mod_pan.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_pan.php 2009-04-03 05:59:49 UTC (rev 3847)
+++ trunk/mapbender/http/javascripts/mod_pan.php 2009-04-03 06:10:52 UTC (rev 3848)
@@ -20,7 +20,7 @@
require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
echo "var mod_pan_target = '".$e_target[0]."';";
?>
-var mod_pan_elName = "pan1";
+var mod_pan_elName = "<?php echo $e_id; ?>";
var mod_pan_frameName = "";
var mod_pan_MapObj = null;
@@ -31,34 +31,35 @@
var mb_panActive = false;
-function init_mod_pan(ind){
- mod_pan_MapObj = getMapObjByName(mod_pan_target);
- 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 p = mod_pan_MapObj.getDomElement();
- p.style.cursor = "pointer";
-
- p.onmousedown = mod_pan_start;
- p.onmouseup = mod_pan_stop;
- p.onmousemove = mod_pan_run;
-}
-function mod_pan_disable(){
- var p = mod_pan_MapObj.getDomElement();
- p.style.cursor = "pointer";
+eventInit.register(function () {
+ mb_regButton(function (ind){
+ mod_pan_MapObj = getMapObjByName(mod_pan_target);
+ 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 = function () {
+ var p = mod_pan_MapObj.getDomElement();
+ p.style.cursor = "pointer";
+
+ p.onmousedown = mod_pan_start;
+ p.onmouseup = mod_pan_stop;
+ p.onmousemove = mod_pan_run;
+ };
+ mb_button[ind].stop = function () {
+ var p = mod_pan_MapObj.getDomElement();
+ p.style.cursor = "pointer";
+
+ p.onmousedown = null;
+ p.onmouseup = null;
+ p.onmousemove = null;
+ };
+ });
+});
- p.onmousedown = null;
- p.onmouseup = null;
- p.onmousemove = null;
-}
function mod_pan_start(e){
mb_panActive = true;
var pos = mod_pan_MapObj.getMousePosition(e);
Modified: trunk/mapbender/http/javascripts/mod_selArea1.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_selArea1.php 2009-04-03 05:59:49 UTC (rev 3847)
+++ trunk/mapbender/http/javascripts/mod_selArea1.php 2009-04-03 06:10:52 UTC (rev 3848)
@@ -19,7 +19,7 @@
require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
?>
-var mod_selArea_elName = "selArea1";
+var mod_selArea_elName = "<?php echo $e_id;?>";
var mod_selArea_frameName = "";
var mod_selArea_target = "<?php echo $e_target[0]; ?>";
@@ -31,18 +31,25 @@
var mod_selArea_img_over = new Image();
mod_selArea_img_over.src = "<?php echo preg_replace("/_off/","_over",$e_src); ?>";
-function init_selArea1(ind){
- mod_selArea_MapObj = getMapObjByName(mod_selArea_target);
- mb_button[ind] = document.getElementById(mod_selArea_elName);
- mb_button[ind].img_over = mod_selArea_img_over.src;
- mb_button[ind].img_on = mod_selArea_img_on.src;
- mb_button[ind].img_off = mod_selArea_img_off.src;
- mb_button[ind].status = 0;
- mb_button[ind].elName = mod_selArea_elName;
- mb_button[ind].fName = mod_selArea_frameName;
- mb_button[ind].go = new Function ("mod_selArea_click()");
- mb_button[ind].stop = new Function ("mod_selArea_disable()");
-}
+eventInit.register(function () {
+ mb_regButton(function (ind) {
+ mod_selArea_MapObj = getMapObjByName(mod_selArea_target);
+ mb_button[ind] = document.getElementById(mod_selArea_elName);
+ mb_button[ind].img_over = mod_selArea_img_over.src;
+ mb_button[ind].img_on = mod_selArea_img_on.src;
+ mb_button[ind].img_off = mod_selArea_img_off.src;
+ mb_button[ind].status = 0;
+ mb_button[ind].elName = mod_selArea_elName;
+ mb_button[ind].fName = mod_selArea_frameName;
+ mb_button[ind].go = function () {
+ mod_selArea_click();
+ };
+ mb_button[ind].stop = function () {
+ mod_selArea_disable();
+ };
+ });
+});
+
function mod_selArea_click(){
var el = mod_selArea_MapObj.getDomElement();
el.onmouseover = mod_selArea_init;
Added: trunk/mapbender/resources/db/update/update_2.7.sql
===================================================================
--- trunk/mapbender/resources/db/update/update_2.7.sql (rev 0)
+++ trunk/mapbender/resources/db/update/update_2.7.sql 2009-04-03 06:10:52 UTC (rev 3848)
@@ -0,0 +1,4 @@
+-- remove event handlers, are now in the script
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'selArea1';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'pan1';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'navFrame';
\ No newline at end of file
More information about the Mapbender_commits
mailing list