[Mapbender-commits] r1934 - in trunk/mapbender/http: frames
javascripts php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Dec 19 06:29:25 EST 2007
Author: christoph
Date: 2007-12-19 06:29:25 -0500 (Wed, 19 Dec 2007)
New Revision: 1934
Added:
trunk/mapbender/http/javascripts/core.js
trunk/mapbender/http/javascripts/core.php
Modified:
trunk/mapbender/http/frames/index.php
trunk/mapbender/http/javascripts/event.js
trunk/mapbender/http/javascripts/map.js
trunk/mapbender/http/javascripts/map.php
trunk/mapbender/http/javascripts/mod_digitize_tab.php
trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
trunk/mapbender/http/php/mod_createJSObjFromDB.php
trunk/mapbender/http/php/mod_map1.php
trunk/mapbender/http/php/mod_mapOV.php
Log:
optimization, see http://lists.osgeo.org/pipermail/mapbender_dev/2007-December/000950.html
Modified: trunk/mapbender/http/frames/index.php
===================================================================
--- trunk/mapbender/http/frames/index.php 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/frames/index.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -84,30 +84,12 @@
?>
-->
</style>
-<script type='text/javascript' src="../extensions/jquery.js"></script>
-<script type='text/javascript' src="../extensions/jqjson.js"></script>
-<script type='text/javascript' src="../javascripts/point.js"></script>
-<script type='text/javascript' src="../javascripts/map_obj.js"></script>
-<script type='text/javascript' src="../javascripts/wfs_obj.js"></script>
<?php
-//echo "<script type='text/javascript' src='../javascripts/map.php?gui_id=".$_REQUEST["gui_id"]."&zoomToLayer=".$_REQUEST["zoomToLayer"]."&portal_services=".$_REQUEST['portal_services']."&portal_services_wfs=".$_REQUEST['portal_services_wfs']."&layer_preview=".$_REQUEST['layer_preview']."&".strip_tags(SID)."&mb_myBBOX=".$_REQUEST["mb_myBBOX"]."'></script>";
-echo "<script type='text/javascript' src='../javascripts/map.php?gui_id=".$_REQUEST["gui_id"]."&".strip_tags(SID)."&mb_myBBOX=".$_REQUEST["mb_myBBOX"]."'></script>";
-echo "<script type='text/javascript' src='../php/mod_createJSObjFromDB.php?". strip_tags (SID)."'></script>";
/*********************************************/
$frame = "";
/*********************************************/
-$sql = "SELECT DISTINCT e_mb_mod FROM gui_element WHERE e_public = 1 AND fkey_gui_id = $1";
-$v = array($_REQUEST["gui_id"]);
-$t = array('s');
-$res = db_prep_query($sql,$v,$t);
-$cnt = 0;
-while($row = db_fetch_array($res)){
- if($row["e_mb_mod"] != ""){
- echo "<script type='text/javascript' src='../javascripts/".trim($row["e_mb_mod"])."?gui_id=".$_REQUEST["gui_id"]."&". strip_tags (SID)."'></script> ";
- }
- $cnt++;
-}
+echo "<script type='text/javascript' src='../javascripts/core.php'></script>";
?>
</head>
<?php
@@ -175,5 +157,10 @@
<form id='sendData' name='sendData' action='' method='POST' target='loadData' style='position:absolute;left:800px'>
<input type='hidden' name='data'>
</form>
+<?php
+#echo "<script type='text/javascript' src='../javascripts/map.php?gui_id=".$_REQUEST["gui_id"]."&zoomToLayer=".$_REQUEST["zoomToLayer"]."&portal_services=".$_REQUEST['portal_services']."&portal_services_wfs=".$_REQUEST['portal_services_wfs']."&layer_preview=".$_REQUEST['layer_preview']."&".strip_tags(SID)."&mb_myBBOX=".$_REQUEST["mb_myBBOX"]."'></script>";
+echo "<script type='text/javascript' src='../javascripts/map.php?gui_id=".$_REQUEST["gui_id"]."&".strip_tags(SID)."&mb_myBBOX=".$_REQUEST["mb_myBBOX"]."'></script>";
+echo "<script type='text/javascript' src='../php/mod_createJSObjFromDB.php?". strip_tags (SID)."'></script>";
+?>
</body>
</html>
\ No newline at end of file
Added: trunk/mapbender/http/javascripts/core.js
===================================================================
--- trunk/mapbender/http/javascripts/core.js (rev 0)
+++ trunk/mapbender/http/javascripts/core.js 2007-12-19 11:29:25 UTC (rev 1934)
@@ -0,0 +1,153 @@
+var currentWmcExtensionData = {};
+var restoredWmcExtensionData = {};
+
+//var mb_MapRequestSubFunctions = [];
+//var mb_MapRequestPreFunctions = [];
+//var mb_MapObjectSubFunctions = [];
+//var mb_GetScalePreFunctions = [];
+//var mb_FeatureInfoPreFunctions = [];
+//var mb_loadWmsSubFunctions = [];
+//var mb_InitFunctions = [];
+var mb_WfsReadSubFunctions = [];
+var mb_WfsWriteSubFunctions = [];
+var mb_l10nFunctions = [];
+
+/**
+ * Triggered after a map is requested.
+ */
+var eventAfterMapRequest = new MapbenderEvent();
+
+/**
+ * Triggered before a map is requested.
+ */
+var eventBeforeMapRequest = new MapbenderEvent();
+
+/**
+ * Triggered before the scale is calculated.
+ */
+var eventBeforeGetScale = new MapbenderEvent();
+
+/**
+ * Triggered before a feature info is requested.
+ */
+var eventBeforeFeatureInfo = new MapbenderEvent();
+
+/**
+ * Triggered after a WMS has been loaded.
+ */
+var eventAfterLoadWMS = new MapbenderEvent();
+
+/**
+ * Triggered when Mapbender is loaded and after the map object has been initialised.
+ */
+var eventInit = new MapbenderEvent();
+
+/**
+ * Initializes the map object. Triggered when Mapbender is loaded.
+ */
+var eventInitMap = new MapbenderEvent();
+
+/**
+ * Triggered after the map object has been created.
+ */
+var eventAfterMapObjectConstruction = new MapbenderEvent(); // possibly obsolete!
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerInitFunctions(stringFunction){
+// mb_InitFunctions[mb_InitFunctions.length] = stringFunction;
+ eventInit.register(stringFunction);
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerPreFunctions(stringFunction){
+// mb_MapRequestPreFunctions[mb_MapRequestPreFunctions.length] = stringFunction;
+ eventBeforeMapRequest.register(stringFunction);
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerFeatureInfoPreFunctions(stringFunction){
+// mb_FeatureInfoPreFunctions[mb_FeatureInfoPreFunctions.length] = stringFunction;
+ eventBeforeFeatureInfo.register(stringFunction);
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerSubFunctions(stringFunction){
+// mb_MapRequestSubFunctions[mb_MapRequestSubFunctions.length] = stringFunction;
+ eventAfterMapRequest.register(stringFunction);
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerMapObjectSubFunctions(stringFunction){
+// mb_MapObjectSubFunctions[mb_MapObjectSubFunctions.length] = stringFunction;
+ eventAfterMapObjectConstruction.register(stringFunction);
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerGetScalePreFunctions(stringFunction){
+// mb_GetScalePreFunctions[mb_GetScalePreFunctions.length] = stringFunction;
+ eventBeforeGetScale.register(stringFunction);
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerloadWmsSubFunctions(stringFunction){
+// mb_loadWmsSubFunctions[mb_loadWmsSubFunctions.length] = stringFunction;
+ eventAfterLoadWMS.register(stringFunction);
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerWfsReadSubFunctions(stringFunction){
+ mb_WfsReadSubFunctions[mb_WfsReadSubFunctions.length] = stringFunction;
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerWfsWriteSubFunctions(stringFunction){
+ mb_WfsWriteSubFunctions[mb_WfsWriteSubFunctions.length] = stringFunction;
+}
+
+/**
+ * deprecated wrapped function
+ * @deprecated
+ */
+function mb_registerL10nFunctions(stringFunction) {
+ mb_l10nFunctions[mb_l10nFunctions.length] = stringFunction;
+}
+
+/**
+ * deprecated function for writing content within a tag via innerHTML
+ * @deprecated
+ */
+function writeTag(frameName, elName, tagSource) {
+ if(frameName && frameName != ""){
+ window.frames[frameName].document.getElementById(elName).innerHTML = tagSource;
+ }
+ else if(!frameName || frameName == ""){
+ document.getElementById(elName).innerHTML = tagSource;
+ }
+}
\ No newline at end of file
Added: trunk/mapbender/http/javascripts/core.php
===================================================================
--- trunk/mapbender/http/javascripts/core.php (rev 0)
+++ trunk/mapbender/http/javascripts/core.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -0,0 +1,30 @@
+<?php
+# $Id: map.php 1915 2007-12-12 16:21:27Z christoph $
+# http://www.mapbender.org/index.php/Map.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.
+
+#if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
+# ob_start("ob_gzhandler");
+#}
+#else {
+ ob_start();
+#}
+header('Content-type: application/x-javascript');
+require_once("../javascripts/event.js");
+require_once("../javascripts/core.js");
+
+?>
\ No newline at end of file
Modified: trunk/mapbender/http/javascripts/event.js
===================================================================
--- trunk/mapbender/http/javascripts/event.js 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/javascripts/event.js 2007-12-19 11:29:25 UTC (rev 1934)
@@ -1,41 +1,48 @@
/**
* An event. What happens, when the event occurs, depends on which functions have been
* registered with the event.
- */
+ *
+ * usage:
+ *
+ * // create a new Event
+ * var eventAfterMapRequest = new MapbenderEvent();
+ *
+ * // register a function with that event
+ * eventAfterMapRequest.register(function () {
+ * ...
+ * })
+ *
+ * // trigger the event
+ * eventAfterMapRequest.trigger();
+ *
+ */
var MapbenderEvent = function () {
- // public
+ // public methods
/**
* A function that needs to be executed, when the event occurs, has to be
* registered via this function.
*/
- this.register = function(aFunction, aPriority) {
-// var e = new Mb_notice("MapbenderEvent: registering " + aFunction);
+ this.register = function(aFunction) {
- var mpbnFunction = new MapbenderFunction(aFunction, aPriority, functionArray.length);
+ var mpbnFunction = new MapbenderFunction(aFunction);
functionArray.push(mpbnFunction);
-
- // unfortunately, there is no way of using static variables in JS...
- sortFunction = mpbnFunction.getSortFunction();
};
/**
* Exclude a previously registered function from the event
*/
this.unregister = function(aFunction) {
- var e = new Mb_notice("functions (before del): " + functionArray.join(","));
for (var i = 0, len = functionArray.length; i < len; i++) {
if (functionArray[i].getFunction() === aFunction) {
for (var j = i + 1; j < len; j++) {
functionArray[j-1] = functionArray[j];
- functionArray[j-1].setArrayPosition(j-1);
}
delete functionArray[len - 1];
len = len - 1;
}
}
functionArray.length = len;
- var e = new Mb_notice("functions (after del): " + functionArray.join(","));
};
/**
@@ -68,18 +75,18 @@
booleanOperator = properties;
}
else {
- var e = new Mb_exception("MapbenderEvent.trigger: invalid properties: %s", properties);
+// var e = new Mb_exception("MapbenderEvent.trigger: invalid properties: %s", properties);
}
}
// booleanOperator
if (typeof(booleanOperator) == "string") {
if (booleanOperator != "AND" && booleanOperator != "OR") {
- var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator: %s", booleanOperator);
+// var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator: %s", booleanOperator);
}
}
else if (typeof(booleanOperator) != "undefined") {
- var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator, must be a string, but is %s", typeof(booleanOperator));
+// var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator, must be a string, but is %s", typeof(booleanOperator));
}
var result;
@@ -98,8 +105,6 @@
break;
}
- // sort the function array by priority
- functionArray.sort(sortFunction);
if (log) {
var e = new Mb_notice("functions (after sort): " + functionArray.join(","));
}
@@ -132,20 +137,14 @@
*/
var functionArray = [];
- /**
- * the functionArray will be sorted using this function
- */
- var sortFunction;
-
var propertiesObj;
var log = false;
- // constructor
};
/**
* A MapbenderFunction is a function with a priority.
*/
-var MapbenderFunction = function (aFunction, aPriority, posInArray) {
+var MapbenderFunction = function (aFunction) {
// public
/**
@@ -156,34 +155,15 @@
};
/**
- * Returns the functions priority
- */
- this.getPriority = function () {
- return priority;
- };
-
- /**
- * Returns the array position
- */
- this.getArrayPosition = function () {
- return posInArray;
- };
-
- /**
- * Returns the array position
- */
- this.setArrayPosition = function (i) {
- posInArray = i;
- };
-
- /**
* Executes the function
*/
this.execute = function (argumentObj) {
-// var e = new Mb_notice("MapbenderFunction: executing " + this);
if (typeof(aFunction) == "function") {
return func(argumentObj);
}
+
+ // this branch is for backwards compatibility with the
+ // pre-2.5 event system that is based on strings.
else {
var argumentNames = [];
var argumentValues = [];
@@ -203,46 +183,10 @@
str += "}";
str += "(" + argumentValues.join(", ") + "));";
var returnValue = eval(str);
-// console.log("%s: %s", aFunction, returnValue);
return returnValue;
}
}
- /**
- * Returns a sort function for Mapbender functions. Sorted by priority.
- */
- this.getSortFunction = function () {
- var mapbenderFunctionSort = function (functionA, functionB) {
- var diff = functionA.getPriority() - functionB.getPriority();
- if (diff === 0) {
- // I assumed that if the return value of the sort function was 0, then no switch
- // would occur. But this is not the case. A random looking output is what I get.
- // So I had to use the array position as well.
- return functionA.getArrayPosition() - functionB.getArrayPosition();
- }
- return diff;
- };
- return mapbenderFunctionSort;
- };
// private
var func = aFunction;
-
- // constructor
- /**
- * priority is a number, lower number means higher priority.
- * Maybe use 0-9, then 5 could be a default.
- */
- if (typeof(aPriority) != "number") {
- var priority = 5;
- }
- else {
- var priority = aPriority;
- }
-
- // the array position is needed for the sort function, if the priorities are equal.
- var posInArray = posInArray;
-};
-
-MapbenderFunction.prototype.toString = function () {
- return this.getFunction() + " (pos: "+this.getArrayPosition()+")";
-};
+};
\ No newline at end of file
Modified: trunk/mapbender/http/javascripts/map.js
===================================================================
--- trunk/mapbender/http/javascripts/map.js 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/javascripts/map.js 2007-12-19 11:29:25 UTC (rev 1934)
@@ -19,71 +19,7 @@
var mb_offset_bottom = 0;
var mb_offset_left = 0;
var mb_log = null;
-var currentWmcExtensionData = {};
-var restoredWmcExtensionData = {};
-/*
- ***************************************************************************************
- * register functions
- ***************************************************************************************
- */
-
-//var mb_MapRequestSubFunctions = [];
-//var mb_MapRequestPreFunctions = [];
-//var mb_MapObjectSubFunctions = [];
-//var mb_GetScalePreFunctions = [];
-//var mb_FeatureInfoPreFunctions = [];
-//var mb_loadWmsSubFunctions = [];
-//var mb_InitFunctions = [];
-var mb_WfsReadSubFunctions = [];
-var mb_WfsWriteSubFunctions = [];
-var mb_l10nFunctions = [];
-
-var eventAfterMapRequest = new MapbenderEvent();
-var eventBeforeMapRequest = new MapbenderEvent();
-var eventBeforeGetScale = new MapbenderEvent();
-var eventBeforeFeatureInfo = new MapbenderEvent();
-var eventAfterLoadWMS = new MapbenderEvent();
-var eventInit = new MapbenderEvent();
-var eventAfterMapObjectConstruction = new MapbenderEvent(); // possibly obsolete!
-
-function mb_registerInitFunctions(stringFunction){
-// mb_InitFunctions[mb_InitFunctions.length] = stringFunction;
- eventInit.register(stringFunction);
-}
-function mb_registerPreFunctions(stringFunction){
-// mb_MapRequestPreFunctions[mb_MapRequestPreFunctions.length] = stringFunction;
- eventBeforeMapRequest.register(stringFunction);
-}
-function mb_registerFeatureInfoPreFunctions(stringFunction){
-// mb_FeatureInfoPreFunctions[mb_FeatureInfoPreFunctions.length] = stringFunction;
- eventBeforeFeatureInfo.register(stringFunction);
-}
-function mb_registerSubFunctions(stringFunction){
-// mb_MapRequestSubFunctions[mb_MapRequestSubFunctions.length] = stringFunction;
- eventAfterMapRequest.register(stringFunction);
-}
-function mb_registerMapObjectSubFunctions(stringFunction){
-// mb_MapObjectSubFunctions[mb_MapObjectSubFunctions.length] = stringFunction;
- eventAfterMapObjectConstruction.register(stringFunction);
-}
-function mb_registerGetScalePreFunctions(stringFunction){
-// mb_GetScalePreFunctions[mb_GetScalePreFunctions.length] = stringFunction;
- eventBeforeGetScale.register(stringFunction);
-}
-function mb_registerloadWmsSubFunctions(stringFunction){
-// mb_loadWmsSubFunctions[mb_loadWmsSubFunctions.length] = stringFunction;
- eventAfterLoadWMS.register(stringFunction);
-}
-function mb_registerWfsReadSubFunctions(stringFunction){
- mb_WfsReadSubFunctions[mb_WfsReadSubFunctions.length] = stringFunction;
-}
-function mb_registerWfsWriteSubFunctions(stringFunction){
- mb_WfsWriteSubFunctions[mb_WfsWriteSubFunctions.length] = stringFunction;
-}
-function mb_registerL10nFunctions(stringFunction) {
- mb_l10nFunctions[mb_l10nFunctions.length] = stringFunction;
-}
function mb_removeFunctionFromArray(arrayname,stringFunction){
var length = eval(arrayname+".length");
for(var i=0; i<length; i++){
@@ -97,7 +33,6 @@
}
}
-
function localize() {
for(var i=0; i<mb_l10nFunctions.length; i++){
eval(mb_l10nFunctions[i]);
@@ -160,7 +95,8 @@
/*END OF GLOBALS*/
-function init(){
+function init() {
+ eventInitMap.trigger();
eventInit.trigger();
/*
for(var i=0; i<mb_InitFunctions.length; i++){
@@ -1101,14 +1037,7 @@
}
if(cnt_fi == 0){alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));}
}
-function writeTag(frameName, elName, tagSource) {
- if(frameName && frameName != ""){
- window.frames[frameName].document.getElementById(elName).innerHTML = tagSource;
- }
- else if(!frameName || frameName == ""){
- document.getElementById(elName).innerHTML = tagSource;
- }
-}
+
/*
* global function to zoom a mapobject
*
@@ -1798,7 +1727,8 @@
*/
function mb_ajax_get(url, param, callback) {
try {
- mb_ajaxWrap_get(url, param, callback);
+// $.ajaxSetup({async:false});
+ $.get(url, param, callback);
}
catch(e) {
var error = new Mb_exception('map.php: mb_ajax_get:'+e);
@@ -1814,7 +1744,8 @@
*/
function mb_ajax_post(url, param, callback) {
try {
- mb_ajaxWrap_post(url, param, callback);
+// $.ajaxSetup({async:false});
+ $.post(url, param, callback);
}
catch(e) {
var error = new Mb_exception('map.php: mb_ajax_post:'+e);
@@ -1830,13 +1761,14 @@
*/
function mb_ajax_json(url, param, callback) {
try {
- mb_ajaxWrap_json(url, param, callback);
+// window.frames['ajax'].$.ajaxSetup({async:false}); //TODO: find out why async doesn't work sometimes
+ $.getJSON(url, param, callback);
}
catch(e) {
var error = new Mb_exception('map.php: mb_ajax_json:'+e);
}
}
-
+
/*
***************************************************************************************
* button handling
Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/javascripts/map.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -17,11 +17,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+session_start();
-include(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
-session_start();
+// see http://trac.osgeo.org/mapbender/ticket/79
+ini_set('session.bug_compat_42',0);
+ini_set('session.bug_compat_warn',0);
+
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
@@ -51,6 +55,9 @@
ob_start();
header('Content-type: application/x-javascript');
+//
+// Define global variables (TODO: move to mapbender object later on)
+//
echo "var mb_nr = '".session_id()."';";
echo "var mb_myLogin = '".$_SESSION["mb_login"]."';";
echo "var mb_styleID = '".md5($_SESSION["mb_user_name"])."';";
@@ -63,16 +70,34 @@
echo "var global_mb_log_level = '".LOG_LEVEL."';";
echo "var global_log_levels = '".LOG_LEVEL_LIST."';";
-include("event.js");
-include("map.js");
+//
+// Load JavaScript libraries
+//
+require_once("../javascripts/map.js");
+require_once("../javascripts/point.js");
+require_once("../javascripts/map_obj.js");
+require_once("../javascripts/wfs_obj.js");
+require_once("../extensions/jquery.js");
+require_once("../extensions/jqjson.js");
-// see http://trac.osgeo.org/mapbender/ticket/79
-ini_set('session.bug_compat_42',0);
-ini_set('session.bug_compat_warn',0);
+//
+// Load JavaScript modules of GUI elements
+//
+$sql = "SELECT DISTINCT e_mb_mod FROM gui_element WHERE e_public = 1 AND fkey_gui_id = $1";
+$v = array($_REQUEST["gui_id"]);
+$t = array('s');
+$res = db_prep_query($sql,$v,$t);
+$cnt = 0;
+while($row = db_fetch_array($res)){
+ if($row["e_mb_mod"] != ""){
+ require_once("../javascripts/" . trim($row["e_mb_mod"]));
+ }
+ $cnt++;
+}
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
-
+//
+// Load JavaScript files of GUI elements
+//
$mb_sql = "SELECT DISTINCT e_js_file, e_id, e_src, e_target, e_pos FROM gui_element WHERE e_public = 1 AND fkey_gui_id = $1 ORDER BY e_pos";
$mb_v = array($_REQUEST["gui_id"]);
$mb_t = array("s");
@@ -84,7 +109,7 @@
$e_id_css = $row_js["e_id"];
$e_src = $row_js["e_src"];
$e_target = $row_js["e_target"];
- include($row_js["e_js_file"]);
+ require_once($row_js["e_js_file"]);
}
}
?>
\ No newline at end of file
Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -64,7 +64,7 @@
var wfsWindow;
var dwin = null;
var wfsConf = [];
-var d = new parent.GeometryArray();
+var d;
var mod_digitize_width;
var mod_digitize_height;
var mod_digitizeEvent = false;
@@ -81,17 +81,24 @@
var digitizeDivTag;
-var GeometryArray = parent.GeometryArray;
+var GeometryArray;
var MultiGeometry = parent.MultiGeometry;
-var Geometry = parent.Geometry;
-var Point = parent.Point;
-var geomType = parent.geomType;
+var Geometry;
+var Point;
+var geomType;
var msgObj;
var featureTypeElementFormId = "featureTypeElementForm";
try {if(mod_digitize_elName){}}catch(e) {mod_digitize_elName = "digitize";}
+function initializeDigitize () {
+ d = new parent.GeometryArray();
+ GeometryArray = parent.GeometryArray;
+ Geometry = parent.Geometry;
+ Point = parent.Point;
+ geomType = parent.geomType;
+}
/**
* Append geometries from KML when KML has been loaded
@@ -391,6 +398,7 @@
registerDigitizePreFunctions("drawDashedLine()");
registerDigitizeSubFunctions("updateListOfGeometries()");
registerDigitizeSubFunctions("drawDashedLine()");
+ parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].initializeDigitize()");
parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].setStyleForTargetFrame()");
parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].checkDigitizeTag()");
parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].initialiseSnapping()");
Modified: trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -50,13 +50,13 @@
maxHighlightedPoints = Number(maxHighlightedPoints);
if (isNaN(maxHighlightedPoints)) {
- var e = new parent.Mb_warning("mod_wfs_gazetteer_client.php: Element var maxHighlightedPoints must be a number.");
+// var e = new parent.Mb_warning("mod_wfs_gazetteer_client.php: Element var maxHighlightedPoints must be a number.");
}
}
}
catch(e){
maxHighlightedPoints = 0;
- var e = new parent.Mb_warning("mod_wfs_gazetteer_client.php: Element var maxHighlightedPoints is not set, see 'edit element vars'.");
+// var e = new parent.Mb_warning("mod_wfs_gazetteer_client.php: Element var maxHighlightedPoints is not set, see 'edit element vars'.");
}
var targetArray = targetString.split(",");
Modified: trunk/mapbender/http/php/mod_createJSObjFromDB.php
===================================================================
--- trunk/mapbender/http/php/mod_createJSObjFromDB.php 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/php/mod_createJSObjFromDB.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -17,6 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ob_start();
require_once(dirname(__FILE__)."/mb_validateSession.php");
require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
require_once(dirname(__FILE__)."/../classes/class_wms.php");
Modified: trunk/mapbender/http/php/mod_map1.php
===================================================================
--- trunk/mapbender/http/php/mod_map1.php 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/php/mod_map1.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -54,15 +54,19 @@
?>
<script type="text/javascript">
<!--
-function init_mod_map1(){
- parent.mb_registerMapObj('mapframe1', 'maps', null,mod_map1_width, mod_map1_height);
- document.getElementById("maps").style.width = mod_map1_width;
- document.getElementById("maps").style.height = mod_map1_height;
+
+function init () {
+ parent.eventInitMap.register(function init_mod_map1(){
+ parent.mb_registerMapObj('mapframe1', 'maps', null,mod_map1_width, mod_map1_height);
+ document.getElementById("maps").style.width = mod_map1_width;
+ document.getElementById("maps").style.height = mod_map1_height;
+ });
}
+
// -->
</script>
</head>
-<body leftmargin='0' topmargin='0' onload="init_mod_map1()" bgcolor='#ffffff'>
+<body leftmargin='0' topmargin='0' onload="init()" bgcolor='#ffffff'>
<div id='markResult' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:26'> </div>
<div id='maps' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:2;'> </div>
Modified: trunk/mapbender/http/php/mod_mapOV.php
===================================================================
--- trunk/mapbender/http/php/mod_mapOV.php 2007-12-18 15:38:37 UTC (rev 1933)
+++ trunk/mapbender/http/php/mod_mapOV.php 2007-12-19 11:29:25 UTC (rev 1934)
@@ -61,18 +61,21 @@
?>
<script type="text/javascript">
<!--
-function init_mod_mapOV(){
- parent.mb_registerMapObj('overview', 'maps', mod_overview_rank, mod_overview_width, mod_overview_height);
- document.onmouseover = mod_ov_setHandler;
- document.onmousedown = parent.mod_box_start;
- document.onmouseup = mod_ov_getExtent;
- document.onmousemove = parent.mod_box_run;
- document.getElementById("maps").style.width = mod_overview_width;
- document.getElementById("maps").style.height = mod_overview_height;
-
- var ind = parent.getMapObjIndexByName('overview');
- var ov_extent = parent.mb_mapObj[ind].getExtentInfos();
- parent.mb_setWmcExtensionData({"ov_minx":ov_extent.minx,"ov_miny":ov_extent.miny,"ov_maxx":ov_extent.maxx,"ov_maxy":ov_extent.maxy});
+
+function init () {
+ parent.eventInitMap.register(function init_mod_mapOV(){
+ parent.mb_registerMapObj('overview', 'maps', mod_overview_rank, mod_overview_width, mod_overview_height);
+ document.onmouseover = mod_ov_setHandler;
+ document.onmousedown = parent.mod_box_start;
+ document.onmouseup = mod_ov_getExtent;
+ document.onmousemove = parent.mod_box_run;
+ document.getElementById("maps").style.width = mod_overview_width;
+ document.getElementById("maps").style.height = mod_overview_height;
+
+ var ind = parent.getMapObjIndexByName('overview');
+ var ov_extent = parent.mb_mapObj[ind].getExtentInfos();
+ parent.mb_setWmcExtensionData({"ov_minx":ov_extent.minx,"ov_miny":ov_extent.miny,"ov_maxx":ov_extent.maxx,"ov_maxy":ov_extent.maxy});
+ });
}
function mod_ov_setHandler(e){
parent.mb_isBF = "overview";
@@ -135,7 +138,7 @@
// -->
</script>
</head>
-<body leftmargin='0' topmargin='0' onload="init_mod_mapOV()" bgcolor='#ffffff'>
+<body leftmargin='0' topmargin='0' onload="init()" bgcolor='#ffffff'>
<div id='maps' name='maps' style =' position:absolute;left:0px;top:0px;width:0px;height:0px;' ></div>
<div id='l_top' name='l_top' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:11;visibility:hidden;background-color:red;cursor: crosshair;"></div>
<div id='l_right' name='l_right' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:12;visibility:hidden;background-color:red;cursor: crosshair;"></div>
More information about the Mapbender_commits
mailing list