Le mercredi 26 août 2009 à 19:08 +0200, Steve a écrit :
> -------- Original-Nachricht --------
> > Datum: Wed, 26 Aug 2009 17:59:24 +0200
> > Von: "Glenn Remstedt" <gl...@remstedt.org>
> > An: dspam-u...@lists.sourceforge.net
> > Betreff: [Dspam-user] WebUI :: Quarantine tab
> 
> > what do i need to config/deconfig for to have the qarantine-tab to not
> > always disply 'Quarantine (Empty)' - i've not ever seen any msg. in there?
> > 
> How about enabling quarantine? It's all in the documentation of DSPAM. 
> Nothing ultra fancy.

I think Glenn's idea is to hide the quarantine tab in case the user does
not use the quarantine feature.

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$

I would personally go for this... what do you think?
I can provide the whole patch if needed.

Cheers,
Julien


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to