--- loncom/interface/lonannounce.pm 2003/05/21 20:10:53 1.11 +++ loncom/interface/lonannounce.pm 2003/06/18 20:06:29 1.15 @@ -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.15 2003/06/18 20:06:29 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,6 +32,9 @@ use strict; use Apache::Constants qw(:common); use Apache::loncommon; use Apache::lonhtmlcommon(); +use HTML::Entities(); + +my %todayhash; sub editfield { my ($r,$start,$end,$text)=@_; @@ -72,7 +75,7 @@ sub emptycell { } sub normalcell { - my ($day,$text)=@_; + my ($day,$month,$year,$text)=@_; my $output=''; foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) { if ($_) { @@ -86,11 +89,17 @@ sub normalcell { $end.'">'; } } + $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\''); + $fullmsg=~s/&/\\&/g; $output.=''. substr($msg,0,20).'...
'; } } - return ''.$day.'
'.$output.''; + return ''.$day.'
'.$output.''; } sub plaincell { @@ -102,6 +111,8 @@ sub plaincell { my $msg=join('@',@msg); my $fullmsg=$ENV{'course.'.$courseid.'.description'}. ', '.localtime($start).' - '.localtime($end).': '.$msg; + $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\''); + $fullmsg=~s/&/\\&/g; $output.=''. substr($msg,0,40).'...
'; } @@ -144,7 +155,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 +176,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 +268,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 +314,9 @@ ENDDOCUMENT if ($allowed) { $r->print(''); } $r->print('

'. 'Previous Month '. - 'Next Month

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

'. ''); return OK; }
SunMonTueWedThuFriSat