$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)
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
#include "webcit.h"
-
-
-
-
+char *viewdefs[] = {
+ "Messages",
+ "Summary",
+ "Address Book"
+};
char floorlist[128][SIZ];
-
/*
* load the list of floors
*/
+/*
+ * 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];
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();
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);
+}
<CENTER>
-<TABLE width=100% border=0 cellpadding=5>
+<TABLE width=100% border=0 cellpadding=5 cellspacing=0>
<TR>
<TD VALIGN=TOP BGCOLOR=444455>
<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>
edituser();
} else if (!strcasecmp(action, "create_user")) {
create_user();
+ } else if (!strcasecmp(action, "changeview")) {
+ change_view();
} else if (!strcasecmp(action, "diagnostics")) {
output_headers(1);