summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Process
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-09-25 11:40:57 +0000
committerfukachan <fukachan>2003-09-25 11:40:57 +0000
commit2d3e485d03bbc3d5ba82871b487a8b4d964041ce (patch)
treee3aa875a61f0b434e798b2fa604e5242c7058644 /fml/lib/FML/Process
parent267560f658d60a5670f8221a7b6f10ff70052abd (diff)
downloadfml8-2d3e485d03bbc3d5ba82871b487a8b4d964041ce.tar.gz
fml8-2d3e485d03bbc3d5ba82871b487a8b4d964041ce.tar.bz2
fml8-2d3e485d03bbc3d5ba82871b487a8b4d964041ce.zip
change *::CGI:: class architecture.
FML::CGI::*Admin::Menu inherits FML::CGI::Menu. methods in FML::Process::CGI::* returns the value by checking the current cgi mode (admin or ml-admin).
Diffstat (limited to 'fml/lib/FML/Process')
-rw-r--r--fml/lib/FML/Process/CGI/Kernel.pm23
-rw-r--r--fml/lib/FML/Process/CGI/Utils.pm149
2 files changed, 161 insertions, 11 deletions
diff --git a/fml/lib/FML/Process/CGI/Kernel.pm b/fml/lib/FML/Process/CGI/Kernel.pm
index 016a771c..2e8a1434 100644
--- a/fml/lib/FML/Process/CGI/Kernel.pm
+++ b/fml/lib/FML/Process/CGI/Kernel.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: Kernel.pm,v 1.52 2003/08/29 15:34:09 fukachan Exp $
+# $FML: Kernel.pm,v 1.53 2003/09/13 09:08:12 fukachan Exp $
#
package FML::Process::CGI::Kernel;
@@ -18,7 +18,8 @@ use CGI qw/:standard/;
use FML::Log qw(Log LogWarn LogError);
use FML::Process::Kernel;
-@ISA = qw(FML::Process::Kernel);
+use FML::Process::CGI::Utils;
+@ISA = qw(FML::Process::CGI::Utils FML::Process::Kernel);
=head1 NAME
@@ -402,9 +403,9 @@ show title.
sub run_cgi_title
{
my ($curproc, $args) = @_;
- my $myname = $curproc->myname();
- my $domain = $curproc->ml_domain();
- my $ml_name = $curproc->safe_param_ml_name();
+ my $myname = $curproc->cgi_var_myname();
+ my $domain = $curproc->cgi_var_ml_domain();
+ my $ml_name = $curproc->cgi_var_ml_name();
my $role = '';
my $title = '';
@@ -429,7 +430,7 @@ help.
sub run_cgi_help
{
my ($curproc, $args) = @_;
- my $domain = $curproc->ml_domain();
+ my $domain = $curproc->cgi_var_ml_domain();
print "<B>\n";
print "<CENTER>fml CGI interface for \@$domain ML's</CENTER><BR>\n";
@@ -544,7 +545,7 @@ show options.
sub run_cgi_options
{
my ($curproc, $args) = @_;
- my $domain = $curproc->ml_domain();
+ my $domain = $curproc->cgi_var_ml_domain();
my $action = $curproc->safe_cgi_action_name();
print "<P> <B> options </B>\n";
@@ -616,12 +617,12 @@ return input address after validating the input
# Descriptions: return input address after validating the input
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc)
# Side Effects: longjmp() if critical error occurs.
# Return Value: STR
sub cgi_try_get_address
{
- my ($curproc, $args) = @_;
+ my ($curproc) = @_;
my $address = '';
my $a = '';
@@ -669,12 +670,12 @@ return input address after validating the input
# Descriptions: return input ml_name after validating the input
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc)
# Side Effects: longjmp() if critical error occurs.
# Return Value: STR
sub cgi_try_get_ml_name
{
- my ($curproc, $args) = @_;
+ my ($curproc) = @_;
my $ml_name = '';
my $a = '';
diff --git a/fml/lib/FML/Process/CGI/Utils.pm b/fml/lib/FML/Process/CGI/Utils.pm
new file mode 100644
index 00000000..0b4ade00
--- /dev/null
+++ b/fml/lib/FML/Process/CGI/Utils.pm
@@ -0,0 +1,149 @@
+#-*- perl -*-
+#
+# Copyright (C) 2003 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.
+#
+# $FML: Utils.pm,v 1.21 2003/08/25 14:13:59 fukachan Exp $
+#
+
+package FML::Process::CGI::Utils;
+use strict;
+use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
+use Carp;
+
+=head1 NAME
+
+FML::Process::CGI::Utils - utility for FML::Process::CGI::Kernel
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=cut
+
+
+# Descriptions: return $ml_name, which varies with the cgi_mode.
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: STR
+sub cgi_var_ml_name
+{
+ my ($curproc) = @_;
+ my $cgi_mode = $curproc->cgi_var_cgi_mode();
+
+ if ($cgi_mode eq 'admin') {
+ return $curproc->cgi_try_get_ml_name();
+ }
+ else {
+ my $hints = $curproc->hints();
+ return $hints->{ ml_name };
+ }
+}
+
+
+# Descriptions: return $ml_domain defined in *.cgi programd .
+# ml_domain is hard-coded, not dependent on cgi_var_cgi_mode.
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: STR
+sub cgi_var_ml_domain
+{
+ my ($curproc) = @_;
+ my $hints = $curproc->hints();
+ return $hints->{ ml_domain };
+}
+
+
+# Descriptions: return $ml_home_prefix defined in *.cgi program.
+# ml_home_prefix is determined by ml_domain,
+# which is hard-coded, not dependent on cgi_var_cgi_mode.
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: STR
+sub cgi_var_ml_home_prefix
+{
+ my ($curproc) = @_;
+ my $ml_domain = $curproc->cgi_var_ml_domain();
+ return $curproc->ml_home_prefix( $ml_domain );
+}
+
+
+sub cgi_var_ml_name_list
+{
+ my ($curproc) = @_;
+ my $cgi_mode = $curproc->cgi_var_cgi_mode();
+ my $ml_domain = $curproc->cgi_var_ml_domain();
+
+ if ($cgi_mode eq 'admin') {
+ return $curproc->get_ml_list($ml_domain);
+ }
+ else {
+ my $ml_name = $curproc->cgi_var_ml_name();
+ return [ $ml_name ];
+ }
+}
+
+
+sub cgi_var_myname
+{
+ my ($curproc) = @_;
+
+ return $curproc->myname();
+}
+
+
+sub cgi_var_available_command_list
+{
+ my ($curproc) = @_;
+ my $config = $curproc->config();
+ my $cgi_mode = $curproc->cgi_var_cgi_mode();
+
+ if ($cgi_mode eq 'admin') {
+ return $config->get_as_array_ref('commands_for_admin_cgi');
+ }
+ else {
+ return $config->get_as_array_ref('commands_for_ml_admin_cgi');
+ }
+}
+
+
+# Descriptions: return $mode, which is hard-coded in *.cgi program.
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: STR
+sub cgi_var_cgi_mode
+{
+ my ($curproc) = @_;
+ my $hints = $curproc->hints();
+
+ return $hints->{ cgi_mode };
+}
+
+
+=head1 CODING STYLE
+
+See C<http://www.fml.org/software/FNF/> on fml coding style guide.
+
+=head1 AUTHOR
+
+Ken'ichi Fukamachi
+
+=head1 COPYRIGHT
+
+Copyright (C) 2003 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::Process::CGI::Utils first appeared in fml8 mailing list driver package.
+See C<http://www.fml.org/> for more details.
+
+=cut
+
+
+1;