[Mapbender-commits] r5618 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Feb 24 05:18:36 EST 2010


Author: christoph
Date: 2010-02-24 05:18:33 -0500 (Wed, 24 Feb 2010)
New Revision: 5618

Modified:
   trunk/mapbender/http/javascripts/mod_savewmc.js
Log:
bug fix save wmc

Modified: trunk/mapbender/http/javascripts/mod_savewmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.js	2010-02-24 09:32:00 UTC (rev 5617)
+++ trunk/mapbender/http/javascripts/mod_savewmc.js	2010-02-24 10:18:33 UTC (rev 5618)
@@ -168,8 +168,8 @@
 		attributes.keywords = $("#" + options.id + "_wmckeywords").val();
 		attributes.inspirecat = inspire_cat;
 		if (!!attributes.title) {
-			sendMapDataToServer(attributes, 0, (function(result, status) {
-				//alert(status + ": " + result);
+			sendMapDataToServer(attributes, 0, (function(result, status, message) {
+				alert(message);
 				$("#" + options.id + "_saveWMCForm form")[0].reset();
 			}));
 		}else{
@@ -297,6 +297,19 @@
 	if (storeInSession) {
 		$.ajaxSetup({async:false}); 
 	}
+
+	//
+	// WORKAROUND....cannot serialize map object,
+	// as it contains a jQuery collection, which is
+	// cyclic.
+	// Removing the $target from the map object before
+	// serialization, and re-appending it afterwards
+	//
+	var $target = [];
+	for (var i = 0; i < mb_mapObj.length; i++) {
+		$target.push(mb_mapObj[i].$target);
+		delete mb_mapObj[i].$target;
+	}
     var req = new Mapbender.Ajax.Request({
         url: "../php/mod_savewmc_server.php",
         method: "saveWMC",
@@ -310,4 +323,7 @@
         callback: callbackFunction
     }); 
     req.send();
+	for (var i = 0; i < mb_mapObj.length; i++) {
+		mb_mapObj[i].$target = $target[i];
+	}
 };



More information about the Mapbender_commits mailing list