[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kupu-checkins
Subject:    [kupu-checkins] r11446 - kupu/branch/kupu-1.2/silva
From:       guido () codespeak ! net
Date:       2005-04-26 9:24:54
Message-ID: 20050426092454.013D127B97 () code1 ! codespeak ! net
[Download RAW message or body]

Author: guido
Date: Tue Apr 26 11:24:54 2005
New Revision: 11446

Modified:
   kupu/branch/kupu-1.2/silva/kupusilvatools.js
Log:
Fixed bug where the 'model' var pointed to the code source rather than to the
document in the source's form. Note that this requires the current trunk of
SilvaExternalSources and a new version of Silva to work, older versions
should work still, although obviously they will display buggy behaviour.


Modified: kupu/branch/kupu-1.2/silva/kupusilvatools.js
==============================================================================
--- kupu/branch/kupu-1.2/silva/kupusilvatools.js	(original)
+++ kupu/branch/kupu-1.2/silva/kupusilvatools.js	Tue Apr 26 11:24:54 2005
@@ -1704,6 +1704,18 @@
             addEventHandler(editor.getInnerDocument(), 'keydown', \
                this.handleKeyPressOnExternalSource, this);
             addEventHandler(editor.getInnerDocument(), 'keyup', \
this.handleKeyPressOnExternalSource, this);  };
+
+        // search for a special serialized identifier of the current document
+        // which is used to send to the ExternalSource element when sending
+        // requests so the ExternalSources know their context
+        this.docref = null;
+        var metas = this.editor.getInnerDocument().getElementsByTagName('meta');
+        for (var i=0; i < metas.length; i++) {
+            var meta = metas[i];
+            if (meta.getAttribute('name') == 'docref') {
+                this.docref = meta.getAttribute('content');
+            };
+        };
         
         this.updatebutton.style.display = 'none';
         this.delbutton.style.display = 'none';
@@ -1813,7 +1825,7 @@
     };
 
     this._continueStartExternalSourceEdit = function(url) {
-        url = url + '/get_rendered_form_for_editor';
+        url = url + '/get_rendered_form_for_editor?docref=' + this.docref;
         var request = Sarissa.getXmlHttpRequest();
         request.open('GET', url, true);
         var callback = new ContextFixer(this._addFormToTool, request, this);
@@ -1838,6 +1850,7 @@
     this._continueStartExternalSourceUpdate = function(url) {
         url = url + '/get_rendered_form_for_editor';
         var formdata = this._gatherFormDataFromElement();
+        formdata += '&docref=' + this.docref;
         var request = Sarissa.getXmlHttpRequest();
         request.open('POST', url, true);
         request.setRequestHeader('Content-Type', \
'application/x-www-form-urlencoded');


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic