--- loncom/interface/lonannounce.pm 2003/05/21 20:10:53 1.11 +++ loncom/interface/lonannounce.pm 2003/06/18 15:11:20 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network # Announce # -# $Id: lonannounce.pm,v 1.11 2003/05/21 20:10:53 www Exp $ +# $Id: lonannounce.pm,v 1.14 2003/06/18 15:11:20 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +33,8 @@ use Apache::Constants qw(:common); use Apache::loncommon; use Apache::lonhtmlcommon(); +my %todayhash; + sub editfield { my ($r,$start,$end,$text)=@_; # Deal with date forms @@ -72,7 +74,7 @@ sub emptycell { } sub normalcell { - my ($day,$text)=@_; + my ($day,$month,$year,$text)=@_; my $output=''; foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) { if ($_) { @@ -90,7 +92,11 @@ sub normalcell { substr($msg,0,20).'...
'; } } - return ''.$day.'
'.$output.''; + return ''.$day.'
'.$output.''; } sub plaincell { @@ -144,7 +150,8 @@ sub showday { } } unless ($mode) { - return ($nextday,$nextmonth,&normalcell($th{'day'},$outp)); + return ($nextday,$nextmonth,&normalcell( + $th{'day'},$th{'month'},$th{'year'},$outp)); } elsif ($outp) { if ($mode==1) { return '
'.&plaincell($outp); @@ -164,7 +171,7 @@ sub handler { # ---------------------------------------------------------- Get time right now my $today=time; - my %todayhash=&Apache::loncommon::timehash($today); + %todayhash=&Apache::loncommon::timehash($today); # ---------------------------------------------------------- Get month and year &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, @@ -256,11 +263,22 @@ ENDDOCUMENT my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year); if ($pm<1) { ($pm,$py)=(12,$year-1); } if ($fm>12){ ($fm,$fy)=(1,$year+1); } + $r->print('

'.('','January','February','March','April','May', 'June','July','August','September','October', - 'November','December')[$month].' '.$year.'

'. + 'November','December')[$month].' '.$year.''); +# Reached the end of times, give up + if (($year<1970) || ($year>2037)) { + $r->print('

No calendar available for this date.

'. + 'Current Month'); + return OK; + } + $r->print( 'Previous Month '. - 'Next Month

'. + 'Next Month'. + '   Current Month

'. ''. ''); @@ -291,7 +309,9 @@ ENDDOCUMENT if ($allowed) { $r->print(''); } $r->print('

'. 'Previous Month '. - 'Next Month

'. + 'Next Month'. + '   Current Month

'. ''); return OK; }
SunMonTueWedThuFriSat