Diff for /loncom/interface/lonannounce.pm between versions 1.51 and 1.52

version 1.51, 2006/04/23 07:16:07 version 1.52, 2006/05/12 02:17:50
Line 326  function dialin(day,month,year) { Line 326  function dialin(day,month,year) {
 </script>  </script>
 ENDDIA  ENDDIA
 }  }
   # ----------------------------------------------------- Summarize all calendars
   sub get_all_calendars {
       my %allcal=();
       foreach my $course (sort(&Apache::loncommon::findallcourses())) {
    %allcal=(%allcal,&readcalendar($course));
       }
       return %allcal;
   }
   
   sub output_ics_file {
       my ($r)=@_;
   # RFC 2445 wants CRLF
       my $crlf="\015\012";
   # Header
       $r->print("BEGIN:VCALENDAR$crlf");
       $r->print("VERSION:2.0$crlf");
       $r->print("PRODID:-//LONCAPA//LONCAPA Calendar Output//EN$crlf");
       my %allcal=&get_all_calendars();
       foreach my $event (keys(%allcal)) {
    my ($course,$startdate,$enddate)=($event=~/^(\w+)\@(\d+)\_(\d+)$/);
    $r->print("BEGIN:VEVENT$crlf");
    $r->print("DTSTART:".&Apache::loncommon::utc_string($startdate).$crlf);
    $r->print("DTEND:".&Apache::loncommon::utc_string($enddate).$crlf);
    $r->print("SUMMARY:$allcal{$event}$crlf");
    $r->print("END:VEVENT$crlf");
       }
   # Footer
       $r->print("END:VCALENDAR$crlf");
   }
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
       if ($r->uri=~/\.(ics|ical)$/) {
           &Apache::loncommon::content_type($r,'text/calendar');
    &output_ics_file($r);
    return OK;
       }
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
Line 479  SERVERANNOUNCE Line 513  SERVERANNOUNCE
         &editfield($r,$today,$tomorrow,'');          &editfield($r,$today,$tomorrow,'');
     }      }
 # ----------------------------------------------------- Summarize all calendars  # ----------------------------------------------------- Summarize all calendars
     my %allcal=();      my %allcal=&get_all_calendars();
     foreach my $course (sort(&Apache::loncommon::findallcourses())) {  
  %allcal=(%allcal,&readcalendar($course));  
     }  
   
 # ------------------------------- Initialize table and forward backward buttons  # ------------------------------- 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); }

Removed from v.1.51  
changed lines
  Added in v.1.52


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