]> 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 b0c36a3b065e99bfa45c980b6d9a815d0e8615ee..62dc983659a1ae6f900a9207b5ea672638398dbb 100644 (file)
@@ -36,7 +36,8 @@ char *viewdefs[] = {
        "Summary",
        "Address Book",
        "Calendar",
-       "Tasks"
+       "Tasks",
+       "Notes"
 };
 
 char floorlist[128][SIZ];
@@ -114,7 +115,7 @@ void room_tree_list(struct roomlisting *rp)
        urlescputs(rmname);
        wprintf("\"");
        wprintf(">");
-       escputs1(rmname, 1);
+       escputs1(rmname, 1, 1);
        if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
                wprintf("}");
        else if (f & QR_DIRECTORY)
@@ -215,63 +216,6 @@ void listrms(char *variety)
 }
 
 
-/*
- * list all rooms by floor (only should get called from knrooms() because
- * that's where output_headers() is called from)
- */
-void tabular_room_list(void)
-{
-       int a;
-       char buf[SIZ];
-
-       do_template("beginbox_nt");
-       wprintf("<TABLE width=100%% border><TR><TH>Floor</TH>");
-       wprintf("<TH>Rooms with new messages</TH>");
-       wprintf("<TH>Rooms with no new messages</TH></TR>\n");
-
-       for (a = 0; a < 128; ++a)
-               if (floorlist[a][0] != 0) {
-
-                       /* Floor name column */
-                       wprintf("<TR><TD>");
-
-                       serv_printf("OIMG _floorpic_|%d", a);
-                       serv_gets(buf);
-                       if (buf[0] == '2') {
-                               serv_puts("CLOS");
-                               serv_gets(buf);
-                               wprintf("<IMG SRC=\"/image&name=_floorpic_&parm=%d\" ALT=\"%s\">",
-                                       a, &floorlist[a][0]);
-                       } else {
-                               escputs(&floorlist[a][0]);
-                       }
-
-                       wprintf("</TD>");
-
-                       /* Rooms with new messages column */
-                       wprintf("<TD>");
-                       sprintf(buf, "LKRN %d", a);
-                       listrms(buf);
-                       wprintf("</TD>\n<TD>");
-
-                       /* Rooms with old messages column */
-                       sprintf(buf, "LKRO %d", a);
-                       listrms(buf);
-                       wprintf("</TD></TR>\n");
-               }
-       wprintf("</TABLE>\n");
-       do_template("endbox");
-       wDumpContent(1);
-}
-
-
-
-
-
-
-
-
-
 /*
  * list all forgotten rooms
  */
@@ -423,36 +367,18 @@ void embed_room_banner(char *got) {
 
 
 /*
- * generic routine to take the session to a new room
+ * back end routine to take the session to a new room
  *
- * display_name values:  0 = goto only
- *                       1 = goto and display
- *                       2 = display only
  */
-void gotoroom(char *gname, int display_name)
+void gotoroom(char *gname)
 {
        char buf[SIZ];
        static long ls = (-1L);
 
+       /* store ungoto information */
+       strcpy(WC->ugname, WC->wc_roomname);
+       WC->uglsn = ls;
 
-       if (display_name) {
-               output_headers(0);
-                wprintf("Pragma: no-cache\n");
-                wprintf("Cache-Control: no-store\n");
-
-               wprintf("<HTML><HEAD>\n"
-                       "<META HTTP-EQUIV=\"refresh\" CONTENT=\"500363689;\">\n"
-                       "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
-                       "<META HTTP-EQUIV=\"expired\" CONTENT=\"28-May-1971 18:10:00 GMT\">\n"
-                       "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">\n"
-                       "</HEAD>\n");
-               do_template("background");
-       }
-       if (display_name != 2) {
-               /* store ungoto information */
-               strcpy(WC->ugname, WC->wc_roomname);
-               WC->uglsn = ls;
-       }
        /* move to the new room */
        serv_printf("GOTO %s", gname);
        serv_gets(buf);
@@ -461,10 +387,6 @@ void gotoroom(char *gname, int display_name)
                serv_gets(buf);
        }
        if (buf[0] != '2') {
-               if (display_name) {
-                       wprintf("<EM>%s</EM><BR>\n", &buf[4]);
-                       wDumpContent(1);
-               }
                return;
        }
        extract(WC->wc_roomname, &buf[4], 0);
@@ -473,6 +395,9 @@ void gotoroom(char *gname, int display_name)
           maxmsgnum = extract_int(&buf[4],5);
           is_mail = (char) extract_int(&buf[4],7); */
        ls = extract_long(&buf[4], 6);
+       WC->wc_floor = extract_int(&buf[4], 10);
+       WC->wc_view = extract_int(&buf[4], 11);
+       WC->wc_default_view = extract_int(&buf[4], 12);
 
        if (WC->is_aide)
                WC->is_room_aide = WC->is_aide;
@@ -482,15 +407,6 @@ void gotoroom(char *gname, int display_name)
        remove_march(WC->wc_roomname);
        if (!strcasecmp(gname, "_BASEROOM_"))
                remove_march(gname);
-
-       /* Display the room banner */
-       if (display_name) {
-               embed_room_banner(buf);
-               wDumpContent(1);
-       }
-       strcpy(WC->wc_roomname, WC->wc_roomname);
-       WC->wc_view = extract_int(&buf[4], 11);
-       WC->wc_default_view = extract_int(&buf[4], 12);
 }
 
 
