[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL - Main.py:1.2 SetLimit.py:1.2 Tree.py:1.2 __init__.py:1.2 action.pt:1.2 limit.pt:1.2 main.pt:1.2 menu.pt:1.2 tree.pt:1.2 xmlrpclib.pt:1.2 xul.zcml:1.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 19:28:33 -0400


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

Added Files:
	Main.py SetLimit.py Tree.py __init__.py action.pt limit.pt 
	main.pt menu.pt tree.pt xmlrpclib.pt xul.zcml 
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/Main.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+
+from Zope.App.PageTemplate import ViewPageTemplateFile
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from Zope.App.OFS.IContainer import IReadContainer
+
+class Main(BrowserView):
+    """ """
+
+    index = ViewPageTemplateFile('main.pt')
+    menu = ViewPageTemplateFile('menu.pt')
+


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/SetLimit.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from Zope.App.Formulator.Form import Form
+from Zope.App.PageTemplate import ViewPageTemplateFile
+
+
+class SetLimit(Form):
+
+    __implements__ = (Form.__implements__,)
+
+    name = 'limitForm'     
+    title = 'Folder Item Limit Form'
+    description = ('This edit form allows you to ...')
+
+    _fieldViewNames = ['XULLimitFieldView']
+
+    template = ViewPageTemplateFile('limit.pt')
+    action_js = ViewPageTemplateFile('action.pt')
+
+    def action(self, limit):
+        ''' '''
+        self.context.setLimit(int(limit))


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/Tree.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+
+from Zope.App.PageTemplate import ViewPageTemplateFiley
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from Zope.App.OFS.IContainer import IReadContainer
+
+class Tree(BrowserView):
+    """ """
+
+    def _makeSubTree(self, base, prefix=''):
+        """ """
+        rdf = ''
+        local_links = ''
+        for item in base.items():
+
+            # first we need to create the meta data for this item
+            fillIn = {'id': item[0],
+                      'rdf_url': prefix + ':' + item[0]}
+            rdf += _node_description %fillIn + '\n\n'
+
+            # now we add the link to the base
+            local_links += (
+                '''<RDF:li resource="urn:explorer%(rdf_url)s"/>\n'''
+                % fillIn)
+
+            if IReadContainer.isImplementedBy(item[1]):
+                rdf += self._makeSubTree(item[1], fillIn['rdf_url'])
+
+        fillIn = {'links': local_links,
+                  'rdf_url': prefix}
+        if prefix and local_links:
+            rdf += _folder_node_links %fillIn
+        elif not prefix and local_links:
+            rdf += _root_folder_node_links %local_links
+            
+        return rdf
+
+
+    def getRDFTree(self, REQUEST=None):
+        ''' '''
+        rdf  = _rdf_start
+        rdf +=  self._makeSubTree(self.context, '')
+        rdf += _rdf_end
+        REQUEST.response.setHeader('Content-Type', 'text/xml')
+        return rdf
+
+
+
+_rdf_start = '''<?xml version="1.0"?>
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+xmlns:explorer="http://www.zope.org/rdf#">
+'''
+
+_rdf_end = '''
+</RDF:RDF>
+'''
+
+_node_description = '''
+  <RDF:Description about="urn:explorer%(rdf_url)s">
+    <explorer:name>%(id)s</explorer:name>
+  </RDF:Description>      
+'''
+
+
+_folder_node_links = '''
+   <RDF:Seq about="urn:explorer%(rdf_url)s">
+     %(links)s
+   </RDF:Seq>        
+'''
+
+_root_folder_node_links = '''
+   <RDF:Seq about="urn:explorer:data">
+        %s
+    </RDF:Seq>                                    
+'''
+
+
+
+
+
+
+


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/__init__.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/action.pt 1.1 => 1.2 ===
+// 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/";
+  s.verifySourceHeader = true;
+  if (!s.verifySourceHeader)
+    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
+
+  var p1 = new SOAPParameter(parseInt(limit), "limit");
+  s.encode(0, "setLimit", "http://physics.cbu.edu:8082/loaded/@@methods/", 0, null, 1, new Array(p1));
+  s.invoke();
+
+  s.encode(0, "getLimit", "http://physics.cbu.edu:8082/loaded/@@methods/", 0, null, 0, new Array());
+  var r = s.invoke();
+  oncompletion(r, s, 0);
+ 
+}


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/limit.pt 1.1 => 1.2 ===
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<tal:dummy
+  replace="python:request.response.setHeader('content-type', 'application/vnd.mozilla.xul+xml')" />
+
+<window id="id-window"
+    	title="Window Title"
+    	orient="vertical"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+    	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        tal:attributes="id string:${view/name}-window;
+                        title view/title">
+
+  <script src="http://physics.cbu.edu:8080/loaded/@@limit_xul/action_js" />
+
+  <description tal:content="view/description">
+    Form Description
+  </description>
+
+  <box tal:repeat="fieldView python:view.getFieldViews(request)">
+    <label control="some-text" value="Label"
+           tal:attributes="value python: fieldView.context.getValue('title')" />
+    <textbox tal:replace="structure fieldView/render" />
+  </box>
+
+  <button id="limitaction" class="dialog" label="Change"
+          onclick="action(document.getElementById('field_limit').value)" />
+
+</window>
+


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/main.pt 1.1 => 1.2 ===
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<tal:dummy
+  replace="python:request.response.setHeader('content-type', 'application/vnd.mozilla.xul+xml')" />
+
+<window id="id-window"
+    	title="Window Title"
+    	orient="vertical"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+    	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+>
+
+  <hbox height="600">
+    <iframe id="tabs" src="@@main_xul/menu"/>
+    <splitter collapse="before" resizeafter="farthest">
+      <spacer flex="1"/>
+      <grippy/>
+      <spacer flex="1"/>
+    </splitter>
+    <iframe flex="1" id="content" src="@@limit_xul"/>
+  </hbox>
+
+
+</window>


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/menu.pt 1.1 => 1.2 ===
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<tal:dummy
+  replace="python:request.response.setHeader('content-type', 'application/vnd.mozilla.xul+xml')" />
+
+<window id="id-window"
+    	title="Window Title"
+    	orient="vertical"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+    	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+>
+
+<box width="150" height="600">
+  <tree>
+    <treechildren id="menuItems" flex="1">
+      <treeitem tal:repeat="view views/ZMIUtility/getZMIViews">
+        <treerow>
+          <treecell label="Menu Item "
+            tal:attributes="label view/label"/>
+        </treerow>
+      </treeitem>
+    </treechildren>
+  </tree>
+</box>
+
+</window>


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/tree.pt 1.1 => 1.2 ===
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<tal:dummy
+  replace="python:request.response.setHeader('content-type', 'application/vnd.mozilla.xul+xml')" />
+
+<window id="tree-window"
+    	title="Tree Window"
+    	orient="vertical"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+    	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script src="tree_js"/>
+
+<box width="200" height="600">
+  <tree open="true" container="true">
+    <treechildren id="mainItems" flex="1">
+      <tal:dummy replace="structure view/tree" />
+    </treechildren>
+  </tree>
+</box>
+
+</window>
\ No newline at end of file


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/xmlrpclib.pt 1.1 => 1.2 === (527/627 lines abridged)
+//    Copyright (C) 2000, 2001, 2002  Virtual Cowboys info@virtualcowboys.nl
+//		
+//		Author: Ruben Daniels <ruben@virtualcowboys.nl>
+//		Version: 0.91
+//		Date: 29-08-2001
+//		Site: www.vcdn.org/Public/XMLRPC/
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Object.prototype.toXMLRPC = function(){
+  var wo = this.valueOf();
+	
+  if(wo.toXMLRPC == this.toXMLRPC){
+     retstr = "<struct>";
+    
+    for(prop in this){
+      if(typeof wo[prop] != "function"){
+        retstr += "<member><name>" + prop + "</name><value>" + XMLRPC.getXML(wo[prop]) + "</value></member>";
+      }
+    }
+    retstr += "</struct>";
+    
+    return retstr;
+  }
+  else{
+    return wo.toXMLRPC();
+  }
+}
+
+String.prototype.toXMLRPC = function(){
+  //<![CDATA[***your text here***]]>
+  return "<string><![CDATA[" + this.replace(/\]\]/g, "] ]") + "]]></string>";//.replace(/</g, "&lt;").replace(/&/g, "&amp;")
+}
+
+Number.prototype.toXMLRPC = function(){
+  if(this == parseInt(this)){
+    return "<int>" + this + "</int>";

[-=- -=- -=- 527 lines omitted -=- -=- -=-]

+  },
+  
+  processResult : function(http){
+    if(self.DEBUG) alert(http.responseText);
+    if(http.status == 200){
+      //getIncoming message
+       dom = http.responseXML;
+
+       if(dom){
+         var rpcErr, main;
+
+         //Check for XMLRPC Errors
+         rpcErr = dom.getElementsByTagName("fault");
+         if(rpcErr.length > 0){
+           rpcErr = this.toObject(rpcErr[0].firstChild);
+           this.handleError(new Error(rpcErr.faultCode, rpcErr.faultString));
+           return false
+         }
+
+         //handle method result
+         main = dom.getElementsByTagName("param");
+          if(main.length == 0) this.handleError(new Error("Malformed XMLRPC Message"));
+        data = this.toObject(this.getNode(main[0], [0]));
+
+        //handle receiving
+        if(this.onreceive) this.onreceive(data);
+        return data;
+       }
+       else{
+          this.handleError(new Error("Malformed XMLRPC Message"));
+      }
+    }
+    else{
+      this.handleError(new Error("HTTP Exception: (" + http.status + ") " + http.statusText + "\n\n" + http.responseText));
+    }
+  }
+}
+
+//Smell something
+ver = navigator.appVersion;
+app = navigator.appName;
+isNS = Boolean(navigator.productSub)
+//moz_can_do_http = (parseInt(navigator.productSub) >= 20010308)
+
+isIE = (ver.indexOf("MSIE 5") != -1 || ver.indexOf("MSIE 6") != -1) ? 1 : 0;
+isIE55 = (ver.indexOf("MSIE 5.5") != -1) ? 1 : 0;
+
+isOTHER = (!isNS && !isIE) ? 1 : 0;
+
+if(isOTHER) alert("Sorry your browser doesn't support the features of vcXMLRPC");


=== Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/xul.zcml 1.1 => 1.2 ===
+   xmlns='http://namespaces.zope.org/zope'
+   xmlns:security='http://namespaces.zope.org/security'
+   xmlns:browser='http://namespaces.zope.org/browser'
+>
+
+  <!-- Loaded Folder View Directives -->
+
+  <browser:view
+      name="main_xul"
+      for="Zope.App.OFS.IContainer.IReadContainer."
+      factory=".Main." />
+
+  <content class=".Main."
+    <security:require
+        permission="Zope.ManageContent"
+        attributes="index menu" />
+  </content>
+  
+  <browser:view
+      name="tree"
+      for="Zope.App.OFS.IContainer.IReadContainer."
+      factory=".Tree." />
+
+  <content class=".Tree."
+    <security:require
+        permission="Zope.ManageContent"
+        attributes="getRDFTree" />
+  </content>
+
+  <browser:view
+      name="limit_xul"
+      for="Zope.App.OFS.IContainerLimit."
+      factory=".SetLimit."/>
+
+  <content class=".SetLimit."
+    <security:require
+        permission="Zope.ManageContent"
+        attributes="index action action_js" />
+  </content>
+
+  <browser:view
+      name="XULLimitFieldView"
+      for="Zope.App.OFS.IContainerLimit."
+      factory="Zope.App.OFS.Content.Folder.LoadedFolderFields.LimitField.
+               Zope.App.Formulator.Widgets.XUL.TextWidget." />
+
+</zopeConfigure>