Implemented 'hidden attributes'

SVN revision: 1167
This commit is contained in:
Stefan Ritt 2005-01-06 10:02:40 +00:00
parent 51e201ae02
commit 442fe5a988
2 changed files with 41 additions and 6 deletions

View File

@ -714,8 +714,8 @@ attachments. The default is 10485760 (= 10 MB).<p>
<UL>
<LI><b><code>Attributes = &lt;list&gt;</code></b>
<br>
Define a number of attributes for the logbook, separated by commata. A maximum of
100 attributes can be defined. Typical values are "<I>Author</I>", "<I>Subject</I>"
Define a number of attributes for the logbook, separated by commata. A maximum of
100 attributes can be defined. Typical values are "<I>Author</I>", "<I>Subject</I>"
or "<I>Type</I>".
<p>
@ -1061,7 +1061,7 @@ so specifying for example only the flags is possible.
<LI><b><code>Type &lt;attribute&gt; = date | numeric | userlist</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, or to consist of a list of all users from the password file.
forced to be numeric or to be a date, or to consist of a list of all users from the password file.
When new logbook entries are made,
numeric attributes are checked to contain only digits. Note that JavaScript has to be
enabled to do this.<br><br>
@ -1171,8 +1171,8 @@ Same as before, but for editing entries.
<li><b><code>Sort Attributes = &lt;list&gt;</code></b>
<br>
For the list display, the entries are normally sorted by their ID. Alternatively,
one can specify one or more (separated by commata) attributes, which are used
for sorting. The first attribute in the list has the highest priority. Only if two
one can specify one or more (separated by commata) attributes, which are used
for sorting. The first attribute in the list has the highest priority. Only if two
entries have the same value in the first sort attribute, they are sorted according to
the second sort attribute and so on.
<p>
@ -1259,6 +1259,25 @@ message comment can be displayed to tell the user what to enter exactly in the
message body for that attribute value.
<p>
<li><b><code>Hidden Attributes = &lt;list&gt;</code></b>
<br>
When using conditional attributes, it might be necessary to omit certain attributes
under certain conditions, to make the input mask shorter. With this option, a list
of attributes can be specified which are not displayed on the new entry input page.
This option only makes sense when used with condisions, such as:<p>
<ul><pre>
Attributes = PC Name, Operating System, Version, Distribution
Options Operating System = Linux{1}, Windows{2}
{1} Hidden Attributes = Version
{2} Hidden Attributes = Distribution
</pre></ul>
<p>
The above statements caus the atrribute <b><code>Version</code></b> to be only
visible when "Windows" is selected, and <b><code>Version</code></b> to be only
visible when "Linux" is selected.<p>
<h2>Multiple conditions</h2>
It is possible to define conditions in more than one options list. The only requiremnt

View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG
$Log$
Revision 1.534 2005/01/06 10:02:34 midas
Implemented 'hidden attributes'
Revision 1.533 2005/01/06 08:51:22 midas
Made extendable attributes work with conditional attributes
@ -942,6 +945,7 @@ char author_list[MAX_N_LIST][NAME_LENGTH] = {
#define AF_DATE (1<<8)
#define AF_NUMERIC (1<<9)
#define AF_USERLIST (1<<10)
#define AF_HIDDEN (1<<11)
/* attribute format flags */
#define AFF_SAME_LINE 1
@ -6075,7 +6079,15 @@ and attr_flags arrays */
for (j = 0; j < n; j++)
if (strieq(attr_list[j], tmp_list[i]))
attr_flags[j] |= AF_EXTENDABLE;
}
/* check for hidden attributes */
getcfg(logbook, "Hidden Attributes", list, sizeof(list));
m = strbreak(list, tmp_list, MAX_N_ATTR, ",");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++)
if (strieq(attr_list[j], tmp_list[i]))
attr_flags[j] |= AF_HIDDEN;
}
for (i = 0; i < n; i++) {
@ -7704,7 +7716,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("{\n");
for (i = 0; i < n_attr; i++) {
if (attr_flags[i] & AF_REQUIRED) {
if ((attr_flags[i] & AF_REQUIRED) && (attr_flags[i] & AF_HIDDEN) == 0) {
/* convert blanks to underscores */
strcpy(ua, attr_list[i]);
@ -7942,6 +7954,10 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
/* display attributes */
for (index = 0; index < n_attr; index++) {
if (attr_flags[index] & AF_HIDDEN)
continue;
strcpy(class_name, "attribname");
strcpy(class_value, "attribvalue");
input_size = 80;