tree view.
$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.
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
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.
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");
+ wprintf("<div id=\"mainMenu\">\n");
+ wprintf("<UL id=\"menuList\">\n");
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, '|');
- 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("\">");
}
- else {
- wprintf("<i>");
- }
+
+/*
if (levels == 1) {
wprintf("<SPAN CLASS=\"roomlist_floor\">");
}
else {
wprintf("<SPAN CLASS=\"roomlist_old\">");
}
+*/
extract(buf, fold[i].name, levels-1);
escputs(buf);
+/*
wprintf("</SPAN>");
+*/
+
+ if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
+ wprintf(" (INBOX)");
+ }
+
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");
}
--- /dev/null
+/*
+ * 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;
+ }
+}
+
+
+
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 -->