/*
+ * $Id$
+ *
* Administrative screen to add/change/delete user accounts
*
*/
char buf[SIZ];
char username[SIZ];
- output_headers(3); /* No room banner on this screen */
+ output_headers(1, 1, 0, 0, 0, 0, 0); /* 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"
- "</B></FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP><TD>\n");
+
+ svprintf("BOXTITLE", WCS_STRING, "Edit or Delete users");
+ do_template("beginbox");
- wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
- "<TD>To edit an existing user account, select the user "
- "name from the list and click 'Edit'.<BR><BR>");
+ wprintf("To edit an existing user account, select the user "
+ "name from the list and click 'Edit'.<br /><br />");
- wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/display_edituser\">\n");
+ wprintf("<CENTER>"
+ "<FORM METHOD=\"POST\" ACTION=\"/display_edituser\">\n");
wprintf("<SELECT NAME=\"username\" SIZE=10>\n");
serv_puts("LIST");
serv_gets(buf);
wprintf("\n");
}
}
- wprintf("</SELECT><BR>\n");
+ wprintf("</SELECT><br />\n");
wprintf("<input type=submit name=sc value=\"Edit configuration\">");
wprintf("<input type=submit name=sc value=\"Edit address book entry\">");
wprintf("</FORM></CENTER>\n");
+ do_template("endbox");
+
+ wprintf("</TD><TD>");
- wprintf("</TD><TD>"
- "To create a new user account, enter the desired "
- "user name in the box below and click 'Create'.<BR><BR>");
+ svprintf("BOXTITLE", WCS_STRING, "Add users");
+ do_template("beginbox");
+
+ wprintf("To create a new user account, enter the desired "
+ "user name in the box below and click 'Create'.<br /><br />");
wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/create_user\">\n");
wprintf("New user: ");
- wprintf("<input type=text name=username><BR>\n"
+ wprintf("<input type=text name=username><br />\n"
"<input type=submit value=\"Create\">"
"</FORM></CENTER>\n");
+ do_template("endbox");
wprintf("</TD></TR></TABLE>\n");
wDumpContent(1);
if (buf[0] != '2') {
sprintf(error_message,
"<IMG SRC=\"static/error.gif\" ALIGN=CENTER>"
- "%s<BR><BR>\n", &buf[4]);
+ "%s<br /><br />\n", &buf[4]);
select_user_to_edit(error_message, username);
return;
}
sprintf(error_message,
"<IMG SRC=\"static/error.gif\" ALIGN=CENTER>"
"Could not create/edit vCard"
- "<BR><BR>\n"
+ "<br /><br />\n"
);
select_user_to_edit(error_message, username);
return;
/*
* Edit a user. If supplied_username is null, look in the "username"
* web variable for the name of the user to edit.
+ *
+ * If "is_new" is set to nonzero, this screen will set the web variables
+ * to send the user to the vCard editor next.
*/
-void display_edituser(char *supplied_username) {
+void display_edituser(char *supplied_username, int is_new) {
char buf[SIZ];
char error_message[SIZ];
time_t now;
if (buf[0] != '2') {
sprintf(error_message,
"<IMG SRC=\"static/error.gif\" ALIGN=CENTER>"
- "%s<BR><BR>\n", &buf[4]);
+ "%s<br /><br />\n", &buf[4]);
select_user_to_edit(error_message, username);
return;
}
return;
}
- output_headers(3); /* No room banner on this screen */
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>"
+ output_headers(1, 1, 2, 0, 0, 0, 0);
+ wprintf("<div id=\"banner\">\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">"
"Edit user account: ");
escputs(username);
- wprintf("</B></FONT></TD></TR></TABLE>\n");
+ wprintf("</SPAN></TD></TR></TABLE>\n");
+ wprintf("</div>\n<div id=\"content\">\n");
+ do_template("beginbox_nt");
wprintf("<FORM METHOD=\"POST\" ACTION=\"/edituser\">\n"
"<INPUT TYPE=\"hidden\" NAME=\"username\" VALUE=\"");
escputs(username);
wprintf("\">\n");
+ wprintf("<INPUT TYPE=\"hidden\" NAME=\"is_new\" VALUE=\"%d\">\n"
+ "<INPUT TYPE=\"hidden\" NAME=\"usernum\" VALUE=\"%ld\">\n",
+ is_new, usernum);
wprintf("<INPUT TYPE=\"hidden\" NAME=\"flags\" VALUE=\"%d\">\n", flags);
wprintf("</TABLE>\n");
wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"OK\">\n"
+ " "
"<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Cancel\">\n"
- "<BR><BR></FORM>\n");
+ "<br /><br /></FORM>\n");
wprintf("</CENTER>\n");
+ do_template("endbox");
wDumpContent(1);
void edituser(void) {
char message[SIZ];
char buf[SIZ];
+ int is_new = 0;
+
+ is_new = atoi(bstr("is_new"));
if (strcasecmp(bstr("action"), "OK")) {
strcpy(message, "Edit user cancelled.");
if (buf[0] != '2') {
sprintf(message,
"<IMG SRC=\"static/error.gif\" ALIGN=CENTER>"
- "%s<BR><BR>\n", &buf[4]);
+ "%s<br /><br />\n", &buf[4]);
}
else {
strcpy(message, "");
}
}
- select_user_to_edit(message, bstr("username"));
+ /* If we are in the middle of creating a new user, move on to
+ * the vCard edit screen.
+ */
+ if (is_new) {
+ display_edit_address_book_entry( bstr("username"), atol(bstr("usernum")) );
+ }
+ else {
+ select_user_to_edit(message, bstr("username"));
+ }
}
serv_gets(buf);
if (buf[0] == '2') {
- sprintf(error_message, "<b>User has been created.</b>");
- select_user_to_edit(error_message, username);
+ /* sprintf(error_message, "<b>User has been created.</b>");
+ select_user_to_edit(error_message, username); */
+ display_edituser(username, 1);
}
else {
sprintf(error_message,
"<IMG SRC=\"static/error.gif\" ALIGN=CENTER>"
- "%s<BR><BR>\n", &buf[4]);
+ "%s<br /><br />\n", &buf[4]);
select_user_to_edit(error_message, NULL);
}