[Mailman-Users] Displaying # of msgs in the archive TOC

Sean Adams sadams at slimdevices.com
Wed Jul 9 01:05:33 CEST 2003


Here's an utterly filthy perl hack to go back and put the numbers in  
after the archives are generated:
Don't have time to learn python right now. :)

Just put [n_%(archive)s] in the archtocentry.html template where you  
want it to appear, then call this script at the end of bin/arch.

#!/usr/bin/perl

$base = "/YOUR_MAILMAN_BASE_DIR/archives/public";

$v=1;

opendir BASEDIR, $base;
foreach $list (sort(readdir(BASEDIR))) {
         $list=~/^\./ && next;
         -d"$base/$list" || next;
         $list=~/\.mbox$/ && next;

         $v && print "$list\n";
         %n=();
         opendir LISTDIR, "$base/$list";
         foreach $month (sort(readdir(LISTDIR))) {
                 $month=~/^\d+\-\w+$/ || next;

                 open MONTHINDEX, "$base/$list/$month/date.html";
                 while ($line=<MONTHINDEX>) {
                         if ($line=~/<b>Messages:<\/b>\s*(\d+)<p>/) {
                                 $n{$month}=$1;
                                 break;
                         }
                 }

                 $v && print "\t$month\t$n{$month}\n";

         }

         open TOC, "$base/$list/index.html";
         $toc=join('',<TOC>);
         foreach $month (keys(%n)) {
                 $toc=~s/\[n_$month\]/$n{$month}/g;
         }
         open TOC, ">$base/$list/index.html";
         print TOC $toc;
}




On Tuesday, July 8, 2003, at 01:44 PM, Sean Adams wrote:

>
> I'm setting up a new mailman server, and I thought a nice touch would  
> be to show the number of messages for each month in the archive index.
>
> I see that there is a %(size)s template variable when viewing the  
> index, but it does not apply in the TOC. Can anyone suggest a quick  
> hack for a non-python-speaker who's new to this code?
>
> thanks,
> Sean
>
>
> ------------------------------------------------------
> Mailman-Users mailing list
> Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users
> Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
> Searchable Archives:  
> http://www.mail-archive.com/mailman-users%40python.org/
>
> This message was sent to: sadams at slimdevices.com
> Unsubscribe or change your options at
> http://mail.python.org/mailman/options/mailman-users/ 
> sadams%40slimdevices.com
>





More information about the Mailman-Users mailing list