[Zope3-checkins] CVS: Zope3/src/zope/app/browser/skins/rotterdam - xmlobject.py:1.9 xmltree.js:1.12
Sidnei da Silva
sidnei@x3ng.com.br
Mon, 23 Jun 2003 13:17:32 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/skins/rotterdam
In directory cvs.zope.org:/tmp/cvs-serv14183/src/zope/app/browser/skins/rotterdam
Modified Files:
xmlobject.py xmltree.js
Log Message:
1. Whitespace cleanup. 2. Docstring fixing. 3. Modified DAV code and tests to append '/' to the path if the last element is 'dir-like'. 4. Support for MKCOL with tests + functional tests. 5. Refactored DAV functional tests into a base class for reusing
=== Zope3/src/zope/app/browser/skins/rotterdam/xmlobject.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/skins/rotterdam/xmlobject.py:1.8 Wed Apr 30 19:37:58 2003
+++ Zope3/src/zope/app/browser/skins/rotterdam/xmlobject.py Mon Jun 23 13:17:01 2003
@@ -2,14 +2,14 @@
#
# Copyright (c) 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.
-#
+#
##############################################################################
"""Service manager interfaces
@@ -29,7 +29,7 @@
def getIconUrl(self, item):
result = ''
- icon = queryView(item, 'zmi_icon', self.request)
+ icon = queryView(item, 'zmi_icon', self.request)
if icon:
result = icon.url()
return result
@@ -49,7 +49,7 @@
item = traverse(container, name, None)
if item is None:
continue
-
+
iconUrl = self.getIconUrl(item)
if IReadContainer.isImplementedBy(item):
result.append(
@@ -62,7 +62,7 @@
return ' '.join(result)
-
+
def children(self):
""" """
container = self.context
@@ -73,7 +73,7 @@
def singleBranchTree(self, root=''):
"""Return an XML document with the siblings and parents of an object.
-
+
There is only one branch expanded, in other words, the tree is
filled with the object, its siblings and its parents with
their respective siblings.
@@ -83,7 +83,7 @@
oldItem = self.context
for item in getParents(self.context):
# skip skin if present
- if item == oldItem:
+ if item == oldItem:
continue
subItems = []
keys = list(item.keys())
@@ -121,10 +121,10 @@
'isroot="">%s</collection>'
% ('', len(oldItem), iconUrl, result)
)
-
+
self.request.response.setHeader('Content-Type', 'text/xml')
return u'<?xml version="1.0" ?><children> %s </children>' % result
-
+
class XmlObjectView(BrowserView):
"""Provide a xml interface for dynamic navigation tree in UI"""
@@ -134,7 +134,7 @@
parent = getParent(self.context)
while parent is not None:
if IReadContainer.isImplementedBy(parent):
- view = queryView(parent,
+ view = queryView(parent,
'singleBranchTree.xml',
self.request)
return view()
=== Zope3/src/zope/app/browser/skins/rotterdam/xmltree.js 1.11 => 1.12 ===
--- Zope3/src/zope/app/browser/skins/rotterdam/xmltree.js:1.11 Wed Jan 15 05:08:17 2003
+++ Zope3/src/zope/app/browser/skins/rotterdam/xmltree.js Mon Jun 23 13:17:01 2003
@@ -48,12 +48,12 @@
navigationTreeNode.prototype.collapse = function() {
this.isCollapsed = 1;
- this.changeExpandIcon("pl.gif");
+ this.changeExpandIcon("pl.gif");
}
navigationTreeNode.prototype.expand = function() {
this.isCollapsed = 0;
- this.changeExpandIcon("mi.gif");
+ this.changeExpandIcon("mi.gif");
}
navigationTreeNode.prototype.changeExpandIcon = function(icon) {
@@ -72,7 +72,7 @@
if (foundChild) {
return foundChild;
}
- }
+ }
}
return null;
}
@@ -91,7 +91,7 @@
}
}
-}
+}
navigationTreeNode.prototype.startLoadingChildren = function() {
with (this) {
@@ -208,7 +208,7 @@
function getCollectionChildNodes(xmlDomElem) {
// get collection element nodes among childNodes of elem
var result = new Array();
-
+
var items = xmlDomElem.childNodes;
var numitems = items.length;
var currentItem;
@@ -246,7 +246,7 @@
function getControlPrefix() {
if (getControlPrefix.prefix)
return getControlPrefix.prefix;
-
+
var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
var o, o2;
for (var i = 0; i < prefixes.length; i++) {
@@ -258,7 +258,7 @@
}
catch (ex) {};
}
-
+
throw new Error("Could not find an installed XML parser");
}
@@ -270,7 +270,7 @@
XmlHttp.create = function () {
if (window.XMLHttpRequest) {
var req = new XMLHttpRequest();
-
+
// some older versions of Moz did not support the readyState property
// and the onreadystate event so we patch it!
if (req.readyState == null) {
@@ -280,7 +280,7 @@
if (typeof req.onreadystatechange == "function")
req.onreadystatechange();}, false);
}
-
+
return req;
}
if (window.ActiveXObject) {
@@ -291,10 +291,10 @@
};
function loadtreexml (url, node) {
- var xmlHttp = XmlHttp.create();
+ var xmlHttp = XmlHttp.create();
if (xmlHttp) {
prettydump('URL ' + url, LG_INFO);
- xmlHttp.open('GET', url, true);
+ xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = function () {
@@ -311,12 +311,12 @@
}
else {
}
- }
+ }
function loadtree (rooturl, thisbaseurl) {
baseurl = rooturl; // Global baseurl
docNavTree = document.getElementById('navtreecontents');
-
+
var url = thisbaseurl + SINGLE_BRANCH_TREE_VIEW;
loadtreexml(url, null);
}
@@ -345,11 +345,11 @@
addNavigationTreeNodes(data, node, 0);
node.finishLoadingChildren();
}
- }
+ }
}
function addNavigationTreeNodes(sourceNode, targetNavTreeNode, deep) {
- // create tree nodes from XML children nodes of sourceNode
+ // create tree nodes from XML children nodes of sourceNode
// and add them to targetNode
// if deep, create all descendants of sourceNode
var basePath = "";
@@ -364,12 +364,12 @@
targetNavTreeNode.appendChild(navTreeChild);
}
}
- }
+ }
function createPresentationNodes(title, targetUrl, icon_url, length) {
// create nodes hierarchy for one collection (without children)
-
+
// create elem for plus/minus icon
var expandElem = document.createElement('expand');
// create elem for item icon
@@ -382,11 +382,11 @@
// create link
var linkElem = document.createElement('a');
var titleTextNode = document.createTextNode(title);
-
+
linkElem.appendChild(titleTextNode);
linkElem.setAttribute('title', 'Contains ' + length + ' item(s)');
linkElem.setAttribute('href', targetUrl);
-
+
iconElem.appendChild(linkElem);
return expandElem;
@@ -396,7 +396,7 @@
var loadingElem = document.createElement('loading');
//XXX should not hardcode loading string
var titleTextNode = document.createTextNode('Loading...');
-
+
loadingElem.appendChild(titleTextNode);
return loadingElem;
@@ -421,15 +421,15 @@
elemPath = basePath + elemTitle + '/';
}
navTreeNode.setPath(elemPath);
-
+
//could show number of child items
var length = source.getAttribute('length');
-
- var icon_url = source.getAttribute('icon_url');
+
+ var icon_url = source.getAttribute('icon_url');
var targetUrl = baseurl;
targetUrl = targetUrl + elemPath;
- targetUrl = targetUrl + CONTENT_VIEW;
+ targetUrl = targetUrl + CONTENT_VIEW;
var expandElem = createPresentationNodes(elemTitle, targetUrl, icon_url, length);
newelem.appendChild(expandElem);
@@ -439,7 +439,7 @@
var children = getCollectionChildNodes(source);
var numchildren = children.length;
for (var i=0; i< numchildren; i++) {
- var navTreeNodeChild = createNavigationTreeNode(children[i], navTreeNode.path, deep);
+ var navTreeNodeChild = createNavigationTreeNode(children[i], navTreeNode.path, deep);
navTreeNode.appendChild(navTreeNodeChild);
}
if (numchildren) {