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

@ -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. message body for that attribute value.
<p> <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> <h2>Multiple conditions</h2>
It is possible to define conditions in more than one options list. The only requiremnt 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 Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 1.534 2005/01/06 10:02:34 midas
Implemented 'hidden attributes'
Revision 1.533 2005/01/06 08:51:22 midas Revision 1.533 2005/01/06 08:51:22 midas
Made extendable attributes work with conditional attributes 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_DATE (1<<8)
#define AF_NUMERIC (1<<9) #define AF_NUMERIC (1<<9)
#define AF_USERLIST (1<<10) #define AF_USERLIST (1<<10)
#define AF_HIDDEN (1<<11)
/* attribute format flags */ /* attribute format flags */
#define AFF_SAME_LINE 1 #define AFF_SAME_LINE 1
@ -6075,7 +6079,15 @@ and attr_flags arrays */
for (j = 0; j < n; j++) for (j = 0; j < n; j++)
if (strieq(attr_list[j], tmp_list[i])) if (strieq(attr_list[j], tmp_list[i]))
attr_flags[j] |= AF_EXTENDABLE; 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++) { 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"); rsprintf("{\n");
for (i = 0; i < n_attr; i++) { 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 */ /* convert blanks to underscores */
strcpy(ua, attr_list[i]); 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 */ /* display attributes */
for (index = 0; index < n_attr; index++) { for (index = 0; index < n_attr; index++) {
if (attr_flags[index] & AF_HIDDEN)
continue;
strcpy(class_name, "attribname"); strcpy(class_name, "attribname");
strcpy(class_value, "attribvalue"); strcpy(class_value, "attribvalue");
input_size = 80; input_size = 80;