[LON-CAPA-cvs] cvs: loncom /interface lonannounce.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 23 May 2003 16:14:33 -0000
www Fri May 23 12:14:33 2003 EDT
Modified files:
/loncom/interface lonannounce.pm
Log:
Bug 1487: has button to go back to current month.
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.11 loncom/interface/lonannounce.pm:1.12
--- loncom/interface/lonannounce.pm:1.11 Wed May 21 16:10:53 2003
+++ loncom/interface/lonannounce.pm Fri May 23 12:14:33 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Announce
#
-# $Id: lonannounce.pm,v 1.11 2003/05/21 20:10:53 www Exp $
+# $Id: lonannounce.pm,v 1.12 2003/05/23 16:14:33 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,6 +33,8 @@
use Apache::loncommon;
use Apache::lonhtmlcommon();
+my %todayhash;
+
sub editfield {
my ($r,$start,$end,$text)=@_;
# Deal with date forms
@@ -72,7 +74,7 @@
}
sub normalcell {
- my ($day,$text)=@_;
+ my ($day,$month,$year,$text)=@_;
my $output='';
foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
if ($_) {
@@ -90,7 +92,11 @@
substr($msg,0,20).'...</a><br />';
}
}
- return '<td><b>'.$day.'</b><br>'.$output.'</td>';
+ return '<td'.
+ ((($day eq $todayhash{'day'}) &&
+ ($month eq $todayhash{'month'}) &&
+ ($year eq $todayhash{'year'}))?' bgcolor="#FFFF00"':'').
+ '><b>'.$day.'</b><br>'.$output.'</td>';
}
sub plaincell {
@@ -144,7 +150,8 @@
}
}
unless ($mode) {
- return ($nextday,$nextmonth,&normalcell($th{'day'},$outp));
+ return ($nextday,$nextmonth,&normalcell(
+ $th{'day'},$th{'month'},$th{'year'},$outp));
} elsif ($outp) {
if ($mode==1) {
return '<br />'.&plaincell($outp);
@@ -164,7 +171,7 @@
# ---------------------------------------------------------- Get time right now
my $today=time;
- my %todayhash=&Apache::loncommon::timehash($today);
+ %todayhash=&Apache::loncommon::timehash($today);
# ---------------------------------------------------------- Get month and year
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
@@ -260,7 +267,9 @@
'June','July','August','September','October',
'November','December')[$month].' '.$year.'</h1>'.
'<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>'.
+ ' <a href="/adm/announcements?month='.$todayhash{'month'}.
+ '&year='.$todayhash{'year'}.'">Current Month</a><p>'.
'<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></tr>');
@@ -291,7 +300,9 @@
if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries"></form>'); }
$r->print('<p>'.
'<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>'.
+ ' <a href="/adm/announcements?month='.$todayhash{'month'}.
+ '&year='.$todayhash{'year'}.'">Current Month</a></p>'.
'</body></html>');
return OK;
}