Diff for /loncom/interface/lonwhatsnew.pm between versions 1.98.2.2 and 1.98.2.3

version 1.98.2.2, 2010/08/09 23:39:43 version 1.98.2.3, 2010/08/10 03:28:53
Line 267  sub display_header { Line 267  sub display_header {
             $command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') {              $command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') {
        $scripttag = <<"END";         $scripttag = <<"END";
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
 function change_display(caller,change) {  function change_display(caller,change) {
     caller.value = change;      caller.value = change;
     document.visible.submit();      document.visible.submit();
Line 328  function togglelogins() { Line 329  function togglelogins() {
     }      }
     return;      return;
 }  }
   // ]]>
 </script>  </script>
 ';  ';
     }      }
Line 556  sub display_actions_box { Line 558  sub display_actions_box {
         $countunread = 'on';          $countunread = 'on';
     }      }
     if ($$checkallowed{'abovethreshold'}) {      if ($$checkallowed{'abovethreshold'}) {
         &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs);          &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu);
     }      }
   
     $headings{'abovethreshold'} =       if ($custommenu) {
  &mt('(Problems with av. attempts &ge; [_1] or deg. difficulty &ge; [_2]) [_3] and total number of '.$stulabel{$crstype}.' with submissions &ge; [_4]',          $headings{'abovethreshold'} = &mt('Questions with submissions');  
     $threshold{'av_attempts'},$threshold{'degdiff'},      } else {
     '<br />',$threshold{'numstudents'});          $headings{'abovethreshold'} = 
       &mt('(Problems with av. attempts &ge; [_1] or deg. difficulty &ge; [_2]) [_3] and total number of '.$stulabel{$crstype}.' with submissions &ge; [_4]',
           $threshold{'av_attempts'},$threshold{'degdiff'},
           '<br />',$threshold{'numstudents'});
       }
   
     my @actionorder;      my @actionorder;
     if ($custommenu) {      if ($custommenu) {
         @actionorder = ('coursenormalmail','coursecritmail','newroles','oldroles','crslogin');          @actionorder = ('coursenormalmail','coursecritmail','abovethreshold','newroles','oldroles','crslogin');
     } else {      } else {
         @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles');          @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles');
     }      }
Line 593  sub display_actions_box { Line 599  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,$custommenu);
     }      }
     if ($show{'coursenormalmail'}) {      if ($show{'coursenormalmail'}) {
         $msgcount = &getnormalmail(\@newmsgs);          $msgcount = &getnormalmail(\@newmsgs);
Line 621  sub display_actions_box { Line 627  sub display_actions_box {
         }          }
     }      }
   
     $r->print('<input type="hidden" name="refpage" value="'.$refpage.'" /><table class="LC_double_column"><tr><td class="LC_left_col">');      $r->print('<input type="hidden" name="refpage" value="'.$refpage.'" />');
       unless($custommenu) {
           $r->print('</form>');
       }
       $r->print('<table class="LC_double_column"><tr><td class="LC_left_col">');
   
     my $displayed = 0;      my $displayed = 0;
     my $totalboxes = 0;      my $totalboxes = 0;
Line 635  sub display_actions_box { Line 645  sub display_actions_box {
     my $halfway = 4;      my $halfway = 4;
 #    my $halfway = int($totalboxes/2) + $totalboxes%2;  #    my $halfway = int($totalboxes/2) + $totalboxes%2;
     if ($custommenu) {      if ($custommenu) {
         $halfway = 2;          $halfway = 3;
     }      }
     foreach my $actionitem (@actionorder) {      foreach my $actionitem (@actionorder) {
         if ($$checkallowed{$actionitem}) {          if ($$checkallowed{$actionitem}) {
             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,\%loggedin,$logincount);              &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,\%loggedin,$logincount,$custommenu);
             $displayed ++;               $displayed ++; 
         }          }
     }      }
     $r->print('      $r->print('
       </td></form>        </td>
     </tr>      </tr>
    </table>     </table>
 ');  ');
       if ($custommenu) {
           $r->print("</form>\n");
       }
 }  }
   
 #-------------------------------  #-------------------------------
Line 783  sub display_discussion_config { Line 796  sub display_discussion_config {
                       'off' => 'on',                        'off' => 'on',
                     );                      );
     $r->print('<script type="text/javascript">      $r->print('<script type="text/javascript">
   // <![CDATA[
 function toggle_countunread(choice) {  function toggle_countunread(choice) {
     if (choice == "unchanged") {      if (choice == "unchanged") {
         document.discussionswitch.command.value = "";          document.discussionswitch.command.value = "";
     }      }
     document.discussionswitch.submit();      document.discussionswitch.submit();
 }  }
   // ]]>
 </script>');  </script>');
     $r->print('<br />'      $r->print('<br />'
              .&mt('Choose whether or not to display a count of the number of new posts for each resource or discussion board which has unread posts.')               .&mt('Choose whether or not to display a count of the number of new posts for each resource or discussion board which has unread posts.')
Line 897  sub display_launcher { Line 912  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,$loggedin,$logincount) = @_;          $crstype,$itemserror,$loggedin,$logincount,$custommenu) = @_;
   
     if ($$checkallowed{$action}) {      if ($$checkallowed{$action}) {
         &start_box($r,$show,$headings,$action,$refpage,$action);          &start_box($r,$show,$headings,$action,$refpage,$action,$custommenu);
         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,$itemserror);
Line 910  sub display_launcher { Line 925  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,$custommenu);
             } 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 938  sub display_launcher { Line 953  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,$custommenu) = @_;
     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 998  sub getitems { Line 1013  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,$custommenu);
         }          }
   
     }      }
