[LON-CAPA-cvs] cvs: loncom /interface lonannounce.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 22 Apr 2006 16:32:55 -0000


albertel		Sat Apr 22 12:32:55 2006 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  - revamp calendar
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.48 loncom/interface/lonannounce.pm:1.49
--- loncom/interface/lonannounce.pm:1.48	Thu Mar 23 17:32:10 2006
+++ loncom/interface/lonannounce.pm	Sat Apr 22 12:32:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.48 2006/03/23 22:32:10 albertel Exp $
+# $Id: lonannounce.pm,v 1.49 2006/04/22 16:32:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -155,7 +155,7 @@
 }
 
 sub emptycell {
-    return '<td bgcolor="#AAAAAA">&nbsp;</td>';
+    return '<td class="LC_calendar_day_empty">&nbsp;</td>';
 }
 
 sub normalcell {
@@ -193,11 +193,11 @@
 	       substr($msg,0,20).'...</a><br />';
        }
     }
-    return '<td valign="top"'.
+    return '<td class="LC_calendar_day'.
 	((($day eq $todayhash{'day'}) &&
           ($month eq $todayhash{'month'}) &&
-          ($year eq $todayhash{'year'}))?' bgcolor="#FFFF00"':'').
-           '>'.&tfont('<b>'.&picklink($day,$day,$month,$year).'</b><br />'.$output).'</td>';
+          ($year eq $todayhash{'year'}))?'_current':'').
+           '" ><b>'.&picklink($day,$day,$month,$year).'</b><br />'.$output.'</td>';
 }
 
 sub plaincell {
@@ -295,15 +295,6 @@
    }
 }
 
-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') {
@@ -342,8 +333,7 @@
     my $today=time;
     %todayhash=&Apache::loncommon::timehash($today);
 # ----------------------------------------------------------------- Check marks
-    %showedcheck=();
-    undef %showedcheck;
+    undef(%showedcheck);
 # ---------------------------------------------------------- Get month and year
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                              ['month','year','pickdate','formname','element']);
@@ -486,7 +476,7 @@
     }
 # ----------------------------------------------------- Summarize all calendars
     my %allcal=();
-    foreach my $course (&Apache::loncommon::findallcourses()) {
+    foreach my $course (sort(&Apache::loncommon::findallcourses())) {
 	%allcal=(%allcal,&readcalendar($course));
     }
 
@@ -509,6 +499,11 @@
 		  &Apache::loncommon::end_page());
 	return OK;
     }
+
+    my $class = "LC_calendar";
+    if ($env{'form.pickdate'} eq 'yes') {
+	$class .= " LC_calendar_pickdate";
+    }
     $r->print(
  '<a href="/adm/announcements?month='.$pm.'&year='.$py.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
@@ -517,21 +512,14 @@
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  '&year='.$todayhash{'year'}.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><p>'.
-        '<table border="2" cols="7" rows="5"><tr><th>'.
-&tfont(&mt('Sun'))
-.'</th><th>'.
-&tfont(&mt('Mon'))
-.'</th><th>'.
-&tfont(&mt('Tue'))
-.'</th><th>'.
-&tfont(&mt('Wed'))
-.'</th><th>'.
-&tfont(&mt('Thu'))
-.'</th><th>'.
-&tfont(&mt('Fri'))
-.'</th><th>'.
-&tfont(&mt('Sat'))
-.'</th></tr>');
+        '<table class="'.$class.'" cols="7" rows="5"><tr>
+<th>'.&mt('Sun').'</th>
+<th>'.&mt('Mon').'</th>
+<th>'.&mt('Tue').'</th>
+<th>'.&mt('Wed').'</th>
+<th>'.&mt('Thu').'</th>
+<th>'.&mt('Fri').'</th>
+<th>'.&mt('Sat').'</th></tr>');
 
     my $tk=&Apache::loncommon::maketime(%firstday);
     my $outp;
@@ -558,8 +546,7 @@
 # ------------------------------------------------------------------- End table
     $r->print('</table>');
 # ----------------------------------------------------------------- Check marks
-    %showedcheck=();
-    undef %showedcheck;
+    undef(%showedcheck);
 # --------------------------------------------------------------- Remove button
     if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'.
 			      &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); }