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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Nov 7 09:27:42 EST 2007


Author: christoph
Date: 2007-11-07 09:27:42 -0500 (Wed, 07 Nov 2007)
New Revision: 1784

Modified:
   trunk/mapbender/http/javascripts/mod_savewmc.php
Log:
abortable

saving to db now alert on callback

Modified: trunk/mapbender/http/javascripts/mod_savewmc.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.php	2007-11-05 08:00:36 UTC (rev 1783)
+++ trunk/mapbender/http/javascripts/mod_savewmc.php	2007-11-07 14:27:42 UTC (rev 1784)
@@ -59,16 +59,17 @@
 //var mod_savewmc_img_over = new Image(); mod_savewmc_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
 
 function mod_savewmc_session(){
-	$.ajaxSetup({async:false}); //TODO: find out why async doesn't work onunload
-	sendMapDataToServer("session");
+	sendMapDataToServer("session", function(result, status) {});
 }
 
 function mod_savewmc(title){
 	var generalTitle = title ? title : prompt("Save WMC as...");
-	sendMapDataToServer(generalTitle);
+	if (generalTitle != "" && generalTitle != null) {
+		sendMapDataToServer(generalTitle, function(result, status) {alert(status + ": " + result);});
+	}
 }
 
-function sendMapDataToServer(generalTitle) {
+function sendMapDataToServer(generalTitle, callbackFunction) {
 	var user = "<?php echo $_SESSION["mb_user_id"]; ?>";
 	var ind = getMapObjIndexByName(mod_savewmc_target);
 	
@@ -77,9 +78,6 @@
 		extensionDataString = currentWmcExtensionData.toJSONString();
 	}
 
-	$.post("../php/mod_insertWmcIntoDb.php", {"saveInSession":saveInSession, "generalTitle":generalTitle, "extensionData":extensionDataString, "mapObject":mb_mapObj[ind].toJSONString()}, function (result, status) {
-		if (!saveInSession) {
-			alert(status + ": " + result);
-		}
-	});
+	window.frames['ajax'].$.ajaxSetup({async:false}); //TODO: find out why async doesn't work onunload
+	window.frames['ajax'].$.post("../php/mod_insertWmcIntoDb.php", {"saveInSession":saveInSession, "generalTitle":generalTitle, "extensionData":extensionDataString, "mapObject":mb_mapObj[ind].toJSONString()}, callbackFunction);
 }
\ No newline at end of file



More information about the Mapbender_commits mailing list