[Zope3-checkins] CVS: ZopeProducts/RotterdamSprint - template.pt:1.17 xmltree.js:1.6 zope3.css:1.10

Paul Everitt paul@zope.com
Thu, 5 Dec 2002 17:22:58 -0500


Update of /cvs-repository/ZopeProducts/RotterdamSprint
In directory cvs.zope.org:/tmp/cvs-serv18348

Modified Files:
	template.pt xmltree.js zope3.css 
Log Message:
folder selection loads folder contents, thanks to Godefroid

=== ZopeProducts/RotterdamSprint/template.pt 1.16 => 1.17 === (1230/1330 lines abridged)
--- ZopeProducts/RotterdamSprint/template.pt:1.16	Thu Dec  5 14:38:54 2002
+++ ZopeProducts/RotterdamSprint/template.pt	Thu Dec  5 17:22:58 2002
@@ -1,663 +1,663 @@
-<metal:block define-macro="page"><metal:block define-slot="doctype"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></metal:block>
-
-
-
-
-
-
-
-<html
-
-
-
-  xmlns="http://www.w3.org/1999/xhtml"
-
-
-
-  xml:lang="en"
-
-
-
-  lang="en" >
-
-
-
-  <head>
-
-
-
-    <title metal:define-slot="title">Z3 UI</title>
-
-
-
-    <style type="text/css" media="all"
-
-
-
-      tal:content="string:
-
-
-
-        @import url(${context/++resource++zope3.css});">
-
-
-
-      @import url(zope3.css);
-
-

[-=- -=- -=- 1230 lines omitted -=- -=- -=-]

+
+        </div>
+
+
+
+      </div>
+
+
+
+    </div>
+
+
+
+    </div>
+
+
+
+
+
+
+
+    <div id="footer"
+
+
+
+      metal:define-macro="footer">
+
+
+
+      Powered by Zope
+
+
+
+    </div>
+
+
+
+
+
+
+
+  </body>
+
+
+
+</html>
+
+
+
+</metal:block>


=== ZopeProducts/RotterdamSprint/xmltree.js 1.5 => 1.6 ===
--- ZopeProducts/RotterdamSprint/xmltree.js:1.5	Thu Dec  5 14:38:54 2002
+++ ZopeProducts/RotterdamSprint/xmltree.js	Thu Dec  5 17:22:58 2002
@@ -6,6 +6,8 @@
 var TITLE = 'TITLE';
 var XML_CHILDREN_VIEW = 'children.xml';
 var SINGLE_BRANCH_TREE_VIEW = 'singleBranchTree.xml';
+var CONTENT_VIEW = '';
+//var CONTENT_VIEW = '@@contents.html';
 var baseurl;
 
 
@@ -13,7 +15,7 @@
 var LG_INFO = 3;
 var LG_DEBUG = 1;
 var LG_NOLOG = 0;
-var loglevel = LG_TRACE;
+var loglevel = LG_NOLOG;
 
 
 function prettydump(s, locallog) {
@@ -100,7 +102,9 @@
   }
   if (!isCollection(elem)){
 	   if (isTitle(elem)){
-		 location.href = baseurl + elem.parentNode.getAttribute('name');
+		 location_href = baseurl + elem.parentNode.getAttribute('name')+ '/' + CONTENT_VIEW;
+		 prettydump(location_href, LG_DEBUG);
+		 location.href=location_href;
 		 }
 	 	 return;
 	}
@@ -169,7 +173,7 @@
 
 function loadtreexml (url) {
   var xmlHttp = XmlHttp.create(); 
-
+  prettydump(url, LG_DEBUG);
   xmlHttp.open('GET', url, false); 
   xmlHttp.send(null);
   prettydump('Response XML ' + xmlHttp.responseText, LG_INFO);
@@ -177,10 +181,11 @@
   return data;
 }  
 
