$Log$
+Revision 323.17 2002/03/26 19:01:12 ajc
+* More edit user stuff
+
Revision 323.16 2002/03/26 18:23:23 ajc
* Don't display room banner on screens that don't pertain to a particular room
* Initial prep for add/change/delete user accounts screen
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
-void select_user_to_edit(void)
+void select_user_to_edit(char *message)
{
char buf[SIZ];
char username[SIZ];
output_headers(3); /* No room banner on this screen */
+ if (message != NULL) wprintf(message);
+
wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>"
"Add/change/delete user accounts"
wDumpContent(1);
}
+
+
+/*
+ * Edit a user. If supplied_username is null, look in the "username"
+ * web variable for the name of the user to edit.
+ */
+void display_edituser(char *supplied_username) {
+ char username[SIZ];
+ char buf[SIZ];
+ char error_message[SIZ];
+
+ if (supplied_username != NULL) {
+ strcpy(username, supplied_username);
+ }
+ else {
+ strcpy(username, bstr("username") );
+ }
+
+ serv_printf("AGUP %s", username);
+ serv_gets(buf);
+ if (buf[0] != '2') {
+ sprintf(error_message,
+ "<IMG SRC=\"static/error.gif\" VALIGN=CENTER>"
+ "%s<BR><BR>\n", &buf[4]);
+ select_user_to_edit(error_message);
+ return;
+ }
+
+ output_headers(3); /* No room banner on this screen */
+
+ wprintf("this is %s", username);
+
+ wDumpContent(1);
+
+}
+
+
+
+void create_user(void) {
+ char buf[SIZ];
+ char username[SIZ];
+ char error_message[SIZ];
+
+ strcpy(username, bstr("username"));
+
+ serv_printf("CREU %s", username);
+ serv_gets(buf);
+
+ if (buf[0] == '2') {
+ display_edituser(username);
+ }
+ else {
+ sprintf(error_message,
+ "<IMG SRC=\"static/error.gif\" VALIGN=CENTER>"
+ "%s<BR><BR>\n", &buf[4]);
+ select_user_to_edit(error_message);
+ return;
+ }
+
+ output_headers(3);
+
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
+ wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>"
+ "Edit user account: ");
+ escputs(username);
+ wprintf("</B></FONT></TD></TR></TABLE>\n");
+
+ wDumpContent(1);
+
+}
} else if (!strcasecmp(action, "submit_vcard")) {
submit_vcard();
} else if (!strcasecmp(action, "select_user_to_edit")) {
- select_user_to_edit();
+ select_user_to_edit(NULL);
+ } else if (!strcasecmp(action, "display_edituser")) {
+ display_edituser(NULL);
+ } else if (!strcasecmp(action, "create_user")) {
+ create_user();
} else if (!strcasecmp(action, "diagnostics")) {
output_headers(1);