From: Art Cancro Date: Tue, 26 Mar 2002 19:01:12 +0000 (+0000) Subject: * More edit user stuff X-Git-Tag: v7.86~6454 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=d587a884353577537c70e5e4259c604b0f5ee3d9;p=citadel.git * More edit user stuff --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index dfffe296d..cfb0d3904 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,7 @@ $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 @@ -762,4 +765,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/static/error.gif b/webcit/static/error.gif new file mode 100644 index 000000000..57d398c3d Binary files /dev/null and b/webcit/static/error.gif differ diff --git a/webcit/useredit.c b/webcit/useredit.c index 47ebb6535..7dafbfacd 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -29,13 +29,15 @@ -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("
"); wprintf("" "Add/change/delete user accounts" @@ -77,3 +79,73 @@ void select_user_to_edit(void) 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, + "" + "%s

\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, + "" + "%s

\n", &buf[4]); + select_user_to_edit(error_message); + return; + } + + output_headers(3); + + wprintf("
"); + wprintf("" + "Edit user account: "); + escputs(username); + wprintf("
\n"); + + wDumpContent(1); + +} diff --git a/webcit/webcit.c b/webcit/webcit.c index f5ed5e0c0..abec0e86c 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1036,7 +1036,11 @@ void session_loop(struct httprequest *req) } 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); diff --git a/webcit/webcit.h b/webcit/webcit.h index 19e411f83..289249b0b 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -292,4 +292,6 @@ int pattern2(char *search, char *patn); void edit_vcard(void); void submit_vcard(void); void striplt(char *); -void select_user_to_edit(void); +void select_user_to_edit(char *message); +void display_edituser(char *who); +void create_user(void);