[Zope3-checkins] CVS: ZopeProducts/RotterdamSprint - template.pt:1.16 xmltree.js:1.5 zope3.css:1.9

Paul Everitt paul@zope.com
Thu, 5 Dec 2002 14:38:54 -0500


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

Modified Files:
	template.pt xmltree.js zope3.css 
Log Message:
checking in to use on other workstation

=== ZopeProducts/RotterdamSprint/template.pt 1.15 => 1.16 === (565/665 lines abridged)
--- ZopeProducts/RotterdamSprint/template.pt:1.15	Thu Dec  5 11:56:47 2002
+++ ZopeProducts/RotterdamSprint/template.pt	Thu Dec  5 14:38:54 2002
@@ -2,331 +2,662 @@
 
 
 
+
+
+
+
 <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);
 
+
+

[-=- -=- -=- 565 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.4 => 1.5 ===
--- ZopeProducts/RotterdamSprint/xmltree.js:1.4	Thu Dec  5 11:56:47 2002
+++ ZopeProducts/RotterdamSprint/xmltree.js	Thu Dec  5 14:38:54 2002
@@ -3,7 +3,9 @@
 var ELEMENT_NODE = 1;
 var TEXT_NODE = 3;
 var COLLECTION = 'COLLECTION';
-var FOLDERDATA_URL = 'children.xml';
+var TITLE = 'TITLE';
+var XML_CHILDREN_VIEW = 'children.xml';
+var SINGLE_BRANCH_TREE_VIEW = 'singleBranchTree.xml';
 var baseurl;
 
 
@@ -11,7 +13,7 @@
 var LG_INFO = 3;
 var LG_DEBUG = 1;
 var LG_NOLOG = 0;
-var loglevel = LG_NOLOG;
+var loglevel = LG_TRACE;
 
 
 function prettydump(s, locallog) {
@@ -29,17 +31,32 @@
 		}
 }
 
+function isCollection(elem){
+	return (checkTagName(elem, COLLECTION));
+	}
+
+function isTitle(elem){
+	return (checkTagName(elem, TITLE));
+	}
+
+function checkTagName(elem, tagName){
+	return (elem.tagName.toUpperCase() == tagName);
+	}
+
 function togglecursor (e) {
-  if(e.target)
-    var elem=e.target;
-  else
-    var elem=e.srcElement;
-  if(elem.nodeType == TEXT_NODE)
-  {elem.parentNode.style.cursor='pointer';
-  /* elem.parentNode.style.textDecoration='underline';*/}
+	var elem;
+  if(e.target) 
+    // Mozilla uses this
+    elem=e.target;
   else
-  {elem.style.cursor='auto';
-  /* elem.style.textDecoration='none';*/}
+    // IE uses this
+    elem=e.srcElement;	
+  if(elem.nodeType == TEXT_NODE){
+		  elem = elem.parentNode;
+	}		
+  if (isCollection(elem)){
+		 elem.style.cursor='pointer';
+	}
 }
 
 function toggleCollection (elem) {
@@ -76,16 +93,19 @@
 		else{
 				 elem=e.target;
 				 }
-		prettydump(elem.tagName, LG_DEBUG);
   }
   else {
     // IE uses this
     elem=e.srcElement;
   }
-  if (elem.tagName.toUpperCase() != COLLECTION) return;
+  if (!isCollection(elem)){
+	   if (isTitle(elem)){
+		 location.href = baseurl + elem.parentNode.getAttribute('name');
+		 }
+	 	 return;
+	}
   if (elem.id == 'navtree') return;
-//  if(elem.nodeType != TEXT_NODE)
-//  {return}
+
 
   // If this collection is empty and should have data, go get it
   // todo xxx optimize for the case when collection has no length
@@ -93,9 +113,9 @@
      prettydump('isEmpty');
 
      var name = elem.getAttribute('name');
-     var thisbaseurl = baseurl + name + '/';
-     var data = loadtreexml(thisbaseurl);
-     createAndAddNodes(data,elem);
+     var url = baseurl + name + '/' + XML_CHILDREN_VIEW;
+     var data = loadtreexml(url);
+     createAndAddNodes(data, elem, 0);
      elem.setAttribute('isEmpty',0);
    	 }
   toggleCollection(elem);
@@ -147,10 +167,10 @@
       }
 };
 
-function loadtreexml (baseurl) {
+function loadtreexml (url) {
   var xmlHttp = XmlHttp.create(); 
 
-  xmlHttp.open('GET',baseurl + FOLDERDATA_URL,false); 
+  xmlHttp.open('GET', url, false); 
   xmlHttp.send(null);
   prettydump('Response XML ' + xmlHttp.responseText, LG_INFO);
   var data = xmlHttp.responseXML.documentElement;
@@ -159,19 +179,19 @@
 
 function loadtree (thisbaseurl) {
   baseurl = thisbaseurl;  // Global baseurl
-
-  var data = loadtreexml(thisbaseurl);
+  
+	var url = 'http://217.77.140.142:9080/Folder2/Folder2.1/' + SINGLE_BRANCH_TREE_VIEW;
+	prettydump(url, LG_DEBUG);
+  var data = loadtreexml(url);
   var navtree = document.getElementById('navtreecontents');
   var newelem = document.createElement('div');
   newelem.setAttribute('name','');
   navtree.appendChild(newelem);
-    createAndAddNodes(data,newelem);
+  createAndAddNodes(data, newelem, 1);
 }
 
 
-function createAndAddNodes(sourceNode, targetNode)
-{
-//  prettydump(targetNode.nodeType + ' and tag name ' + targetNode.tagName, LG_DEBUG);
+function createAndAddNodes(sourceNode, targetNode, deep){
   var items = sourceNode.childNodes;
   var numitems = items.length;
   var basename = targetNode.getAttribute('name');
@@ -185,10 +205,16 @@
       continue;
     }
 
-    if (curritem.tagName.toUpperCase() != COLLECTION) {
+    if (!isCollection(curritem)) {
       continue;
     }
 
+    var newelem = createCollection(curritem, basename, deep);
+    targetNode.appendChild(newelem);
+  }
+}
+
+function createCollection(curritem, basename, deep){
     var currname = curritem.getAttribute('name');
     var newtextnode = document.createTextNode(currname);
     var newelem = document.createElement(curritem.tagName);
@@ -198,8 +224,28 @@
     newelem.setAttribute('name',basename+currname);
     newelem.setAttribute('isCollapsed', 1);
     newelem.setAttribute('isEmpty', 1);
- 
-    targetNode.appendChild(newelem);
-  }
-}
 
+    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);
+           newelem.appendChild(newchild);
+
+       }
+		}	 
+		return newelem;
+}
\ No newline at end of file


=== ZopeProducts/RotterdamSprint/zope3.css 1.8 => 1.9 ===
--- ZopeProducts/RotterdamSprint/zope3.css:1.8	Thu Dec  5 11:56:47 2002
+++ ZopeProducts/RotterdamSprint/zope3.css	Thu Dec  5 14:38:54 2002
@@ -445,7 +445,7 @@
 */
 
 title {
-	   display: block;
+	   display: inline;
 		 }