Menu

#42 Please do only show quarantine tab when quarantine is used

open
nobody
webui (9)
5
2009-08-29
2009-08-29
No

Hi,

Following to discussion on the mailing-list, it would be better to only show the quarantine tab when the quarantine is used (or if not empty in case a user changes her preferences).

Here is a quick hack to do this (could be improved, but this is just to
demonstrate the idea):

diff --git a/webui/cgi-bin/dspam.cgi b/webui/cgi-bin/dspam.cgi
index 3d2a3c3..4626924 100755
--- a/webui/cgi-bin/dspam.cgi
+++ b/webui/cgi-bin/dspam.cgi
@@ -760,6 +760,13 @@ _END
$DATA{"OPTION"} = "";
}

+ # Check whether the quarantine tab should be displayed
+ if ( ($PREFS{"spamAction"} ne "quarantine") && ($DATA{'TOTAL_QUARANTINED_MESSAGES'} == $LANG{'empty'}) ) {
+ $DATA{'NAV_QUARANTINE'} = '';
+ } else {
+ $DATA{'NAV_QUARANTINE'} = qq!<li><a href="$CONFIG{'ME'}?user=$CURRENT_USER&template=quarantine">$LANG{'quarantine'} ($DATA{'TOTAL_QUARANTINED_MESSAGES'})</a></li>!;
+ }
+
&output(%DATA);
}

diff --git a/webui/cgi-bin/templates/nav_performance.html b/webui/cgi-bin/templates/nav_performance.html
index de1b0e0..1a68535 100644
--- a/webui/cgi-bin/templates/nav_performance.html
+++ b/webui/cgi-bin/templates/nav_performance.html
@@ -20,7 +20,7 @@
<li id="active"><a id="current" href="$CGI$?$USER$template=performance">Performance</a></li>
<li><a href="$CGI$?$USER$template=preferences">Preferences</a></li>
<li><a href="$CGI$?$USER$template=alerts">Alerts</a></li>
- <li><a href="$CGI$?$USER$template=quarantine">Quarantine ($TOTAL_QUARANTINED_MESSAGES$)</a></li>
+ $NAV_QUARANTINE$
<li><a href="$CGI$?$USER$template=analysis">Analysis</a></li>
<li><a href="$CGI$?$USER$template=history&history_page=1">History</a></li>
$NAV_ADMIN$

Obviously, all the templates will need to be updated (also the translated templates).
It also requires to add $LANG{'quarantine'} to strings.pl files.

Another (better but not fully tested) idea would be to you a css property, I am not however sure if all supported browser can deal with this (I do not even know which browsers are supported!):
diff --git a/webui/cgi-bin/dspam.cgi b/webui/cgi-bin/dspam.cgi
index 3d2a3c3..101be8b 100755
--- a/webui/cgi-bin/dspam.cgi
+++ b/webui/cgi-bin/dspam.cgi
@@ -760,6 +760,13 @@ _END
$DATA{"OPTION"} = "";
}

+ # Check wether the quarantine tab should be displayed
+ if ( ($PREFS{"spamAction"} ne "quarantine") && ($DATA{'TOTAL_QUARANTINED_MESSAGES'} == $LANG{'empty'}) ) {
+ $DATA{'NAV_QUARANTINE'} = qq!style="display: none"!;
+ } else {
+ $DATA{'NAV_QUARANTINE'} = "";
+ }
+
&output(%DATA);
}

diff --git a/webui/cgi-bin/templates/nav_performance.html b/webui/cgi-bin/templates/nav_performance.html
index de1b0e0..9ae325e 100644
--- a/webui/cgi-bin/templates/nav_performance.html
+++ b/webui/cgi-bin/templates/nav_performance.html
@@ -20,7 +20,7 @@
<li id="active"><a id="current" href="$CGI$?$USER$template=performance">Performance</a></li>
<li><a href="$CGI$?$USER$template=preferences">Preferences</a></li>
<li><a href="$CGI$?$USER$template=alerts">Alerts</a></li>
- <li><a href="$CGI$?$USER$template=quarantine">Quarantine ($TOTAL_QUARANTINED_MESSAGES$)</a></li>
+ <li $NAV_QUARANTINE$><a href="$CGI$?$USER$template=quarantine">Quarantine ($TOTAL_QUARANTINED_MESSAGES$)</a></li>
<li><a href="$CGI$?$USER$template=analysis">Analysis</a></li>
<li><a href="$CGI$?$USER$template=history&history_page=1">History</a></li>
$NAV_ADMIN$

Cheers,
Julien

Discussion

  • Julien Valroff

    Julien Valroff - 2009-08-29
     
  • Julien Valroff

    Julien Valroff - 2009-08-29
     
  • Julien Valroff

    Julien Valroff - 2009-08-29

    Sorry, the diff's aren't displayed correctly, I have attached them instead.

     

Log in to post a comment.