diff options
| author | fukachan <fukachan> | 2001-06-28 09:06:43 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-06-28 09:06:43 +0000 |
| commit | c9f8e684bdb41ac67be448162863a23df9507b4a (patch) | |
| tree | ff2bf674955eebea5e3c7a57745dbd9b874c55e0 /fml | |
| parent | 139e7a3593253919d59772bec63b4f262173b13c (diff) | |
| download | fml8-c9f8e684bdb41ac67be448162863a23df9507b4a.tar.gz fml8-c9f8e684bdb41ac67be448162863a23df9507b4a.tar.bz2 fml8-c9f8e684bdb41ac67be448162863a23df9507b4a.zip | |
define print_specific_month() method at TinyScheduler class.
fmlsch (fmlsch -a) and fmlsch.cgi uses this method to show
3 continuous months once.
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/FML/CGI/Scheduler.pm | 16 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Scheduler.pm | 21 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Switch.pm | 4 | ||||
| -rw-r--r-- | fml/lib/TinyScheduler.pm | 31 |
4 files changed, 60 insertions, 12 deletions
diff --git a/fml/lib/FML/CGI/Scheduler.pm b/fml/lib/FML/CGI/Scheduler.pm index 48d913d3..3d750687 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.2 2001/04/03 09:45:41 fukachan Exp $ +# $FML: Scheduler.pm,v 1.3 2001/06/17 08:57:09 fukachan Exp $ # package FML::CGI::Scheduler; @@ -67,8 +67,18 @@ sub run use TinyScheduler; my $schedule = new TinyScheduler { user => param('user') }; - $schedule->parse; - $schedule->print; + + 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); + } + + for my $n ('this', 'next', 'last') { + print "<A HREF=\"\#$n\">[$n month]</A>\n"; + } } diff --git a/fml/lib/FML/Process/Scheduler.pm b/fml/lib/FML/Process/Scheduler.pm index 8c1380f1..93340589 100644 --- a/fml/lib/FML/Process/Scheduler.pm +++ b/fml/lib/FML/Process/Scheduler.pm @@ -4,7 +4,7 @@ # Copyright (C) 2000 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Scheduler.pm,v 1.2 2001/04/03 09:45:43 fukachan Exp $ +# $FML: Scheduler.pm,v 1.3 2001/04/05 08:31:44 fukachan Exp $ # package FML::Process::Scheduler; @@ -68,16 +68,25 @@ sub prepare { ; } sub run { my ($self, $args) = @_; - + use FileHandle; use TinyScheduler; my $schedule = new TinyScheduler $args; - $schedule->parse; + my $tmp = $schedule->tmpfile; + my $fh = new FileHandle $tmp, "w"; + + # show three calender for this month, next month, last month + my $show_3_month = defined($args->{ options }->{ a }) ? 1 : 0; + if ($show_3_month) { + for my $n ('this', 'next', 'last') { + $schedule->print_specific_month($fh, $n); + } + } + else { + $schedule->print_specific_month($fh, 'this'); + } - my $tmp = $schedule->tmpfile; - my $fh = new FileHandle $tmp, "w"; - $schedule->print($fh); $fh->close; my $mode = $args->{ options }->{ m } || 'text'; diff --git a/fml/lib/FML/Process/Switch.pm b/fml/lib/FML/Process/Switch.pm index 9009aef2..d316944c 100644 --- a/fml/lib/FML/Process/Switch.pm +++ b/fml/lib/FML/Process/Switch.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: Switch.pm,v 1.18 2001/04/15 13:30:02 fukachan Exp $ +# $FML: Switch.pm,v 1.19 2001/05/28 16:17:14 fukachan Exp $ # package FML::Process::Switch; @@ -343,7 +343,7 @@ sub _module_specific_options return qw(debug!); } elsif ($myname eq 'fmlsch') { - return qw(debug! -D=s -F=s -m=s); + return qw(debug! -D=s -F=s -m=s a!); } else { croak "options for $myname are not defined.\n"; diff --git a/fml/lib/TinyScheduler.pm b/fml/lib/TinyScheduler.pm index e80be8d6..043e9e74 100644 --- a/fml/lib/TinyScheduler.pm +++ b/fml/lib/TinyScheduler.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: TinyScheduler.pm,v 1.5 2001/04/05 08:32:49 fukachan Exp $ +# $FML: TinyScheduler.pm,v 1.6 2001/06/17 08:57:10 fukachan Exp $ # package TinyScheduler; @@ -174,6 +174,14 @@ sub _parse } +=head2 C<print($fd)> + +print out the result as HTML. +You can specify the output channel by C<$fd>. + +=cut + + sub print { my ($self, $fd) = @_; @@ -182,6 +190,27 @@ sub print } +=head2 C<print_specific_month($fh, $n)> + +print range specified by C<$n>. +C<$n> is one of C<this>, C<next> and C<last>. + +=cut + +sub print_specific_month +{ + my ($self, $fh, $n) = @_; + my ($sec,$min,$hour,$mday,$month,$year,$wday) = localtime(time); + my $thismonth = $month + 1; + $thismonth++ if $n eq 'next'; + $thismonth-- if $n eq 'last'; + + print $fh "<A NAME=\"$n\">\n"; + $self->parse( { month => $thismonth } ); + $self->print($fh); +} + + if ($0 eq __FILE__) { eval q{ my %options; |
