[Mapbender-commits] r3288 - branches/beck_dev/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Dec 11 02:00:30 EST 2008
Author: beck
Date: 2008-12-11 02:00:29 -0500 (Thu, 11 Dec 2008)
New Revision: 3288
Modified:
branches/beck_dev/http/javascripts/mod_mapCookie.php
Log:
Modified: branches/beck_dev/http/javascripts/mod_mapCookie.php
===================================================================
--- branches/beck_dev/http/javascripts/mod_mapCookie.php 2008-12-11 06:45:13 UTC (rev 3287)
+++ branches/beck_dev/http/javascripts/mod_mapCookie.php 2008-12-11 07:00:29 UTC (rev 3288)
@@ -22,12 +22,16 @@
echo "var mod_mapCookie_target = '".trim($e_target[0])."';";
?>
+// Cookie lifetime in days
var mod_mapCookie_cookieLifetime = 7;
+// Cookie name
var mod_mapCookie_cookieName = 'stored_map_state';
+// Bind funtions to init event
eventInit.register(restoreMapState);
eventInit.register(triggerUnload);
+// Restore map state from cookie
function restoreMapState() {
if(!document.cookie) {
return;
@@ -43,13 +47,14 @@
continue;
}
- var storedMapState = eval('(' + cookieData[i].replace(mod_mapCookie_cookieName + '=','') + ')');
+ var storedMapState = eval('(' + cookieData[i].replace(cookieName + '=','') + ')');
currentMapState.extent = storedMapState.extent;
currentMapState.epsg = storedMapState.epsg;
}
}
+// Store map state on exit
function storeMapState() {
var currentMapState = mb_mapObj[getMapObjIndexByName(mod_mapCookie_target)];
var cookieExpires = new Date();
@@ -63,6 +68,7 @@
document.cookie = 'stored_map_state=' + $.toJSON(cookieData) + ';expires=' + cookieExpires.toGMTString();
}
+// Call function on unload
function triggerUnload() {
if(ie) {
document.getElementById('body').onunload = function() {
More information about the Mapbender_commits
mailing list