#!/usr/local/bin/perl
# index.cgi
# Display all mailing lists and majordomo options
require './majordomo-lib.pl';
%access = &get_module_acl();
$conf = &get_config();
eval { require "$config{'program_dir'}/majordomo_version.pl"; };
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
&mdom_help(),
undef, undef, &text('index_version', $majordomo_version));
&check_mdom_config($conf);
# Check for the majordomo aliases
$aliases_files = &get_aliases_file();
$email = &find_value("whoami", $conf); $email =~ s/\@.*$//g;
$owner = &find_value("whoami_owner", $conf); $owner =~ s/\@.*$//g;
@aliases = &foreign_call($aliases_module, "list_aliases", $aliases_files);
foreach $a (@aliases) {
if ($a->{'enabled'} && lc($a->{'name'}) eq lc($email)) {
$majordomo_alias = 1;
}
if ($a->{'enabled'} && lc($a->{'name'}) eq lc($owner)) {
$majordomo_owner = 1;
}
}
# Offer to setup aliases
if (!$majordomo_alias) {
print "
$text{'index_setupdesc'}\n";
print "
\n";
print &ui_hr();
}
# Display active lists
@lists = &list_lists($conf);
@lists = sort { $a cmp $b } @lists if ($config{'sort_mode'});
map { $lcan{$_}++ } split(/\s+/, $access{'lists'});
# top links
local $otherbut, $bcss=' style="display: box; float: left; padding: 10px;"';
if ($access{'create'}) {
print "\n";
print "\n";
print ""
}
if (@lists) {
# table header
local @hcols, @tds;
push(@hcols, $text{'index_name'}, $text{'index_info'}, $text{'index_mail'}, $text{'index_moderated'}, $text{'index_count'});
push(@tds, "width=5" ,"width=100" );
push(@tds, "", "", "width=100", "", "");
print &ui_columns_start(\@hcols, 100, 0, \@tds);
# mailing lists
foreach $l (grep { $lcan{$_} || $lcan{"*"} } @lists) {
local @cols,@list,@conf;
$list = &get_list( $l , &get_config());
$conf = &get_list_config($list->{'config'});
push(@cols, "
".
&html_escape(ucfirst($l)) ."" );
open(INFO, $list->{'info'});
local $info=;
$info= if ( $info =~ !/^\[Last updated on:/);
push(@cols, "".$info."" ." edit");
close(INFO);
local $m=&find_value('reply_to', $conf);
push(@cols, "$m".
" edit");
push(@cols, "". $text{&find_value('moderate', $conf)} .
"" ." edit");
push(@cols, "".`cat $list->{'members'} | wc -l` .
" edit");
print&ui_columns_row(\@cols, \@tds);
}
} else {
print "$text{'index_none'}.\n";
}
if ($access{'global'}) {
print "
\n";
print "$text{'index_globaldesc'}
\n";
}
&ui_print_footer("/", $text{'index'});
print "",
"";