[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL - SetLimit.py:1.1.2.2 action.pt:1.1.2.3 limit.pt:1.1.2.3 main.pt:1.1.2.2 xul.zcml:1.1.2.3

Stephan Richter srichter@cbu.edu
Wed, 13 Mar 2002 11:39:34 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL
In directory cvs.zope.org:/tmp/cvs-serv1678/Zope/App/OFS/Folder/Views/XUL

Modified Files:
      Tag: srichter-OFS_Formulator-branch
	SetLimit.py action.pt limit.pt main.pt xul.zcml 
Log Message:
- Switched to SOAPpy library.

- Made the first action in XUL work.

This checkin is primary for people that want to look at the code. I will 
probably replace SOAPpy with Brian Lloyd's SOAP implementation later today,
since I have no approval to use SOAPpy in Zope 3 and Brian's stuff is 
already ZPL 2.0.


=== Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/SetLimit.py 1.1.2.1 => 1.1.2.2 ===
 
     template = PageTemplateFile('limit.pt')
-    xmlrpclib = PageTemplateFile('action.pt')
-    test = PageTemplateFile('test.pt')
+    action_js = PageTemplateFile('action.pt')
 
     def action(self, limit):
         ''' '''


=== Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/action.pt 1.1.2.2 => 1.1.2.3 ===
-    var p = new XMLHttpRequest();
-    p.open("POST", "http://physics.cbu.edu:8080/loaded/limit_xul;view/action?limit=2000");
-    alert('Limit successfully updated')
+
+// Passed in as the response handler in the asynchronous case
+// and called directly (see below) in the synchronous case
+function oncompletion(resp, call, status) { 
+  if (status != 0) {
+    alert("Error completion: " + status);
+    return true;
   }
+
+  // Was there a SOAP fault in the response?
+  if (resp.fault != null) {
+    var f = resp.fault;
+    var detail = f.detail;
+    var ds = new XMLSerializer();
+    var detailStr = detail ? ds.serializeToString(detail) : "";
+    alert("Fault namespace: " + f.faultNamespaceURI + "\nFault code: " + 
+          f.faultCode + "\nFault string: " + f.faultString + 
+          "\nFault actor: "  + f.faultActor + "\nDetail: " + detailStr);
+  }
+  else {
+    var ret = resp.getParameters(true, {})[0];
+    var val = ret.value;
+    var retStr = "Success:\nName: " + ret.name + "\nValue: " + val;
+    alert(retStr);
+  }
+  return true;
+}
+
+function action(limit) {
+  var s = new SOAPCall();
+  s.transportURI = "http://physics.cbu.edu:8082/loaded/methods;view/";
+  s.verifySourceHeader = true;
+  if (!s.verifySourceHeader)
+    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
+
+  var p1 = new SOAPParameter(limit, "limit");
+  s.encode(0, "setLimit", "http://physics.cbu.edu:8082/loaded/methods;view/", 0, null, 1, new Array(p1));
+  s.invoke();
+
+  // s.encode(0, "getLimit", "http://physics.cbu.edu:8082/loaded/methods;view/", 0, null, 0, new Array());
+  // var r = s.invoke();
+  // oncompletion(r, s, 0);
+ 
+}


=== Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/limit.pt 1.1.2.2 => 1.1.2.3 ===
                         title container/title">
 
-  <script src="http://physics.cbu.edu:8080/loaded/limit_xul;view/action" />
+  <script src="http://physics.cbu.edu:8080/loaded/limit_xul;view/action_js" />
 
   <description tal:content="container/description">
     Form Description
@@ -25,7 +25,7 @@
   </box>
 
   <button id="limitaction" class="dialog" label="Change"
-          onclick="action()" />
+          onclick="action(document.getElementById('field_limit').value)" />
 
 </window>
 


=== Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/main.pt 1.1.2.1 => 1.1.2.2 ===
   </hbox>
 
+
 </window>


=== Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/xul.zcml 1.1.2.2 => 1.1.2.3 ===
   <security:protectClass 
     name="Zope.App.OFS.Folder.Views.XUL.SetLimit."
-    permission_id="Zope.ManageContent" methods="index, action, xmlrpclib" />
+    permission_id="Zope.ManageContent" methods="index, action, action_js" />
 
   <browser:view name="XULLimitFieldView"
     for="Zope.App.OFS.IContainerLimit."