* useredit.c: added an "Delete user" button, because it was unintuitive
authorArt Cancro <ajc@citadel.org>
Fri, 11 Feb 2005 03:35:58 +0000 (03:35 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 11 Feb 2005 03:35:58 +0000 (03:35 +0000)
  to tell people "Delete a user by setting their access level to 0"

webcit/ChangeLog
webcit/useredit.c
webcit/webcit.h

index ce91998c3a9050e532a0ecafd15b3e3163f74db4..aea5096fb3aa7bba9027157440b24e91389dcaaf 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 528.48  2005/02/11 03:35:57  ajc
+* useredit.c: added an "Delete user" button, because it was unintuitive
+  to tell people "Delete a user by setting their access level to 0"
+
 Revision 528.47  2005/02/09 04:37:32  ajc
 * More GroupDAV fixes and tuning.
 
@@ -2334,4 +2338,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
-
index 78fa28ba68da3498603832480ba8a6903aaeeeee..38a1d5c2dd98285c869476efa88539a67f6ce103 100644 (file)
@@ -37,7 +37,16 @@ void select_user_to_edit(char *message, char *preselect)
        char buf[SIZ];
        char username[SIZ];
 
-       output_headers(1, 1, 0, 0, 0, 0, 0);    /* No room banner on this screen */
+       output_headers(1, 1, 2, 0, 1, 0, 0);
+       wprintf("<div id=\"banner\">\n");
+       wprintf("<table width=100%% border=0 bgcolor=#444455><tr>"
+               "<td>"
+               "<span class=\"titlebar\">"
+               "<img src=\"/static/users-icon.gif\">"
+               "Edit or delete users"
+               "</span></td></tr></table>\n"
+               "</div>\n<div id=\"content\">\n"
+       );
 
        if (message != NULL) wprintf(message);
 
@@ -51,7 +60,7 @@ void select_user_to_edit(char *message, char *preselect)
        
         wprintf("<CENTER>"
                "<FORM METHOD=\"POST\" ACTION=\"/display_edituser\">\n");
-        wprintf("<SELECT NAME=\"username\" SIZE=10>\n");
+        wprintf("<SELECT NAME=\"username\" SIZE=10 STYLE=\"width:100%%\">\n");
         serv_puts("LIST");
         serv_gets(buf);
         if (buf[0] == '1') {
@@ -70,6 +79,8 @@ void select_user_to_edit(char *message, char *preselect)
 
         wprintf("<input type=submit name=sc value=\"Edit configuration\">");
         wprintf("<input type=submit name=sc value=\"Edit address book entry\">");
+        wprintf("<input type=submit name=sc value=\"Delete user\" "
+               "onClick=\"return confirm('Delete this user?');\">");
         wprintf("</FORM></CENTER>\n");
        do_template("endbox");
 
@@ -265,6 +276,11 @@ void display_edituser(char *supplied_username, int is_new) {
                return;
        }
 
+       if (!strcmp(bstr("sc"), "Delete user")) {
+               delete_user(username);
+               return;
+       }
+
        output_headers(1, 1, 2, 0, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
        wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
@@ -401,6 +417,24 @@ void edituser(void) {
 }
 
 
+void delete_user(char *username) {
+       char buf[SIZ];
+       char message[SIZ];
+
+       serv_printf("ASUP %s|0|0|0|0|0|", username);
+       serv_gets(buf);
+       if (buf[0] != '2') {
+               sprintf(message,
+                       "<IMG SRC=\"static/error.gif\" ALIGN=CENTER>"
+                       "%s<br /><br />\n", &buf[4]);
+       }
+       else {
+               strcpy(message, "");
+       }
+       select_user_to_edit(message, bstr("username"));
+}
+               
+
 
 
 void create_user(void) {
index 6692c25ecc561aa6f187fa20d07fd2aeb1dc2502..c89f5a59fe132ab67f05c4660b6561cdbef14950 100644 (file)
@@ -393,6 +393,7 @@ void edit_vcard(void);
 void submit_vcard(void);
 void striplt(char *);
 void select_user_to_edit(char *message, char *preselect);
+void delete_user(char *);
 void display_edituser(char *who, int is_new);
 void create_user(void);
 void edituser(void);