diff options
| author | fukachan <fukachan> | 2003-11-26 09:19:10 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-11-26 09:19:10 +0000 |
| commit | 4fe7894867fa88101aa721afab21da1b873cc36a (patch) | |
| tree | 9b35244b3adf3d477f3449003b0839f4e70af095 /fml/lib/FML/Command | |
| parent | 0c885956b2f245a05c2a7d1a1d4abaada05ba4d7 (diff) | |
| download | fml8-4fe7894867fa88101aa721afab21da1b873cc36a.tar.gz fml8-4fe7894867fa88101aa721afab21da1b873cc36a.tar.bz2 fml8-4fe7894867fa88101aa721afab21da1b873cc36a.zip | |
try to list up arbitorary map if could.
FML::User::Control::{userlist -> print_userlist}
Diffstat (limited to 'fml/lib/FML/Command')
| -rw-r--r-- | fml/lib/FML/Command/Admin/list.pm | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/fml/lib/FML/Command/Admin/list.pm b/fml/lib/FML/Command/Admin/list.pm index 4754cdbd..3836cc2a 100644 --- a/fml/lib/FML/Command/Admin/list.pm +++ b/fml/lib/FML/Command/Admin/list.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: list.pm,v 1.17 2003/09/27 03:00:16 fukachan Exp $ +# $FML: list.pm,v 1.18 2003/11/23 03:54:45 fukachan Exp $ # package FML::Command::Admin::list; @@ -79,20 +79,19 @@ sub _show_list { my ($self, $curproc, $command_args, $options) = @_; my $config = $curproc->config(); - my $maplist = undef; + my $maplist = $config->get_as_array_ref( 'recipient_maps' ); # default + # XXX first match is ok ? + ARGV: for my $option (@$options) { - if ($option =~ /^recipient|active/i) { - $maplist = $config->get_as_array_ref( 'recipient_maps' ); - } - elsif ($option =~ /^member/i) { - $maplist = $config->get_as_array_ref( 'member_maps' ); - } - elsif ($option =~ /^adminmember|^admin_member/i) { - $maplist = $config->get_as_array_ref( 'admin_member_maps' ); - } - else { - $curproc->logwarn("list: unknown type $option"); + my $list = $self->_gen_key_list($option); + + KEY: + for my $key (@$list) { + if (defined $config->{ $key } && $config->{ $key }) { + $maplist = $config->get_as_array_ref( $key ); + last ARGV; + } } } @@ -111,7 +110,7 @@ sub _show_list eval q{ use FML::User::Control; my $obj = new FML::User::Control; - $obj->userlist($curproc, $command_args, $uc_args); + $obj->print_userlist($curproc, $command_args, $uc_args); }; if ($r = $@) { croak($r); @@ -119,6 +118,25 @@ sub _show_list } +# Descriptions: generate keyword list +# Arguments: OBJ($self) STR($key) +# Side Effects: none +# Return Value: ARRAY_REF +sub _gen_key_list +{ + my ($self, $key) = @_; + my (@list) = (sprintf("%s_maps", $key), + sprintf("primary_%s_map", $key), + sprintf("fml_%s_maps", $key)); + + if ($key =~ /maps$/ || $key =~ /^primary_\S+_map$/) { + unshift(@list, $key); + } + + return \@list; +} + + # Descriptions: show cgi menu. # Arguments: OBJ($self) # OBJ($curproc) HASH_REF($args) HASH_REF($command_args) |
