[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL - Main.py:1.1.2.1 SetLimit.py:1.1.2.1 Tree.py:1.1.2.1 action.pt:1.1.2.1 main.pt:1.1.2.1 menu.pt:1.1.2.1 tree.pt:1.1.2.1 xmlrpclib.pt:1.1.2.1 limit.pt:1.1.2.2 xul.zcml:1.1.2.2 FolderLimitEdit.py:NONE
Stephan Richter
srichter@cbu.edu
Mon, 4 Mar 2002 00:55:14 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL
In directory cvs.zope.org:/tmp/cvs-serv25134/Folder/Views/XUL
Modified Files:
Tag: srichter-OFS_Formulator-branch
limit.pt xul.zcml
Added Files:
Tag: srichter-OFS_Formulator-branch
Main.py SetLimit.py Tree.py action.pt main.pt menu.pt tree.pt
xmlrpclib.pt
Removed Files:
Tag: srichter-OFS_Formulator-branch
FolderLimitEdit.py
Log Message:
Here are some of the changes:
- XML-RPC View for Folders; methods are far from being complete, however
it is the proof of concept; it works.
- Experimental XUL code in folder that shows a tree, a menu and the limit
view.
- File can now be viewed like an Image. Since it also sets the right
content type, it is even more useful for some of the development.
- ZPTPages are the last content object to be "formulatorized". Now they
also entered the new generation code.
ToDo:
- Make tests.
- Update interfaces.
- Get a client side XML-RPC client talk from the browser with Zope to save
values.
- Get a tutorial going, so that the ZMI sprinters and developers can make
use of the technology
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/Main.py ===
##############################################################################
#
# 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: Main.py,v 1.1.2.1 2002/03/04 05:54:42 srichter Exp $
"""
from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
from Zope.App.OFS.IContainer import IReadContainer
class Main(AttributePublisher):
""" """
__implements__ = AttributePublisher.__implements__
def __init__(self, context):
"""Initialize form.
"""
self._context = context
def getContext(self):
""" """
return self._context
index = PageTemplateFile('main.pt')
menu = PageTemplateFile('menu.pt')
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/SetLimit.py ===
##############################################################################
#
# 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: SetLimit.py,v 1.1.2.1 2002/03/04 05:54:42 srichter Exp $
"""
from Zope.App.Formulator.Form import Form
from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
class SetLimit(Form):
__implements__ = (Form.__implements__,)
name = 'limitForm'
title = 'Folder Item Limit Form'
description = ('This edit form allows you to ...')
_fieldViewNames = ['XULLimitFieldView']
template = PageTemplateFile('limit.pt')
xmlrpclib = PageTemplateFile('action.pt')
test = PageTemplateFile('test.pt')
def action(self, limit):
''' '''
self.getContext().setLimit(int(limit))
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/Tree.py ===
##############################################################################
#
# 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: Tree.py,v 1.1.2.1 2002/03/04 05:54:42 srichter Exp $
"""
from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
from Zope.App.OFS.IContainer import IReadContainer
class Tree(AttributePublisher):
""" """
__implements__ = AttributePublisher.__implements__
def __init__(self, context):
"""Initialize form.
"""
self._context = context
def _makeSubTree(self, base, level=0):
""" """
xul = ''
for item in base.objectItems():
if IReadContainer.isImplementedBy(item[1]):
sub_xul = self._makeSubTree(item[1], level+1)
xul += _folderish_tree_item %{'id': item[0], 'sub_xul': sub_xul}
else:
xul += _simple_tree_item %item[0]
return xul
def tree(self):
''' '''
return self._makeSubTree(self.getContext())
def getContext(self):
""" """
return self._context
index = PageTemplateFile('tree.pt')
tree_js = PageTemplateFile('tree.js')
_simple_tree_item = '''
<treeitem>
<treerow>
<treecell class="treecell-indent" label="%s"/>
</treerow>
</treeitem>
'''
_folderish_tree_item = '''
<treeitem id="%(id)s" container="true" open="true">
<treerow>
<treecell class="treecell-indent" label="%(id)s"/>
</treerow>
<treechildren id="%(id)sItems" flex="1">
%(sub_xul)s
</treechildren>
</treeitem>
'''
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/action.pt ===
function action() {
var p = new XMLHttpRequest();
p.open("POST", "http://physics.cbu.edu:8080/loaded/limit_xul;view/action?limit=2000");
p.send("");
alert('Limit successfully updated')
}
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/main.pt ===
<?xml version="1.0"?>
<?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;view/menu"/>
<splitter collapse="before" resizeafter="farthest">
<spacer flex="1"/>
<grippy/>
<spacer flex="1"/>
</splitter>
<iframe flex="1" id="content" src="limit_xul;view"/>
</hbox>
</window>
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/menu.pt ===
<?xml version="1.0"?>
<?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>
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/tree.pt ===
<?xml version="1.0"?>
<?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 container/tree" />
</treechildren>
</tree>
</box>
</window>
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/xmlrpclib.pt === (528/628 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, "<").replace(/&/g, "&")
}
Number.prototype.toXMLRPC = function(){
if(this == parseInt(this)){
[-=- -=- -=- 528 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/Folder/Views/XUL/limit.pt 1.1.2.1 => 1.1.2.2 ===
title container/title">
+ <script src="http://physics.cbu.edu:8080/loaded/limit_xul;view/action" />
+
<description tal:content="container/description">
Form Description
</description>
- <html:span tal:repeat="fieldView python:container.getFieldViews(request)">
+ <box tal:repeat="fieldView python:container.getFieldViews(request)">
<label control="some-text" value="Label"
tal:attributes="value python: fieldView.getContext().getValue('title')" />
- <textbox tal:content="structure fieldView/render" />
- </html:span>
+ <textbox tal:replace="structure fieldView/render" />
+ </box>
- <button id="action" class="dialog" label="Change"
- onclick="window.location()" />
+ <button id="limitaction" class="dialog" label="Change"
+ onclick="action()" />
</window>
=== Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/xul.zcml 1.1.2.1 => 1.1.2.2 ===
<!-- Loaded Folder View Directives -->
+ <browser:view name="main_xul"
+ for="Zope.App.OFS.IContainer.IReadContainer."
+ factory="Zope.App.OFS.Folder.Views.XUL.Main." />
+
+ <security:protectClass
+ name="Zope.App.OFS.Folder.Views.XUL.Main."
+ permission_id="Zope.ManageContent" methods="index, menu" />
+
+ <browser:view name="tree_xul"
+ for="Zope.App.OFS.IContainer.IReadContainer."
+ factory="Zope.App.OFS.Folder.Views.XUL.Tree." />
+
+ <security:protectClass
+ name="Zope.App.OFS.Folder.Views.XUL.Tree."
+ permission_id="Zope.ManageContent" methods="index, tree, tree_js" />
+
<browser:view name="limit_xul"
for="Zope.App.OFS.IContainerLimit."
- factory="Zope.App.OFS.Folder.Views.XUL.FolderLimitEdit." />
+ factory="Zope.App.OFS.Folder.Views.XUL.SetLimit."/>
<security:protectClass
- name="Zope.App.OFS.Folder.Views.XUL.FolderLimitEdit."
- permission_id="Zope.ManageContent" methods="index, action" />
+ name="Zope.App.OFS.Folder.Views.XUL.SetLimit."
+ permission_id="Zope.ManageContent" methods="index, action, xmlrpclib" />
<browser:view name="XULLimitFieldView"
for="Zope.App.OFS.IContainerLimit."
=== Removed File Zope3/lib/python/Zope/App/OFS/Folder/Views/XUL/FolderLimitEdit.py ===