[Zope3-checkins] CVS: ZopeProducts/RotterdamSprint - mi.gif:1.1 pl.gif:1.1 configure.zcml:1.13 template.pt:1.15 xmltree.js:1.4 zope3.css:1.8

Paul Everitt paul@zope.com
Thu, 5 Dec 2002 11:56:48 -0500


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

Modified Files:
	configure.zcml template.pt xmltree.js zope3.css 
Added Files:
	mi.gif pl.gif 
Log Message:
icons for coll/expand added

=== Added File ZopeProducts/RotterdamSprint/mi.gif ===
  <Binary-ish file>

=== Added File ZopeProducts/RotterdamSprint/pl.gif ===
  <Binary-ish file>

=== ZopeProducts/RotterdamSprint/configure.zcml 1.12 => 1.13 ===
--- ZopeProducts/RotterdamSprint/configure.zcml:1.12	Thu Dec  5 11:44:30 2002
+++ ZopeProducts/RotterdamSprint/configure.zcml	Thu Dec  5 11:56:47 2002
@@ -12,6 +12,12 @@
 <browser:resource 
     name="xmltree.js" file="xmltree.js" layer="rotterdam" />
 
+<browser:resource 
+    name="pl.gif" file="pl.gif" layer="rotterdam" />
+
+<browser:resource 
+    name="mi.gif" file="mi.gif" layer="rotterdam" />
+
 <!-- browser:view 
     name="template"
     permission="Zope.View"


=== ZopeProducts/RotterdamSprint/template.pt 1.14 => 1.15 === (401/501 lines abridged)
--- ZopeProducts/RotterdamSprint/template.pt:1.14	Thu Dec  5 06:37:34 2002
+++ ZopeProducts/RotterdamSprint/template.pt	Thu Dec  5 11:56:47 2002
@@ -1,167 +1,332 @@
-<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);
-    </style>
-
-    <metal:block define-slot="style_slot" />
-
-    <metal:block define-slot="ecmascript_slot" />
-
-    <script type="text/javascript" src="xmltree.js" 
-      tal:attributes="src string:${context/++resource++xmltree.js}"></script>
-
-  </head>
-  <body onload="loadtree('');"
-    tal:attributes="onload string:loadtree('${request/URL/1}/');" >
-    <div id="global">
-      Global elements
-    </div>
-
-    <div id="personal">
-      <metal:block define-macro="logged_user">
-        User:
-        <tal:block replace="request/user/getTitle">
-          User
-        </tal:block>
-      </metal:block>
-      (Personal elements)
-    </div>
-  
-    <div id="breadcrumbs"
-      metal:define-macro="breadcrumbs">
-      Location:&nbsp;
-      <tal:block repeat="breadcrumb context/@@absolute_url/breadcrumbs">
-        <a href=""
-          tal:condition="repeat/breadcrumb/start"
-          tal:content="string:[top] /"
-          tal:attributes="
-            href string:${breadcrumb/url}/@@SelectedManagementView.html">

[-=- -=- -=- 401 lines omitted -=- -=- -=-]

+
+    </div>
+
+
+
+    <div id="inspectors">
+
+      <div class="box" id="metadata">
+
+        <h3>Metadata</h3>
+
+        <div class="body">
+
+          <div class="content odd">
+
+            testing testing
+
+          </div>
+
+          <div class="content even">
+
+            and some more
+
+          </div>
+
+        </div>
+
+      </div>
+
+    </div>
+
+    </div>
+
+
+
+    <div id="footer"
+
+      metal:define-macro="footer">
+
+      Powered by Zope
+
+    </div>
+
+
+
+  </body>
+
+</html>
+
 </metal:block>


=== ZopeProducts/RotterdamSprint/xmltree.js 1.3 => 1.4 ===
--- ZopeProducts/RotterdamSprint/xmltree.js:1.3	Wed Dec  4 11:25:35 2002
+++ ZopeProducts/RotterdamSprint/xmltree.js	Thu Dec  5 11:56:47 2002
@@ -6,29 +6,27 @@
 var FOLDERDATA_URL = 'children.xml';
 var baseurl;
 
-function prettydump(s) {
-  // Put the string "s" in a box on the screen as an log message
 
-  var logger = document.getElementById('logger');
-  var msg = document.createElement('code');
-  var br1 = document.createElement('br');
-  var br2 = document.createElement('br');
-  var msg_text = document.createTextNode(s);
-  msg.appendChild(msg_text);
-  logger.insertBefore(br1,logger.firstChild);
-  logger.insertBefore(br2,logger.firstChild);
-  logger.insertBefore(msg,logger.firstChild);
-}
-
-function togglenode (n) {
-	 if (typeof(n.style) == 'undefined') {
-	    alert('no style on node');
-	    }
-
- 	    if (n.style.display == 'none')
-	       n.style.display = 'block';
-	    else 
-    	    	 n.style.display = 'none';
+var LG_TRACE = 6;
+var LG_INFO = 3;
+var LG_DEBUG = 1;
+var LG_NOLOG = 0;
+var loglevel = LG_NOLOG;
+
+
+function prettydump(s, locallog) {
+  // Put the string "s" in a box on the screen as an log message
+  if (locallog <= loglevel){
+	  var logger = document.getElementById('logger');
+  	var msg = document.createElement('code');
+		var br1 = document.createElement('br');
+  	var br2 = document.createElement('br');
+  	var msg_text = document.createTextNode(s);
+  	msg.appendChild(msg_text);
+  	logger.insertBefore(br1,logger.firstChild);
+  	logger.insertBefore(br2,logger.firstChild);
+  	logger.insertBefore(msg,logger.firstChild);
+		}
 }
 
 function togglecursor (e) {
@@ -44,48 +42,63 @@
   /* elem.style.textDecoration='none';*/}
 }
 
