]> code.citadel.org Git - citadel.git/blobdiff - webcit/roomops.c
* Set up framework for "notes" view, and added a skeleton function for
[citadel.git] / webcit / roomops.c
index 98b20e579e8afcc82e458f68e437a94f0352c66b..62dc983659a1ae6f900a9207b5ea672638398dbb 100644 (file)
@@ -36,7 +36,8 @@ char *viewdefs[] = {
        "Summary",
        "Address Book",
        "Calendar",
-       "Tasks"
+       "Tasks",
+       "Notes"
 };
 
 char floorlist[128][SIZ];
@@ -1929,33 +1930,52 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
        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\">");
                }
@@ -1968,17 +1988,32 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
                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");
 }
 
@@ -2011,7 +2046,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
 
                levels = num_tokens(fold[i].name, '|');
 
-               if ((levels == 1) && (oldlevels == 2)) {
+               if ((levels == 1) && (oldlevels > 1)) {
 
                        /* End inner box */
                        do_template("endbox");