* More edit user stuff
authorArt Cancro <ajc@citadel.org>
Tue, 26 Mar 2002 19:01:12 +0000 (19:01 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 26 Mar 2002 19:01:12 +0000 (19:01 +0000)
webcit/ChangeLog
webcit/static/error.gif [new file with mode: 0644]
webcit/useredit.c
webcit/webcit.c
webcit/webcit.h

index dfffe296d3d6e488ac3f2d28a27abf5b38f40cfe..cfb0d39040c7f7c2b180caf043ee093cfeb271fc 100644 (file)
@@ -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 <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
diff --git a/webcit/static/error.gif b/webcit/static/error.gif
new file mode 100644 (file)
index 0000000..57d398c
Binary files /dev/null and b/webcit/static/error.gif differ
index 47ebb65355e085237d34dfdbe64f73f39bd56c5f..7dafbfacd620d354b6637eeb0c072db33c5c9400 100644 (file)
 
 
 
-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"
@@ -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,
+                       "<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);
+
+}
index f5ed5e0c0e7bf0c3cf27196137fdcba21087a82c..abec0e86ceaaceedd3e84ff7a2721bd3044de644 100644 (file)
@@ -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);
 
index 19e411f83ceaa4764cdfe5eb8e60ef45248681f0..289249b0b4b8b36fb0c202a3743ae2205c144ff7 100644 (file)
@@ -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);