-function togglenodes (e) {
+function toggleCollection (elem) {
+// First change icon
+	 prettydump('toggleCollection', LG_TRACE);
+   var collections = elem.getElementsByTagName('collection');
+   var num = collections.length;
+   if (elem.getAttribute('isCollapsed') == 1) {
+	 	 	prettydump('show', LG_TRACE);
+	 		elem.setAttribute('isCollapsed',0);
+     	elem.style.backgroundImage = 'url("' + baseurl + '@@/mi.gif")';
+  		for (var i = num - 1; i >=0; i--) {
+    	 		 collections[i].style.display = 'block';
+  				 }
+   		}
+   else {
+	 	 	prettydump('hide', LG_TRACE);
+	 		elem.setAttribute('isCollapsed',1);
+      elem.style.backgroundImage = 'url("' + baseurl + '@@/pl.gif")';
+  		for (var i = num - 1; i >=0; i--) {
+    			collections[i].style.display = 'none';
+  				}
+   		}
+}
+
+function treeclicked (e) {
+  prettydump('treeclicked', LG_TRACE);
+	var elem;
   if(e.target) {
     // Mozilla uses this
-    var elem=e.target.parentNode;
+		if (e.target.nodeType == TEXT_NODE){
+    	 elem=e.target.parentNode;
+		}
+		else{
+				 elem=e.target;
+				 }
+		prettydump(elem.tagName, LG_DEBUG);
   }
   else {
     // IE uses this
-    var elem=e.srcElement;
+    elem=e.srcElement;
   }
   if (elem.tagName.toUpperCase() != COLLECTION) return;
-  if(elem.id == 'navtree')
-  {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
-   if (elem.getAttribute('isEmpty') == 1) {
+  if (elem.getAttribute('isEmpty') == 1) {
+     prettydump('isEmpty');
 
      var name = elem.getAttribute('name');
      var thisbaseurl = baseurl + name + '/';
      var data = loadtreexml(thisbaseurl);
      createAndAddNodes(data,elem);
      elem.setAttribute('isEmpty',0);
-
-     // If we don't return here, then the following will immediately 
-     // hide the new data
-     return;
-   }
-
-  // Grab child elements and hide/show them
-  var collections = elem.getElementsByTagName('collection');
-  var num = collections.length;
-  for (var i = num - 1; i >=0; i--) {
-    togglenode(collections[i]);
-  }
-  var items = elem.getElementsByTagName('item');
-  var num = items.length;
-  for (var i = num - 1; i >=0; i--) {
-    togglenode(items[i]);
- 
-}
+   	 }
+  toggleCollection(elem);
 }
 
 function getControlPrefix() {
@@ -139,7 +152,7 @@
 
   xmlHttp.open('GET',baseurl + FOLDERDATA_URL,false); 
   xmlHttp.send(null);
-  prettydump('Response XML ' + xmlHttp.responseText);
+  prettydump('Response XML ' + xmlHttp.responseText, LG_INFO);
   var data = xmlHttp.responseXML.documentElement;
   return data;
 }  
@@ -158,7 +171,7 @@
 
 function createAndAddNodes(sourceNode, targetNode)
 {
-//  prettydump(targetNode.nodeType + ' and tag name ' + targetNode.tagName);
+//  prettydump(targetNode.nodeType + ' and tag name ' + targetNode.tagName, LG_DEBUG);
   var items = sourceNode.childNodes;
   var numitems = items.length;
   var basename = targetNode.getAttribute('name');
@@ -172,18 +185,21 @@
       continue;
     }
 
+    if (curritem.tagName.toUpperCase() != COLLECTION) {
+      continue;
+    }
+
     var currname = curritem.getAttribute('name');
     var newtextnode = document.createTextNode(currname);
     var newelem = document.createElement(curritem.tagName);
+    var titleelem = document.createElement('title');
+    titleelem.appendChild(newtextnode);
+    newelem.appendChild(titleelem);
     newelem.setAttribute('name',basename+currname);
-    if (curritem.tagName == 'collection')
-       {
-       newelem.setAttribute('isCollapsed', 1);
-       newelem.setAttribute('isEmpty', 1);
-       
-       }
-    newelem.appendChild(newtextnode);
-   targetNode.appendChild(newelem);
+    newelem.setAttribute('isCollapsed', 1);
+    newelem.setAttribute('isEmpty', 1);
+ 
+    targetNode.appendChild(newelem);
   }
 }
 


=== ZopeProducts/RotterdamSprint/zope3.css 1.7 => 1.8 ===
--- ZopeProducts/RotterdamSprint/zope3.css:1.7	Wed Dec  4 14:30:45 2002
+++ ZopeProducts/RotterdamSprint/zope3.css	Thu Dec  5 11:56:47 2002
@@ -444,8 +444,16 @@
 /*  Styles for xmltree
 */
 
+title {
+	   display: block;
+		 }
+
+
 collection {
 	   display: block;margin-left:1.0em;
+  background-image: url("pl.gif");
+  background-repeat: no-repeat;
+  padding-left: 15px;
 /*	   border: red solid 1pt;
 /*	   cursor: pointer; */
 }