]> code.citadel.org Git - citadel.git/commitdiff
* Added a drop-down box to change a user's view of a room.
authorArt Cancro <ajc@citadel.org>
Wed, 1 May 2002 03:23:32 +0000 (03:23 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 1 May 2002 03:23:32 +0000 (03:23 +0000)
webcit/ChangeLog
webcit/roomops.c
webcit/static/roombanner.html
webcit/webcit.c
webcit/webcit.h

index ce6096576be5e02d7761e0e3b58e87738f0b2900..88f6548e883935e4464fdd3cf05a05ee2577efa0 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 323.24  2002/05/01 03:23:31  ajc
+* Added a drop-down box to change a user's view of a room.
+
 Revision 323.23  2002/04/28 03:56:47  ajc
 * Finished summary mode (for the most part, anyway)
 
@@ -785,3 +788,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 10e5549c8b33d5789b98aeec92802fcc14f83fb9..97e95e809be30cbc1d5db4b23456fb39ad5e671f 100644 (file)
 #include "webcit.h"
 
 
-
-
-
-
+char *viewdefs[] = {
+       "Messages",
+       "Summary",
+       "Address Book"
+};
 
 char floorlist[128][SIZ];
 
-
 /*
  * load the list of floors
  */
@@ -339,6 +339,29 @@ void embed_newmail_button(void) {
 
 
 
+/*
+ * Display the current view and offer an option to change it
+ */
+void embed_view_o_matic(void) {
+       int i;
+
+       wprintf("<FORM NAME=\"viewomatic\">\n"
+               "<SELECT NAME=\"newview\" SIZE=\"1\" "
+               "OnChange=\"location.href=viewomatic.newview.options"
+               "[selectedIndex].value\">\n");
+
+       for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
+               wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
+                       ((i == WC->wc_view) ? "SELECTED" : ""),
+                       i );
+               escputs(viewdefs[i]);
+               wprintf("</OPTION>\n");
+       }
+       wprintf("</SELECT></FORM>\n");
+}
+
+
+
 void embed_room_banner(char *got) {
        char fakegot[SIZ];
 
@@ -361,6 +384,7 @@ void embed_room_banner(char *got) {
        svcallback("ROOMPIC", embed_room_graphic);
        svcallback("ROOMINFO", readinfo);
        svcallback("YOUHAVEMAIL", embed_newmail_button);
+       svcallback("VIEWOMATIC", embed_view_o_matic);
 
        do_template("roombanner.html");
        clear_local_substs();
@@ -1566,3 +1590,19 @@ void netedit(void) {
        fclose(fp);
        display_editroom();
 }
+
+
+
+/*
+ * Change the view for this room
+ */
+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);
+}
index f337094da7009030046565ef6dd552f694c38b23..9fdb9c48a24e292e8d269c4dcb3b193b794e1991 100644 (file)
@@ -1,5 +1,5 @@
 <CENTER>
-<TABLE width=100% border=0 cellpadding=5>
+<TABLE width=100% border=0 cellpadding=5 cellspacing=0>
 <TR>
 
 <TD VALIGN=TOP BGCOLOR=444455>
@@ -7,16 +7,17 @@
 <FONT COLOR=DDDDCC><?NEWMSGS> new of <?TOTALMSGS> messages</FONT>
 </TD>
 
-<TD>
+<TD BGCOLOR=444455>
 <?ROOMPIC>
 </TD>
 
-<TD VALIGN=TOP>
+<TD VALIGN=TOP BGCOLOR=444455>
 <?ROOMINFO>
 </TD>
 
-<TD VALIGN=TOP>
+<TD VALIGN=TOP BGCOLOR=444455>
 <?YOUHAVEMAIL>
+<?VIEWOMATIC>
 </TD>
 
 </TR></TABLE></CENTER>
index 13e7ba22bfbf88baec4411c77bb76f3a115280ef..be758504cefa5a8ec6c543585f57d99b1feca58d 100644 (file)
@@ -1043,6 +1043,8 @@ void session_loop(struct httprequest *req)
                edituser();
        } else if (!strcasecmp(action, "create_user")) {
                create_user();
+       } else if (!strcasecmp(action, "changeview")) {
+               change_view();
        } else if (!strcasecmp(action, "diagnostics")) {
                output_headers(1);
 
index 9e864a2e4f12c2df404732889a205c9f92c17a65..37ce21b0987fa62db66b54afad81cfd96368081a 100644 (file)
@@ -297,3 +297,4 @@ void select_user_to_edit(char *message);
 void display_edituser(char *who);
 void create_user(void);
 void edituser(void);
+void change_view(void);