version 1.17, 2003/08/12 19:46:04
|
version 1.19, 2003/09/03 01:53:46
|
Line 86 sub normalcell {
|
Line 86 sub normalcell {
|
', '.localtime($start).' - '.localtime($end).': '.$msg; |
', '.localtime($start).' - '.localtime($end).': '.$msg; |
if ($courseid eq $ENV{'request.course.id'}) { |
if ($courseid eq $ENV{'request.course.id'}) { |
if ((&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) |
if ((&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) |
&& (!$showedcheck{$start.'_'.$end})) { |
&& (!$showedcheck{$start.'_'.$end}) |
|
&& ($ENV{'form.pickdate'} ne 'yes')) { |
$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 102 sub normalcell {
|
Line 103 sub normalcell {
|
((($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'}))?' bgcolor="#FFFF00"':''). |
'><b>'.$day.'</b><br>'.$output.'</td>'; |
'>'.&tfont('<b>'.&picklink($day,$day,$month,$year).'</b><br>'.$output).'</td>'; |
} |
} |
|
|
sub plaincell { |
sub plaincell { |
Line 171 sub showday {
|
Line 172 sub showday {
|
} |
} |
} |
} |
|
|
|
sub tfont { |
|
my $text=shift; |
|
if ($ENV{'form.pickdate'} eq 'yes') { |
|
return '<font size="1">'.$text.'</font>'; |
|
} else { |
|
return $text; |
|
} |
|
} |
|
|
|
sub picklink { |
|
my ($text,$day,$month,$year)=@_; |
|
if ($ENV{'form.pickdate'} eq 'yes') { |
|
return '<a href="javascript:dialin('.$day.','.$month.','.$year.')">'. |
|
$text.'</a>'; |
|
} else { |
|
return $text; |
|
} |
|
} |
|
|
|
sub dialscript { |
|
return (<<ENDDIA); |
|
<script language="Javascript"> |
|
function dialin(day,month,year) { |
|
opener.document.$ENV{'form.formname'}.$ENV{'form.element'}\_year.value=year; |
|
var slct=opener.document.$ENV{'form.formname'}.$ENV{'form.element'}\_month; |
|
var i; |
|
for (i=0;i<slct.length;i++) { |
|
if (slct.options[i].value==month) { slct.selectedIndex=i; } |
|
} |
|
opener.document.$ENV{'form.formname'}.$ENV{'form.element'}\_day.value=day; |
|
opener.$ENV{'form.element'}\_checkday(); |
|
self.close(); |
|
} |
|
</script> |
|
ENDDIA |
|
} |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
$r->content_type('text/html'); |
$r->content_type('text/html'); |
Line 185 sub handler {
|
Line 223 sub handler {
|
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']); |
['month','year','pickdate','formname','element']); |
# --------------------------------------------------- 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'}; } |
my $month=$todayhash{'month'}; |
my $month=$todayhash{'month'}; |
if ($ENV{'form.month'}) { $month=$ENV{'form.month'}; } |
if ($ENV{'form.month'}) { $month=$ENV{'form.month'}; } |
|
|
|
# ---------------------------------------------- See if we are in pickdate mode |
|
my $pickdatemode=($ENV{'form.pickdate'} eq 'yes'); |
|
my $pickinfo='&pickdate=yes&formname='.$ENV{'form.formname'}. |
|
'&element='.$ENV{'form.element'}; |
# --------------------------------------------- Find out first day of the month |
# --------------------------------------------- Find out first day of the month |
|
|
my %firstday=&Apache::loncommon::timehash( |
my %firstday=&Apache::loncommon::timehash( |
Line 219 sub handler {
|
Line 262 sub handler {
|
</script> |
</script> |
</head> |
</head> |
ENDDOCUMENT |
ENDDOCUMENT |
$r->print(&Apache::loncommon::bodytag("Announcements and Calendar")); |
if ($pickdatemode) { |
|
# no big header in pickdate mode |
|
$r->print(&Apache::loncommon::bodytag("Pick a Date",'','',1). |
|
&dialscript(). |
|
'<font size="1">'); |
|
} else { |
|
$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 233 ENDDOCUMENT
|
Line 283 ENDDOCUMENT
|
} else { |
} else { |
$serverpost=&Apache::lonnet::allowed('psa','/'); |
$serverpost=&Apache::lonnet::allowed('psa','/'); |
} |
} |
|
# -------------------------------- BUT: do no fancy stuff when in pickdate mode |
|
if ($pickdatemode) { |
|
$serverpost=0; |
|
$allowed=0; |
|
} |
# ------------------------------------------------------------ Process commands |
# ------------------------------------------------------------ Process commands |
if ($serverpost) { |
if ($serverpost) { |
if ($ENV{'form.serveraction'}) { |
if ($ENV{'form.serveraction'}) { |
Line 323 SERVERANNOUNCE
|
Line 378 SERVERANNOUNCE
|
return OK; |
return OK; |
} |
} |
$r->print( |
$r->print( |
'<a href="/adm/announcements?month='.$pm.'&year='.$py.'">Previous Month</a> '. |
'<a href="/adm/announcements?month='.$pm.'&year='.$py. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy.'">Next Month</a>'. |
($pickdatemode?$pickinfo:'').'">Previous Month</a> '. |
|
'<a href="/adm/announcements?month='.$fm.'&year='.$fy. |
|
($pickdatemode?$pickinfo:'').'">Next Month</a>'. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
'&year='.$todayhash{'year'}.'">Current Month</a><p>'. |
'&year='.$todayhash{'year'}. |
'<table border="2" cols="7" rows="5"><tr><th>Sun</th><th>Mon</th>'. |
($pickdatemode?$pickinfo:'').'">Current Month</a><p>'. |
'<th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>'); |
'<table border="2" cols="7" rows="5"><tr><th>'. |
|
&tfont('Sun') |
|
.'</th><th>'. |
|
&tfont('Mon') |
|
.'</th><th>'. |
|
&tfont('Tue') |
|
.'</th><th>'. |
|
&tfont('Wed') |
|
.'</th><th>'. |
|
&tfont('Thu') |
|
.'</th><th>'. |
|
&tfont('Fri') |
|
.'</th><th>'. |
|
&tfont('Sat') |
|
.'</th></tr>'); |
|
|
my $tk=&Apache::loncommon::maketime(%firstday); |
my $tk=&Apache::loncommon::maketime(%firstday); |
my $outp; |
my $outp; |
Line 360 SERVERANNOUNCE
|
Line 431 SERVERANNOUNCE
|
# --------------------------------------------------------------- Remove button |
# --------------------------------------------------------------- Remove button |
if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries"></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. |
'<a href="/adm/announcements?month='.$fm.'&year='.$fy.'">Next Month</a>'. |
($pickdatemode?$pickinfo:'').'">Previous Month</a> '. |
|
'<a href="/adm/announcements?month='.$fm.'&year='.$fy. |
|
($pickdatemode?$pickinfo:'').'">Next Month</a>'. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
'&year='.$todayhash{'year'}.'">Current Month</a></p>'. |
'&year='.$todayhash{'year'}. |
|
($pickdatemode?$pickinfo:'').'">Current Month</a></p>'. |
|
($pickdatemode?'</font>':''). |
'</body></html>'); |
'</body></html>'); |
return OK; |
return OK; |
} |
} |