Implemented "last default" to restrict quick filter display by default on the last n days

This commit is contained in:
2017-08-10 16:42:51 +02:00
parent 927ffac38c
commit e41cb58950
2 changed files with 18 additions and 2 deletions
+8
View File
@@ -1475,6 +1475,14 @@ Subst on edit author = $full_name
can be displayed. The <b><code>Subtext</code></b> filter works on the
entry body text.
</li>
<li>
<b><code>Last default = &lt;n&gt;</code></b><br>
Some logbooks are very big ans searching through all entries with
quick filter can be time consuming. This option sets a default value
for the <code><b>Date</b></code> quick filter, so that by default
only the &lt;n&gt; days are displayed.
</li>
<li>
<b><code>Format &lt;attribute&gt; =
&lt;flags&gt;,&lt;css_class_name&gt;,&lt;css_class_value&gt;,&lt;width&gt;,&lt;size&gt;</code></b><br>
+10 -2
View File
@@ -19169,6 +19169,11 @@ void show_page_filters(LOGBOOK * lbs, int n_msg, int page_n, BOOL mode_commands,
if (strieq(list[index], "Date")) {
i = isparam("last") ? atoi(getparam("last")) : 0;
if (i == 0 && getcfg(lbs->name, "Last default", str, sizeof(str))) {
i = atoi(str);
setparam("last", str);
}
rsprintf("<select title=\"%s\" name=last onChange=\"document.form1.submit()\">\n",
loc("Select period"));
@@ -20419,9 +20424,12 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
msg_list[i].lbs = NULL;
}
if (isparam("last")) {
if (isparam("last") || getcfg(lbs->name, "Last default", str, sizeof(str))) {
date_filtering = TRUE;
n = atoi(getparam("last"));
if (isparam("last"))
n = atoi(getparam("last"));
else
n = atoi(str);
if (n > 0) {
for (i = 0; i < n_msg; i++)