Diff for /loncom/interface/lonwhatsnew.pm between versions 1.80.2.3 and 1.81

version 1.80.2.3, 2008/12/21 16:41:15 version 1.81, 2008/12/06 12:49:18
Line 354  sub display_actions_box { Line 354  sub display_actions_box {
               .' <span class="LC_nobreak">'                .' <span class="LC_nobreak">'
               .&mt('Currently: [_1].','<i>'.$currinit.'</i>')                .&mt('Currently: [_1].','<i>'.$currinit.'</i>')
               .'&nbsp;&nbsp;'                .'&nbsp;&nbsp;'
               .&mt('<b>Change</b> for just [_1]this course[_2]'                .&mt('[_1]Change[_2] for just [_3]this course[_4] or for all [_5]your courses[_6].'
                   .' or for all [_3]your courses[_2].'                    ,'<b>'
                     ,'</b>'
                   ,'<a href="/adm/whatsnew?command=courseinit&amp;refpage='.$refpage.'">'                    ,'<a href="/adm/whatsnew?command=courseinit&amp;refpage='.$refpage.'">'
                   ,'</a>'                    ,'</a>'
                   ,'<a href="/adm/preferences?action=changecourseinit&amp;refpage='.$refpage.'">')                    ,'<a href="/adm/preferences?action=changecourseinit&amp;refpage='.$refpage.'">'
                     ,'</a>')
               .' </span><br /><hr />');                .' </span><br /><hr />');
   
     if ($command eq 'reset') {      if ($command eq 'reset') {
Line 488  sub display_actions_box { Line 490  sub display_actions_box {
         }          }
     }      }
   
     my $itemserror;  
     if ($needitems) {      if ($needitems) {
         $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);          &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);
     }      }
     if ($show{'coursenormalmail'}) {      if ($show{'coursenormalmail'}) {
         $msgcount = &getnormalmail(\@newmsgs);          $msgcount = &getnormalmail(\@newmsgs);
Line 532  sub display_actions_box { Line 533  sub display_actions_box {
             if ($displayed == $halfway) {              if ($displayed == $halfway) {
                 $r->print('</td><td>&nbsp;</td><td class="LC_right_col" >');                  $r->print('</td><td>&nbsp;</td><td class="LC_right_col" >');
             }              }
             &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror);              &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype);
             $displayed ++;               $displayed ++; 
         }          }
     }      }
