[Mapbender-commits] r3284 - branches/beck_dev/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Dec 9 08:16:34 EST 2008
Author: beck
Date: 2008-12-09 08:16:34 -0500 (Tue, 09 Dec 2008)
New Revision: 3284
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-09 12:11:19 UTC (rev 3283)
+++ branches/beck_dev/http/javascripts/mod_mapCookie.php 2008-12-09 13:16:34 UTC (rev 3284)
@@ -20,8 +20,26 @@
require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
echo "var mod_mapCookie_target = '".trim($e_target[0])."';";
+
+$sql = "SELECT * FROM gui_element_vars ";
+$sql .= "WHERE fkey_gui_id = $1 ";
+$sql .= "AND fkey_e_id = $2";
+
+$v = array($_SESSION["mb_user_gui"],"mapCookie");
+$t = array("s","s");
+
+$result = db_prep_query($sql,$v,$t);
+$row = db_fetch_array($result);
+
+/*
+echo "var mod_mapCookie_cookieLifetime = ".(int)trim(row["cookieLifetime"]).";";
+echo "var mod_mapCookie_cookieName = '".trim(row["cookieName"])."';";
+*/
?>
+var mod_mapCookie_cookieLifetime = 7; // Cookie lifetime in days
+var mod_mapCookie_cookieName = 'stored_map_state'; // Cookie name
+
eventInit.register(restoreMapState);
eventInit.register(triggerUnload);
@@ -34,11 +52,13 @@
var cookieData = document.cookie.split(';');
for(var i = 0; i < cookieData.length; i++) {
- if(!cookieData[i].match(/stored_map_state/)) {
+ var cookieName = new RegExp(mod_mapCookie_cookieName);
+
+ if(!cookieData[i].match(cookieName)) {
continue;
}
- var storedMapState = eval('(' + cookieData[i].replace(/stored_map_state=/,'') + ')');
+ var storedMapState = eval('(' + cookieData[i].replace(mod_mapCookie_cookieName + '=','') + ')');
currentMapState.extent = storedMapState.extent;
currentMapState.epsg = storedMapState.epsg;
@@ -50,7 +70,7 @@
var cookieExpires = new Date();
var cookieData = {}
- cookieExpires.setTime(cookieExpires.getTime() + (24 * 60 * 60 * 1000));
+ cookieExpires.setTime(cookieExpires.getTime() + (mod_mapCookie_cookieLifetime * 24 * 60 * 60 * 1000));
cookieData.extent = currentMapState.extent;
cookieData.epsg = currentMapState.epsg;
More information about the Mapbender_commits
mailing list