@@ -601,7 +517,7 @@ void gotonext(void)
 
 
 void smart_goto(char *next_room) {
-       gotoroom(next_room, 0);
+       gotoroom(next_room);
        readloop("readnew");
 }
 
@@ -735,10 +651,15 @@ void display_editroom(void)
        char *tab;
        char *shared_with;
        char *not_shared_with;
+       int roompolicy = 0;
+       int roomvalue = 0;
+       int floorpolicy = 0;
+       int floorvalue = 0;
 
        tab = bstr("tab");
        if (strlen(tab) == 0) tab = "admin";
 
+       load_floorlist();
        serv_puts("GETR");
        serv_gets(buf);
 
@@ -756,7 +677,7 @@ void display_editroom(void)
        output_headers(1);
 
        /* print the tabbed dialog */
-       wprintf("<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
+       wprintf("<BR><TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
                "<TR ALIGN=CENTER>"
                "<TD>&nbsp;</TD>\n");
 
@@ -764,9 +685,9 @@ void display_editroom(void)
                wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=admin\">");
+               wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=admin\">");
        }
-       wprintf("Room administration");
+       wprintf("Administration");
        if (!strcmp(tab, "admin")) {
                wprintf("</SPAN></TD>\n");
        }
@@ -780,9 +701,9 @@ void display_editroom(void)
                wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=config\">");
+               wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=config\">");
        }
-       wprintf("Room configuration");
+       wprintf("Configuration");
        if (!strcmp(tab, "config")) {
                wprintf("</SPAN></TD>\n");
        }
@@ -792,11 +713,27 @@ void display_editroom(void)
 
        wprintf("<TD>&nbsp;</TD>\n");
 
+       if (!strcmp(tab, "expire")) {
+               wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
+       }
+       else {
+               wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=expire\">");
+       }
+       wprintf("Message expire policy");
+       if (!strcmp(tab, "expire")) {
+               wprintf("</SPAN></TD>\n");
+       }
+       else {
+               wprintf("</A></TD>\n");
+       }
+
+       wprintf("<TD>&nbsp;</TD>\n");
+
        if (!strcmp(tab, "sharing")) {
                wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=sharing\">");
+               wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=sharing\">");
        }
        wprintf("Sharing");
        if (!strcmp(tab, "sharing")) {
@@ -812,7 +749,7 @@ void display_editroom(void)
                wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=listserv\">");
+               wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=listserv\">");
        }
        wprintf("Mailing list service");
        if (!strcmp(tab, "listserv")) {
@@ -822,6 +759,8 @@ void display_editroom(void)
                wprintf("</A></TD>\n");
        }
 
+       wprintf("<TD>&nbsp;</TD>\n");
+
        wprintf("</TR></TABLE>\n");
        /* end tabbed dialog */ 
 
@@ -847,7 +786,6 @@ void display_editroom(void)
                wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
        
                wprintf("<LI>Resides on floor: ");
