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

version 1.80, 2009/11/04 20:01:24 version 1.88, 2017/02/16 18:17:49
Line 62  sub editfield { Line 62  sub editfield {
        'end' => 'Ending date',         'end' => 'Ending date',
        'incrss' => 'Include in course RSS newsfeed');         'incrss' => 'Include in course RSS newsfeed');
     if ($crstype eq 'Community') {      if ($crstype eq 'Community') {
         $lt{'anon'} = &mt('Community Announcements');          $lt{'annon'} = &mt('Community Announcements');
         $lt{'incrss'} = &mt('Include in community RSS newsfeed');          $lt{'incrss'} = &mt('Include in community RSS newsfeed');
     }      }
   
     $r->print(<<ENDFORM);      $r->print(<<ENDFORM);
 <h2>$lt{'annon'} $help</h2>  <h2>$lt{'annon'} $help</h2>
 <form name="anno" method="post">  <form name="anno" method="post" action="">
 <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>
 <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 117  sub readcalendar { Line 117  sub readcalendar {
     foreach my $thiskey (keys(%$resourcedata)) {      foreach my $thiskey (keys(%$resourcedata)) {
  if ($resourcedata->{$thiskey.'.type'}=~/^date/) {   if ($resourcedata->{$thiskey.'.type'}=~/^date/) {
     my ($course,$middle,$part,$name)=      my ($course,$middle,$part,$name)=
  ($thiskey=~/^(\Q$courseid\E)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);   ($thiskey=~/^(\Q$courseid\E)\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/);
   
     my %data = ( 'section' => &mt('All Students'));      my %data = ( 'section' => &mt('All Students'));
     if ($middle=~/^\[(.*)\]\./) {      if ($middle=~/^\[(.*)\]\./) {
Line 228  sub normalcell { Line 228  sub normalcell {
        && ($env{'form.pickdate'} ne 'yes')         && ($env{'form.pickdate'} ne 'yes')
        && (!$internalflag)) {         && (!$internalflag)) {
                $output.='<input type="checkbox" name="remove_'.$start.'_'.                 $output.='<input type="checkbox" name="remove_'.$start.'_'.
    $end.'">';     $end.'" />';
                $showedcheck{$start.'_'.$end}=1;                 $showedcheck{$start.'_'.$end}=1;
       }        }
     }      }
Line 420  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 431  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 506  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 522  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 532  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 565  ENDDOCUMENT Line 569  ENDDOCUMENT
     }      }
 # ------------------------------------------------------------ Process commands  # ------------------------------------------------------------ Process commands
     if ($serverpost) {      if ($serverpost) {
  if ($env{'form.serveraction'}) {          if ($env{'form.serveraction'}) {
     foreach my $key (keys(%env)) {              my $rc;
  if ($key=~/^form\.postto\_(\w+)/) {              my $message;
     $r->print(               foreach my $key (keys(%env)) {
  '<br />Posting '.$1.': '.&Apache::lonnet::postannounce                  if ($key=~/^form\.postto\_(\w+[\w\-]*)/) {
  ($1,$env{'form.serverannnounce'}));                       $rc = &Apache::lonnet::postannounce
  }                             ($1,$env{'form.serverannnounce'});
     }                      if ($rc eq 'ok') {
  }                          $message .= 
  $r->print('<form name="serveranno" method="post">'                              &Apache::lonhtmlcommon::confirm_success(
                                   &mt('Announcement posted to [_1]',$1))
                                  .'<br />';
                       } else {
                           $message .=
                               &Apache::lonhtmlcommon::confirm_success(
                                   &mt('Posting announcement to [_1] failed: [_2]'
                                       ,$1,$rc), 1)
                                  .'<br />';
                       }
                   }
               }
               $r->print(&Apache::loncommon::confirmwrapper($message));
           }
    $r->print('<form name="serveranno" method="post" action="">'
                  .'<h2>'.&mt('Post Server Announcements').'</h2>'                   .'<h2>'.&mt('Post Server Announcements').'</h2>'
                  .&mt('Post announcements to the system login and roles screen').'<br />'                   .&mt('Post announcements to the system login and roles screen').'<br />'
                  .'<i>'.&mt('(leave blank to delete announcement)').'</i><br />'                   .'<i>'.&mt('(leave blank to delete announcement)').'</i><br />'
Line 667  ENDDOCUMENT Line 685  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 706  ENDDOCUMENT Line 724  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 753  ENDDOCUMENT Line 771  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.80  
changed lines
  Added in v.1.88


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