Implemented useremail attribute type

SVN revision: 1754
This commit is contained in:
Stefan Ritt 2006-11-09 21:50:32 +00:00
parent b45ae98494
commit 7a54af9160
2 changed files with 37 additions and 3 deletions

View File

@ -1402,7 +1402,7 @@ Subst on edit author = $full_name
</li>
<li>
<code><b>Type &lt;attribute&gt; = date | datetime | numeric |
userlist</b></code><br>
userlist | useremail</b></code><br>
A normal attribute can contain strings of any type. With this option,
attributes can be forced to be numeric or to be a date/time, or to
consist of a list of all users from the password file. When new logbook
@ -1427,7 +1427,11 @@ Subst on edit author = $full_name
If the attribute type is <b><code>userlist</code></b>, a drop-down box
is displayed which contains all user names from the current password
file. This can be useful for example in a bug tracking system, where a
new entry gets assigned to an individual.
new entry gets assigned to an individual. The type
<b><code>useremail</code></b> is similar, just a list of email addresses
of all registered users. This can be used to send email notification
to assigned people by using this attribute in an
<b><code>Email all = &lt;attribute&gt;</code></b> statement.
</li>
<li>
<code><b>Change &lt;attribute&gt; = &lt;string&gt;</b></code><br>

View File

@ -255,7 +255,8 @@ char author_list[MAX_N_LIST][NAME_LENGTH] = {
#define AF_TIME (1<<10)
#define AF_NUMERIC (1<<11)
#define AF_USERLIST (1<<12)
#define AF_HIDDEN (1<<13)
#define AF_USEREMAIL (1<<13)
#define AF_HIDDEN (1<<14)
/* attribute format flags */
#define AFF_SAME_LINE 1
@ -6776,6 +6777,9 @@ and attr_flags arrays */
attr_flags[i] |= AF_NUMERIC;
if (strieq(type, "userlist"))
attr_flags[i] |= AF_USERLIST;
if (strieq(type, "useremail"))
attr_flags[i] |= AF_USEREMAIL;
}
}
@ -9422,6 +9426,32 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("</td>\n");
} else if (attr_flags[index] & AF_USEREMAIL) {
rsprintf("<td%s class=\"attribvalue\">\n", title);
/* display drop-down box with list of users */
rsprintf("<select name=\"%s\"", ua);
rsprintf(" onChange=\"mod();\">\n");
/* display emtpy option */
rsprintf("<option value=\"\">- %s -\n", loc("please select"));
for (i = 0;; i++) {
if (!enum_user_line(lbs, i, login_name, sizeof(login_name)))
break;
get_user_line(lbs, login_name, NULL, NULL, str, NULL, NULL);
if (strieq(str, attrib[index]))
rsprintf("<option selected value=\"%s\">%s\n", str, str);
else
rsprintf("<option value=\"%s\">%s\n", str, str);
}
rsprintf("</select>\n");
rsprintf("</td>\n");
} else {
/* show normal edit field */