]> code.citadel.org Git - citadel.git/commitdiff
* "folders view" of room list now uses Dave Lindquist's "menuExpandable3"
authorArt Cancro <ajc@citadel.org>
Fri, 24 Sep 2004 04:04:35 +0000 (04:04 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 24 Sep 2004 04:04:35 +0000 (04:04 +0000)
  tree view.

webcit/ChangeLog
webcit/README.txt
webcit/roomops.c
webcit/static/menuExpandable3.js [new file with mode: 0644]
webcit/static/minus.gif [new file with mode: 0644]
webcit/static/plus.gif [new file with mode: 0644]
webcit/static/square.gif [new file with mode: 0644]
webcit/static/style.css

index 8965d77c1b6ecf782410ac5d2132cf5585efd413..44a10925a80d92c60d3cfa8d1ffa9f87e0f12806 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
 $Log$
+Revision 523.6  2004/09/24 04:04:34  ajc
+* "folders view" of room list now uses Dave Lindquist's "menuExpandable3"
+  tree view.
+
 Revision 523.5  2004/09/23 03:21:10  ajc
 * roomops.c: "folders" view of rooms is an actual Unnumbered List now.
 
 Revision 523.5  2004/09/23 03:21:10  ajc
 * roomops.c: "folders" view of rooms is an actual Unnumbered List now.
 
@@ -2052,4 +2056,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index 312add91499a689166845d7cf0d1a5e9fff41600..f7442ccb041eab17de217c448be9656a3ca8ae86 100644 (file)
@@ -7,6 +7,7 @@
        Nick Grossman
        Andru Luvisi
         Kevin Roth
        Nick Grossman
        Andru Luvisi
         Kevin Roth
+       Dave Lindquist
  
 This program is free software released under the terms of the GNU General
 Public License.  Please read COPYING.txt for more licensing information.
  
 This program is free software released under the terms of the GNU General
 Public License.  Please read COPYING.txt for more licensing information.
index 98b20e579e8afcc82e458f68e437a94f0352c66b..2317751b682c2890f81b94366e8697ee9320cbe3 100644 (file)
@@ -1929,33 +1929,53 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
        char buf[SIZ];
        int levels, oldlevels;
        int i, t;
        char buf[SIZ];
        int levels, oldlevels;
        int i, t;
+       int actnum = 0;
+       int has_subfolders = 0;
+
+       /* Include the menu expanding/collapsing code */
+       wprintf("<script type=\"text/javascript\" src=\"/static/menuExpandable3.js\"></script>\n");
 
        do_template("beginbox_nt");
 
        do_template("beginbox_nt");
+       wprintf("<div id=\"mainMenu\">\n");
+       wprintf("<UL id=\"menuList\">\n");
        levels = 0;
        oldlevels = 0;
 
        for (i=0; i<max_folders; ++i) {
 
        levels = 0;
        oldlevels = 0;
 
        for (i=0; i<max_folders; ++i) {
 
+               has_subfolders = 0;
+               if ((i+1) < max_folders) {
+                       if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
+                          && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
+                               has_subfolders = 1;
+                       }
+               }
+
                levels = num_tokens(fold[i].name, '|');
 
                levels = num_tokens(fold[i].name, '|');
 
-               if (levels > oldlevels) for (t=0; t<(levels-oldlevels); ++t) {
-                       wprintf("<UL>\n");
-               }
-               if (levels < oldlevels) for (t=0; t<(oldlevels-levels); ++t) {
-                       wprintf("</UL>\n");
+               if ( (levels < oldlevels) || ((levels==1)&&(i!=0)) ) {
+                       for (t=0; t<(oldlevels-levels); ++t) {
+                               wprintf("</UL>\n");
+                       }
                }
                }
-               wprintf("<LI>");
 
 
-               oldlevels = levels;
+               if (has_subfolders) {
+                       wprintf("<LI");
+                       if (levels == 1) wprintf(" class=\"menubar\"");
+                       wprintf(">");
+                       wprintf("<A href=\"#\" id=\"actuator%d\" class=\"actuator\"></a>\n", actnum);
+               }
+               else {
+                       wprintf("<LI>");
+               }
 
                if (fold[i].selectable) {
                        wprintf("<A HREF=\"/dotgoto?room=");
                        urlescputs(fold[i].room);
                        wprintf("\">");
                }
 
                if (fold[i].selectable) {
                        wprintf("<A HREF=\"/dotgoto?room=");
                        urlescputs(fold[i].room);
                        wprintf("\">");
                }
-               else {
-                       wprintf("<i>");
-               }
+
+/*
                if (levels == 1) {
                        wprintf("<SPAN CLASS=\"roomlist_floor\">");
                }
                if (levels == 1) {
                        wprintf("<SPAN CLASS=\"roomlist_floor\">");
                }
@@ -1965,20 +1985,38 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
                else {
                        wprintf("<SPAN CLASS=\"roomlist_old\">");
                }
                else {
                        wprintf("<SPAN CLASS=\"roomlist_old\">");
                }
+*/
                extract(buf, fold[i].name, levels-1);
                escputs(buf);
                extract(buf, fold[i].name, levels-1);
                escputs(buf);
+/*
                wprintf("</SPAN>");
                wprintf("</SPAN>");
+*/
+
+               if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
+                       wprintf(" (INBOX)");
+               }
+
                if (fold[i].selectable) {
                        wprintf("</A>");
                }
                if (fold[i].selectable) {
                        wprintf("</A>");
                }
-               else {
-                       wprintf("</i>");
-               }
-               if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
-                       wprintf(" (INBOX)");
+               wprintf("\n");
+
+               if (has_subfolders) {
+                       wprintf("<UL id=\"menu%d\" class=\"%s\">\n",
+                               actnum++,
+                               ( (levels == 1) ? "menu" : "submenu")
+                       );
                }
                }
