Guest User

[PATCH] XSLTForms rev397: preserve old instance-nodes after submissions with replace="instance" (so reset works as by the xforms specs)

a guest
Apr 22nd, 2010
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.19 KB | None | 0 0
  1. Index: src/js/core/XFInstance.js.xml
  2. ===================================================================
  3. --- src/js/core/XFInstance.js.xml   (revision 396)
  4. +++ src/js/core/XFInstance.js.xml   (working copy)
  5. @@ -115,11 +115,12 @@
  6.         <cm:wiki>
  7.  * '''setDoc''' method : sets a document for this instance</cm:wiki>
  8.  <![CDATA[
  9. -XFInstance.prototype.setDoc = function(doc, isReset) {
  10. +XFInstance.prototype.setDoc = function(doc, isReset, isPreserveOld) {
  11.     this.doc = typeof doc == "string"? XDocument.parse(doc) : doc;
  12.     this.doc.model = this.model;
  13.     this.doc.instance = this;
  14. -  this.store(isReset);
  15. +   if (!isPreserveOld)
  16. +       this.store(isReset);
  17.  };
  18.          
  19.  ]]>
  20. Index: src/js/core/XFSubmission.js.xml
  21. ===================================================================
  22. --- src/js/core/XFSubmission.js.xml (revision 397)
  23. +++ src/js/core/XFSubmission.js.xml (working copy)
  24. @@ -184,7 +184,7 @@
  25.            
  26.                         if (subm.replace == "instance") {
  27.                             var inst = instance == null? (node ? node.ownerDocument.instance : subm.model.getInstance()) : $(instance).xfElement;
  28. -                           inst.setDoc(req.responseText);
  29. +                           inst.setDoc(req.responseText, false, true);
  30.                             xforms.addChange(subm.model);
  31.                             XMLEvents.dispatch(subm.model, "xforms-rebuild");
  32.                             xforms.refresh();
  33. Index: build/xsltforms.js
  34. ===================================================================
  35. --- build/xsltforms.js  (revision 396)
  36. +++ build/xsltforms.js  (working copy)
  37. @@ -1715,11 +1715,12 @@
  38.  
  39.        
  40.  
  41. -XFInstance.prototype.setDoc = function(doc, isReset) {
  42. +XFInstance.prototype.setDoc = function(doc, isReset, isPreserveOld) {
  43.     this.doc = typeof doc == "string"? XDocument.parse(doc) : doc;
  44.     this.doc.model = this.model;
  45.     this.doc.instance = this;
  46. -  this.store(isReset);
  47. +   if (!isPreserveOld)
  48. +       this.store(isReset);
  49.  };
  50.          
  51.  
  52. @@ -2076,7 +2077,7 @@
  53.            
  54.                         if (subm.replace == "instance") {
  55.                             var inst = instance == null? (node ? node.ownerDocument.instance : subm.model.getInstance()) : $(instance).xfElement;
  56. -                           inst.setDoc(req.responseText);
  57. +                           inst.setDoc(req.responseText, false, true);
  58.                             XMLEvents.dispatch(subm.model, "xforms-rebuild");
  59.                             xforms.refresh();
  60.                         }
Advertisement
Add Comment
Please, Sign In to add comment