-               load_floorlist();
                wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
                for (i = 0; i < 128; ++i)
                        if (strlen(floorlist[i]) > 0) {
@@ -933,6 +871,11 @@ void display_editroom(void)
                        wprintf("CHECKED ");
                wprintf("> Network shared room\n");
 
+               wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
+               if (er_flags & QR_PERMANENT)
+                       wprintf("CHECKED ");
+               wprintf("> Permanent (does not auto-purge)\n");
+
        /* start of anon options */
        
                wprintf("<LI>Anonymous messages<UL>\n");
@@ -966,9 +909,12 @@ void display_editroom(void)
                }
        
                wprintf("</UL><CENTER>\n");
-               wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
-               wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
-               wprintf("</CENTER>\n");
+               wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
+                       "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
+                       "&nbsp;"
+                       "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
+                       "</CENTER>\n"
+               );
        }
 
 
@@ -1143,6 +1089,82 @@ void display_editroom(void)
                wprintf("</CENTER>\n");
        }
 
+
+       /* Mailing list management */
+       if (!strcmp(tab, "expire")) {
+
+               serv_puts("GPEX room");
+               serv_gets(buf);
+               if (buf[0] == '2') {
+                       roompolicy = extract_int(&buf[4], 0);
+                       roomvalue = extract_int(&buf[4], 1);
+               }
+               
+               serv_puts("GPEX floor");
+               serv_gets(buf);
+               if (buf[0] == '2') {
+                       floorpolicy = extract_int(&buf[4], 0);
+                       floorvalue = extract_int(&buf[4], 1);
+               }
+               
+               wprintf("<BR><FORM METHOD=\"POST\" ACTION=\"/set_room_policy\">\n");
+               wprintf("<TABLE border=0 cellspacing=5>\n");
+               wprintf("<TR><TD>Message expire policy for this room<BR>(");
+               escputs(WC->wc_roomname);
+               wprintf(")</TD><TD>");
+               wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
+                       ((roompolicy == 0) ? "CHECKED" : "") );
+               wprintf("Use the default policy for this floor<BR>\n");
+               wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
+                       ((roompolicy == 1) ? "CHECKED" : "") );
+               wprintf("Never automatically expire messages<BR>\n");
+               wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
+                       ((roompolicy == 2) ? "CHECKED" : "") );
+               wprintf("Expire by message count<BR>\n");
+               wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
+                       ((roompolicy == 3) ? "CHECKED" : "") );
+               wprintf("Expire by message age<BR>");
+               wprintf("Number of messages or days: ");
+               wprintf("<INPUT TYPE=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
+               wprintf("</TD></TR>\n");
+
+               if (WC->axlevel >= 6) {
+                       wprintf("<TR><TD COLSPAN=2><HR></TD></TR>\n");
+                       wprintf("<TR><TD>Message expire policy for this floor<BR>(");
+                       escputs(floorlist[WC->wc_floor]);
+                       wprintf(")</TD><TD>");
+                       wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
+                               ((floorpolicy == 0) ? "CHECKED" : "") );
+                       wprintf("Use the system default<BR>\n");
+                       wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
+                               ((floorpolicy == 1) ? "CHECKED" : "") );
+                       wprintf("Never automatically expire messages<BR>\n");
+                       wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
+                               ((floorpolicy == 2) ? "CHECKED" : "") );
+                       wprintf("Expire by message count<BR>\n");
+                       wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
+                               ((floorpolicy == 3) ? "CHECKED" : "") );
+                       wprintf("Expire by message age<BR>");
+                       wprintf("Number of messages or days: ");
+                       wprintf("<INPUT TYPE=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
+                               floorvalue);
+               }
+
+               wprintf("<CENTER>\n");
+               wprintf("<TR><TD COLSPAN=2><HR><CENTER>\n");
+               wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
+               wprintf("&nbsp;");
+               wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
+               wprintf("</CENTER></TD><TR>\n");
+
+               wprintf("</TABLE>\n"
+                       "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
+                       "</FORM>\n"
+               );
+
+       }
+
+
        /* end content of whatever tab is open now */
        wprintf("</TD></TR></TABLE>\n");
 
