/*
* $Id$
*/
-/**
- * \defgroup AdminTasks Administrative screen to add/change/delete user accounts
- * \ingroup CitadelConfig
- *
- */
-/*@{*/
#include "webcit.h"
#include "webserver.h"
/**
- * \brief show a list of available users to edit them
- * \param message the header message???
- * \param preselect which user should be selected in the browser
+ * show a list of available users to edit them
+ * message the header message???
+ * preselect which user should be selected in the browser
*/
void select_user_to_edit(char *message, char *preselect)
{/*
StrBuf *UserName;
StrBuf *Passvoid;
- StrBuf *LastLogon;
time_t LastLogonT;
/* Just available for Single users to view: */
unsigned int Flags;
ul = (UserListEntry*) malloc(sizeof(UserListEntry));
ul->UserName = NewStrBuf();
- ul->LastLogon = NewStrBuf();
ul->Passvoid = NewStrBuf();
StrBufExtract_token(ul->UserName, SerializedUser, 0, '|');
ul->nPosts = StrBufExtract_int(SerializedUser, 4, '|');
ul->AccessLevel = StrBufExtract_int(SerializedUser, 5, '|');
ul->UID = StrBufExtract_int(SerializedUser, 6, '|');
- StrBufExtract_token(ul->LastLogon, SerializedUser, 7, '|');
- /// TODO: ul->LastLogon -> ulLastLogonT
+ ul->LastLogonT = StrBufExtract_long(SerializedUser, 7, '|');
ul->DaysTillPurge = StrBufExtract_int(SerializedUser, 8, '|');
return ul;
}
{
UserListEntry *ul = (UserListEntry*) vUserList;
FreeStrBuf(&ul->UserName);
- FreeStrBuf(&ul->LastLogon);
FreeStrBuf(&ul->Passvoid);
free(ul);
}
ul = (UserListEntry*) malloc(sizeof(UserListEntry));
ul->UserName = NewStrBuf();
- ul->LastLogon = NewStrBuf();
ul->Passvoid = NewStrBuf();
StrBufExtract_token(ul->UserName, SerializedUserList, 0, '|');
ul->AccessLevel = StrBufExtract_int(SerializedUserList, 1, '|');
ul->UID = StrBufExtract_int(SerializedUserList, 2, '|');
- StrBufExtract_token(ul->LastLogon, SerializedUserList, 3, '|');
- /// TODO: ul->LastLogon -> ulLastLogonT
+ ul->LastLogonT = StrBufExtract_long(SerializedUserList, 3, '|');
ul->nLogons = StrBufExtract_int(SerializedUserList, 4, '|');
ul->nPosts = StrBufExtract_int(SerializedUserList, 5, '|');
StrBufExtract_token(ul->Passvoid, SerializedUserList, 6, '|');
}
-HashList *iterate_load_userlist(WCTemplateToken *Token)
+HashList *iterate_load_userlist(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
HashList *Hash;
char buf[SIZ];
{
UserListEntry *ul = (UserListEntry*) Context;
- StrBufAppendBuf(Target, ul->LastLogon, 0);
+ StrBufAppendPrintf(Target,"%ld", ul->LastLogonT, 0);
}
void tmplput_USERLIST_LastLogonStr(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
{
}
/**
- * \brief Locate the message number of a user's vCard in the current room
- * \param username the plaintext name of the user
- * \param usernum the number of the user on the citadel server
+ * Locate the message number of a user's vCard in the current room
+ * username the plaintext name of the user
+ * usernum the number of the user on the citadel server
* \return the message id of his vcard
*/
long locate_user_vcard(char *username, long usernum) {
}
/** If there's no vcard, create one */
- if (vcard_msgnum < 0) if (already_tried_creating_one == 0) {
+ if ((vcard_msgnum < 0) && (already_tried_creating_one == 0)) {
already_tried_creating_one = 1;
serv_puts("ENT0 1|||4");
serv_getln(buf, sizeof buf);
/**
- * \brief Display the form for editing a user's address book entry
- * \param username the name of the user
- * \param usernum the citadel-uid of the user
+ * Display the form for editing a user's address book entry
+ * username the name of the user
+ * usernum the citadel-uid of the user
*/
void display_edit_address_book_entry(char *username, long usernum) {
char roomname[SIZ];
}
else {
UL = NewUserListOneEntry(Buf);
- output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("userlist_detailview"), NULL, (void*) UL, CTX_USERLIST);
- end_burst();
+ if (havebstr("edit_abe_button")) {
+ display_edit_address_book_entry(username, UL->UID);
+ }
+ else if (havebstr("delete_button")) {
+ delete_user(username);
+ }
+ else {
+ output_headers(1, 0, 0, 0, 1, 0);
+ DoTemplate(HKEY("userlist_detailview"), NULL, (void*) UL, CTX_USERLIST);
+ end_burst();
+ }
+ DeleteUserListEntry(UL);
}
FreeStrBuf(&Buf);
/* *
- * \brief Edit a user.
+ * 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.
- * \param supplied_username user to look up or NULL if to search in the environment
- * \param is_new should we create the user?
+ * supplied_username user to look up or NULL if to search in the environment
+ * is_new should we create the user?
* /
void display_edituser(char *supplied_username, int is_new) {
char buf[1024];
*/
/**
- * \brief do the backend operation of the user edit on the server
+ * do the backend operation of the user edit on the server
*/
void edituser(void) {
char message[SIZ];
}
/*
- * \brief burge a user
- * \param username the name of the user to remove
+ * burge a user
+ * username the name of the user to remove
*/
void delete_user(char *username) {
char buf[SIZ];
/**
- * \brief create a new user
+ * create a new user
* take the web environment username and create it on the citadel server
*/
void create_user(void) {
RegisterConditional(HKEY("COND:USERACCESS"), 0, ConditionalUserAccess, CTX_USERLIST);
RegisterConditional(HKEY("COND:USERLIST:FLAG:USE_INTERNET"), 0, ConditionalFlagINetEmail, CTX_USERLIST);
- RegisterConditional(HKEY("COND:USERNAME"), 0, ConditionalUser, CTX_USERLIST);
- RegisterIterator("USERLIST", 0, NULL, iterate_load_userlist, NULL, DeleteHash, CTX_USERLIST);
+ RegisterIterator("USERLIST", 0, NULL, iterate_load_userlist, NULL, DeleteHash, CTX_USERLIST, CTX_NONE);
}
-/*@}*/