Line 678  function toggle_countunread(choice) { Line 679  function toggle_countunread(choice) {
     document.discussionswitch.submit();      document.discussionswitch.submit();
 }  }
 </script>');  </script>');
     $r->print('<br />'.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').'<br />'.&mt("This can increase the time taken to gather data for the '<i>What's New?</i>' page by a few seconds.").'&nbsp;&nbsp;'.&mt("Currently set to <b>$current</b>."));      $r->print('<br />'
                .&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.')
                .'<br />'
                .&mt("This can increase the time taken to gather data for the '<i>What's New?</i>' page by a few seconds.")
                .'&nbsp;&nbsp;'
                .&mt('Currently set to [_1].','<b>'.$current.'</b>.')
       );
     $r->print('<br /><br />      $r->print('<br /><br />
 <form method="post" name="discussionswitch" action="/adm/whatsnew">  <form method="post" name="discussionswitch" action="/adm/whatsnew">
 <input type="hidden" name="command" value="newdiscconf" />  <input type="hidden" name="command" value="newdiscconf" />
Line 688  function toggle_countunread(choice) { Line 695  function toggle_countunread(choice) {
     $r->print('<br/>      $r->print('<br/>
                <input type="button" name="display" value="'.                 <input type="button" name="display" value="'.
                &mt('Change to [_1]',&mt($opposite{$current})).'"                  &mt('Change to [_1]',&mt($opposite{$current})).'" 
                onclick="javascript:toggle_countunread('."'change'".')" />'.                 onclick="javascript:toggle_countunread('."'change'".')" />
                ('&nbsp;' x7).                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;
                '<input type="button" name="nochange" value="'.                 <input type="button" name="nochange" value="'.
                &mt("No change").'"                  &mt("No change").'" 
                onclick="javascript:toggle_countunread('."'unchanged'".')" />                 onclick="javascript:toggle_countunread('."'unchanged'".')" />
                </form>');                 </form>');
Line 779  sub display_launcher { Line 786  sub display_launcher {
         $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,          $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,
         $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,          $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,
         $interval,$countunread,$expired,$expirecount,$activated,$activecount,          $interval,$countunread,$expired,$expirecount,$activated,$activecount,
         $crstype,$itemserror) = @_;          $crstype) = @_;
   
     if ($$checkallowed{$action}) {      if ($$checkallowed{$action}) {
         &start_box($r,$show,$headings,$action,$refpage,$action);          &start_box($r,$show,$headings,$action,$refpage,$action);
         if ($$show{$action}) {          if ($$show{$action}) {
             if ($action eq 'handgrading') {    # UNGRADED ITEMS              if ($action eq 'handgrading') {    # UNGRADED ITEMS
                 &display_handgrade($r,$tograde,$ungraded,$itemserror);                  &display_handgrade($r,$tograde,$ungraded);
             } elsif ($action eq 'haserrors') { # BOMBS              } elsif ($action eq 'haserrors') { # BOMBS
                 &display_haserrors($r,$bombs,$bombed,$res_title,$itemserror);                  &display_haserrors($r,$bombs,$bombed,$res_title);
             } elsif ($action eq 'versionchanges') { # VERSION CHANGES              } elsif ($action eq 'versionchanges') { # VERSION CHANGES
                 &display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror);                  &display_versionchanges($r,$changed,$res_title,$interval->{'versions'});
             } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS              } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS
                 &display_abovethreshold($r,$refpage,$warnings,$triggered,                  &display_abovethreshold($r,$refpage,$warnings,$triggered,
  $res_title,$itemserror);   $res_title);
             } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION              } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION
                 &display_coursediscussion($r,$newdiscussions,$unread,                  &display_coursediscussion($r,$newdiscussions,$unread,
                                 $countunread,$res_title,$itemserror);                                  $countunread,$res_title);
             } elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES              } elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES
                 &display_coursenormalmail($r,$msgcount,$newmsgs);                  &display_coursenormalmail($r,$msgcount,$newmsgs);
             } elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES              } elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES
Line 818  sub getitems { Line 825  sub getitems {
         $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,          $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,
         $starttime,$countunread) = @_;          $starttime,$countunread) = @_;
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {  
         my $itemserror = '<span class="LC_warning">'.&mt('An error occurred retrieving information about the course.').'<br />'.&mt('It is recommended that you [_1]re-select the course[_2].','<a href="/adm/roles">','</a>').'</span>';  
         return $itemserror;  
     }  
     # force retrieve Resource to seed the part id cache we'll need it later      # force retrieve Resource to seed the part id cache we'll need it later
     my @allres=$navmap->retrieveResources(undef,      my @allres=$navmap->retrieveResources(undef,
                      sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;});                       sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;});
Line 880  sub getitems { Line 883  sub getitems {
         }          }
   
     }      }
     return;  
 }  }
   
 sub check_discussions {  sub check_discussions {
Line 1444  sub checkversions { Line 1446  sub checkversions {
 }  }
   
 sub display_handgrade {  sub display_handgrade {
     my ($r,$tograde,$ungraded,$itemserror) = @_;      my ($r,$tograde,$ungraded) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                         'prna' => 'Problem Name',                          'prna' => 'Problem Name',
                         'nmun' => 'Number ungraded',                          'nmun' => 'Number ungraded',
Line 1467  sub display_handgrade { Line 1469  sub display_handgrade {
             }               } 
             $r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>');              $r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>');
         }          }
     } elsif ($itemserror) {  
         $r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>');  
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');
     }      }
 }  }
   
 sub display_haserrors {  sub display_haserrors {
     my ($r,$bombs,$bombed,$res_title,$itemserror) = @_;      my ($r,$bombs,$bombed,$res_title) = @_;
     my $bombnum = 0;      my $bombnum = 0;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                                    reso => 'Resource',                                     reso => 'Resource',
Line 1494  sub display_haserrors { Line 1494  sub display_haserrors {
                       '</td><td class="LC_right_item">'.                        '</td><td class="LC_right_item">'.
                       $$bombed{$bomb}{errorcount}.'</td></tr>');                        $$bombed{$bomb}{errorcount}.'</td></tr>');
         }          }
     } elsif ($itemserror) {  
         $r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>');  
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'.$lt{'noer'}.'</td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'noer'}.'</td></tr>');
     }      }
