Diff for /loncom/interface/spreadsheet/classcalc.pm between versions 1.29 and 1.32

version 1.29, 2008/10/23 09:07:57 version 1.32, 2014/02/12 16:53:09
Line 91  sub html_header { Line 91  sub html_header {
         $toprow .= '<th align="center"><b>'.&mt($name).'</b></th>';          $toprow .= '<th align="center"><b>'.&mt($name).'</b></th>';
         $bottomrow .= '<td>'.$selector.'</td>';          $bottomrow .= '<td>'.$selector.'</td>';
     }      }
     my $status .= '<p><span class="LC_nobreak">'  
                  .&mt('Status: [_1]',  
                           '<input type="text" name="spreadsheet_status"'  
                          .' size="60" value="" readonly="readonly" />')  
                  .'</span></p>';  
   
     return "<p>\n<table>\n".      return "<p>\n<table>\n".
         "<tr>".$toprow."</tr>\n".          "<tr>".$toprow."</tr>\n".
         "<tr>".$bottomrow."</tr>\n".          "<tr>".$bottomrow."</tr>\n".
         "</table>\n".$status."\n".          "</table>\n".
         "</p>";          "</p>";
 }  }
   
Line 322  sub outsheet_htmlclasslist { Line 316  sub outsheet_htmlclasslist {
     #      #
     if ($show_expire_link) {      if ($show_expire_link) {
         $r->print('<a href="/adm/classcalc?output_format=htmlclasslist&'.          $r->print('<a href="/adm/classcalc?output_format=htmlclasslist&'.
                   'recalc=ilovewastingtime&not_first_run=1">'.                    'recalc=expireallsheets&not_first_run=1">'.
                   &mt('Expire all student spreadsheets').'</a>'.$/);                    &mt('Expire all student spreadsheets').'</a>'.$/);
     }      }
     #      #
     $r->print('<h3>'.      $r->print('<p class="LC_info">'.
               &mt('Click on a student to be taken to their spreadsheet').                &mt('Click on a student to be taken to their spreadsheet').
               '</h3>');                '</p>');
     #      #
     my %header=&Apache::lonlocal::texthash(      my %header=&Apache::lonlocal::texthash(
                                            'student'      => 'Student',                                             'student'      => 'Student',
Line 363  END Line 357  END
     $r->print("</table>\n".$tableheader);      $r->print("</table>\n".$tableheader);
  }   }
         my $link = '<a href="/adm/studentcalc?sname='.$student->{'username'}.          my $link = '<a href="/adm/studentcalc?sname='.$student->{'username'}.
             '&sdomain='.$student->{'domain'}.'">';              '&amp;sdomain='.$student->{'domain'}.'">';
         $student->{'section'} = 'none' if ($student->{'section'} eq '-1');          $student->{'section'} = 'none' if ($student->{'section'} eq '-1');
  $r->print('<tr>'.   $r->print('<tr>'.
                   '<td>'.$num_output.'</td>'.                    '<td>'.$num_output.'</td>'.
Line 376  END Line 370  END
         if ($show_expire_link) {          if ($show_expire_link) {
             $r->print('<td>'.              $r->print('<td>'.
                       '<a href="/adm/classcalc?recalc=student:'.                        '<a href="/adm/classcalc?recalc=student:'.
                       $student->{'username'}.':'.$student->{'domain'}.'&'.                        $student->{'username'}.':'.$student->{'domain'}.'&amp;'.
                       'output_format=htmlclasslist&'.                        'output_format=htmlclasslist&amp;'.
                       'not_first_run=1'.'">Expire Record</a>'.$/);                        'not_first_run=1'.'">'.&mt('Expire Record').'</a>'.$/);
         }          }
         $r->print("</tr>\n");          $r->print("</tr>\n");
     }      }
Line 386  END Line 380  END
     return;      return;
 }  }
   
 sub update_status {  
     my ($r,$message) = @_;  
     $r->print('<script>'.  
               'window.document.sheet.spreadsheet_status.value="'.  
               $message.  
               '";</script>');  
     $r->rflush();  
     return;  
 }  
   
 sub compute {  sub compute {
     my $self = shift;      my $self = shift;
     my ($r) = @_;      my ($r) = @_;
Line 404  sub compute { Line 388  sub compute {
     $self->initialize_safe_space();      $self->initialize_safe_space();
     my %c = $self->constants();      my %c = $self->constants();
     my %f = $self->formulas();      my %f = $self->formulas();
     &update_status($r,'Initializing Course Structure');  
     &Apache::studentcalc::initialize_package();      &Apache::studentcalc::initialize_package();
     my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin      my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,scalar(@Students));
         ($r,&mt('Spreadsheet Computation Status'),      &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Processing first student'));
          &mt('Spreadsheet Computation'), scalar(@Students),'inline',undef,  
          'sheet','spreadsheet_status');  
     &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,  
                                           &mt('Processing first student'));  
     foreach my $student (@Students) {      foreach my $student (@Students) {
         if ($connection->aborted()) { $self->cleanup(); return; }          if ($connection->aborted()) { $self->cleanup(); return; }
         my $sname = $student->{'username'}.':'.$student->{'domain'};          my $sname = $student->{'username'}.':'.$student->{'domain'};
Line 437  sub compute { Line 416  sub compute {
                 $c{$cell} = $data;                  $c{$cell} = $data;
             }              }
  }   }
         &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,          &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
                                                  'last student');  
     }      }
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);      &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
     &update_status($r,'Done computing student sheets');  
     $r->rflush();      $r->rflush();
     $self->constants(\%c);      $self->constants(\%c);
     $self->formulas(\%f);      $self->formulas(\%f);
     $self->calcsheet();      $self->calcsheet();
     $self->save() if ($self->need_to_save());      $self->save() if ($self->need_to_save());
     &update_status($r,'Done!');  
 }  }
   
 1;  1;

Removed from v.1.29  
changed lines
  Added in v.1.32


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