Diff for /loncom/interface/lonannounce.pm between versions 1.10 and 1.11

version 1.10, 2003/05/21 19:15:41 version 1.11, 2003/05/21 20:10:53
Line 78  sub normalcell { Line 78  sub normalcell {
         if ($_) {          if ($_) {
     my ($courseid,$start,$end,@msg)=split(/\@/,$_);      my ($courseid,$start,$end,@msg)=split(/\@/,$_);
             my $msg=join('@',@msg);              my $msg=join('@',@msg);
             my $fullmsg=$ENV{'course.'.$courseid.'.description'}.': '.$msg;              my $fullmsg=$ENV{'course.'.$courseid.'.description'}.
    ', '.localtime($start).' - '.localtime($end).': '.$msg;
             if ($courseid eq $ENV{'request.course.id'}) {              if ($courseid eq $ENV{'request.course.id'}) {
               if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {                if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
                $output.='<input type="checkbox" name="remove_'.$start.'_'.                 $output.='<input type="checkbox" name="remove_'.$start.'_'.
Line 86  sub normalcell { Line 87  sub normalcell {
       }        }
     }      }
             $output.='<a href="javascript:alert('."'$fullmsg'".')">'.              $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
        substr($msg,0,20).'...</a><br>';         substr($msg,0,20).'...</a><br />';
        }         }
     }      }
     return '<td><b>'.$day.'</b><br>'.$output.'</td>';      return '<td><b>'.$day.'</b><br>'.$output.'</td>';
 }  }
   
   sub plaincell {
       my ($text)=@_;
       my $output='';
       foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
           if ($_) {
       my ($courseid,$start,$end,@msg)=split(/\@/,$_);
               my $msg=join('@',@msg);
               my $fullmsg=$ENV{'course.'.$courseid.'.description'}.
    ', '.localtime($start).' - '.localtime($end).': '.$msg;
               $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
          substr($msg,0,40).'...</a><br />';
          }
       }
       return $output;
   }
   
   sub listcell {
       my ($text)=@_;
       my $output='';
       foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
           if ($_) {
       my ($courseid,$start,$end,@msg)=split(/\@/,$_);
               my $msg=join('@',@msg);
               my $fullmsg=localtime($start).' to '.localtime($end).':<br /><b>'.
                  $msg.'</b>';
               $output.='<li>'.$fullmsg.'</li>';
          }
       }
       return $output;
   }
   
 sub nextday {  sub nextday {
     my %th=@_;      my %th=@_;
     $th{'day'}++;      $th{'day'}++;
Line 99  sub nextday { Line 131  sub nextday {
 }  }
   
 sub showday {  sub showday {
     my ($tk,%allcal)=@_;      my ($tk,$mode,%allcal)=@_;
     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='';
Line 111  sub showday { Line 143  sub showday {
             $allcal{$_};              $allcal{$_};
         }          }
     }      }
     return ($nextday,$nextmonth,&normalcell($th{'day'},$outp));      unless ($mode) {
          return ($nextday,$nextmonth,&normalcell($th{'day'},$outp));
      } elsif ($outp) {
          if ($mode==1) {
             return '<br />'.&plaincell($outp);
         } else {
             return '<ul>'.&listcell($outp).'</ul>';
         }
      } else {
          return '';
      }
 }  }
   
 sub handler {  sub handler {
Line 230  ENDDOCUMENT Line 272  ENDDOCUMENT
     $r->print('<tr>');      $r->print('<tr>');
     for (my $i=0;$i<$weekday;$i++) { $r->print(&emptycell); }      for (my $i=0;$i<$weekday;$i++) { $r->print(&emptycell); }
     for (my $i=$weekday;$i<=6;$i++) {       for (my $i=$weekday;$i<=6;$i++) { 
         ($tk,$nm,$outp)=&showday($tk,%allcal);          ($tk,$nm,$outp)=&showday($tk,0,%allcal);
         $r->print($outp);          $r->print($outp);
     }      }
     $r->print('</tr>');      $r->print('</tr>');
Line 238  ENDDOCUMENT Line 280  ENDDOCUMENT
     for (my $k=0;$k<=3;$k++) {      for (my $k=0;$k<=3;$k++) {
         $r->print('<tr>');          $r->print('<tr>');
         for (my $i=0;$i<=6;$i++) {          for (my $i=0;$i<=6;$i++) {
             ($tk,$nm,$outp)=&showday($tk,%allcal);              ($tk,$nm,$outp)=&showday($tk,0,%allcal);
             if ($month!=$nm) { $outp=&emptycell; }              if ($month!=$nm) { $outp=&emptycell; }
             $r->print($outp);              $r->print($outp);
         }          }

Removed from v.1.10  
changed lines
  Added in v.1.11


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