Diff for /loncom/interface/lonannounce.pm between versions 1.78 and 1.82

version 1.78, 2009/03/25 15:49:47 version 1.82, 2010/03/16 20:10:13
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 61  sub editfield { Line 61  sub editfield {
        '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{'annon'} = &mt('Community Announcements');
           $lt{'incrss'} = &mt('Include in community RSS newsfeed');
       }
   
     $r->print(<<ENDFORM);      $r->print(<<ENDFORM);
 <h2>$lt{'annon'} $help</h2>  <h2>$lt{'annon'} $help</h2>
Line 416  sub picklink { Line 420  sub picklink {
 sub dialscript {  sub dialscript {
     return (<<ENDDIA);      return (<<ENDDIA);
 <script type="text/javascript" language="JavaScript">  <script type="text/javascript" language="JavaScript">
   // <![CDATA[
 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 427  function dialin(day,month,year) { Line 432  function dialin(day,month,year) {
     opener.$env{'form.element'}\_checkday();      opener.$env{'form.element'}\_checkday();
     self.close();      self.close();
 }  }
   // ]]>
 </script>  </script>
 ENDDIA  ENDDIA
 }  }
Line 502  sub handler { Line 508  sub handler {
   
 # ---------------------------------------------- See if we are in pickdate mode  # ---------------------------------------------- See if we are in pickdate mode
     my $pickdatemode=($env{'form.pickdate'} eq 'yes');      my $pickdatemode=($env{'form.pickdate'} eq 'yes');
     my $pickinfo='&pickdate=yes&formname='.$env{'form.formname'}.      my $pickinfo='&amp;pickdate=yes&amp;formname='.$env{'form.formname'}.
  '&element='.$env{'form.element'};   '&amp;element='.$env{'form.element'};
 # --------------------------------------------- Find out first day of the month  # --------------------------------------------- Find out first day of the month
   
     my $tk = &Apache::loncommon::maketime( 'day' => 1,      my $tk = &Apache::loncommon::maketime( 'day' => 1,
Line 518  sub handler { Line 524  sub handler {
 # ------------------------------------------------------------ Print the screen  # ------------------------------------------------------------ Print the screen
     my $js = <<ENDDOCUMENT;      my $js = <<ENDDOCUMENT;
 <script type="text/javascript" language="JavaScript">  <script type="text/javascript" language="JavaScript">
   // <![CDATA[
   
     function trysubmit() {      function trysubmit() {
         document.anno.action.value="new";          document.anno.action.value="new";
Line 528  sub handler { Line 535  sub handler {
         document.anno.action.value="del";          document.anno.action.value="del";
  document.anno.submit();   document.anno.submit();
     }      }
   // ]]>
 </script>  </script>
 ENDDOCUMENT  ENDDOCUMENT
   
Line 590  ENDDOCUMENT Line 598  ENDDOCUMENT
  }   }
     }      }
     $r->print(      $r->print(
   '<br /><input type="submit" name="serveraction" value="'.&mt('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 612  ENDDOCUMENT Line 621  ENDDOCUMENT
  $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 634  ENDDOCUMENT Line 649  ENDDOCUMENT
         $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 656  ENDDOCUMENT Line 671  ENDDOCUMENT
                  .&mt('No calendar available for this date.')                   .&mt('No calendar available for this date.')
                  .'</p>'                   .'</p>'
                  .'<a href="/adm/announcements?month='.$todayhash{'month'}                   .'<a href="/adm/announcements?month='.$todayhash{'month'}
                  .'&year='.$todayhash{'year'}.'">'.&mt('Current Month').'</a>'                   .'&amp;year='.$todayhash{'year'}.'">'.&mt('Current Month').'</a>'
  .&Apache::loncommon::end_page());   .&Apache::loncommon::end_page());
  return OK;   return OK;
     }      }
Line 695  ENDDOCUMENT Line 710  ENDDOCUMENT
     }      }
   
     $r->print(      $r->print(
  '<a href="/adm/announcements?month='.$pm.'&year='.$py.   '<a href="/adm/announcements?month='.$pm.'&amp;year='.$py.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.   ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.   '<a href="/adm/announcements?month='.$fm.'&amp;year='.$fy.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.   ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.   '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  '&year='.$todayhash{'year'}.   '&amp;year='.$todayhash{'year'}.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><p>'.   ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><div>'.
         '<table class="'.$class.'" cols="7" rows="5"><tr>');          '<table class="'.$class.'"><tr>');
     for (my $i=0; $i<@localdays; $i++) {      for (my $i=0; $i<@localdays; $i++) {
         $r->print('<th>'.&mt($localdays[$i]).'</th>');          $r->print('<th>'.&mt($localdays[$i]).'</th>');
     }      }
Line 742  ENDDOCUMENT Line 757  ENDDOCUMENT
         }          }
     }      }
 # ------------------------------------------------------------------- End table  # ------------------------------------------------------------------- End table
     $r->print('</table>');      $r->print('</table></div>');
 # ----------------------------------------------------------------- Check marks  # ----------------------------------------------------------------- Check marks
     undef(%showedcheck);      undef(%showedcheck);
 # --------------------------------------------------------------- Remove button  # --------------------------------------------------------------- Remove button
     if ($allowed) { $r->print('<br /><input type="button" onClick="removesub()" value="'.&mt('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.'&amp;year='.$py.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.   ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.   '<a href="/adm/announcements?month='.$fm.'&amp;year='.$fy.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.   ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.   '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  '&year='.$todayhash{'year'}.   '&amp;year='.$todayhash{'year'}.
  ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'.   ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'.
  ($pickdatemode?'</font>':'').&Apache::loncommon::end_page());   ($pickdatemode?'</font>':'').
     $r->print('<a href="/adm/announcements.ics">'.&mt('Download your Calendar as iCalendar File').'</a>');   '<a href="/adm/announcements.ics">'.&mt('Download your Calendar as iCalendar File').'</a>'.
       &Apache::loncommon::end_page());
     return OK;      return OK;
 }   } 
   

Removed from v.1.78  
changed lines
  Added in v.1.82


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