Diff for /loncom/interface/lonwhatsnew.pm between versions 1.14 and 1.16

version 1.14, 2005/05/24 15:54:19 version 1.16, 2005/06/03 19:33:37
Line 105  sub display_main_box { Line 105  sub display_main_box {
                          degdiff => 'Degree of difficulty',                           degdiff => 'Degree of difficulty',
                          numstudents => 'Total number of students with submissions',                           numstudents => 'Total number of students with submissions',
     );      );
       my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
   
     if ($command eq 'chgthreshold') {      if ($command eq 'chgthreshold') {
         &display_config_box($r,$command,$tabbg,\%threshold_titles);          &display_config_box($r,$command,$tabbg,\%threshold_titles,$cdom,$crs);
     } else {      } else {
         &display_actions_box($r,$command,\%threshold_titles);          &display_actions_box($r,$command,\%threshold_titles,$cdom,$crs);
     }      }
     $r->print(<<END_OF_BLOCK);      $r->print(<<END_OF_BLOCK);
   </td>    </td>
Line 146  ENDHEAD Line 149  ENDHEAD
 #-------------------------------  #-------------------------------
                                                                                                                                                                   
 sub display_actions_box() {  sub display_actions_box() {
     my ($r,$command,$threshold_titles) = @_;      my ($r,$command,$threshold_titles,$cdom,$crs) = @_;
   
     my $rowColor1 = "#ffffff";      my $rowColor1 = "#ffffff";
     my $rowColor2 = "#eeeeee";      my $rowColor2 = "#eeeeee";
Line 162  sub display_actions_box() { Line 165  sub display_actions_box() {
     my @tograde = ();      my @tograde = ();
     my @bombs = ();      my @bombs = ();
     my @warnings = ();      my @warnings = ();
       my %res_title = ();
   
     my $domain=&Apache::loncommon::determinedomain();      my $domain=&Apache::loncommon::determinedomain();
     my $function;      my $function;
Line 187  sub display_actions_box() { Line 191  sub display_actions_box() {
     }      }
   
     my $result;      my $result;
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};  
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};  
   
     if ($command eq 'reset') {      if ($command eq 'reset') {
         $result = &process_reset($cdom,$crs);          $result = &process_reset($cdom,$crs);
Line 200  sub display_actions_box() { Line 202  sub display_actions_box() {
     }      }
   
     &get_curr_thresholds(\%threshold,$cdom,$crs);      &get_curr_thresholds(\%threshold,$cdom,$crs);
     &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs);      &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,%res_title);
     my ($msgcount,$critmsgcount) = &getmail(\@newmsgs,\@critmsgs);      my ($msgcount,$critmsgcount) = &getmail(\@newmsgs,\@critmsgs);
   
     $r->print('<br /><table border="0" width="100%" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">');      $r->print('<br /><table border="0" width="100%" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">');
Line 254  END Line 256  END
      my $bombnum = 0;       my $bombnum = 0;
      if (@bombs > 0) {       if (@bombs > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>Resource</small></b></td><td align="right"><b><small>Number of errors</small></b></td></tr>');          $r->print('<tr bgcolor="#cccccc"><td><b><small>Resource</small></b></td><td align="right"><b><small>Number of errors</small></b></td></tr>');
 #        @bombs = sort { &cmp_title($a,$b) } @bombs;          @bombs = sort { &cmp_title($a,$b,\%res_title) } @bombs;
         foreach my $bomb (@bombs) {          foreach my $bomb (@bombs) {
             if ($bombnum %2 == 1) {              if ($bombnum %2 == 1) {
                  $rowColor = $rowColor1;                   $rowColor = $rowColor1;
Line 283  END Line 285  END
                </tr>                 </tr>
                 <tr>                  <tr>
                 <td bgcolor="#ffffff">                  <td bgcolor="#ffffff">
                  <table width="100%" cellspacing="0" cellpadding="0" border="0">                   <table width="100%" cellspacing="2" cellpadding="2" border="0">
 END  END
     my $warningnum = 0;      my $warningnum = 0;
     if (@warnings > 0) {      if (@warnings > 0) {
 #        @warnings = sort { &cmp_title($a,$b) } @warnings;          @warnings = sort { &cmp_title($a,$b,\%res_title) } @warnings;
         $r->print('<form name="reset_tracking" method="post">'.          $r->print('<form name="reset_tracking" method="post">'.
                  '  <input type="hidden" name="action" value="reset" />'."\n");                   '  <input type="hidden" name="action" value="reset" />'."\n");
         $r->print('<tr bgcolor="#cccccc"><td><b><small>Resource</small></b></td><td align="right"><b><small>Part</small></b></td><td align="right"><b><small>Num. students</small></b></td><td align="right"><b><small>Av. Attempts</small></b></td><td align="right"><b><small>Deg. Diff</small></b></td><td align="right"><b><small>Last Reset</small></b></td><td align="right"><b><small>Reset Count?</small></b></td></tr>');          $r->print('<tr bgcolor="#cccccc"><td><b><small>Resource</small></b></td><td align="right"><b><small>Part</small></b></td><td align="right"><b><small>Num. students</small></b></td><td align="right"><b><small>Av. Attempts</small></b></td><td align="right"><b><small>Deg. Diff</small></b></td><td align="right"><b><small>Last Reset</small></b></td><td align="right"><b><small>Reset Count?</small></b></td></tr>');
Line 330  END Line 332  END
                                                                                                                                                                       
     if (@newdiscussions > 0) {      if (@newdiscussions > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>Location</small></b></td><td><b><small>Type</small></b><td align="right"><b><small>Number of new posts</small></b></td></tr>');          $r->print('<tr bgcolor="#cccccc"><td><b><small>Location</small></b></td><td><b><small>Type</small></b><td align="right"><b><small>Number of new posts</small></b></td></tr>');
 #        @newdiscussions = sort { &cmp_title($a,$b) } @newdiscussions;          @newdiscussions = sort { &cmp_title($a,$b,\%res_title) } @newdiscussions;
         my $rowNum = 0;          my $rowNum = 0;
         foreach my $ressymb (@newdiscussions) {          foreach my $ressymb (@newdiscussions) {
             my $forum_title = $unread{$ressymb}{'title'};              my $forum_title = $unread{$ressymb}{'title'};
Line 437  END Line 439  END
 #-------------------------------  #-------------------------------
                                                                                                                                                                   
 sub display_config_box() {  sub display_config_box() {
     my ($r,$command,$tabbg,$threshold_titles) = @_;      my ($r,$command,$tabbg,$threshold_titles,$cdom,$crs) = @_;
     my %threshold = ();      my %threshold = ();
     my $rowColor1 = "#ffffff";      my $rowColor1 = "#ffffff";
     my $rowColor2 = "#eeeeee";      my $rowColor2 = "#eeeeee";
Line 449  sub display_config_box() { Line 451  sub display_config_box() {
                          degdiff => 'Degree of difficulty',                           degdiff => 'Degree of difficulty',
                          numstudents => 'Total number of students with submissions',                           numstudents => 'Total number of students with submissions',
                          );                           );
     &get_curr_thresholds(\%threshold);      &get_curr_thresholds(\%threshold,$cdom,$crs);
   
     $r->print('<br /><form name="thresholdform" method="post"><table border="0" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">      $r->print('<br /><form name="thresholdform" method="post"><table border="0" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">
            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">             <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
Line 495  sub display_config_box() { Line 497  sub display_config_box() {
 }  }
   
 sub getitems {  sub getitems {
     my ($unread,$ungraded,$bombed,$triggered,$newdiscussions,$tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs) = @_;      my ($unread,$ungraded,$bombed,$triggered,$newdiscussions,$tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs,$res_title) = @_;
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     my @allres=$navmap->retrieveResources();      my @allres=$navmap->retrieveResources();
     my %discussiontime = &Apache::lonnet::dump('discussiontimes',$cdom,$crs);      my %discussiontime = &Apache::lonnet::dump('discussiontimes',$cdom,$crs);
Line 507  sub getitems { Line 509  sub getitems {
   
     my %resourcetracker =  &Apache::lonnet::dump('nohist_resourcetracker',      my %resourcetracker =  &Apache::lonnet::dump('nohist_resourcetracker',
                $cdom,$crs);                 $cdom,$crs);
     my %res_title;  
     my $warningnum = 0;      my $warningnum = 0;
     foreach my $key (keys(%lastread)) {      foreach my $key (keys(%lastread)) {
         my $newkey = $key;          my $newkey = $key;
Line 523  sub getitems { Line 524  sub getitems {
         %{$$triggered{$symb}} = ();          %{$$triggered{$symb}} = ();
         $$triggered{$symb}{numparts} = 0;          $$triggered{$symb}{numparts} = 0;
         my $title = $resource->compTitle();          my $title = $resource->compTitle();
         $res_title{$symb} = $title;          $$res_title{$symb} = $title;
         my $ressymb = $resource->wrap_symb();          my $ressymb = $resource->wrap_symb();
 # Check for unread discussion postings  # Check for unread discussion postings
         if (defined($discussiontime{$ressymb})) {          if (defined($discussiontime{$ressymb})) {
Line 616  sub getitems { Line 617  sub getitems {
             }              }
             if ($users > 0) {              if ($users > 0) {
                 $av_attempts = $attempts/$users;                  $av_attempts = $attempts/$users;
                   $av_attempts = sprintf("%.2f",$av_attempts);
             }              }
             if ((($degdiff ne '' && $degdiff >= $$threshold{'degdiff'}) || ($av_attempts ne '' && $av_attempts >= $$threshold{'av_attempts'})) && ($users >= $$threshold{'numstudents'})) {              if ((($degdiff ne '' && $degdiff >= $$threshold{'degdiff'}) || ($av_attempts ne '' && $av_attempts >= $$threshold{'av_attempts'})) && ($users >= $$threshold{'numstudents'})) {
                 $stats{$part}{degdiff} = $degdiff;                  $stats{$part}{degdiff} = $degdiff;
Line 668  sub get_counter_resets { Line 670  sub get_counter_resets {
     my $lastreset = 'None';      my $lastreset = 'None';
     if ($$resethash{'version'}) {      if ($$resethash{'version'}) {
         for (my $version=1;$version<=$$resethash{'version'};$version++) {          for (my $version=1;$version<=$$resethash{'version'};$version++) {
             if (exists($$resethash{$version.':'.$part.'prev_attempts'})) {              if (exists($$resethash{$version.':'.$part."\0".'prev_attempts'})) {
                  $lastreset = $$resethash{$version.':timestamp'};                  $lastreset = $$resethash{$version.':timestamp'};
             }              }
         }          }
     }      }
Line 737  sub process_reset { Line 739  sub process_reset {
   
 sub process_update {  sub process_update {
     my ($dom,$crs,$threshold_titles) = @_;      my ($dom,$crs,$threshold_titles) = @_;
     my $setoutput = '<b>Changes to threshold(s):</b><br />';      my $setoutput = '<b>Changes to threshold(s) for problem tracking:</b><br />';
     foreach (keys %env) {      foreach (keys %env) {
         next if ($_!~/^form\.(.+)\_setparmval$/);          next if ($_!~/^form\.(.+)\_setparmval$/);
         my $name  = $1;          my $name  = $1;
Line 823  sub getmail { Line 825  sub getmail {
 }  }
   
 sub cmp_title {  sub cmp_title {
     my ($atitle,$btitle) = (lc($_[0]->compTitle),lc($_[1]->compTitle));      my ($a,$b,$res_title) = @_;
       my ($atitle,$btitle) = (lc($$res_title{$a}),lc($$res_title{$b}));
     $atitle=~s/^\s*//;      $atitle=~s/^\s*//;
     $btitle=~s/^\s*//;      $btitle=~s/^\s*//;
     return $atitle cmp $btitle;      return $atitle cmp $btitle;

Removed from v.1.14  
changed lines
  Added in v.1.16


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