Update of /var/cvs/applications/searchrelate/templates
In directory james.mmbase.org:/tmp/cvs-serv28900

Modified Files:
        List.js.jsp 
Log Message:
maintaining the 'sequence' number on the request is very hard to get correct 
when using this tag nested (so in the item of another one). This number is now 
maintained in the session, and reset on page leave.


See also: http://cvs.mmbase.org/viewcvs/applications/searchrelate/templates


Index: List.js.jsp
===================================================================
RCS file: /var/cvs/applications/searchrelate/templates/List.js.jsp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- List.js.jsp 26 Sep 2008 13:04:06 -0000      1.25
+++ List.js.jsp 26 Sep 2008 13:40:42 -0000      1.26
@@ -17,7 +17,7 @@
  * -  mmsrCreated
  *
  * @author Michiel Meeuwissen
- * @version $Id: List.js.jsp,v 1.25 2008/09/26 13:04:06 michiel Exp $
+ * @version $Id: List.js.jsp,v 1.26 2008/09/26 13:40:42 michiel Exp $
  */
 
 
@@ -81,7 +81,7 @@
 
     $(window).bind("beforeunload",
            function(ev) {
-               var result = self.commit(0, false);
+                       var result = self.commit(0, true);
                if (!result) {
                ev.returnValue = '<fmt:message key="invalid" />';
                }
@@ -99,7 +99,7 @@
     $(this.div).trigger("mmsrRelatedNodesReady", [self]);
 }
 
-
+List.prototype.leftPage = false;
 
 /**
  * Finds all elements with given node name and class, but ignores everything 
in a child div.list.
@@ -151,7 +151,6 @@
     if (this.item != undefined) {
         params.item   = this.item;
     }
-    params.mm_list_sequence  = List.seq++;
     if (this.source != undefined) {
         params.source = this.source;
     }
@@ -257,9 +256,12 @@
 /**
  * @param stale Number of millisecond the content may be aut of date. Defaults 
to 5 s. But on unload it is set to 0.
  */
-List.prototype.commit = function(stale, async) {
+List.prototype.commit = function(stale, leavePage) {
+    if (leavePage && ! List.prototype.leftPage) {
+        List.prototype.leftPage = true;
+        $.ajax({ type: "GET", async: false, url: 
"${mm:link('/mmbase/searchrelate/list/leavePage.jspx')}" });
+    }
     if(this.needsCommit()) {
-
         if (this.valid) {
             var now = new Date();
             if (stale == null) stale = this.defaultStale; //
@@ -271,6 +273,7 @@
                 params.source = this.source;
                 params.icondir = this.icondir;
                 params.createpos = this.createpos;
+                params.leavePage = leavePage ? true : false;
 
                 this.find(this.div, "input[checked], input[type='text'], 
input[type='hidden'], input[type='password'], option[selected], textarea")
                 .each(function() {
@@ -280,7 +283,7 @@
                 var self = this;
                 this.status("<img 
src='${mm:link('/mmbase/style/ajax-loader.gif')}' />");
                 $.ajax({ type: "POST",
-                         async: async == null ? true : async,
+                         async: leavePage == null ? true : !leavePage,
                          url: 
"${mm:link('/mmbase/searchrelate/list/save.jspx')}",
                          data: params,
                          complete: function(req, textStatus) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to