-function loadtree (thisbaseurl) {
-  baseurl = thisbaseurl;  // Global baseurl
+function loadtree (rooturl, thisbaseurl) {
+  baseurl = rooturl;  // Global baseurl
   
-	var url = 'http://217.77.140.142:9080/Folder2/Folder2.1/' + SINGLE_BRANCH_TREE_VIEW;
+  //	var url = 'http://localhost:9080/Folder2/Folder2.1/' + SINGLE_BRANCH_TREE_VIEW;
+	var url = thisbaseurl + SINGLE_BRANCH_TREE_VIEW;
 	prettydump(url, LG_DEBUG);
   var data = loadtreexml(url);
   var navtree = document.getElementById('navtreecontents');
@@ -192,12 +197,23 @@
 
 
 function createAndAddNodes(sourceNode, targetNode, deep){
-  var items = sourceNode.childNodes;
-  var numitems = items.length;
   var basename = targetNode.getAttribute('name');
   if (basename != '')
      basename = basename + '/';
+
+  var items = getChildCollectionNodes(sourceNode);
+  var numitems = items.length;
+  for (var i=0; i< numitems; i++) {
+    var newelem = createCollection(items[i], basename, deep);
+    targetNode.appendChild(newelem);
+  }
+}
+
+function getChildCollectionNodes(elem){
+  var items = elem.childNodes;
+  var numitems = items.length;
   var curritem;
+  var result = new Array();
   for (var i=0; i< numitems; i++) {
     curritem = items[i];
 
@@ -208,12 +224,12 @@
     if (!isCollection(curritem)) {
       continue;
     }
-
-    var newelem = createCollection(curritem, basename, deep);
-    targetNode.appendChild(newelem);
+    result.push(curritem);
   }
+  return result;
 }
 
+
 function createCollection(curritem, basename, deep){
     var currname = curritem.getAttribute('name');
     var newtextnode = document.createTextNode(currname);
@@ -222,30 +238,26 @@
     titleelem.appendChild(newtextnode);
     newelem.appendChild(titleelem);
     newelem.setAttribute('name',basename+currname);
-    newelem.setAttribute('isCollapsed', 1);
-    newelem.setAttribute('isEmpty', 1);
 
     if (deep){
-	prettydump('deep', LG_DEBUG);
-       var children = curritem.childNodes;
-       var numchildren = children.length;
-       var currchild;
-	prettydump('numchildren' + numchildren, LG_DEBUG);
-       for (var i=0; i< numchildren; i++) {
-           currchild = children[i];
-
-           if (currchild.nodeType != ELEMENT_NODE) {
-             continue;
-           }
-
-           if (!isCollection(currchild)) {
-             continue;
-           }
-
-           var newchild = createCollection(currchild, basename, deep);
+      var children = getChildCollectionNodes(curritem);
+      var numchildren = children.length;
+      for (var i=0; i< numchildren; i++) {
+           var newchild = createCollection(children[i], basename+currname+'/', deep);
            newelem.appendChild(newchild);
-
-       }
-		}	 
-		return newelem;
-}
\ No newline at end of file
+      }
+      if (numchildren){
+	newelem.setAttribute('isCollapsed', 0);
+	newelem.setAttribute('isEmpty', 0);
+      }
+      else{
+	newelem.setAttribute('isCollapsed', 1);
+	newelem.setAttribute('isEmpty', 1);
+      }
+    }
+    else{
+    newelem.setAttribute('isCollapsed', 1);
+    newelem.setAttribute('isEmpty', 1);
+    }
+    return newelem;
+}


=== ZopeProducts/RotterdamSprint/zope3.css 1.9 => 1.10 ===
--- ZopeProducts/RotterdamSprint/zope3.css:1.9	Thu Dec  5 14:38:54 2002
+++ ZopeProducts/RotterdamSprint/zope3.css	Thu Dec  5 17:22:58 2002
@@ -450,14 +450,11 @@
 
 
 collection {
-	   display: block;margin-left:1.0em;
-  background-image: url("pl.gif");
-  background-repeat: no-repeat;
-  padding-left: 15px;
+	   display: block;
+	   margin-left: 5px;
+  	   background-image: url("pl.gif");
+  	   background-repeat: no-repeat;
+  	   padding-left: 15px;
 /*	   border: red solid 1pt;
 /*	   cursor: pointer; */
-}
-item {
-     display: block;margin-left: 1.0em;
-/*     border: blue solid 1pt; */
 }