@@ -1181,7 +1203,7 @@ void editroom(void)
        if (strcmp(bstr("sc"), "OK")) {
                strcpy(WC->ImportantMessage,
                        "Cancelled.  Changes were not saved.");
-               display_main_menu();
+               display_editroom();
                return;
        }
        serv_puts("GETR");
@@ -1189,7 +1211,7 @@ void editroom(void)
 
        if (buf[0] != '2') {
                strcpy(WC->ImportantMessage, &buf[4]);
-               display_main_menu();
+               display_editroom();
                return;
        }
        extract(er_name, &buf[4], 0);
@@ -1246,6 +1268,12 @@ void editroom(void)
                er_flags &= ~QR_READONLY;
        }
 
+       if (!strcmp(bstr("permanent"), "yes")) {
+               er_flags |= QR_PERMANENT;
+       } else {
+               er_flags &= ~QR_PERMANENT;
+       }
+
        if (!strcmp(bstr("network"), "yes")) {
                er_flags |= QR_NETWORK;
        } else {
@@ -1296,10 +1324,10 @@ void editroom(void)
        serv_gets(buf);
        if (buf[0] != '2') {
                strcpy(WC->ImportantMessage, &buf[4]);
-               display_main_menu();
+               display_editroom();
                return;
        }
-       gotoroom(er_name, 0);
+       gotoroom(er_name);
 
        if (strlen(er_roomaide) > 0) {
                sprintf(buf, "SETA %s", er_roomaide);
@@ -1311,7 +1339,10 @@ void editroom(void)
                        return;
                }
        }
-       smart_goto(er_name);
+       gotoroom(er_name);
+       strcpy(WC->ImportantMessage, "Your changes have been saved.");
+       display_editroom();
+       return;
 }
 
 /*
@@ -1360,7 +1391,7 @@ void display_whok(void)
         }
         
         output_headers(1);
-       stresc(buf, WC->wc_roomname, 1);
+       stresc(buf, WC->wc_roomname, 1, 1);
        svprintf("BOXTITLE", WCS_STRING, "Access control list for %s", buf);
        do_template("beginbox");
 
@@ -1427,7 +1458,7 @@ void display_entroom(void)
        wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
 
        wprintf("<UL><LI>Name of room: ");
-       wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"19\">\n");
+       wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
 
         wprintf("<LI>Resides on floor: ");
         load_floorlist(); 
@@ -1472,6 +1503,7 @@ void display_entroom(void)
 
        wprintf("<CENTER>\n");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
+       wprintf("&nbsp;");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
        wprintf("</CENTER>\n");
        wprintf("</FORM>\n<HR>");
@@ -1529,11 +1561,12 @@ void er_set_default_view(int newview) {
 void entroom(void)
 {
        char buf[SIZ];
-       char er_name[20];
-       char er_type[20];
-       char er_password[10];
+       char er_name[SIZ];
+       char er_type[SIZ];
+       char er_password[SIZ];
        int er_floor;
        int er_num_type;
+       int er_view;
 
        if (strcmp(bstr("sc"), "OK")) {
                strcpy(WC->ImportantMessage,
@@ -1545,6 +1578,7 @@ void entroom(void)
        strcpy(er_type, bstr("type"));
        strcpy(er_password, bstr("er_password"));
        er_floor = atoi(bstr("er_floor"));
+       er_view = atoi(bstr("er_view"));
 
        er_num_type = 0;
        if (!strcmp(er_type, "guessname"))
@@ -1556,8 +1590,8 @@ void entroom(void)
        if (!strcmp(er_type, "personal"))
                er_num_type = 4;
 
-       sprintf(buf, "CRE8 1|%s|%d|%s|%d", 
-               er_name, er_num_type, er_password, er_floor);
+       sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d", 
+               er_name, er_num_type, er_password, er_floor, 0, er_view);
        serv_puts(buf);
        serv_gets(buf);
        if (buf[0] != '2') {
@@ -1565,9 +1599,8 @@ void entroom(void)
                display_main_menu();
                return;
        }
-       gotoroom(er_name, 0);
-       er_set_default_view(atoi(bstr("er_view")));
-       smart_goto(er_name);
+       gotoroom(er_name);
+       do_change_view(er_view);                /* Now go there */
 }
 
 
@@ -1666,6 +1699,7 @@ void display_zap(void)
 
        wprintf("<FORM METHOD=\"GET\" ACTION=\"/zap\">\n");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
