version 1.48, 2006/03/23 22:32:10
|
version 1.52, 2006/05/12 02:17:50
|
Line 155 sub readcalendar {
|
Line 155 sub readcalendar {
|
} |
} |
|
|
sub emptycell { |
sub emptycell { |
return '<td bgcolor="#AAAAAA"> </td>'; |
return '<td class="LC_calendar_day_empty"> </td>'; |
} |
} |
|
|
sub normalcell { |
sub normalcell { |
my ($day,$month,$year,$text)=@_; |
my ($day,$month,$year,$text)=@_; |
my $output=''; |
my $output; |
my @items=&order($text); |
my @items=&order($text); |
foreach my $item (@items) { |
foreach my $item (@items) { |
if ($item) { |
if ($item) { |
Line 189 sub normalcell {
|
Line 189 sub normalcell {
|
$fullmsg=~s/[\n\r]/\\n/gs; |
$fullmsg=~s/[\n\r]/\\n/gs; |
$fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\''); |
$fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\''); |
$fullmsg=~s/&/\\&/g; |
$fullmsg=~s/&/\\&/g; |
|
my $short_msg = substr($msg,0,20).((length($msg) > 20)?'...':''); |
|
if (defined($output)) { $output.='<br />'; } |
$output.='<a href="javascript:alert('."'$fullmsg'".')">'. |
$output.='<a href="javascript:alert('."'$fullmsg'".')">'. |
substr($msg,0,20).'...</a><br />'; |
$short_msg.'</a>'; |
} |
} |
} |
} |
return '<td valign="top"'. |
return '<td class="LC_calendar_day'. |
((($day eq $todayhash{'day'}) && |
((($day eq $todayhash{'day'}) && |
($month eq $todayhash{'month'}) && |
($month eq $todayhash{'month'}) && |
($year eq $todayhash{'year'}))?' bgcolor="#FFFF00"':''). |
($year eq $todayhash{'year'}))?'_current':''). |
'>'.&tfont('<b>'.&picklink($day,$day,$month,$year).'</b><br />'.$output).'</td>'; |
'" ><b>'.&picklink($day,$day,$month,$year).'</b><br />'.$output.'</td>'; |
} |
} |
|
|
sub plaincell { |
sub plaincell { |
my ($text)=@_; |
my ($text)=@_; |
my $output=''; |
my $output; |
my @items=&order($text); |
my @items=&order($text); |
foreach my $item (@items) { |
foreach my $item (@items) { |
if ($item) { |
if ($item) { |
Line 217 sub plaincell {
|
Line 219 sub plaincell {
|
$fullmsg=~s/[\n\r]/\\n/gs; |
$fullmsg=~s/[\n\r]/\\n/gs; |
$fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\''); |
$fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\''); |
$fullmsg=~s/&/\\&/g; |
$fullmsg=~s/&/\\&/g; |
|
my $short_msg = substr($msg,0,80).((length($msg) > 80)?'...':''); |
|
if (defined($output)) { $output.='<br />'; } |
$output.='<a href="javascript:alert('."'$fullmsg'".')">'. |
$output.='<a href="javascript:alert('."'$fullmsg'".')">'. |
substr($msg,0,80).'...</a><br />'; |
$short_msg.'</a>'; |
} |
} |
} |
} |
return $output; |
return $output; |
Line 295 sub showday {
|
Line 299 sub showday {
|
} |
} |
} |
} |
|
|
sub tfont { |
|
my $text=shift; |
|
if ($env{'form.pickdate'} eq 'yes') { |
|
return '<font size="1">'.$text.'</font>'; |
|
} else { |
|
return $text; |
|
} |
|
} |
|
|
|
sub picklink { |
sub picklink { |
my ($text,$day,$month,$year)=@_; |
my ($text,$day,$month,$year)=@_; |
if ($env{'form.pickdate'} eq 'yes') { |
if ($env{'form.pickdate'} eq 'yes') { |
Line 331 function dialin(day,month,year) {
|
Line 326 function dialin(day,month,year) {
|
</script> |
</script> |
ENDDIA |
ENDDIA |
} |
} |
|
# ----------------------------------------------------- Summarize all calendars |
|
sub get_all_calendars { |
|
my %allcal=(); |
|
foreach my $course (sort(&Apache::loncommon::findallcourses())) { |
|
%allcal=(%allcal,&readcalendar($course)); |
|
} |
|
return %allcal; |
|
} |
|
|
|
sub output_ics_file { |
|
my ($r)=@_; |
|
# RFC 2445 wants CRLF |
|
my $crlf="\015\012"; |
|
# Header |
|
$r->print("BEGIN:VCALENDAR$crlf"); |
|
$r->print("VERSION:2.0$crlf"); |
|
$r->print("PRODID:-//LONCAPA//LONCAPA Calendar Output//EN$crlf"); |
|
my %allcal=&get_all_calendars(); |
|
foreach my $event (keys(%allcal)) { |
|
my ($course,$startdate,$enddate)=($event=~/^(\w+)\@(\d+)\_(\d+)$/); |
|
$r->print("BEGIN:VEVENT$crlf"); |
|
$r->print("DTSTART:".&Apache::loncommon::utc_string($startdate).$crlf); |
|
$r->print("DTEND:".&Apache::loncommon::utc_string($enddate).$crlf); |
|
$r->print("SUMMARY:$allcal{$event}$crlf"); |
|
$r->print("END:VEVENT$crlf"); |
|
} |
|
# Footer |
|
$r->print("END:VCALENDAR$crlf"); |
|
} |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
|
if ($r->uri=~/\.(ics|ical)$/) { |
|
&Apache::loncommon::content_type($r,'text/calendar'); |
|
&output_ics_file($r); |
|
return OK; |
|
} |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
Line 342 sub handler {
|
Line 371 sub handler {
|
my $today=time; |
my $today=time; |
%todayhash=&Apache::loncommon::timehash($today); |
%todayhash=&Apache::loncommon::timehash($today); |
# ----------------------------------------------------------------- Check marks |
# ----------------------------------------------------------------- Check marks |
%showedcheck=(); |
undef(%showedcheck); |
undef %showedcheck; |
|
# ---------------------------------------------------------- Get month and year |
# ---------------------------------------------------------- Get month and year |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['month','year','pickdate','formname','element']); |
['month','year','pickdate','formname','element']); |
Line 485 SERVERANNOUNCE
|
Line 513 SERVERANNOUNCE
|
&editfield($r,$today,$tomorrow,''); |
&editfield($r,$today,$tomorrow,''); |
} |
} |
# ----------------------------------------------------- Summarize all calendars |
# ----------------------------------------------------- Summarize all calendars |
my %allcal=(); |
my %allcal=&get_all_calendars(); |
foreach my $course (&Apache::loncommon::findallcourses()) { |
|
%allcal=(%allcal,&readcalendar($course)); |
|
} |
|
|
|
# ------------------------------- Initialize table and forward backward buttons |
# ------------------------------- Initialize table and forward backward buttons |
my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year); |
my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year); |
if ($pm<1) { ($pm,$py)=(12,$year-1); } |
if ($pm<1) { ($pm,$py)=(12,$year-1); } |
Line 509 SERVERANNOUNCE
|
Line 533 SERVERANNOUNCE
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
|
my $class = "LC_calendar"; |
|
if ($env{'form.pickdate'} eq 'yes') { |
|
$class .= " LC_calendar_pickdate"; |
|
} |
$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> '. |
Line 517 SERVERANNOUNCE
|
Line 546 SERVERANNOUNCE
|
' <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>'. |
'<table border="2" cols="7" rows="5"><tr><th>'. |
'<table class="'.$class.'" cols="7" rows="5"><tr> |
&tfont(&mt('Sun')) |
<th>'.&mt('Sun').'</th> |
.'</th><th>'. |
<th>'.&mt('Mon').'</th> |
&tfont(&mt('Mon')) |
<th>'.&mt('Tue').'</th> |
.'</th><th>'. |
<th>'.&mt('Wed').'</th> |
&tfont(&mt('Tue')) |
<th>'.&mt('Thu').'</th> |
.'</th><th>'. |
<th>'.&mt('Fri').'</th> |
&tfont(&mt('Wed')) |
<th>'.&mt('Sat').'</th></tr>'); |
.'</th><th>'. |
|
&tfont(&mt('Thu')) |
|
.'</th><th>'. |
|
&tfont(&mt('Fri')) |
|
.'</th><th>'. |
|
&tfont(&mt('Sat')) |
|
.'</th></tr>'); |
|
|
|
my $tk=&Apache::loncommon::maketime(%firstday); |
my $tk=&Apache::loncommon::maketime(%firstday); |
my $outp; |
my $outp; |
Line 558 SERVERANNOUNCE
|
Line 580 SERVERANNOUNCE
|
# ------------------------------------------------------------------- End table |
# ------------------------------------------------------------------- End table |
$r->print('</table>'); |
$r->print('</table>'); |
# ----------------------------------------------------------------- Check marks |
# ----------------------------------------------------------------- Check marks |
%showedcheck=(); |
undef(%showedcheck); |
undef %showedcheck; |
|
# --------------------------------------------------------------- Remove button |
# --------------------------------------------------------------- Remove button |
if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'. |
if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'. |
&Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); } |
&Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); } |