]> code.citadel.org Git - citadel.git/commitdiff
* Room list or folder list? Give the user a choice. (Has bugs.)
authorArt Cancro <ajc@citadel.org>
Wed, 22 May 2002 01:53:23 +0000 (01:53 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 22 May 2002 01:53:23 +0000 (01:53 +0000)
webcit/ChangeLog
webcit/mainmenu.c
webcit/roomops.c
webcit/webcit.c
webcit/webcit.h

index 0234da8cd576c7fa99d393c9d1e890e835800493..081e22902038948b01d0428a21e989f51474e522 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 323.36  2002/05/22 01:53:23  ajc
+* Room list or folder list?  Give the user a choice.  (Has bugs.)
+
 Revision 323.35  2002/05/12 15:21:43  error
 * do_template() now parses a .wml file for WAP clients, and a .html file
   for everybody else
@@ -822,3 +825,4 @@ 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
+
index 1b6c95800bbaee40a15554d095c76d27ed0e29bc..65513869878ad5129763528ef91544c555aa597b 100644 (file)
@@ -151,9 +151,6 @@ void display_main_menu(void)
        wprintf("<LI><A HREF=\"/zapped_list\">");
        wprintf("List all forgotten rooms</A>\n");
 
-       wprintf("<LI><A HREF=\"/folders\">");
-       wprintf("folders</A>\n");
-
        wprintf("</UL>\n");
 
        wprintf("</TD><TD>");
index 06c921049c49487c2486a2870fa20578032b36e0..65dc7d2aaa71429beb3d7f6f18fe1d161082e760 100644 (file)
@@ -215,17 +215,14 @@ void listrms(char *variety)
 
 
 /*
- * list all rooms by floor
+ * list all rooms by floor (only should get called from knrooms() because
+ * that's where output_headers() is called from)
  */
 void list_all_rooms_by_floor(void)
 {
        int a;
        char buf[SIZ];
 
-       load_floorlist();
-
-       output_headers(1);
-
        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");
@@ -1642,7 +1639,8 @@ void change_view(void) {
 
 
 /*
- * Show the room list in "folders" format
+ * Show the room list in "folders" format.  (only should get called by
+ * knrooms() because that's where output_headers() is called from)
  */
 void folders(void) {
        char buf[SIZ];
@@ -1667,9 +1665,6 @@ void folders(void) {
        int floor;
        int nests = 0;
 
-       load_floorlist();
-
-       output_headers(1);
        wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>"
                "<FONT SIZE=+1 COLOR=\"FFFFFF\""
                "<B>Folder list</B>\n"
@@ -1776,3 +1771,54 @@ void folders(void) {
        free(fold);
        wDumpContent(1);
 }
+
+
+/* Do either a known rooms list or a folders list, depending on the
+ * user's preference
+ */
+void knrooms() {
+       char listviewpref[SIZ];
+
+       load_floorlist();
+       output_headers(1);
+
+       /* Determine whether the user is trying to change views */
+       strcpy(listviewpref, "rooms");
+       if (bstr("view") != NULL) {
+               set_preference("roomlistview", bstr("view"));
+       }
+
+       get_preference("roomlistview", listviewpref);
+
+       if (!strcasecmp(listviewpref, "folders")) {
+               strcpy(listviewpref, "rooms");
+       }
+
+       /* offer the ability to switch views */
+       wprintf("<FORM NAME=\"roomlistomatic\">\n"
+               "<SELECT NAME=\"newview\" SIZE=\"1\" "
+               "OnChange=\"location.href=roomlistomatic.newview.options"
+               "[selectedIndex].value\">\n");
+
+       wprintf("<OPTION %s VALUE=\"/knrooms&view=rooms\">"
+               "View as room list"
+               "</OPTION>\n",
+               ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
+       );
+
+       wprintf("<OPTION %s VALUE=\"/knrooms&view=folders\">"
+               "View as folder list"
+               "</OPTION>\n",
+               ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
+       );
+
+       wprintf("</SELECT></FORM>\n");
+
+       /* Display the room list in the user's preferred format */
+       if (!strcasecmp(listviewpref, "folders")) {
+               folders();
+       }
+       else {
+               list_all_rooms_by_floor();
+       }
+}
index a65016329f606f8dee27c53bc2261a3dc0709f52..bbd183813cb48cdcdc03ab7e165115b8f721ac7a 100644 (file)
@@ -903,7 +903,7 @@ void session_loop(struct httprequest *req)
        } else if (!strcasecmp(action, "whobbs")) {
                whobbs();
        } else if (!strcasecmp(action, "knrooms")) {
-               list_all_rooms_by_floor();
+               knrooms();
        } else if (!strcasecmp(action, "gotonext")) {
                slrp_highest();
                gotonext();
index f5c4babceda2533e5644a41708f63a430d20e915..26d57e158d1cc54e9fd189b9ef2b430d73bc506a 100644 (file)
@@ -306,3 +306,4 @@ void load_preferences(void);
 void save_preferences(void);
 void get_preference(char *key, char *value);
 void set_preference(char *key, char *value);
+void knrooms(void);