Diff for /loncom/interface/lonwhatsnew.pm between versions 1.105.2.11 and 1.105.2.12

version 1.105.2.11, 2016/08/07 02:06:00 version 1.105.2.12, 2016/10/23 21:52:26
Line 73  sub handler { Line 73  sub handler {
                             ['vcl','newroles',1],                              ['vcl','newroles',1],
                             ['vcl','oldroles',1],                              ['vcl','oldroles',1],
                             ['whn','crslogin',1],                              ['whn','crslogin',1],
                               ['mgr','resetcounters',1],
     ) {      ) {
  my ($perm,$key,$check_section) = @{ $perm_check };   my ($perm,$key,$check_section) = @{ $perm_check };
  my $scope = $env{'request.course.id'};   my $scope = $env{'request.course.id'};
Line 441  sub display_actions_box { Line 442  sub display_actions_box {
     $r->print(&Apache::loncommon::head_subbox($header));      $r->print(&Apache::loncommon::head_subbox($header));
   
     if ($command eq 'reset') {      if ($command eq 'reset') {
         $result = &process_reset($cdom,$crs);          $result = &process_reset($cdom,$crs,$checkallowed);
     } elsif ($command eq 'update') {      } elsif ($command eq 'update') {
         $result = &process_update($uname,$udom,$threshold_titles);          $result = &process_update($uname,$udom,$threshold_titles);
     } elsif ($command eq 'newinterval') {      } elsif ($command eq 'newinterval') {
Line 596  sub display_actions_box { Line 597  sub display_actions_box {
   
     my $itemserror;      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);          $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread,$checkallowed);
     }      }
     my $classlist;      my $classlist;
     if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'}) {      if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'}) {
Line 914  sub display_launcher { Line 915  sub display_launcher {
                 &display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror);                  &display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror);
             } 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,$itemserror,$checkallowed);
             } 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,$itemserror);
Line 941  sub display_launcher { Line 942  sub display_launcher {
 sub getitems {  sub getitems {
     my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions,      my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions,
         $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,          $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,
         $starttime,$countunread) = @_;          $starttime,$countunread,$checkallowed) = @_;
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {      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>';          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>';
Line 1001  sub getitems { Line 1002  sub getitems {
 # Maxtries and degree of difficulty for problem parts, unless handgradeable  # Maxtries and degree of difficulty for problem parts, unless handgradeable
         if ($$show{'abovethreshold'}) {            if ($$show{'abovethreshold'}) {  
             &check_thresholds($resource,$symb,\%resourcetracker,              &check_thresholds($resource,$symb,\%resourcetracker,
       $triggered,$threshold,$warnings);        $triggered,$threshold,$warnings,
                                 $checkallowed);
         }          }
   
     }      }
Line 1075  sub check_bombed { Line 1077  sub check_bombed {
 }  }
   
 sub check_thresholds {  sub check_thresholds {
     my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_;      my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,
           $checkallowed) = @_;
 # Compile maxtries and degree of difficulty for problem parts, unless handgradeable  # Compile maxtries and degree of difficulty for problem parts, unless handgradeable
     my @parts = @{$resource->parts()};      my @parts = @{$resource->parts()};
     my %stats;      my %stats;
Line 1141  sub check_thresholds { Line 1144  sub check_thresholds {
                      <td>'.$stats{$part}{users}.'</td>                       <td>'.$stats{$part}{users}.'</td>
                      <td>'.$stats{$part}{attempts}.'</td>                       <td>'.$stats{$part}{attempts}.'</td>
                      <td>'.$stats{$part}{degdiff}.'</td>                       <td>'.$stats{$part}{degdiff}.'</td>
                      <td>'.$lastreset{$part}.'</td>                       <td>'.$lastreset{$part}.'</td>';
                      <td><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>';                  if ($checkallowed->{'resetcounters'}) {
                       $$triggered{$symb}{text}[$partcount] .=
                           '<td><input type="checkbox" name="'.$resetname.'" />'.
                           '<input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>';
                   }
                 $partcount ++;                  $partcount ++;
             }              }
             $$triggered{$symb}{numparts} = $partcount;              $$triggered{$symb}{numparts} = $partcount;
Line 1204  sub get_current { Line 1211  sub get_current {
 }  }
   
 sub process_reset {  sub process_reset {
     my ($dom,$crs) = @_;      my ($dom,$crs,$checkallowed) = @_;
       if (!$checkallowed->{'resetcounters'}) {
           return '<b>'.&mt('You do not the required privileges to reset counters').
                  '</b><br />';
       }
     my $result = '<b>'.&mt('Counters reset for following problems (and parts):').      my $result = '<b>'.&mt('Counters reset for following problems (and parts):').
                            '</b><br />';                             '</b><br />';
     my @agg_types = ('attempts','users','correct');      my @agg_types = ('attempts','users','correct');
Line 1675  sub display_haserrors { Line 1686  sub display_haserrors {
 }  }
   
 sub display_abovethreshold {  sub display_abovethreshold {
     my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_;      my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror,$checkallowed) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                  reso => 'Resource',                   reso => 'Resource',
                  part => 'Part',                   part => 'Part',
Line 1694  sub display_abovethreshold { Line 1705  sub display_abovethreshold {
                   '<input type="hidden" name="command" value="" /></td>'.                    '<input type="hidden" name="command" value="" /></td>'.
   '<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'.    '<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'.
   '<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'.    '<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'.
   '<td>'.$lt{'lare'}.'</td><td  class="LC_right_item">'.    '<td>'.$lt{'lare'}.'</td>');
                   $lt{'reco'}.'</td></tr>');          if ($checkallowed->{'resetcounters'}) {
               $r->print('<td  class="LC_right_item">'.$lt{'reco'}.'</td>');
           }
           $r->print('</tr>');
  my $row;   my $row;
         foreach my $res (@{$warnings}) {          foreach my $res (@{$warnings}) {
     $row++;      $row++;
Line 1727  sub display_abovethreshold { Line 1741  sub display_abovethreshold {
                 }                  }
             }              }
         }          }
         $r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="button" name="counters" value="'.$lt{'rese'}.'" onclick="javascript:thresholdreset();" /></td></tr>');          if ($checkallowed->{'resetcounters'}) {
               $r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="button" name="counters" value="'.$lt{'rese'}.'" onclick="javascript:thresholdreset();" /></td></tr>');
           }
     } elsif ($itemserror) {      } elsif ($itemserror) {
         $r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>');
     } else {      } else {

Removed from v.1.105.2.11  
changed lines
  Added in v.1.105.2.12


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