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

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


www		Fri Aug  9 16:39:13 2002 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  Wonderful.
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.4 loncom/interface/lonannounce.pm:1.5
--- loncom/interface/lonannounce.pm:1.4	Fri Aug  9 16:15:16 2002
+++ loncom/interface/lonannounce.pm	Fri Aug  9 16:39:13 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.4 2002/08/09 20:15:16 www Exp $
+# $Id: lonannounce.pm,v 1.5 2002/08/09 20:39:13 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -55,9 +55,16 @@
     my $output='';
     foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
         if ($_) {
-	    my ($courseid,$msg)=split(/\@/,$_);
+	    my ($courseid,$start,$end,@msg)=split(/\@/,$_);
+            my $msg=join('@',@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>';
        }
     }
@@ -79,7 +86,8 @@
     foreach (keys %allcal) {
 	my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/);
         if (($startdate<$nextday) && ($enddate>$tk))  {
-	    $outp.='___&&&___'.$course.'@'.$allcal{$_};
+	    $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.
+            $allcal{$_};
         }
     }
     return ($nextday,$nextmonth,&normalcell($th{'day'},$outp));
@@ -98,11 +106,6 @@
 # ---------------------------------------------------------- Get month and year
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['month','year']);
-# ----------------------------------------------------- Summarize all calendars
-    my %allcal=();
-    foreach (&Apache::loncommon::findallcourses()) {
-	%allcal=(%allcal,&readcalendar($_));
-    }
 # --------------------------------------------------- Decide what month to show
     my $year=$todayhash{'year'};
     if ($ENV{'form.year'}) { $year=$ENV{'form.year'}; }
@@ -226,6 +229,13 @@
 <input type="button" onClick="removesub()" value="Remove Marked"><hr>
 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);
     if ($pm<1) { ($pm,$py)=(12,$year-1); }
     if ($fm>12){ ($fm,$fy)=(1,$year+1); }