+       wprintf("&nbsp;");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
        wprintf("</FORM>\n");
        wDumpContent(1);
@@ -1864,6 +1898,17 @@ void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
 
 
 
+/*
+ * Back end for change_view()
+ */
+void do_change_view(int newview) {
+       char buf[SIZ];
+
+       serv_printf("VIEW %d", newview);
+       serv_gets(buf);
+       WC->wc_view = newview;
+       smart_goto(WC->wc_roomname);
+}
 
 
 
@@ -1872,13 +1917,9 @@ void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
  */
 void change_view(void) {
        int view;
-       char buf[SIZ];
 
        view = atol(bstr("view"));
-
-       serv_printf("VIEW %d", view);
-       serv_gets(buf);
-       smart_goto(WC->wc_roomname);
+       do_change_view(view);
 }
 
 
@@ -1889,25 +1930,56 @@ 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, '|');
-               oldlevels = levels;
 
-               for (t=0; t<levels; ++t) wprintf("&nbsp;&nbsp;&nbsp;");
+               if ( (levels < oldlevels) || ((levels==1)&&(i!=0)) ) {
+                       for (t=0; t<(oldlevels-levels); ++t) {
+                               wprintf("</UL>\n");
+                       }
+               }
+
+               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\">");
                }
-               if (fold[i].hasnewmsgs) {
+               else if (fold[i].hasnewmsgs) {
                        wprintf("<SPAN CLASS=\"roomlist_new\">");
                }
                else {
@@ -1916,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("<BR>\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");
 }
 
@@ -1959,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");
@@ -1977,7 +2064,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
 
                        /* Begin inner box */
                        extract(buf, fold[i].name, levels-1);
-                       stresc(boxtitle, buf, 1);
+                       stresc(boxtitle, buf, 1, 0);
                        svprintf("BOXTITLE", WCS_STRING, boxtitle);
                        do_template("beginbox");
 
@@ -2152,7 +2239,7 @@ void knrooms() {
        }
 
        /* title bar */
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#000077\"><TR><TD>"
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
                "<SPAN CLASS=\"titlebar\">"
        );
        if (!strcasecmp(listviewpref, "rooms")) {
@@ -2168,7 +2255,7 @@ void knrooms() {
 
 
        /* offer the ability to switch views */
-       wprintf("<TD><FORM NAME=\"roomlistomatic\">\n"
+       wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
                "<SELECT NAME=\"newview\" SIZE=\"1\" "
                "OnChange=\"location.href=roomlistomatic.newview.options"
                "[selectedIndex].value\">\n");
@@ -2185,21 +2272,39 @@ void knrooms() {
                ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
        );
 
-       wprintf("<OPTION %s VALUE=\"/knrooms&view=table\">"
-               "Classic table view"
-               "</OPTION>\n",
-               ( !strcasecmp(listviewpref, "table") ? "SELECTED" : "" )
-       );
-
-       wprintf("</SELECT></FORM></TD><TD>\n");
+       wprintf("</SELECT><BR>");
        offer_start_page();
-       wprintf("</TD></TR></TABLE>\n");
+       wprintf("</FORM></TD></TR></TABLE>\n");
 
        /* Display the room list in the user's preferred format */
-       if (!strcasecmp(listviewpref, "table")) {
-               tabular_room_list();
+       list_all_rooms_by_floor(listviewpref);
+}
+
+
+
+/* 
+ * Set the message expire policy for this room and/or floor
+ */
+void set_room_policy(void) {
+       char buf[SIZ];
+
+       if (strcmp(bstr("sc"), "OK")) {
+               strcpy(WC->ImportantMessage,
+                       "Cancelled.  Changes were not saved.");
+               display_editroom();
+               return;
        }
-       else {
-               list_all_rooms_by_floor(listviewpref);
+
+       serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
+       serv_gets(buf);
+       strcpy(WC->ImportantMessage, &buf[4]);
+
+       if (WC->axlevel >= 6) {
+               strcat(WC->ImportantMessage, "<BR>\n");
+               serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
+               serv_gets(buf);
+               strcat(WC->ImportantMessage, &buf[4]);
        }
+
+       display_editroom();
 }