diff options
| author | fukachan <fukachan> | 2001-03-24 13:57:16 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-03-24 13:57:16 +0000 |
| commit | 9b755f0af01dcb4237ca73791b4a22920088ad18 (patch) | |
| tree | 9f25da6921153f45bda022f05a47bfe3029b67fc | |
| parent | 6641fff181e6dcb3c919b4b7f01ec6bab25655b2 (diff) | |
| download | fml8-9b755f0af01dcb4237ca73791b4a22920088ad18.tar.gz fml8-9b755f0af01dcb4237ca73791b4a22920088ad18.tar.bz2 fml8-9b755f0af01dcb4237ca73791b4a22920088ad18.zip | |
modified to make makefml.cgi work.
XXX we should pass arguments in $args hash not @argv itself useful for
XXX several programs with difference IO interface.
| -rw-r--r-- | fml/lib/FML/CGI/Configure.pm | 87 | ||||
| -rw-r--r-- | fml/lib/FML/Command/subscribe.pm | 2 | ||||
| -rw-r--r-- | fml/lib/FML/Command/unsubscribe.pm | 2 | ||||
| -rw-r--r-- | fml/lib/FML/Process/CGI.pm | 54 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Kernel.pm | 2 |
5 files changed, 140 insertions, 7 deletions
diff --git a/fml/lib/FML/CGI/Configure.pm b/fml/lib/FML/CGI/Configure.pm new file mode 100644 index 00000000..0924985e --- /dev/null +++ b/fml/lib/FML/CGI/Configure.pm @@ -0,0 +1,87 @@ +#-*- perl -*- +# +# Copyright (C) 2001 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $Id$ +# $FML$ +# + +package FML::CGI::Configure; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use CGI qw/:standard/; # load standard CGI routines + +use FML::Process::CGI; +@ISA = qw(FML::Process::CGI); + + +=head1 NAME + +FML::CGI::Configure - CGI details to control ticket system + +=head1 SYNOPSIS + + $ticket = new FML::CGI::Configure; + $ticket->new(); + $ticket->run(); + +See L<FML::Process::Flow> for flow methods details. + +=head1 DESCRIPTION + +C<NOT YET IMPLEMENTED>. + +=head2 CLASS HIERARCHY + +C<FML::CGI::Configure> is a subclass of C<FML::Process::CGI>. + + FML::Process::Kernel + | + A + FML::Process::CGI + | + A + ----------------------- + | | + A A + FML::CGI::Configure + +=head1 METHODS + +Almost methods common for CGI or HTML are forwarded to +C<FML::Process::CGI> base class. + +This module has routines needed for CGI. +But ticket model specific routines exist within C<FML::Ticket::Model>. + +=head1 SEE ALSO + +L<CGI>, +L<FML::Process::CGI> +and +L<FML::Process::Flow> + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2001 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::CGI::Configure appeared in fml5 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/subscribe.pm b/fml/lib/FML/Command/subscribe.pm index adf2ea72..83aaf8d2 100644 --- a/fml/lib/FML/Command/subscribe.pm +++ b/fml/lib/FML/Command/subscribe.pm @@ -35,7 +35,7 @@ sub subscribe my $member_map = $config->{ primary_member_map }; my $recipient_map = $config->{ primary_recipient_map }; my $options = $args->{ options }; - my $address = $options->[ 0 ]; + my $address = $args->{ address } || $options->[ 0 ]; # fundamental check croak("\$member_map is not specified") unless $member_map; diff --git a/fml/lib/FML/Command/unsubscribe.pm b/fml/lib/FML/Command/unsubscribe.pm index 6fd6c0c7..717e7612 100644 --- a/fml/lib/FML/Command/unsubscribe.pm +++ b/fml/lib/FML/Command/unsubscribe.pm @@ -33,7 +33,7 @@ sub unsubscribe my $member_map = $config->{ primary_member_map }; my $recipient_map = $config->{ primary_recipient_map }; my $options = $args->{ options }; - my $address = $options->[ 0 ]; + my $address = $args->{ address } || $options->[ 0 ]; # fundamental check croak("\$member_map is not specified") unless $member_map; diff --git a/fml/lib/FML/Process/CGI.pm b/fml/lib/FML/Process/CGI.pm index 5773b0c9..d4744ad2 100644 --- a/fml/lib/FML/Process/CGI.pm +++ b/fml/lib/FML/Process/CGI.pm @@ -107,12 +107,58 @@ sub run { my ($curproc, $args) = @_; my $config = $curproc->{ config }; + my $myname = $config->{ program_name }; # model specific ticket object - my $module = 'FML::Ticket::Model::'.$config->{ ticket_model }; - my $ticket = $curproc->load_module($args, $module); - $ticket->mode({ mode => 'html' }); - $ticket->run_cgi($curproc, $args); + if ($myname eq 'fmlticket.cgi') { + my $module = 'FML::Ticket::Model::'.$config->{ ticket_model }; + my $ticket = $curproc->load_module($args, $module); + $ticket->mode({ mode => 'html' }); + $ticket->run_cgi($curproc, $args); + } + elsif ($myname eq 'makefml.cgi') { + $curproc->_makefml($args); + } + else { + croak("Who am I ($myname)? I don't know $myname\n"); + } +} + + +sub _makefml +{ + my ($curproc, $args) = @_; + my $method = param('method'); + my $ml_name = param('ml_name'); + my $address = param('address') || ''; + my $argv = $args->{ ARGV } || ''; + my @options = (); + + # arguments to pass off to each method + my $optargs = { + command => $method, + ml_name => $ml_name, + address => $address, + options => \@options, + argv => $argv, + args => $args, + }; + + Log("makefml.cgi ml_name=$ml_name command=$method address=$address"); + + # here we go + $curproc->lock() if $curproc->_makefml_require_lock($method); + require FML::Command; + my $obj = new FML::Command; + $obj->$method($curproc, $optargs); + $curproc->unlock() if $curproc->_makefml_require_lock($method); +} + + +sub _makefml_require_lock +{ + my ($self, $command) = @_; + $command eq 'newml' ? 0 : 1; } diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm index 7400fd31..83a03eaa 100644 --- a/fml/lib/FML/Process/Kernel.pm +++ b/fml/lib/FML/Process/Kernel.pm @@ -72,7 +72,7 @@ sub new my ($cfargs) = {}; # import variables - my (@import_vars) = qw(ml_home_prefix ml_home_dir); + my (@import_vars) = qw(ml_home_prefix ml_home_dir program_name); my $var; IMPORT_CHECK: |
