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

version 1.40, 2006/01/12 22:58:47 version 1.46, 2006/03/15 21:55:43
Line 33  use Apache::Constants qw(:common); Line 33  use Apache::Constants qw(:common);
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::lonnavmaps();
 use Apache::lonrss();  use Apache::lonrss();
 use Apache::lonnet;  use Apache::lonnet;
 use HTML::Entities();  use HTML::Entities();
Line 63  $help Line 64  $help
 <tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table>  <tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table>
 <textarea name="msg" rows="4" cols="60">$text</textarea>  <textarea name="msg" rows="4" cols="60">$text</textarea>
 <br />  <br />
 <!-- <label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> -->  <label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label>
 <br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr />  <br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr />
 ENDFORM  ENDFORM
 }  }
Line 74  sub readcalendar { Line 75  sub readcalendar {
     my $coursedom=$env{'course.'.$courseid.'.domain'};      my $coursedom=$env{'course.'.$courseid.'.domain'};
     my %thiscal=&Apache::lonnet::dump('calendar',$coursedom,$coursenum);      my %thiscal=&Apache::lonnet::dump('calendar',$coursedom,$coursenum);
     my %returnhash=();      my %returnhash=();
     foreach (keys %thiscal) {      foreach my $item (keys(%thiscal)) {
         unless (($_=~/^error\:/) || ($thiscal{$_}=~/^error\:/)) {          unless (($item=~/^error\:/) || ($thiscal{$item}=~/^error\:/)) {
    $returnhash{$courseid.'@'.$_}=$thiscal{$_};     $returnhash{$courseid.'@'.$item}=$thiscal{$item};
         }          }
     }      }
   
     if ($courseid eq $env{'request.course.id'}) {      if ($courseid eq $env{'request.course.id'}) {
    my $can_see_hidden = $env{'request.role.adv'};
    my $navmap = Apache::lonnavmaps::navmap->new();
  my %resourcedata=   my %resourcedata=
     &Apache::lonnet::dump('resourcedata',$coursedom,$coursenum);      &Apache::lonnet::dump('resourcedata',$coursedom,$coursenum);
  foreach my $thiskey (sort keys %resourcedata) {   foreach my $thiskey (sort keys %resourcedata) {
Line 101  sub readcalendar { Line 105  sub readcalendar {
  $middle=~s/\.$//;   $middle=~s/\.$//;
  my $realm=&mt('All Resources');   my $realm=&mt('All Resources');
  if ($middle=~/^(.+)\_\_\_\(all\)$/) {   if ($middle=~/^(.+)\_\_\_\(all\)$/) {
     $realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1);      my $map_url=$1;
       if (!$can_see_hidden && !$navmap) {
    next;
       }
       if (!$can_see_hidden) {
    my $res = $navmap->getResourceByUrl($map_url);
    if ($res && $res->randomout()) { next; }
       }
       $realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($map_url);
  } elsif ($middle) {   } elsif ($middle) {
       if (!$can_see_hidden && !$navmap) {
    next;
       }
       if (!$can_see_hidden) {
    my $res = $navmap->getBySymb($middle);
    if ($res && $res->randomout()) { next; }
       }
     $realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle);      $realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle);
  }   }
  my $datetype='';   my $datetype='';
Line 146  sub normalcell { Line 165  sub normalcell {
     foreach my $item (@items) {      foreach my $item (@items) {
         if ($item) {          if ($item) {
     my $internalflag=0;      my $internalflag=0;
     my ($courseid,$start,$end,@msg)=split(/\@/,$item);      my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
             my $msg=join('@',@msg);  
     if ($msg=~/INTERNAL\:/) {      if ($msg=~/INTERNAL\:/) {
  $msg=~s/INTERNAL\://gs;   $msg=~s/INTERNAL\://gs;
  $internalflag=1;   $internalflag=1;
Line 188  sub plaincell { Line 206  sub plaincell {
     my @items=&order($text);      my @items=&order($text);
     foreach my $item (@items) {      foreach my $item (@items) {
         if ($item) {          if ($item) {
     my ($courseid,$start,$end,@msg)=split(/\@/,$item);      my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
             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);
     if ($start!=$end) {      if ($start!=$end) {
Line 213  sub listcell { Line 230  sub listcell {
     my @items=&order($text);      my @items=&order($text);
     foreach my $item (@items) {      foreach my $item (@items) {
         if ($item) {          if ($item) {
     my ($courseid,$start,$end,@msg)=split(/\@/,$item);      my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
             my $msg=join('@',@msg);  
     $msg=~s/INTERNAL\://gs;      $msg=~s/INTERNAL\://gs;
             my $fullmsg=&Apache::lonlocal::locallocaltime($start);              my $fullmsg=&Apache::lonlocal::locallocaltime($start);
     if ($start!=$end) {      if ($start!=$end) {
Line 398  ENDDOCUMENT Line 414  ENDDOCUMENT
 # ------------------------------------------------------------ Process commands  # ------------------------------------------------------------ Process commands
     if ($serverpost) {      if ($serverpost) {
  if ($env{'form.serveraction'}) {   if ($env{'form.serveraction'}) {
     foreach (keys %env) {      foreach my $key (keys(%env)) {
  if ($_=~/^form\.postto\_(\w+)/) {   if ($key=~/^form\.postto\_(\w+)/) {
     $r->print(       $r->print( 
  '<br />Posting '.$1.': '.&Apache::lonnet::postannounce   '<br />Posting '.$1.': '.&Apache::lonnet::postannounce
  ($1,$env{'form.serverannnounce'}));   ($1,$env{'form.serverannnounce'}));
Line 415  Post announcements to the system login a Line 431  Post announcements to the system login a
 Check machines:<br />  Check machines:<br />
 SERVERANNOUNCE  SERVERANNOUNCE
 # list servers  # list servers
     foreach (sort keys %Apache::lonnet::hostname) {      foreach my $host (sort(keys(%Apache::lonnet::hostname))) {
  if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$_})) {   if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$host})) {
     $r->print ('<br /><input type="checkbox" name="postto_'.$_.'" /> '.      $r->print ('<br /><input type="checkbox" name="postto_'.$host.'" /> '.
        $_.' <tt>'.$Apache::lonnet::hostname{$_}.'</tt> '.         $host.' <tt>'.$Apache::lonnet::hostname{$host}.'</tt> '.
        '<a href="http://'.$Apache::lonnet::hostname{$_}.         '<a href="http://'.$Apache::lonnet::hostname{$host}.
        '/announcement.txt" target="annowin">current</a>');         '/announcement.txt" target="annowin">current</a>');
  }   }
     }      }
Line 456  SERVERANNOUNCE Line 472  SERVERANNOUNCE
 # ---------------------------------------------------------------- Remove items  # ---------------------------------------------------------------- Remove items
         if ($env{'form.action'} eq 'del') {          if ($env{'form.action'} eq 'del') {
     my @delwhich=();      my @delwhich=();
             foreach (keys %env) {              foreach my $key (keys(%env)) {
  if ($_=~/^form\.remove\_(.+)$/) {   if ($key=~/^form\.remove\_(.+)$/) {
     push(@delwhich,$1);      push(@delwhich,$1);
                 }                  }
             }              }
Line 472  SERVERANNOUNCE Line 488  SERVERANNOUNCE
     }      }
 # ----------------------------------------------------- Summarize all calendars  # ----------------------------------------------------- Summarize all calendars
     my %allcal=();      my %allcal=();
     foreach (&Apache::loncommon::findallcourses()) {      foreach my $course (&Apache::loncommon::findallcourses()) {
  %allcal=(%allcal,&readcalendar($_));   %allcal=(%allcal,&readcalendar($course));
     }      }
   
 # ------------------------------- Initialize table and forward backward buttons  # ------------------------------- Initialize table and forward backward buttons

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


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