summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-03-18 15:21:31 +0000
committerfukachan <fukachan>2002-03-18 15:21:31 +0000
commit7f995250e8aeba35457875b845eb04531e4763f2 (patch)
treeae729f38260e949684f35e4d718cb4a6d9f2b278 /fml/lib
parent8d5c92e16a50b02f1ab3360b4098855283b9a0d2 (diff)
downloadfml8-7f995250e8aeba35457875b845eb04531e4763f2.tar.gz
fml8-7f995250e8aeba35457875b845eb04531e4763f2.tar.bz2
fml8-7f995250e8aeba35457875b845eb04531e4763f2.zip
cosmetics
FNF define cgi_execute_command() and try_get_address() into FML::Process::CGI::Kernel and remove them from FML::CGI::Admin::Menu
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/CGI/Admin/Menu.pm91
-rw-r--r--fml/lib/FML/Process/CGI/Kernel.pm83
2 files changed, 97 insertions, 77 deletions
diff --git a/fml/lib/FML/CGI/Admin/Menu.pm b/fml/lib/FML/CGI/Admin/Menu.pm
index fb4289b8..117eb909 100644
--- a/fml/lib/FML/CGI/Admin/Menu.pm
+++ b/fml/lib/FML/CGI/Admin/Menu.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: Menu.pm,v 1.2 2002/03/18 14:07:38 fukachan Exp $
+# $FML: Menu.pm,v 1.3 2002/03/18 14:19:41 fukachan Exp $
#
package FML::CGI::Admin::Menu;
@@ -68,16 +68,18 @@ This module has routines needed for CGI.
sub html_start
{
my ($curproc, $args) = @_;
+ my $config = $curproc->{ config };
my $myname = $curproc->myname();
+ my $domain = $curproc->ml_domain();
my $ml_name = $curproc->safe_param_ml_name();
- my $title = "$ml_name configuration interface";
- my $color = '#FFFFFF';
- my $charset = 'euc-jp';
-
+ my $title = "${ml_name}\@${domain} configuration interface";
+ my $color = $config->{ cgi_main_menu_color } || '#FFFFFF';
+ my $charset = $config->{ cgi_charset } || 'euc-jp';
+
# o.k start html
- print start_html(-title=>$title,
- -lang => $charset,
- -BGCOLOR=>$color);
+ print start_html(-title => $title,
+ -lang => $charset,
+ -BGCOLOR => $color);
print "\n";
}
@@ -96,37 +98,6 @@ sub html_end
}
-sub _try_get_address
-{
- my ($curproc, $args) = @_;
- my $address = '';
- my $a = '';
-
- eval q{ $a = $curproc->safe_param_address_specified();};
- unless ($@) {
- $address = $a;
- }
- else {
- # XXX longjmp() if insecure input is given.
- my $r = $@;
- if ($r =~ /ERROR\.INSECURE/) { croak($r);}
-
- eval q{ $a = $curproc->safe_param_address_selected();};
- unless ($@) {
- $address = $a;
- }
- else {
- # XXX longjmp() if insecure input is given.
- my $r = $@;
- if ($r =~ /ERROR\.INSECURE/) { croak($r);}
- }
- }
-
- return $address;
-}
-
-
-
# Descriptions: show help
# Arguments: OBJ($curproc) HASH_REF($args)
# Side Effects: none
@@ -134,7 +105,7 @@ sub _try_get_address
sub run_cgi_help
{
my ($curproc, $args) = @_;
- my $domain = $curproc->default_domain();
+ my $domain = $curproc->ml_domain();
print "<B>\n";
print "fml CGI interface for \@$domain ML's\n";
@@ -143,7 +114,8 @@ sub run_cgi_help
# Descriptions: main routine for makefml.cgi.
-# kick off suitable FML::Command finally via _execulte_command().
+# kick off suitable FML::Command finally
+# via cgi_execulte_command().
# Arguments: OBJ($curproc) HASH_REF($args)
# Side Effects: none
# Return Value: none
@@ -151,7 +123,7 @@ sub run_cgi_main
{
my ($curproc, $args) = @_;
my $command = $curproc->safe_param_command() || '';
- my $address = $curproc->_try_get_address($args);
+ my $address = $curproc->try_get_address($args);
if ($command && $address) {
my $ml_name = $curproc->safe_param_ml_name();
@@ -164,7 +136,7 @@ sub run_cgi_main
argv => undef,
args => undef,
};
- $curproc->_execute_command($args, $command_args);
+ $curproc->cgi_execute_command($args, $command_args);
print hr;
$curproc->_show_menu($args);
@@ -182,39 +154,6 @@ sub run_cgi_main
}
-# Descriptions: execute FML::Command
-# Arguments: OBJ($curproc) HASH_REF($args) HASH_REF($command_args)
-# Side Effects: load module
-# Return Value: none
-sub _execute_command
-{
- my ($curproc, $args, $command_args) = @_;
-
- use FML::Command;
- my $obj = new FML::Command;
- if (defined $obj) {
- my $comname = $command_args->{ comname };
- eval q{
- $obj->$comname($curproc, $command_args);
- };
- unless ($@) {
- print "OK! $comname succeed.\n";
- }
- else {
- print "Error! $comname fails.\n<BR>\n";
- if ($@ =~ /^(.*)\s+at\s+/) {
- my $reason = $@;
- print "<BR>\n";
- print $1;
- print "<BR>\n";
- print $reason;
- print "<BR>\n";
- }
- }
- }
-}
-
-
# Descriptions: show menu
# Arguments: OBJ($curproc) HASH_REF($args)
# Side Effects: none
diff --git a/fml/lib/FML/Process/CGI/Kernel.pm b/fml/lib/FML/Process/CGI/Kernel.pm
index 6dcd07dc..1ac6e6e1 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.15 2002/02/02 15:24:19 fukachan Exp $
+# $FML: Kernel.pm,v 1.16 2002/03/18 13:52:20 fukachan Exp $
#
package FML::Process::CGI::Kernel;
@@ -311,6 +311,87 @@ sub get_recipient_list
}
+=head2 cgi_execute_command($args, $command_args)
+
+execute specified command given as FML::Command::*
+
+=cut
+
+
+# Descriptions: execute FML::Command
+# Arguments: OBJ($curproc) HASH_REF($args) HASH_REF($command_args)
+# Side Effects: load module
+# Return Value: none
+sub cgi_execute_command
+{
+ my ($curproc, $args, $command_args) = @_;
+
+ use FML::Command;
+ my $obj = new FML::Command;
+ if (defined $obj) {
+ my $comname = $command_args->{ comname };
+ eval q{
+ $obj->$comname($curproc, $command_args);
+ };
+ unless ($@) {
+ print "OK! $comname succeed.\n";
+ }
+ else {
+ print "Error! $comname fails.\n<BR>\n";
+ if ($@ =~ /^(.*)\s+at\s+/) {
+ my $reason = $@;
+ print "<BR>\n";
+ print $1;
+ print "<BR>\n";
+ print $reason;
+ print "<BR>\n";
+ }
+ }
+ }
+}
+
+
+=head2 try_get_address()
+
+return input address after validating the input
+
+=cut
+
+
+# Descriptions: return input address after validating the input
+# Arguments: OBJ($curproc) HASH_REF($args)
+# Side Effects: longjmp() if critical error occurs.
+# Return Value: STR
+sub try_get_address
+{
+ my ($curproc, $args) = @_;
+ my $address = '';
+ my $a = '';
+
+ eval q{ $a = $curproc->safe_param_address_specified();};
+ unless ($@) {
+ $address = $a;
+ }
+ else {
+ # XXX longjmp() if insecure input is given.
+ my $r = $@;
+ if ($r =~ /ERROR\.INSECURE/) { croak($r);}
+
+ eval q{ $a = $curproc->safe_param_address_selected();};
+ unless ($@) {
+ $address = $a;
+ }
+ else {
+ # XXX longjmp() if insecure input is given.
+ my $r = $@;
+ if ($r =~ /ERROR\.INSECURE/) { croak($r);}
+ }
+ }
+
+ return $address;
+}
+
+
=head2 safe_param_xxx()
get and filter param('xxx') via AUTOLOAD().