version 1.4, 2002/08/09 20:15:16
|
version 1.8, 2003/04/30 15:49:45
|
Line 31 package Apache::lonannounce;
|
Line 31 package Apache::lonannounce;
|
use strict; |
use strict; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::loncommon; |
use Apache::loncommon; |
|
use Apache::lonhtmlcommon(); |
|
|
sub readcalendar { |
sub readcalendar { |
my $courseid=shift; |
my $courseid=shift; |
Line 55 sub normalcell {
|
Line 56 sub normalcell {
|
my $output=''; |
my $output=''; |
foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) { |
foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) { |
if ($_) { |
if ($_) { |
my ($courseid,$msg)=split(/\@/,$_); |
my ($courseid,$start,$end,@msg)=split(/\@/,$_); |
|
my $msg=join('@',@msg); |
my $fullmsg=$ENV{'course.'.$courseid.'.description'}.': '.$msg; |
my $fullmsg=$ENV{'course.'.$courseid.'.description'}.': '.$msg; |
$output.='<a href="javascript:alert('."'$fullmsg'".')">'. |
if ($courseid eq $ENV{'request.course.id'}) { |
|
if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { |
|
$output.='<input type="checkbox" name="remove_'.$start.'_'. |
|
$end.'">'; |
|
} |
|
} |
|
$output.='<a href="javascript:alert('."'$fullmsg'".')">'. |
substr($msg,0,20).'...</a><br>'; |
substr($msg,0,20).'...</a><br>'; |
} |
} |
} |
} |
Line 79 sub showday {
|
Line 87 sub showday {
|
foreach (keys %allcal) { |
foreach (keys %allcal) { |
my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/); |
my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/); |
if (($startdate<$nextday) && ($enddate>$tk)) { |
if (($startdate<$nextday) && ($enddate>$tk)) { |
$outp.='___&&&___'.$course.'@'.$allcal{$_}; |
$outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'. |
|
$allcal{$_}; |
} |
} |
} |
} |
return ($nextday,$nextmonth,&normalcell($th{'day'},$outp)); |
return ($nextday,$nextmonth,&normalcell($th{'day'},$outp)); |
Line 98 sub handler {
|
Line 107 sub handler {
|
# ---------------------------------------------------------- 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']); |
['month','year']); |
# ----------------------------------------------------- Summarize all calendars |
|
my %allcal=(); |
|
foreach (&Apache::loncommon::findallcourses()) { |
|
%allcal=(%allcal,&readcalendar($_)); |
|
} |
|
# --------------------------------------------------- Decide what month to show |
# --------------------------------------------------- Decide what month to show |
my $year=$todayhash{'year'}; |
my $year=$todayhash{'year'}; |
if ($ENV{'form.year'}) { $year=$ENV{'form.year'}; } |
if ($ENV{'form.year'}) { $year=$ENV{'form.year'}; } |
Line 117 sub handler {
|
Line 121 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> |
Line 128 sub handler {
|
Line 133 sub handler {
|
parmwin.close(); |
parmwin.close(); |
} |
} |
|
|
function pjump(type,dis,value,marker,ret,call) { |
$pjump_function |
parmwin=window.open("/adm/rat/parameter.html?type="+escape(type) |
|
+"&value="+escape(value)+"&marker="+escape(marker) |
|
+"&return="+escape(ret) |
|
+"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms", |
|
"height=350,width=350,scrollbars=no,menubar=no"); |
|
|
|
} |
|
|
|
function dateset() { |
function dateset() { |
if (document.anno.pres_marker.value=='end') { |
if (document.anno.pres_marker.value=='end') { |
Line 172 sub handler {
|
Line 170 sub handler {
|
} |
} |
</script> |
</script> |
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
|
<h1>Announcements</h1> |
|
ENDDOCUMENT |
ENDDOCUMENT |
|
$r->print(&Apache::loncommon::bodytag("Announcements and Calendar")); |
# does this user have privileges to post, etc? |
# does this user have privileges to post, etc? |
my $allowed=0; |
my $allowed=0; |
if ($ENV{'request.course.id'}) { |
if ($ENV{'request.course.id'}) { |
Line 226 ENDDOCUMENT
|
Line 222 ENDDOCUMENT
|
<input type="button" onClick="removesub()" value="Remove Marked"><hr> |
<input type="button" onClick="removesub()" value="Remove Marked"><hr> |
ENDFORM |
ENDFORM |
} |
} |
|
# ----------------------------------------------------- Summarize all calendars |
|
my %allcal=(); |
|
foreach (&Apache::loncommon::findallcourses()) { |
|
%allcal=(%allcal,&readcalendar($_)); |
|
} |
|
|
|
# ------------------------------- 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); } |
if ($fm>12){ ($fm,$fy)=(1,$year+1); } |
if ($fm>12){ ($fm,$fy)=(1,$year+1); } |
Line 235 ENDFORM
|
Line 238 ENDFORM
|
'<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>'. |
'<table border="2" cols="7" rows="5"><tr><th>Sun</th><th>Mon</th>'. |
'<table border="2" cols="7" rows="5"><tr><th>Sun</th><th>Mon</th>'. |
'<th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th>'); |
'<th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>'); |
|
|
my $tk=&Apache::loncommon::maketime(%firstday); |
my $tk=&Apache::loncommon::maketime(%firstday); |
my $outp; |
my $outp; |
Line 260 ENDFORM
|
Line 263 ENDFORM
|
$r->print('</tr>'); |
$r->print('</tr>'); |
} |
} |
# ------------------------------------------------------------------- End table |
# ------------------------------------------------------------------- End table |
|
$r->print('</table>'); |
if ($allowed) { $r->print('</form>'); } |
if ($allowed) { $r->print('</form>'); } |
$r->print('</table><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>'. |
'</body></html>'); |
'</body></html>'); |