Diff for /loncom/interface/lonannounce.pm between versions 1.3 and 1.5

version 1.3, 2002/08/08 13:44:17 version 1.5, 2002/08/09 20:39:13
Line 52  sub emptycell { Line 52  sub emptycell {
   
 sub normalcell {  sub normalcell {
     my ($day,$text)=@_;      my ($day,$text)=@_;
     return '<td><b>'.$day.'</b><br>'.$text.'</td>';      my $output='';
       foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
           if ($_) {
       my ($courseid,$start,$end,@msg)=split(/\@/,$_);
               my $msg=join('@',@msg);
               my $fullmsg=$ENV{'course.'.$courseid.'.description'}.': '.$msg;
               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>';
          }
       }
       return '<td><b>'.$day.'</b><br>'.$output.'</td>';
 }  }
   
 sub nextday {  sub nextday {
Line 66  sub showday { Line 82  sub showday {
     my %th=&Apache::loncommon::timehash($tk);      my %th=&Apache::loncommon::timehash($tk);
     my ($nextday,$nextmonth)=&nextday(%th);      my ($nextday,$nextmonth)=&nextday(%th);
     my $outp='';      my $outp='';
       my $oneday=24*3600;
     foreach (keys %allcal) {      foreach (keys %allcal) {
  my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/);   my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/);
         print $course.' '.localtime($startdate).' '.localtime($enddate).          if (($startdate<$nextday) && ($enddate>$tk))  {
               localtime($tk).' '.localtime($nextday).'<br>';      $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.
         if (($startdate>$tk) && ($enddate<$nextday)) {              $allcal{$_};
     $outp.='___&&&___'.$course.'@'.$allcal{$_};  
         }          }
     }      }
     return ($nextday,$nextmonth,&normalcell($th{'day'},$outp));      return ($nextday,$nextmonth,&normalcell($th{'day'},$outp));
Line 90  sub handler { Line 106  sub handler {
 # ---------------------------------------------------------- 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']);
 # ----------------------------------------------------- Summarize all calendars  
     my %allcal=();  
     foreach (&Apache::loncommon::findallcourses()) {  
  %allcal=(%allcal,&readcalendar($_));  
     }  
 # --------------------------------------------------- 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'}; }
Line 218  ENDDOCUMENT Line 229  ENDDOCUMENT
 <input type="button" onClick="removesub()" value="Remove Marked"><hr>  <input type="button" onClick="removesub()" value="Remove Marked"><hr>
 ENDFORM  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);      my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year);
     if ($pm<1) { ($pm,$py)=(12,$year-1); }      if ($pm<1) { ($pm,$py)=(12,$year-1); }
     if ($fm>12){ ($fm,$fy)=(1,$year+1); }      if ($fm>12){ ($fm,$fy)=(1,$year+1); }

Removed from v.1.3  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>