Line 1503  sub display_haserrors { Line 1501  sub display_haserrors {
 }  }
   
 sub display_abovethreshold {  sub display_abovethreshold {
     my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_;      my ($r,$refpage,$warnings,$triggered,$res_title) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                  reso => 'Resource',                   reso => 'Resource',
                  part => 'Part',                   part => 'Part',
Line 1559  sub display_abovethreshold { Line 1557  sub display_abovethreshold {
             }              }
         }          }
         $r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></td></tr></form>');          $r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></td></tr></form>');
     } elsif ($itemserror) {  
         $r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>');  
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');
     }      }
 }  }
   
 sub display_versionchanges {  sub display_versionchanges {
     my ($r,$changed,$res_title,$interval,$itemserror) = @_;      my ($r,$changed,$res_title,$interval) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'reso' => 'Resource',          'reso' => 'Resource',
         'revd' => 'Last revised',          'revd' => 'Last revised',
Line 1594  sub display_versionchanges { Line 1590  sub display_versionchanges {
                       $$changed{$item}{'current'}.'</td><td>'.                        $$changed{$item}{'current'}.'</td><td>'.
                       $$changed{$item}{'version'}.'</td></tr>');                        $$changed{$item}{'version'}.'</td></tr>');
         }          }
     } elsif ($itemserror) {  
         $r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>');  
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'          $r->print('<tr class="LC_empty_row"><td>'
                  .&mt('No '.$interval).'</td></tr>');                   .&mt('No '.$interval).'</td></tr>');
Line 1661  sub display_rolechanges { Line 1655  sub display_rolechanges {
 }  }
     
 sub display_coursediscussion {  sub display_coursediscussion {
     my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_;      my ($r,$newdiscussions,$unread,$countunread,$res_title) = @_;
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                 'loca' => 'Location',                  'loca' => 'Location',
Line 1709  sub display_coursediscussion { Line 1703  sub display_coursediscussion {
             }              }
             $r->print("</tr>\n");              $r->print("</tr>\n");
         }          }
     } elsif ($itemserror) {  
         $r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>');  
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'.$lt{'noun'}.'</td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'noun'}.'</td></tr>');
     }      }
Line 1889  sub store_courseinit_setting { Line 1881  sub store_courseinit_setting {
                                            \%courseinit_settings,$udom,$uname);                                             \%courseinit_settings,$udom,$uname);
             if ($outcome eq 'ok') {              if ($outcome eq 'ok') {
                 if ($page_control eq 'global preferences') {                  if ($page_control eq 'global preferences') {
                     $result = &mt("Page displayed after role selection in $lctype now set by <b>user's global preferences</b>.");                      $result = &mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>');
                 } else {                  } else {
                     $result = &mt('Page displayed after role selection in this '.$lctype.' set to <b>[_2]</b>',$lctype,$$initpage{$env{'form.courseinit_page'}});                      $result = &mt('Page displayed after role selection in this '.$lctype.' set to [_1].'
                                    ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>');
                 }                  }
             } else {              } else {
                 &Apache::lonnet::logthis('Error saving whatsnew courseinit '.                  &Apache::lonnet::logthis('Error saving whatsnew courseinit '.
Line 1903  sub store_courseinit_setting { Line 1896  sub store_courseinit_setting {
                          '<b>'.$page_control.'</b>',                           '<b>'.$page_control.'</b>',
                          '<tt>'.$outcome.'</tt>.<br />');                           '<tt>'.$outcome.'</tt>.<br />');
                 } else {                  } else {
                     $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to <b>[_2]</b> due to <tt>[_3]</tt>.<br />',                      $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'
                          $$initpage{$env{'form.courseinit_page'}},$outcome);                                   ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>'
                                    ,'<tt>'.$outcome.'</tt>')
                                .'<br />';
                 }                  }
             }              }
         }          }

Removed from v.1.80.2.3  
changed lines
  Added in v.1.81


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