Diff for /loncom/interface/lonannounce.pm between versions 1.39 and 1.40

version 1.39, 2006/01/12 22:45:19 version 1.40, 2006/01/12 22:58:47
Line 142  sub emptycell { Line 142  sub emptycell {
 sub normalcell {  sub normalcell {
     my ($day,$month,$year,$text)=@_;      my ($day,$month,$year,$text)=@_;
     my $output='';      my $output='';
     foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {      my @items=&order($text);
         if ($_) {      foreach my $item (@items) {
           if ($item) {
     my $internalflag=0;      my $internalflag=0;
     my ($courseid,$start,$end,@msg)=split(/\@/,$_);      my ($courseid,$start,$end,@msg)=split(/\@/,$item);
             my $msg=join('@',@msg);              my $msg=join('@',@msg);
     if ($msg=~/INTERNAL\:/) {      if ($msg=~/INTERNAL\:/) {
  $msg=~s/INTERNAL\://gs;   $msg=~s/INTERNAL\://gs;
Line 184  sub normalcell { Line 185  sub normalcell {
 sub plaincell {  sub plaincell {
     my ($text)=@_;      my ($text)=@_;
     my $output='';      my $output='';
     foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {      my @items=&order($text);
         if ($_) {      foreach my $item (@items) {
     my ($courseid,$start,$end,@msg)=split(/\@/,$_);          if ($item) {
       my ($courseid,$start,$end,@msg)=split(/\@/,$item);
             my $msg=join('@',@msg);              my $msg=join('@',@msg);
             my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.              my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.
  '\n'.&Apache::lonlocal::locallocaltime($start);   '\n'.&Apache::lonlocal::locallocaltime($start);
Line 208  sub plaincell { Line 210  sub plaincell {
 sub listcell {  sub listcell {
     my ($text)=@_;      my ($text)=@_;
     my $output='';      my $output='';
     foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {      my @items=&order($text);
         if ($_) {      foreach my $item (@items) {
     my ($courseid,$start,$end,@msg)=split(/\@/,$_);          if ($item) {
       my ($courseid,$start,$end,@msg)=split(/\@/,$item);
             my $msg=join('@',@msg);              my $msg=join('@',@msg);
     $msg=~s/INTERNAL\://gs;      $msg=~s/INTERNAL\://gs;
             my $fullmsg=&Apache::lonlocal::locallocaltime($start);              my $fullmsg=&Apache::lonlocal::locallocaltime($start);
Line 226  sub listcell { Line 229  sub listcell {
     return $output;      return $output;
 }  }
   
   sub order {
       my ($text)=@_;
       my @items = split(/___&&&___/,$text);
       sort {
    my (undef,$astart,$aend)=split(/\@/,$a);
    my (undef,$bstart,$bend)=split(/\@/,$b);
    if ($astart != $bstart) {
       return $astart <=> $bstart;
    }
    return $aend <=> $bend;
       } @items;
   }
   
 sub nextday {  sub nextday {
     my %th=@_;      my %th=@_;
     $th{'day'}++;      $th{'day'}++;
Line 242  sub showday { Line 258  sub showday {
  $tk-=$oneday;   $tk-=$oneday;
  $nextday+=$oneday;   $nextday+=$oneday;
     }      }
     foreach (keys %allcal) {      foreach my $item (keys(%allcal)) {
  my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/);   my ($course,$startdate,$enddate)=($item=~/^(\w+)\@(\d+)\_(\d+)$/);
         if (($startdate<$nextday) && ($enddate>=$tk))  {          if (($startdate<$nextday) && ($enddate>=$tk))  {
     $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.      $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.
             $allcal{$_};              $allcal{$item};
         }          }
     }      }
     unless ($mode) {      unless ($mode) {

Removed from v.1.39  
changed lines
  Added in v.1.40


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