version 1.79, 2009/04/04 21:47:40
|
version 1.88, 2017/02/16 18:17:49
|
Line 45 my %todayhash;
|
Line 45 my %todayhash;
|
my %showedcheck; |
my %showedcheck; |
|
|
sub editfield { |
sub editfield { |
my ($r,$start,$end,$text)=@_; |
my ($r,$start,$end,$text,$crstype)=@_; |
# Deal with date forms |
# Deal with date forms |
my $startdateform = &Apache::lonhtmlcommon::date_setter('anno', |
my $startdateform = &Apache::lonhtmlcommon::date_setter('anno', |
'startdate', |
'startdate', |
Line 61 sub editfield {
|
Line 61 sub editfield {
|
'start' => 'Starting date', |
'start' => 'Starting date', |
'end' => 'Ending date', |
'end' => 'Ending date', |
'incrss' => 'Include in course RSS newsfeed'); |
'incrss' => 'Include in course RSS newsfeed'); |
|
if ($crstype eq 'Community') { |
|
$lt{'annon'} = &mt('Community Announcements'); |
|
$lt{'incrss'} = &mt('Include in community RSS newsfeed'); |
|
} |
|
|
$r->print(<<ENDFORM); |
$r->print(<<ENDFORM); |
<h2>$lt{'annon'} $help</h2> |
<h2>$lt{'annon'} $help</h2> |
<form name="anno" method="post"> |
<form name="anno" method="post" action=""> |
<input type="hidden" value='' name="action" /> |
<input type="hidden" value='' name="action" /> |
<table><tr><td>$lt{'start'}:</td><td>$startdateform</td></tr> |
<table><tr><td>$lt{'start'}:</td><td>$startdateform</td></tr> |
<tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table> |
<tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table> |
<textarea name="msg" rows="4" cols="60">$text</textarea> |
<textarea name="msg" rows="4" cols="60">$text</textarea> |
<br /> |
<br /> |
<label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> |
<label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> |
<br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr /> |
<br /><input type="button" onclick="trysubmit()" value="$lt{'post'}" /><hr /> |
ENDFORM |
ENDFORM |
} |
} |
|
|
Line 113 sub readcalendar {
|
Line 117 sub readcalendar {
|
foreach my $thiskey (keys(%$resourcedata)) { |
foreach my $thiskey (keys(%$resourcedata)) { |
if ($resourcedata->{$thiskey.'.type'}=~/^date/) { |
if ($resourcedata->{$thiskey.'.type'}=~/^date/) { |
my ($course,$middle,$part,$name)= |
my ($course,$middle,$part,$name)= |
($thiskey=~/^(\Q$courseid\E)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($thiskey=~/^(\Q$courseid\E)\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/); |
|
|
my %data = ( 'section' => &mt('All Students')); |
my %data = ( 'section' => &mt('All Students')); |
if ($middle=~/^\[(.*)\]\./) { |
if ($middle=~/^\[(.*)\]\./) { |
Line 224 sub normalcell {
|
Line 228 sub normalcell {
|
&& ($env{'form.pickdate'} ne 'yes') |
&& ($env{'form.pickdate'} ne 'yes') |
&& (!$internalflag)) { |
&& (!$internalflag)) { |
$output.='<input type="checkbox" name="remove_'.$start.'_'. |
$output.='<input type="checkbox" name="remove_'.$start.'_'. |
$end.'">'; |
$end.'" />'; |
$showedcheck{$start.'_'.$end}=1; |
$showedcheck{$start.'_'.$end}=1; |
} |
} |
} |
} |
Line 416 sub picklink {
|
Line 420 sub picklink {
|
sub dialscript { |
sub dialscript { |
return (<<ENDDIA); |
return (<<ENDDIA); |
<script type="text/javascript" language="JavaScript"> |
<script type="text/javascript" language="JavaScript"> |
|
// <![CDATA[ |
function dialin(day,month,year) { |
function dialin(day,month,year) { |
opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year; |
opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year; |
var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month; |
var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month; |
Line 427 function dialin(day,month,year) {
|
Line 432 function dialin(day,month,year) {
|
opener.$env{'form.element'}\_checkday(); |
opener.$env{'form.element'}\_checkday(); |
self.close(); |
self.close(); |
} |
} |
|
// ]]> |
</script> |
</script> |
ENDDIA |
ENDDIA |
} |
} |
Line 502 sub handler {
|
Line 508 sub handler {
|
|
|
# ---------------------------------------------- See if we are in pickdate mode |
# ---------------------------------------------- See if we are in pickdate mode |
my $pickdatemode=($env{'form.pickdate'} eq 'yes'); |
my $pickdatemode=($env{'form.pickdate'} eq 'yes'); |
my $pickinfo='&pickdate=yes&formname='.$env{'form.formname'}. |
my $pickinfo='&pickdate=yes&formname='.$env{'form.formname'}. |
'&element='.$env{'form.element'}; |
'&element='.$env{'form.element'}; |
# --------------------------------------------- Find out first day of the month |
# --------------------------------------------- Find out first day of the month |
|
|
my $tk = &Apache::loncommon::maketime( 'day' => 1, |
my $tk = &Apache::loncommon::maketime( 'day' => 1, |
Line 518 sub handler {
|
Line 524 sub handler {
|
# ------------------------------------------------------------ Print the screen |
# ------------------------------------------------------------ Print the screen |
my $js = <<ENDDOCUMENT; |
my $js = <<ENDDOCUMENT; |
<script type="text/javascript" language="JavaScript"> |
<script type="text/javascript" language="JavaScript"> |
|
// <![CDATA[ |
|
|
function trysubmit() { |
function trysubmit() { |
document.anno.action.value="new"; |
document.anno.action.value="new"; |
Line 528 sub handler {
|
Line 535 sub handler {
|
document.anno.action.value="del"; |
document.anno.action.value="del"; |
document.anno.submit(); |
document.anno.submit(); |
} |
} |
|
// ]]> |
</script> |
</script> |
ENDDOCUMENT |
ENDDOCUMENT |
|
|
Line 561 ENDDOCUMENT
|
Line 569 ENDDOCUMENT
|
} |
} |
# ------------------------------------------------------------ Process commands |
# ------------------------------------------------------------ Process commands |
if ($serverpost) { |
if ($serverpost) { |
if ($env{'form.serveraction'}) { |
if ($env{'form.serveraction'}) { |
foreach my $key (keys(%env)) { |
my $rc; |
if ($key=~/^form\.postto\_(\w+)/) { |
my $message; |
$r->print( |
foreach my $key (keys(%env)) { |
'<br />Posting '.$1.': '.&Apache::lonnet::postannounce |
if ($key=~/^form\.postto\_(\w+[\w\-]*)/) { |
($1,$env{'form.serverannnounce'})); |
$rc = &Apache::lonnet::postannounce |
} |
($1,$env{'form.serverannnounce'}); |
} |
if ($rc eq 'ok') { |
} |
$message .= |
$r->print('<form name="serveranno" method="post">' |
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Announcement posted to [_1]',$1)) |
|
.'<br />'; |
|
} else { |
|
$message .= |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Posting announcement to [_1] failed: [_2]' |
|
,$1,$rc), 1) |
|
.'<br />'; |
|
} |
|
} |
|
} |
|
$r->print(&Apache::loncommon::confirmwrapper($message)); |
|
} |
|
$r->print('<form name="serveranno" method="post" action="">' |
.'<h2>'.&mt('Post Server Announcements').'</h2>' |
.'<h2>'.&mt('Post Server Announcements').'</h2>' |
.&mt('Post announcements to the system login and roles screen').'<br />' |
.&mt('Post announcements to the system login and roles screen').'<br />' |
.'<i>'.&mt('(leave blank to delete announcement)').'</i><br />' |
.'<i>'.&mt('(leave blank to delete announcement)').'</i><br />' |
Line 595 ENDDOCUMENT
|
Line 617 ENDDOCUMENT
|
if ($allowed) { |
if ($allowed) { |
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crstype = &Apache::loncommon::course_type(); |
# ----------------------------------------------------- Store new submitted one |
# ----------------------------------------------------- Store new submitted one |
if ($env{'form.action'} eq 'new') { |
if ($env{'form.action'} eq 'new') { |
my $startdate = |
my $startdate = |
Line 612 ENDDOCUMENT
|
Line 635 ENDDOCUMENT
|
$startdate.'_'.$enddate => |
$startdate.'_'.$enddate => |
$env{'form.msg'} },$coursedom,$coursenum); |
$env{'form.msg'} },$coursedom,$coursenum); |
if ($env{'form.rsspost'}) { |
if ($env{'form.rsspost'}) { |
&Apache::lonrss::addentry($coursenum,$coursedom,'Course_Announcements', |
my $feed; |
|
if ($crstype eq 'Community') { |
|
$feed = 'Community_Announcements'; |
|
} else { |
|
$feed = 'Course_Announcements'; |
|
} |
|
&Apache::lonrss::addentry($coursenum,$coursedom,$feed, |
&mt('Event from [_1] to [_2]', |
&mt('Event from [_1] to [_2]', |
&Apache::lonlocal::locallocaltime($startdate), |
&Apache::lonlocal::locallocaltime($startdate), |
&Apache::lonlocal::locallocaltime($enddate)), |
&Apache::lonlocal::locallocaltime($enddate)), |
Line 634 ENDDOCUMENT
|
Line 663 ENDDOCUMENT
|
$tomorrowhash{'day'}++; |
$tomorrowhash{'day'}++; |
my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash); |
my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash); |
|
|
&editfield($r,$today,$tomorrow,''); |
&editfield($r,$today,$tomorrow,'',$crstype); |
} |
} |
# ----------------------------------------------------- Summarize all calendars |
# ----------------------------------------------------- Summarize all calendars |
my %allcal=&get_all_calendars(); |
my %allcal=&get_all_calendars(); |
Line 656 ENDDOCUMENT
|
Line 685 ENDDOCUMENT
|
.&mt('No calendar available for this date.') |
.&mt('No calendar available for this date.') |
.'</p>' |
.'</p>' |
.'<a href="/adm/announcements?month='.$todayhash{'month'} |
.'<a href="/adm/announcements?month='.$todayhash{'month'} |
.'&year='.$todayhash{'year'}.'">'.&mt('Current Month').'</a>' |
.'&year='.$todayhash{'year'}.'">'.&mt('Current Month').'</a>' |
.&Apache::loncommon::end_page()); |
.&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
Line 695 ENDDOCUMENT
|
Line 724 ENDDOCUMENT
|
} |
} |
|
|
$r->print( |
$r->print( |
'<a href="/adm/announcements?month='.$pm.'&year='.$py. |
'<a href="/adm/announcements?month='.$pm.'&year='.$py. |
($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '. |
($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy. |
($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'. |
($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
'&year='.$todayhash{'year'}. |
'&year='.$todayhash{'year'}. |
($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><p>'. |
($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><div>'. |
'<table class="'.$class.'" cols="7" rows="5"><tr>'); |
'<table class="'.$class.'"><tr>'); |
for (my $i=0; $i<@localdays; $i++) { |
for (my $i=0; $i<@localdays; $i++) { |
$r->print('<th>'.&mt($localdays[$i]).'</th>'); |
$r->print('<th>'.&mt($localdays[$i]).'</th>'); |
} |
} |
Line 742 ENDDOCUMENT
|
Line 771 ENDDOCUMENT
|
} |
} |
} |
} |
# ------------------------------------------------------------------- End table |
# ------------------------------------------------------------------- End table |
$r->print('</table>'); |
$r->print('</table></div>'); |
# ----------------------------------------------------------------- Check marks |
# ----------------------------------------------------------------- Check marks |
undef(%showedcheck); |
undef(%showedcheck); |
# --------------------------------------------------------------- Remove button |
# --------------------------------------------------------------- Remove button |
if ($allowed) { $r->print('<br /><input type="button" onClick="removesub()" value="'.&mt('Remove Checked Entries').'">'. |
if ($allowed) { $r->print('<br /><input type="button" onclick="removesub()" value="'.&mt('Remove Checked Entries').'" />'. |
&Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); } |
&Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); } |
$r->print('<p>'. |
$r->print('<p>'. |
'<a href="/adm/announcements?month='.$pm.'&year='.$py. |
'<a href="/adm/announcements?month='.$pm.'&year='.$py. |
($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '. |
($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy. |
($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'. |
($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
'&year='.$todayhash{'year'}. |
'&year='.$todayhash{'year'}. |
($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'. |
($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'. |
($pickdatemode?'</font>':'').&Apache::loncommon::end_page()); |
($pickdatemode?'</font>':''). |
$r->print('<a href="/adm/announcements.ics">'.&mt('Download your Calendar as iCalendar File').'</a>'); |
'<a href="/adm/announcements.ics">'.&mt('Download your Calendar as iCalendar File').'</a>'. |
|
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|