--- loncom/interface/lonannounce.pm 2002/08/09 20:39:13 1.5 +++ loncom/interface/lonannounce.pm 2003/05/21 16:26:46 1.9 @@ -1,7 +1,7 @@ # The LearningOnline Network # Announce # -# $Id: lonannounce.pm,v 1.5 2002/08/09 20:39:13 www Exp $ +# $Id: lonannounce.pm,v 1.9 2003/05/21 16:26:46 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,6 +31,7 @@ package Apache::lonannounce; use strict; use Apache::Constants qw(:common); use Apache::loncommon; +use Apache::lonhtmlcommon(); sub readcalendar { my $courseid=shift; @@ -120,51 +121,14 @@ sub handler { 'dlsav' => $todayhash{'dlsav'} )); my $weekday=$firstday{'weekday'}; # ------------------------------------------------------------ Print the screen + $r->print(< The LearningOnline Network with CAPA - -

Announcements

ENDDOCUMENT - + $r->print(&Apache::loncommon::bodytag("Announcements and Calendar")); # does this user have privileges to post, etc? my $allowed=0; if ($ENV{'request.course.id'}) { @@ -190,8 +152,19 @@ ENDDOCUMENT my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; # ----------------------------------------------------- Store new submitted one if ($ENV{'form.action'} eq 'new') { + my $startdate = + &Apache::lonhtmlcommon::get_date_from_form('startdate'); + my $enddate = + &Apache::lonhtmlcommon::get_date_from_form('enddate'); + unless ($startdate=~/^\d+$/) { $startdate=time; } + unless ($enddate=~/^\d+$/) { $enddate=$startdate+1; } + if ($startdate>$enddate) { + my $buffer=$startdate; + $startdate=$enddate; + $enddate=$buffer; + } &Apache::lonnet::put('calendar',{ - $ENV{'form.startdate'}.'_'.$ENV{'form.enddate'} => + $startdate.'_'.$enddate => $ENV{'form.msg'} },$coursedom,$coursenum); } # ---------------------------------------------------------------- Remove items @@ -209,24 +182,23 @@ ENDDOCUMENT $tomorrowhash{'day'}++; my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash); + # Deal with date forms + my $startdateform = &Apache::lonhtmlcommon::date_setter('anno', + 'startdate', + $today); + my $enddateform = &Apache::lonhtmlcommon::date_setter('anno', + 'enddate', + $tomorrow); + # + $r->print(< - - - - - -Set Starting Date -Set Ending Date

+ +
Starting date:$startdateform
Ending date:$enddateform


-
ENDFORM } # ----------------------------------------------------- Summarize all calendars @@ -245,7 +217,7 @@ ENDFORM 'Previous Month '. 'Next Month

'. ''. - ''); + ''); my $tk=&Apache::loncommon::maketime(%firstday); my $outp; @@ -270,8 +242,9 @@ ENDFORM $r->print(''); } # ------------------------------------------------------------------- End table - if ($allowed) { $r->print(''); } - $r->print('
SunMonTueWedThuFriSatTueWedThuFriSat

'. + $r->print(''); + if ($allowed) { $r->print(''); } + $r->print('

'. 'Previous Month '. 'Next Month

'. '');