version 1.75, 2008/12/10 21:46:58
|
version 1.85, 2012/08/21 14:36:27
|
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> |
Line 415 sub picklink {
|
Line 419 sub picklink {
|
|
|
sub dialscript { |
sub dialscript { |
return (<<ENDDIA); |
return (<<ENDDIA); |
<script 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 517 sub handler {
|
Line 523 sub handler {
|
|
|
# ------------------------------------------------------------ Print the screen |
# ------------------------------------------------------------ Print the screen |
my $js = <<ENDDOCUMENT; |
my $js = <<ENDDOCUMENT; |
<script type="text/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 538 ENDDOCUMENT
|
Line 546 ENDDOCUMENT
|
&dialscript(). |
&dialscript(). |
'<font size="1">'); |
'<font size="1">'); |
} else { |
} else { |
my @brcrum = [{href=>"/adm/announcements",text=>"Announcements and Calendar"}]; |
my $brcrum = [{href=>"/adm/announcements",text=>"Announcements and Calendar"}]; |
$r->print(&Apache::loncommon::start_page("Announcements and Calendar",$js,{'bread_crumbs' => @brcrum})); |
$r->print(&Apache::loncommon::start_page("Communication",$js,{'bread_crumbs' => $brcrum})); |
} |
} |
# does this user have privileges to post, etc? |
# does this user have privileges to post, etc? |
my $allowed=0; |
my $allowed=0; |
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 .= |
|
&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">' |
$r->print('<form name="serveranno" method="post">' |
.'<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 />' |
Line 590 ENDDOCUMENT
|
Line 612 ENDDOCUMENT
|
} |
} |
} |
} |
$r->print( |
$r->print( |
'<br /><input type="submit" name="serveraction" value="'.&mt('Post').'"></form><hr />'); |
'<br /><input type="submit" name="serveraction" value="'.&mt('Post').'" /></form><hr />'); |
} |
} |
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; |
} |
} |
|
|