Diff for /loncom/interface/lonannounce.pm between versions 1.71 and 1.80

version 1.71, 2008/09/19 03:27:04 version 1.80, 2009/11/04 20:01:24
Line 45  my %todayhash; Line 45  my %todayhash;
 my %showedcheck;  my %showedcheck;
   
 sub editfield {  sub editfield {
     my ($r,$start,$end,$text)=@_;      my ($r,$start,$end,$text,$crstype)=@_;
     # Deal with date forms      # Deal with date forms
     my $startdateform = &Apache::lonhtmlcommon::date_setter('anno',      my $startdateform = &Apache::lonhtmlcommon::date_setter('anno',
                                                             'startdate',                                                              'startdate',
Line 53  sub editfield { Line 53  sub editfield {
     my $enddateform = &Apache::lonhtmlcommon::date_setter('anno',      my $enddateform = &Apache::lonhtmlcommon::date_setter('anno',
                                                           'enddate',                                                            'enddate',
                                                           $end);                                                            $end);
     my $help=&Apache::loncommon::help_open_menu('Calendar Add Announcement','Calendar_Add_Announcement',274,'Communication Tools');      #my $help=&Apache::loncommon::help_open_menu('Calendar Add Announcement','Calendar_Add_Announcement',274,'Communication Tools');
     my %lt=&Apache::lonlocal::texthash('post' => 'Post Announcement',      my $help=&Apache::loncommon::help_open_topic('Calendar_Add_Announcement');
       
       my %lt=&Apache::lonlocal::texthash('annon' => 'Course Announcements',
                                          'post' => 'Post Announcement',
        'start' => 'Starting date',         'start' => 'Starting date',
        'end' => 'Ending date',         'end' => 'Ending date',
        'incrss' => 'Include in course RSS newsfeed');         'incrss' => 'Include in course RSS newsfeed');
       if ($crstype eq 'Community') {
           $lt{'anon'} = &mt('Community Announcements');
           $lt{'incrss'} = &mt('Include in community RSS newsfeed');
       }
   
     $r->print(<<ENDFORM);      $r->print(<<ENDFORM);
 $help  <h2>$lt{'annon'} $help</h2>
 <form name="anno" method="post">  <form name="anno" method="post">
 <input type="hidden" value='' name="action" />  <input type="hidden" value='' name="action" />
 <table><tr><td>$lt{'start'}:</td><td>$startdateform</td></tr>  <table><tr><td>$lt{'start'}:</td><td>$startdateform</td></tr>
Line 412  sub picklink { Line 419  sub picklink {
   
 sub dialscript {  sub dialscript {
     return (<<ENDDIA);      return (<<ENDDIA);
 <script language="Javascript">  <script type="text/javascript" language="JavaScript">
 function dialin(day,month,year) {  function dialin(day,month,year) {
  opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year;   opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year;
     var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month;      var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month;
Line 514  sub handler { Line 521  sub handler {
   
 # ------------------------------------------------------------ Print the screen  # ------------------------------------------------------------ Print the screen
     my $js = <<ENDDOCUMENT;      my $js = <<ENDDOCUMENT;
 <script type="text/javascript">  <script type="text/javascript" language="JavaScript">
   
     function trysubmit() {      function trysubmit() {
         document.anno.action.value="new";          document.anno.action.value="new";
Line 535  ENDDOCUMENT Line 542  ENDDOCUMENT
   &dialscript().    &dialscript().
   '<font size="1">');    '<font size="1">');
     } else {      } else {
        $r->print(&Apache::loncommon::start_page("Announcements and Calendar",          my $brcrum = [{href=>"/adm/announcements",text=>"Announcements and Calendar"}];
  $js));          $r->print(&Apache::loncommon::start_page("Communication",$js,{'bread_crumbs' => $brcrum}));
     }      }
 # does this user have privileges to post, etc?  # does this user have privileges to post, etc?
     my $allowed=0;      my $allowed=0;
Line 567  ENDDOCUMENT Line 574  ENDDOCUMENT
  }   }
     }      }
  }   }
  $r->print(<<SERVERANNOUNCE);   $r->print('<form name="serveranno" method="post">'
 <form name="serveranno" method="post">                   .'<h2>'.&mt('Post Server Announcements').'</h2>'
 <h3>Post Server Announcements</h3>                   .&mt('Post announcements to the system login and roles screen').'<br />'
 Post announcements to the system login and roles screen<br />                   .'<i>'.&mt('(leave blank to delete announcement)').'</i><br />'
 <i>(leave blank to delete announcement)</i><br />                   .'<textarea name="serverannnounce" cols="60" rows="5"></textarea><br />'
 <textarea name="serverannnounce" cols="60" rows="5"></textarea><br />                   .&mt('Check machines:').'<br />'
 Check machines:<br />          );
 SERVERANNOUNCE  
 # list servers  # list servers
     my %hostname = &Apache::lonnet::all_hostnames();      my %hostname = &Apache::lonnet::all_hostnames();
     foreach my $host (sort(keys(%hostname))) {      foreach my $host (sort(keys(%hostname))) {
  if (&Apache::lonnet::allowed('psa',   if (&Apache::lonnet::allowed('psa',
      &Apache::lonnet::host_domain($host))) {       &Apache::lonnet::host_domain($host))) {
     $r->print ('<br /><label><input type="checkbox" name="postto_'.$host.'" /> '.      $r->print ('<label><input type="checkbox" name="postto_'.$host.'" /> '.
        $host.' <tt>'.$hostname{$host}.'</tt> '.         $host.' <tt>'.$hostname{$host}.'</tt> '.
        '</label><a href="http://'.$hostname{$host}.         '</label><a href="http://'.$hostname{$host}.
        '/announcement.txt?time='.time.'" target="annowin">current</a>');         '/announcement.txt?time='.time.'" target="annowin">'.
                          &mt('Current Announcement').'</a><br />');
  }   }
     }      }
     $r->print(      $r->print(
   '<br /><input type="submit" name="serveraction" value="Post"></form><hr />');    '<br /><input type="submit" name="serveraction" value="'.&mt('Post').'" /></form><hr />');
     }      }
     if ($allowed) {      if ($allowed) {
         my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};          my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
         my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};          my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
           my $crstype = &Apache::loncommon::course_type();
 # ----------------------------------------------------- Store new submitted one  # ----------------------------------------------------- Store new submitted one
         if ($env{'form.action'} eq 'new') {          if ($env{'form.action'} eq 'new') {
     my $startdate =       my $startdate = 
Line 609  SERVERANNOUNCE Line 617  SERVERANNOUNCE
  $startdate.'_'.$enddate =>    $startdate.'_'.$enddate => 
     $env{'form.msg'} },$coursedom,$coursenum);      $env{'form.msg'} },$coursedom,$coursenum);
     if ($env{'form.rsspost'}) {      if ($env{'form.rsspost'}) {
                &Apache::lonrss::addentry($coursenum,$coursedom,'Course_Announcements',                 my $feed;
                  if ($crstype eq 'Community') {
                      $feed = 'Community_Announcements';
                  } else {
                      $feed = 'Course_Announcements';
                  }
                  &Apache::lonrss::addentry($coursenum,$coursedom,$feed,
  &mt('Event from [_1] to [_2]',   &mt('Event from [_1] to [_2]',
      &Apache::lonlocal::locallocaltime($startdate),       &Apache::lonlocal::locallocaltime($startdate),
      &Apache::lonlocal::locallocaltime($enddate)),       &Apache::lonlocal::locallocaltime($enddate)),
Line 631  SERVERANNOUNCE Line 645  SERVERANNOUNCE
         $tomorrowhash{'day'}++;          $tomorrowhash{'day'}++;
         my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash);          my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash);
                   
         &editfield($r,$today,$tomorrow,'');          &editfield($r,$today,$tomorrow,'',$crstype);
     }      }
 # ----------------------------------------------------- Summarize all calendars  # ----------------------------------------------------- Summarize all calendars
     my %allcal=&get_all_calendars();      my %allcal=&get_all_calendars();
Line 640  SERVERANNOUNCE Line 654  SERVERANNOUNCE
     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); }
   
     $r->print('<h1>'.('',&mt('January'),&mt('February'),&mt('March'),      $r->print('<h2>'.&mt('Calendar').'</h2>'
                .'<h3>'.('',&mt('January'),&mt('February'),&mt('March'),
       &mt('April'),&mt('May'),        &mt('April'),&mt('May'),
       &mt('June'),&mt('July'),&mt('August'),        &mt('June'),&mt('July'),&mt('August'),
                       &mt('September'),&mt('October'),                        &mt('September'),&mt('October'),
                       &mt('November'),&mt('December'))[$month].' '.                        &mt('November'),&mt('December'))[$month].' '.
               $year.' '.&show_timezone().'</h1>');                $year.' '.&show_timezone().'</h3>');
 # Reached the end of times, give up  # Reached the end of times, give up
     if (($year<1970) || ($year>2037)) {      if (($year<1970) || ($year>2037)) {
  $r->print('<h3>No calendar available for this date.</h3>'.   $r->print('<p class="LC_warning">'
  '<a href="/adm/announcements?month='.$todayhash{'month'}.                   .&mt('No calendar available for this date.')
  '&year='.$todayhash{'year'}.'">Current Month</a>'.                   .'</p>'
   &Apache::loncommon::end_page());                   .'<a href="/adm/announcements?month='.$todayhash{'month'}
                    .'&year='.$todayhash{'year'}.'">'.&mt('Current Month').'</a>'
    .&Apache::loncommon::end_page());
  return OK;   return OK;
     }      }
   
Line 702  SERVERANNOUNCE Line 719  SERVERANNOUNCE
     }      }
     $r->print('</tr>');      $r->print('</tr>');
   
     my $tk=&Apache::loncommon::maketime(%firstday);  
     my $outp;      my $outp;
     my $nm;      my $nm;
   
Line 741  SERVERANNOUNCE Line 757  SERVERANNOUNCE
 # ----------------------------------------------------------------- Check marks  # ----------------------------------------------------------------- Check marks
     undef(%showedcheck);      undef(%showedcheck);
 # --------------------------------------------------------------- Remove button  # --------------------------------------------------------------- Remove button
     if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'.      if ($allowed) { $r->print('<br /><input type="button" onClick="removesub()" value="'.&mt('Remove Checked Entries').'">'.
       &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); }        &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); }
     $r->print('<p>'.      $r->print('<p>'.
  '<a href="/adm/announcements?month='.$pm.'&year='.$py.   '<a href="/adm/announcements?month='.$pm.'&year='.$py.

Removed from v.1.71  
changed lines
  Added in v.1.80


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