version 1.8, 2003/04/30 15:49:45
|
version 1.10, 2003/05/21 19:15:41
|
Line 33 use Apache::Constants qw(:common);
|
Line 33 use Apache::Constants qw(:common);
|
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
|
|
|
sub editfield { |
|
my ($r,$start,$end,$text)=@_; |
|
# Deal with date forms |
|
my $startdateform = &Apache::lonhtmlcommon::date_setter('anno', |
|
'startdate', |
|
$start); |
|
my $enddateform = &Apache::lonhtmlcommon::date_setter('anno', |
|
'enddate', |
|
$end); |
|
|
|
$r->print(<<ENDFORM); |
|
<form name="anno" method="post"> |
|
<input type="hidden" value='' name="action" > |
|
<table><tr><td>Starting date:</td><td>$startdateform</td></tr> |
|
<tr><td>Ending date:</td><td>$enddateform</td></tr></table> |
|
<textarea name="msg" rows="4" cols="60">$text</textarea> |
|
<input type="button" onClick="trysubmit()" value="Post Announcement"><hr> |
|
ENDFORM |
|
} |
|
|
sub readcalendar { |
sub readcalendar { |
my $courseid=shift; |
my $courseid=shift; |
my $coursenum=$ENV{'course.'.$courseid.'.num'}; |
my $coursenum=$ENV{'course.'.$courseid.'.num'}; |
Line 121 sub handler {
|
Line 141 sub handler {
|
'dlsav' => $todayhash{'dlsav'} )); |
'dlsav' => $todayhash{'dlsav'} )); |
my $weekday=$firstday{'weekday'}; |
my $weekday=$firstday{'weekday'}; |
# ------------------------------------------------------------ Print the screen |
# ------------------------------------------------------------ Print the screen |
my $pjump_function = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
|
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
<script> |
<script> |
function pclose() { |
|
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
|
"height=350,width=350,scrollbars=no,menubar=no"); |
|
parmwin.close(); |
|
} |
|
|
|
$pjump_function |
|
|
|
function dateset() { |
|
if (document.anno.pres_marker.value=='end') { |
|
document.anno.enddate.value= |
|
document.anno.pres_value.value; |
|
} |
|
if (document.anno.pres_marker.value=='start') { |
|
document.anno.startdate.value= |
|
document.anno.pres_value.value; |
|
} |
|
pclose(); |
|
} |
|
|
|
function trysubmit() { |
function trysubmit() { |
if (document.anno.startdate.value=='') { |
|
alert("Announcements must have a starting date"); |
|
return ''; |
|
} |
|
if (document.anno.enddate.value=='') { |
|
alert("Announcements must have a starting date"); |
|
return ''; |
|
} |
|
if (document.anno.startdate.value>document.anno.enddate.value) { |
|
alert("Starting date is later than ending date"); |
|
return ''; |
|
} |
|
document.anno.action.value="new"; |
document.anno.action.value="new"; |
document.anno.submit(); |
document.anno.submit(); |
} |
} |
Line 183 ENDDOCUMENT
|
Line 172 ENDDOCUMENT
|
my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
# ----------------------------------------------------- Store new submitted one |
# ----------------------------------------------------- Store new submitted one |
if ($ENV{'form.action'} eq 'new') { |
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',{ |
&Apache::lonnet::put('calendar',{ |
$ENV{'form.startdate'}.'_'.$ENV{'form.enddate'} => |
$startdate.'_'.$enddate => |
$ENV{'form.msg'} },$coursedom,$coursenum); |
$ENV{'form.msg'} },$coursedom,$coursenum); |
} |
} |
# ---------------------------------------------------------------- Remove items |
# ---------------------------------------------------------------- Remove items |
Line 202 ENDDOCUMENT
|
Line 202 ENDDOCUMENT
|
$tomorrowhash{'day'}++; |
$tomorrowhash{'day'}++; |
my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash); |
my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash); |
|
|
$r->print(<<ENDFORM); |
&editfield($r,$today,$tomorrow,''); |
<form name="anno" method="post"> |
|
<input type="hidden" value='' name="action" > |
|
<input type="hidden" value='' name="pres_value" > |
|
<input type="hidden" value='' name="pres_type" > |
|
<input type="hidden" value='' name="pres_marker" > |
|
<input type="hidden" value='$today' name="startdate" > |
|
<input type="hidden" value='$tomorrow' name="enddate" > |
|
<a |
|
href="javascript:pjump('date_start','Starting Date',document.anno.startdate.value,'start','anno.pres','dateset');" |
|
>Set Starting Date</a> |
|
<a |
|
href="javascript:pjump('date_end','Ending Date',document.anno.enddate.value,'end','anno.pres','dateset');" |
|
>Set Ending Date</a><p> |
|
<textarea name="msg" rows="4" cols="60"> |
|
</textarea> |
|
<input type="button" onClick="trysubmit()" value="Post Announcement"><hr> |
|
<input type="button" onClick="removesub()" value="Remove Marked"><hr> |
|
ENDFORM |
|
} |
} |
# ----------------------------------------------------- Summarize all calendars |
# ----------------------------------------------------- Summarize all calendars |
my %allcal=(); |
my %allcal=(); |
Line 264 ENDFORM
|
Line 246 ENDFORM
|
} |
} |
# ------------------------------------------------------------------- End table |
# ------------------------------------------------------------------- End table |
$r->print('</table>'); |
$r->print('</table>'); |
if ($allowed) { $r->print('</form>'); } |
if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries"></form>'); } |
$r->print('<p>'. |
$r->print('<p>'. |
'<a href="/adm/announcements?month='.$pm.'&year='.$py.'">Previous Month</a> '. |
'<a href="/adm/announcements?month='.$pm.'&year='.$py.'">Previous Month</a> '. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy.'">Next Month</a><p>'. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy.'">Next Month</a><p>'. |