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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Dec 8 08:26:54 EST 2008


Author: beck
Date: 2008-12-08 08:26:54 -0500 (Mon, 08 Dec 2008)
New Revision: 3275

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-08 12:21:29 UTC (rev 3274)
+++ branches/beck_dev/http/javascripts/mod_wmsByCookie.js	2008-12-08 13:26:54 UTC (rev 3275)
@@ -2,20 +2,23 @@
 
 // Initialze
 function wmsByCookie_init() {
-	console.log(parent.wms[0].objLayer);return;
-	wmsByCookie_setCookies();
+//	wmsByCookie_setCookies();
 	wmsByCookie_getCookies();
 }
 
 // Set cookie lifetime
 var cookieExpires  = new Date();
-var cookieValidity = cookieExpires.getTime() + (24 * 60 * 60 * 1000);
-cookieExpires.setTime(cookieValidity);
+cookieExpires.setTime(cookieExpires.getTime() + (24 * 60 * 60 * 1000));
 
-// Set cookie for each WMS object
+// Set a cookie for each WMS object
 function wmsByCookie_setCookies() {
 	for(var i = 0; i < parent.wms.length; i++) {
-		document.cookie = 'wms' + i + '=' + $.toJSON(parent.wms[i]) + ';expires=' + cookieExpires.toGMTString();
+		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();
 	}
 }
 
@@ -32,6 +35,8 @@
 			continue;
 		}
 		
-		console.log(eval('(' + cookieData[i].replace(/wms[0-9*]=/,'') + ')'));
+		wmsData = eval('(' + cookieData[i].replace(/wms[0-9*]=/,'') + ')');
+		
+		console.log('wms id: %s\nobject layer: %s',wmsData.wms_id,wmsData.objLayer);
 	}
 }
\ No newline at end of file



More information about the Mapbender_commits mailing list