summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-11-13 15:18:31 +0000
committerfukachan <fukachan>2001-11-13 15:18:31 +0000
commit4f3fc40f9ad4fb16ab91c1230c252e8b76757fa5 (patch)
tree51cda66e1f91a800f9e01d9f97bb655a082c8b9d
parentc184913bb1af2606dc281cb6888f4c0b96b656e1 (diff)
downloadfml8-4f3fc40f9ad4fb16ab91c1230c252e8b76757fa5.tar.gz
fml8-4f3fc40f9ad4fb16ab91c1230c252e8b76757fa5.tar.bz2
fml8-4f3fc40f9ad4fb16ab91c1230c252e8b76757fa5.zip
rewrite in new method style
-rw-r--r--fml/lib/FML/CGI/Configure.pm134
-rw-r--r--fml/lib/FML/CGI/Scheduler.pm68
2 files changed, 176 insertions, 26 deletions
diff --git a/fml/lib/FML/CGI/Configure.pm b/fml/lib/FML/CGI/Configure.pm
index bdeae252..11019ee9 100644
--- a/fml/lib/FML/CGI/Configure.pm
+++ b/fml/lib/FML/CGI/Configure.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: Configure.pm,v 1.3 2001/05/30 04:03:21 fukachan Exp $
+# $FML: Configure.pm,v 1.4 2001/11/09 03:14:57 fukachan Exp $
#
package FML::CGI::Configure;
@@ -61,13 +61,137 @@ This module has routines needed for CGI.
=cut
-sub run
+sub html_start
{
my ($curproc, $args) = @_;
- my $config = $curproc->{ config };
- my $myname = $config->{ program_name };
+ my $myname = $curproc->myname();
+ my $ml_name = $curproc->safe_param_ml_name();
+ my $title = "$ml_name configuration interface";
+ my $color = '#E6E6FA';
+ my $charset = 'euc-jp';
- print STDERR "(debug) loading $0\n";
+ # o.k start html
+ print start_html(-title=>$title,
+ -lang => $charset,
+ -BGCOLOR=>$color);
+ print "\n";
+
+ $curproc->_show_guide($args);
+
+ print "<HR>\n";
+}
+
+
+sub html_end
+{
+ my ($curproc, $args) = @_;
+
+ print "<HR>\n";
+
+ $curproc->_show_guide($args);
+
+ # o.k. end of html
+ print end_html;
+ print "\n";
+}
+
+
+sub _show_guide
+{
+ my ($curproc, $args) = @_;
+
+ ;
+}
+
+
+sub run_cgi
+{
+ my ($curproc, $args) = @_;
+ my $config = $curproc->{ config };
+ my $myname = $config->{ program_name };
+ my $command = $curproc->safe_param_command() || '';
+ my $address = $curproc->safe_param_address() || '';
+
+ print "command = $command\n<BR>\n";
+ print "address = $address\n<BR>\n";
+
+ print hr;
+ $curproc->_show_menu($args);
+
+ my $command_args = {
+ command_mode => 'admin',
+ comname => $command,
+ command => $command,
+ options => [ $address ],
+ argv => undef,
+ args => undef,
+ };
+ $curproc->_execute_command($args, $command_args);
+}
+
+
+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\n";
+ }
+ else {
+ print "$comname fails\n<BR>\n";
+ if ($@ =~ /^(.*)\s+at\s+/) {
+ print $@;
+ print "<BR>\n";
+ print $1;
+ print "<BR>\n";
+ }
+ }
+ }
+}
+
+
+sub _show_menu
+{
+ my ($curproc, $args) = @_;
+ my $action = $curproc->myname();
+ my $target = 'ResultsWindow';
+ my $ml_list = $curproc->get_ml_list($args);
+ my $address = $curproc->safe_param_address() || '';
+ my $command_list = [
+ 'subscribe',
+ 'unsubscribe',
+ ];
+
+ print start_form(-action=>$action, -target=>$target);
+
+ print "ML: ";
+ print popup_menu(-name => 'ml_name', -values => $ml_list);
+
+ print "command: ";
+ print popup_menu(-name => 'command', -values => $command_list);
+
+ print "\n<BR>\n";
+
+ print "address: ";
+ print textfield(-name => 'address',
+ -default => $address,
+ -override => 1,
+ -size => 32,
+ -maxlength => 64,
+ );
+
+ print "\n<BR>\n";
+
+ print submit(-name => 'submit');
+ print reset(-name => 'reset');
+ print end_form;
}
diff --git a/fml/lib/FML/CGI/Scheduler.pm b/fml/lib/FML/CGI/Scheduler.pm
index 026418c6..f4d448a4 100644
--- a/fml/lib/FML/CGI/Scheduler.pm
+++ b/fml/lib/FML/CGI/Scheduler.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: Scheduler.pm,v 1.4 2001/06/28 09:06:43 fukachan Exp $
+# $FML: Scheduler.pm,v 1.5 2001/11/07 14:11:46 fukachan Exp $
#
package FML::CGI::Scheduler;
@@ -20,7 +20,7 @@ use FML::Process::CGI;
=head1 NAME
-FML::CGI::Scheduler - CGI details to control ticket system
+FML::CGI::Scheduler - CGI module demo to show your schedule
=head1 SYNOPSIS
@@ -38,17 +38,6 @@ C<NOT YET IMPLEMENTED>.
C<FML::CGI::Scheduler> is a subclass of C<FML::Process::CGI>.
- FML::Process::Kernel
- |
- A
- FML::Process::CGI
- |
- A
- -----------------------
- | |
- A A
- FML::CGI::Scheduler
-
=head1 METHODS
Almost methods common for CGI or HTML are forwarded to
@@ -59,24 +48,61 @@ This module has routines needed for CGI.
=cut
-sub run
+sub html_start
{
my ($curproc, $args) = @_;
- my $user = $curproc->safe_param_user;
+ my $user = $curproc->safe_param_user;
+ my $myname = $curproc->myname();
+ my $title = "$user schedule";
+ my $color = '#E6E6FA';
+ my $charset = 'euc-jp';
+
+ # o.k start html
+ print start_html(-title=>$title,
+ -lang => $charset,
+ -BGCOLOR=>$color);
+ print "\n";
+
+ $curproc->_show_guide($args);
+
+ print "<HR>\n";
+}
+
+
+sub html_end
+{
+ my ($curproc, $args) = @_;
+
+ print "<HR>\n";
+
+ $curproc->_show_guide($args);
+
+ # o.k. end of html
+ print end_html;
+ print "\n";
+}
- use TinyScheduler;
- my $schedule = new TinyScheduler { user => $user };
+
+sub _show_guide
+{
+ my ($curproc, $args) = @_;
for my $n ('this', 'next', 'last') {
print "<A HREF=\"\#$n\">[$n month]</A>\n";
}
+}
- for my $n ('this', 'next', 'last') {
- $schedule->print_specific_month(\*STDOUT, $n);
- }
+
+sub run_cgi
+{
+ my ($curproc, $args) = @_;
+ my $user = $curproc->safe_param_user;
+
+ use TinyScheduler;
+ my $schedule = new TinyScheduler { user => $user };
for my $n ('this', 'next', 'last') {
- print "<A HREF=\"\#$n\">[$n month]</A>\n";
+ $schedule->print_specific_month(\*STDOUT, $n);
}
}