Author: michiel
Date: 2010-04-12 11:10:00 +0200 (Mon, 12 Apr 2010)
New Revision: 41832

Modified:
   
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
Log:
sometimes if for some reason saving is costing some time, users get annoying 
confirmation dialogs. Trying to fix that here.

Modified: 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
===================================================================
--- 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
        2010-04-11 18:06:14 UTC (rev 41831)
+++ 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
        2010-04-12 09:10:00 UTC (rev 41832)
@@ -224,6 +224,7 @@
     $(window).bind("beforeunload",
                    function(ev) {
                        List.prototype.leftPage = true;
+                      $(self.div).find(":input").attr("disabled", true);
                        var result = self.commit(0, true);
                        if (result != null) {
                            ev.returnValue = confirm(result); //'<fmt:message 
key="invalid" />';
@@ -799,9 +800,20 @@
         result = null;
     }
     if (leavePage) {
-        if (self.saving) {
-            return "Cannot leave because still saving " + result;
-        }
+
+       // put a maximum on the duration time of the next while loop. Just to 
be sure.
+       $.timer(10000,
+               function(timer) {
+                   self.saving = false;
+                   timer.stop();
+                }
+               );
+
+       while(self.saving) {
+           // waiting a bit for that.
+           // There is no proper wait or join method  in javascript.
+       }
+
         if (result != null) {
             return "Cannot leave because save failed: " + result;
         }

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to