[Mapbender-commits] r3280 - branches/beck_dev/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Dec 9 06:32:11 EST 2008
Author: beck
Date: 2008-12-09 06:32:10 -0500 (Tue, 09 Dec 2008)
New Revision: 3280
Modified:
branches/beck_dev/http/javascripts/mod_wmsByCookie.php
Log:
Modified: branches/beck_dev/http/javascripts/mod_wmsByCookie.php
===================================================================
--- branches/beck_dev/http/javascripts/mod_wmsByCookie.php 2008-12-09 11:10:06 UTC (rev 3279)
+++ branches/beck_dev/http/javascripts/mod_wmsByCookie.php 2008-12-09 11:32:10 UTC (rev 3280)
@@ -1,5 +1,5 @@
<?php
-# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze
+# $Id: mod_mapCookie.php 264 2008-12-09 12:10:19Z beck
# http://www.mapbender.org/index.php/mod_savewmc.php
# Copyright (C) 2002 CCGIS
#
@@ -18,25 +18,39 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-include(dirname(__FILE__) . "/../include/dyn_js.php");
-echo "mod_savewmc_target = '".$e_target[0]."';";
+echo "var mod_mapCookie_target = '".$e_target[0]."';";
?>
-mb_registerInitFunctions('triggerUnload()');
+eventInit.register(restoreMapState);
+eventInit.register(triggerUnload);
+function restoreMapState() {
+ if(!document.cookie) {
+ return;
+ }
+}
+
+function storeMapState() {
+ var mapIndex = getMapObjIndexByName(mod_wmsByCookie_target);
+ var cookieData = {}
+ var cookieExpires = new Date();
+
+ cookieExpires.setTime(cookieExpires.getTime() + (24 * 60 * 60 * 1000));
+
+ cookieData.extent = $.toJSON(mb_mapObj[getMapObjIndexByName(mod_wmsByCookie_target)].extent);
+
+ document.cookie = 'stored_map_state=' + $.toJSON(cookieData) + ';expires=' + cookieExpires.toGMTString();
+}
+
function triggerUnload() {
if(ie) {
document.getElementById('body').onunload = function() {
- var trigger = new Function ('','saveMapState()');
+ var trigger = new Function ('','storeMapState()');
trigger();
};
}
else {
- document.getElementById('body').setAttribute('onunload','saveMapState();');
+ document.getElementById('body').setAttribute('onunload','storeMapState();');
}
-}
-
-function saveMapState() {
- alert(0);
}
\ No newline at end of file
More information about the Mapbender_commits
mailing list