Implemented 'sort attribute'

SVN revision: 1138
This commit is contained in:
2004-12-05 11:40:52 +00:00
parent 398d32cbe7
commit ec9fa88f3c
2 changed files with 35 additions and 4 deletions
+13 -3
View File
@@ -714,8 +714,9 @@ 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. A maximum of 50 attributes can be
defined. Typical values are "<I>Author</I>", "<I>Subject</I>" or "<I>Type</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>
<LI><b><code>Options &lt;attribute&gt; = &lt;list&gt;</code></b>
@@ -1156,7 +1157,7 @@ this can be useful for adding the author and the date of a reply, like<br>
where "\n" causes a line break.
<p>
<li><b><code>Apend on reply = &lt;string&gt;</code></b>
<li><b><code>Append on reply = &lt;string&gt;</code></b>
<br>
Same as before, but gets added after the previous entry.
<p>
@@ -1167,6 +1168,15 @@ Same as before, but gets added after the previous entry.
Same as before, but for editing entries.
<p>
<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
entries have the same value in the first sort attribute, they are sorted according to
the second sort attribute and so on.
<p>
</UL>
<a name="conditional"><hr>
+22 -1
View File
@@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG
$Log$
Revision 1.516 2004/12/05 11:40:52 midas
Implemented 'sort attribute'
Revision 1.515 2004/12/04 16:18:50 midas
Look for parameters first under conditions, then unconditional if not found
@@ -14460,7 +14463,8 @@ void show_elog_list(LOGBOOK * lbs, INT past_n, INT last_n, INT page_n, char *inf
*list, *text, *text1, in_reply_to[80], reply_to[MAX_REPLY_TO * 10],
attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], encoding[80], locked_by[256],
str[NAME_LENGTH], ref[256], img[80], comment[NAME_LENGTH], mode[80], mid[80],
menu_str[1000], menu_item[MAX_N_LIST][NAME_LENGTH], param[NAME_LENGTH], format[80];
menu_str[1000], menu_item[MAX_N_LIST][NAME_LENGTH], param[NAME_LENGTH], format[80],
sort_attr[MAX_N_ATTR + 4][NAME_LENGTH];
char *p, *pt, *pt1, *pt2, *slist, *svalue, *gattr;
BOOL show_attachments, threaded, csv, xml, mode_commands, expand, filtering, disp_filter, show_text;
time_t ltime, ltime_start, ltime_end, now, ltime1, ltime2;
@@ -14813,6 +14817,9 @@ void show_elog_list(LOGBOOK * lbs, INT past_n, INT last_n, INT page_n, char *inf
if (*getparam("subtext"))
filtering = TRUE;
if (getcfg(lbs->name, "Sort Attributes", list, 10000))
filtering = TRUE;
text = xmalloc(TEXT_SIZE);
text1 = xmalloc(TEXT_SIZE);
@@ -15014,6 +15021,20 @@ void show_elog_list(LOGBOOK * lbs, INT past_n, INT last_n, INT page_n, char *inf
}
}
/* evaluate "sort attributes" */
if (getcfg(lbs->name, "Sort Attributes", list, 10000)) {
msg_list[index].string[0] = 0;
n = strbreak(list, sort_attr, MAX_N_ATTR, ",");
for (i = 0; i < n; i++) {
for (j = 0; j < lbs->n_attr; j++) {
if (strieq(sort_attr[i], attr_list[j])) {
strlcat(msg_list[index].string, " ", sizeof(msg_list[index].string));
strlcat(msg_list[index].string, attrib[j], sizeof(msg_list[index].string));
}
}
}
}
/* add attribute for sorting */
for (i = 0; i < lbs->n_attr; i++) {
if (strieq(getparam("sort"), attr_list[i])