Line 1072  sub check_bombed { Line 1087  sub check_bombed {
 }  }
   
 sub check_thresholds {  sub check_thresholds {
     my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_;      my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,$custommenu) = @_;
 # 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 1130  sub check_thresholds { Line 1145  sub check_thresholds {
                     $$triggered{$symb}{text}[$partcount] = '                      $$triggered{$symb}{text}[$partcount] = '
                      <td>'.&mt('single part').'</td>';                       <td>'.&mt('single part').'</td>';
                 }                  }
                 $$triggered{$symb}{text}[$partcount] .= '                  if ($custommenu) {
                      <td>'.$stats{$part}{users}.'</td>                      $$triggered{$symb}{text}[$partcount] .= '
                      <td>'.$stats{$part}{attempts}.'</td>                           <td class="LC_right_item">'.$stats{$part}{users}.'</td>';
                      <td>'.$stats{$part}{degdiff}.'</td>                  } else {
                      <td>'.$lastreset{$part}.'</td>                      $$triggered{$symb}{text}[$partcount] .= '
                      <td><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>';                           <td>'.$stats{$part}{users}.'</td>
                            <td>'.$stats{$part}{attempts}.'</td>
                            <td>'.$stats{$part}{degdiff}.'</td>
                            <td>'.$lastreset{$part}.'</td>
                            <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 1146  sub check_thresholds { Line 1166  sub check_thresholds {
   
   
 sub get_curr_thresholds {  sub get_curr_thresholds {
     my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_;      my ($threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu) = @_;
       if ($custommenu) {
           %$threshold = (av_attempts => 0,
                     degdiff => 0.00000000000000,
                     numstudents => 1
                     );
           return;
       }
     # set default values      # set default values
     %$threshold = (av_attempts => 2,      %$threshold = (av_attempts => 2,
                   degdiff => 0.5,                    degdiff => 0.5,
Line 1658  sub display_haserrors { Line 1685  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,$custommenu) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                  reso => 'Resource',                   reso => 'Resource',
                  part => 'Part',                   part => 'Part',
Line 1672  sub display_abovethreshold { Line 1699  sub display_abovethreshold {
     );      );
     if (@{$warnings} > 0) {      if (@{$warnings} > 0) {
         @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings};          @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings};
         $r->print('<form name="reset_tracking" method="post" action="/adm/whatsnew">'.          if ($custommenu) {
               my (%bynum,@overthresh);
               foreach my $item (@{$warnings}) {
                   my ($probnum) = ($res_title->{$item} =~ /^Problem\s+(\d+)$/);
                   if ($probnum ne '') {
                       $bynum{$probnum} = $item;
                   }
               }
               foreach my $num (sort { $a <=> $b } keys(%bynum)) {
                   push(@overthresh,$bynum{$num});
               }
               @{$warnings} = @overthresh;
           }
           if ($custommenu) {
               $r->print('<tr class="LC_info_row">'.
                         '<td class="LC_left_item">'.$lt{'reso'}.'</td>'.
                         '<td>'.$lt{'part'}.'</td><td class="LC_right_item">'.$lt{'nust'}.'</td></tr>');
           } else {
               $r->print('<form name="reset_tracking" method="post" action="/adm/whatsnew">'.
                 ' <input type="hidden" name="command" value="reset" />'."\n".                  ' <input type="hidden" name="command" value="reset" />'."\n".
                 ' <input type="hidden" name="refpage" value="'.$refpage.'" />'.                  ' <input type="hidden" name="refpage" value="'.$refpage.'" />'.
                 "\n");                  "\n");
         $r->print('<tr class="LC_info_row">'.              $r->print('<tr class="LC_info_row">'.
   '<td class="LC_left_item">'.$lt{'reso'}.'</td>'.        '<td class="LC_left_item">'.$lt{'reso'}.'</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><td  class="LC_right_item">'.
                   $lt{'reco'}.'</td></tr>');                        $lt{'reco'}.'</td></tr>');
           }
  my $row;   my $row;
         foreach my $res (@{$warnings}) {          foreach my $res (@{$warnings}) {
     $row++;      $row++;
Line 1713  sub display_abovethreshold { Line 1759  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>');          unless ($custommenu) {
               $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) {      } 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 {
Line 1824  sub display_crslogins { Line 1872  sub display_crslogins {
         'number' => 'Total number of logins',          'number' => 'Total number of logins',
     );      );
     if ($logincount) {      if ($logincount) {
         $r->print('<tr class="LC_info_row" style="display:none" id="logintitledet">'.        
           my $hdr = '<tr class="LC_info_row" style="display:none" id="logintitledet">'.
                   '<td class="LC_left_item">'.$lt{'user'}.'</td>'.                    '<td class="LC_left_item">'.$lt{'user'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'role'}.'</td>'.                    '<td class="LC_left_item">'.$lt{'role'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'sec'}.'</td></tr>'.                    '<td class="LC_left_item">'.$lt{'sec'}.'</td></tr>'.
                   '<tr class="LC_info_row" id="logintitlesum">'.                    '<tr class="LC_info_row" id="logintitlesum">'.
                   '<td class="LC_left_item">'.$lt{'number'}.'</td>'.                    '<td class="LC_left_item">'.$lt{'number'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'role'}.'</td>'.                    '<td class="LC_left_item">'.$lt{'role'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'sec'}.'</td></tr>');                    '<td class="LC_left_item">'.$lt{'sec'};
         my (%bylastname,%counts);          my (%bylastname,%counts);
         if (ref($loggedin) eq 'HASH') {          if (ref($loggedin) eq 'HASH') {
             my @logins = sort { $b <=> $a } (keys(%{$loggedin}));              my @logins = sort { $b <=> $a } (keys(%{$loggedin}));
Line 1863  sub display_crslogins { Line 1912  sub display_crslogins {
                     }                      }
                 }                  }
             }              }
               my $table;
             foreach my $person (sort(keys(%bylastname))) {              foreach my $person (sort(keys(%bylastname))) {
                 if (ref($bylastname{$person}) eq 'ARRAY') {                   if (ref($bylastname{$person}) eq 'ARRAY') { 
                     foreach my $item (@{$bylastname{$person}}) {                       foreach my $item (@{$bylastname{$person}}) { 
                         $numlogin ++;                          $numlogin ++;
                         my $css_class = $numlogin%2?' class="LC_odd_row"':'';                          my $css_class = $numlogin%2?' class="LC_odd_row"':'';
                         $r->print('<tr'.$css_class.' style="display:none;"  id="logindet_'.$numlogin.'">'.$item.'</td></tr>');                           $table .= '<tr'.$css_class.' style="display:none;"  id="logindet_'.$numlogin.'">'.$item.'</tr>'; 
                     }                      }
                 }                  }
             }              }
Line 1879  sub display_crslogins { Line 1929  sub display_crslogins {
                     foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) {                      foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) {
                         $numrow ++;                          $numrow ++;
                         my $css_class = $numrow%2?' class="LC_odd_row"':'';                          my $css_class = $numrow%2?' class="LC_odd_row"':'';
                         $r->print('<tr '.$css_class.' id="loginsum_'.$numrow.'">'.                          $table .= '<tr '.$css_class.' id="loginsum_'.$numrow.'">'.
                                   '<td>'.$counts{$role}{$sec}.'</td>'.                                    '<td>'.$counts{$role}{$sec}.'</td>'.
                                   '<td>'.$showrole.'</td>'.                                    '<td>'.$showrole.'</td>'.
                                   '<td>'.$sec.'</td></tr>');                                    '<td>'.$sec.'</td></tr>';
                    }                     }
                 }                  }
             }              }
             $r->print('<input type="hidden" name="logincount" value="'.$numlogin.              $r->print($hdr.'<input type="hidden" name="logincount" value="'.$numlogin.
                       '" /><input type="hidden" name="loginrow" value="'.$numrow.                        '" /><input type="hidden" name="loginrow" value="'.$numrow.
                       '" />');                        '" /></td></tr>'.$table);
         }          }
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'.          $r->print('<tr class="LC_empty_row"><td>'.
Line 2157  sub store_courseinit_setting { Line 2207  sub store_courseinit_setting {
 }  }
   
 sub start_box {  sub start_box {
     my ($r,$show,$heading,$caller,$refpage) = @_;      my ($r,$show,$heading,$caller,$refpage,$action,$custommenu) = @_;
     my %lt = &Apache::lonlocal::texthash(       my %lt = &Apache::lonlocal::texthash( 
                        chth => 'Change thresholds?',                         chth => 'Change thresholds?',
                        chin => 'Change interval?',                         chin => 'Change interval?',
Line 2182  sub start_box { Line 2232  sub start_box {
            <th class="LC_right_item">'.$showhide.'</th>             <th class="LC_right_item">'.$showhide.'</th>
           </tr>');            </tr>');
      if (($caller eq 'abovethreshold') && ($$show{$caller})) {       if (($caller eq 'abovethreshold') && ($$show{$caller})) {
          if ($$show{$caller}) {           if ($$show{$caller} && !$custommenu) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&amp;refpage='.$refpage.'">'.$lt{'chth'}.'</a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&amp;refpage='.$refpage.'">'.$lt{'chth'}.'</a></td>

Removed from v.1.98.2.2  
changed lines
  Added in v.1.98.2.3


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