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

www lon-capa-cvs@mail.lon-capa.org
Fri, 09 Aug 2002 20:15:17 -0000


www		Fri Aug  9 16:15:17 2002 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  Does stuff now. Still needs "remove".
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.3 loncom/interface/lonannounce.pm:1.4
--- loncom/interface/lonannounce.pm:1.3	Thu Aug  8 09:44:17 2002
+++ loncom/interface/lonannounce.pm	Fri Aug  9 16:15:16 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.3 2002/08/08 13:44:17 www Exp $
+# $Id: lonannounce.pm,v 1.4 2002/08/09 20:15:16 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,7 +52,16 @@
 
 sub normalcell {
     my ($day,$text)=@_;
-    return '<td><b>'.$day.'</b><br>'.$text.'</td>';
+    my $output='';
+    foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
+        if ($_) {
+	    my ($courseid,$msg)=split(/\@/,$_);
+            my $fullmsg=$ENV{'course.'.$courseid.'.description'}.': '.$msg;
+           $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
+	       substr($msg,0,20).'...</a><br>';
+       }
+    }
+    return '<td><b>'.$day.'</b><br>'.$output.'</td>';
 }
 
 sub nextday {
@@ -66,11 +75,10 @@
     my %th=&Apache::loncommon::timehash($tk);
     my ($nextday,$nextmonth)=&nextday(%th);
     my $outp='';
+    my $oneday=24*3600;
     foreach (keys %allcal) {
 	my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/);
-        print $course.' '.localtime($startdate).' '.localtime($enddate).
-              localtime($tk).' '.localtime($nextday).'<br>';
-        if (($startdate>$tk) && ($enddate<$nextday)) {
+        if (($startdate<$nextday) && ($enddate>$tk))  {
 	    $outp.='___&&&___'.$course.'@'.$allcal{$_};
         }
     }