-               wprintf("</LI>\n");
+
+               oldlevels = levels;
+       }
+       wprintf("</UL></UL>\n");
+       wprintf("<img src=\"/static/blank.gif\" onLoad = ' \n");
+       for (i=0; i<actnum; ++i) {
+               wprintf(" initializeMenu(\"menu%d\", \"actuator%d\");\n", i, i);
        }
        }
+       wprintf(" ' > \n");
+       wprintf("</DIV>\n");
        do_template("endbox");
 }
 
        do_template("endbox");
 }
 
diff --git a/webcit/static/menuExpandable3.js b/webcit/static/menuExpandable3.js
new file mode 100644 (file)
index 0000000..d898aa6
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * menuExpandable3.js - implements an expandable menu based on a HTML list
+ * Author: Dave Lindquist (http://www.gazingus.org)
+ */
+
+if (!document.getElementById)
+    document.getElementById = function() { return null; }
+
+function initializeMenu(menuId, actuatorId) {
+    var menu = document.getElementById(menuId);
+    var actuator = document.getElementById(actuatorId);
+
+    if (menu == null || actuator == null) return;
+
+    //if (window.opera) return; // I'm too tired
+
+    actuator.parentNode.style.backgroundImage = "url(/static/plus.gif)";
+    actuator.onclick = function() {
+        var display = menu.style.display;
+        this.parentNode.style.backgroundImage =
+            (display == "block") ? "url(/static/plus.gif)" : "url(/static/minus.gif)";
+        menu.style.display = (display == "block") ? "none" : "block";
+
+        return false;
+    }
+}
+
+
+
diff --git a/webcit/static/minus.gif b/webcit/static/minus.gif
new file mode 100644 (file)
index 0000000..608bc29
Binary files /dev/null and b/webcit/static/minus.gif differ
diff --git a/webcit/static/plus.gif b/webcit/static/plus.gif
new file mode 100644 (file)
index 0000000..87ccefe
Binary files /dev/null and b/webcit/static/plus.gif differ
diff --git a/webcit/static/square.gif b/webcit/static/square.gif
new file mode 100644 (file)
index 0000000..a413fc8
Binary files /dev/null and b/webcit/static/square.gif differ
index 6c974c0266b512e1476a3249f635b5182b9a12b2..115154a03829f91b07f89153b0792a46c75ff24e 100644 (file)
@@ -336,3 +336,65 @@ strong.legal {
   input#toggler, .toolbar { display: none }
 }
 
   input#toggler, .toolbar { display: none }
 }
 
+<!-- begin tree view styles -->
+
+#mainMenu {
+  background-color: #EEE;
+  border: 1px solid #CCC;
+  color: #000;
+  width: 203px;
+}
+
+#menuList {
+  margin: 0px;
+  padding: 10px 0px 10px 15px;
+}
+
+li.menubar {
+  background: url(/static/plus.gif) no-repeat 0em 0.3em;
+  font-size: 12px;
+  line-height: 1.5em;
+  list-style: none outside;
+}
+
+.menu, .submenu {
+  display: none;
+  margin-left: 15px;
+  padding: 0px;
+}
+
+.menu li, .submenu li {
+  background: url(/static/square.gif) no-repeat 0em 0.3em;
+  list-style: none outside;
+}
+
+a.actuator {
+  background-color: transparent;
+  color: #000;
+  font-size: 12px;
+  padding-left: 15px;
+  text-decoration: none;
+}
+
+a.actuator:hover {
+  text-decoration: underline;
+}
+
+.menu li a, .submenu li a {
+  background-color: transparent;
+  color: #000;
+  font-size: 12px;
+  padding-left: 15px;
+  text-decoration: none;
+}
+
+.menu li a:hover, submenu li a:hover {
+  /*border-bottom: 1px dashed #000;*/
+  text-decoration: underline;
+}
+
+span.key {
+  text-decoration: underline;
+}
+
+<!-- end tree view styles -->