[Mapbender-commits] r3278 - branches/beck_dev/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Dec 9 06:09:45 EST 2008


Author: beck
Date: 2008-12-09 06:09:45 -0500 (Tue, 09 Dec 2008)
New Revision: 3278

Modified:
   branches/beck_dev/http/javascripts/mod_wmsByCookie.js
Log:


Modified: branches/beck_dev/http/javascripts/mod_wmsByCookie.js
===================================================================
--- branches/beck_dev/http/javascripts/mod_wmsByCookie.js	2008-12-09 11:09:32 UTC (rev 3277)
+++ branches/beck_dev/http/javascripts/mod_wmsByCookie.js	2008-12-09 11:09:45 UTC (rev 3278)
@@ -1,42 +1,18 @@
-mb_registerInitFunctions('wmsByCookie_init()');
+mb_registerInitFunctions('triggerUnload()');
 
-// Initialze
-function wmsByCookie_init() {
-//	wmsByCookie_setCookies();
-	wmsByCookie_getCookies();
-}
-
-// Set cookie lifetime
-var cookieExpires  = new Date();
-cookieExpires.setTime(cookieExpires.getTime() + (24 * 60 * 60 * 1000));
-
-// Set a cookie for each WMS object
-function wmsByCookie_setCookies() {
-	for(var i = 0; i < parent.wms.length; i++) {
-		var wmsData = {};
-		
-		wmsData.wms_id   = parent.wms[i].wms_id;
-		wmsData.objLayer = parent.wms[i].objLayer;
-	
-		document.cookie = 'wms' + i + '=' + $.toJSON(wmsData) + ';expires=' + cookieExpires.toGMTString();
+function triggerUnload() {
+	if(ie) {
+		document.getElementById('body').onunload = function() {
+			var trigger = new Function ('','saveMapState()');
+			
+			trigger(); 
+		};
 	}
+	else {
+		document.getElementById('body').setAttribute('onunload','saveMapState();');
+	}
 }
 
-// Get stored WMS objects from cookie if available
-function wmsByCookie_getCookies() {
-	if(!document.cookie) {
-		return;
-	}
-	
-	var cookieData = document.cookie.split(';');
-	
-	for(var i = 0; i < cookieData.length; i++) {
-		if(!cookieData[i].match(/wms[0-9*]/)) {
-			continue;
-		}
-		
-		var wmsData = eval('(' + cookieData[i].replace(/wms[0-9*]=/,'') + ')');
-		
-		console.log('wms id: %s\nobject layer: %s',wmsData.wms_id,wmsData.objLayer);
-	}
+function saveMapState() {
+	alert(0);
 }
\ No newline at end of file



More information about the Mapbender_commits mailing list