Scarab commit: svn commit: r10665 - trunk/src/webapp: WEB-INF/templates/screens/notifications scripts

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2009-01-04 11:10:45-0800
New Revision: 10665

Modified:
   trunk/src/webapp/WEB-INF/templates/screens/notifications/NotificationList.vm
   trunk/src/webapp/scripts/sstree.js

Log:
The Treeview was calculated based on  tagnames (<ol>) This breaks wiki rendering features. I have changed the treeview to rely on a combination of tag-name and css-class. Thus we have a better encapsulation now. 

Modified: trunk/src/webapp/WEB-INF/templates/screens/notifications/NotificationList.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/screens/notifications/NotificationList.vm?view=diff&pathrev=10665&r1=10664&r2=10665
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/screens/notifications/NotificationList.vm	(original)
+++ trunk/src/webapp/WEB-INF/templates/screens/notifications/NotificationList.vm	2009-01-04 11:10:45-0800
@@ -19,14 +19,14 @@
 #if ($notificationStructure.size() > 0 )
 
 ## populate treeview based on sstree.tigris.org
-<ol id="root">
+<ol id="root" class="treeview">
   <li>
     ##main folders are sorted by issue:
     #foreach ($issue in $notificationStructure.keySet())
       <a class="folder" id="$issue.UniqueId" href="#$issue.UniqueId" onclick=toggle(this,"$staticLink.setPath('/images')")></a>
       $link.setPage("ViewIssue.vm").addPathInfo("id", $issue.UniqueId).setLabel("$issue.UniqueId")
       $issue.DefaultText ($issue.Module.Name)<br/>
-      <ol>
+      <ol class="treeview">
         #set ($issueSets = $notificationStructure.get($issue).keySet())
 
         ##subfolders are listed by contributors:
@@ -37,7 +37,7 @@
             $set.CreatedDate <img src="$staticLink.setPath("/images/icon_rightarrow.gif")" border="0"/>
             <a href="mailto:$set.creator.Email">$!set.creator.name</a>
             #set ($notifications = $notificationStructure.get($issue).get($set))<br/>
-            <ol>
+            <ol class="treeview">
               <li>
                 ##contributions are listed by (removable) Activities: 
                 <table>

Modified: trunk/src/webapp/scripts/sstree.js
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/scripts/sstree.js?view=diff&pathrev=10665&r1=10664&r2=10665
==============================================================================
--- trunk/src/webapp/scripts/sstree.js	(original)
+++ trunk/src/webapp/scripts/sstree.js	2009-01-04 11:10:45-0800
@@ -30,7 +30,7 @@
 
 function collapseAll(tags) {
  for (i = 0; i < tags.length; i++) {
-  var lists = document.getElementsByTagName(tags[i]);
+  var lists = getElementsByClassName(document, tags[i], "treeview");
   for (var j = 0; j < lists.length; j++)
   {
    lists[j].style.display = "none";
@@ -52,3 +52,18 @@
   if (ids[i] != "") toggle(document.getElementById(ids[i]), imgpath);
  }
 }
+
+function getElementsByClassName(oElm, strTagName, strClassName){
+	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
+	var arrReturnElements = new Array();
+	strClassName = strClassName.replace(/\-/g, "\\-");
+	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
+	var oElement;
+	for(var i=0; i<arrElements.length; i++){
+		oElement = arrElements[i];
+		if(oRegExp.test(oElement.className)){
+			arrReturnElements.push(oElement);
+		}
+	}
+	return (arrReturnElements)
+}

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=1003548
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.