[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet classcalc.pm lonspreadsheet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 08 Jun 2004 15:55:39 -0000


matthew		Tue Jun  8 11:55:39 2004 EDT

  Modified files:              
    /loncom/interface/spreadsheet	classcalc.pm lonspreadsheet.pm 
  Log:
  Modified to use inline progress window.
  
  
Index: loncom/interface/spreadsheet/classcalc.pm
diff -u loncom/interface/spreadsheet/classcalc.pm:1.20 loncom/interface/spreadsheet/classcalc.pm:1.21
--- loncom/interface/spreadsheet/classcalc.pm:1.20	Fri Jun  4 17:43:36 2004
+++ loncom/interface/spreadsheet/classcalc.pm	Tue Jun  8 11:55:38 2004
@@ -1,5 +1,5 @@
 #
-# $Id: classcalc.pm,v 1.20 2004/06/04 21:43:36 matthew Exp $
+# $Id: classcalc.pm,v 1.21 2004/06/08 15:55:38 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -90,10 +90,16 @@
         $toprow .= '<th align="center"><b>'.&mt($name).'</b></th>';
         $bottomrow .= '<td>'.$selector.'</td>';
     }
+    my $status .= '<nobr>'.&mt('Status: [_1]',
+                            '<input type="text" '.
+                            'name="spreadsheet_status" size="60" value="" />'
+                            ).'</nobr>';
+
     return "<p>\n<table>\n".
         "<tr>".$toprow."</tr>\n".
         "<tr>".$bottomrow."</tr>\n".
-        "</table>\n</p>";
+        "</table>\n".$status."\n".
+        "</p>";
 }
 
 sub get_title {
@@ -368,6 +374,16 @@
     return;
 }
 
+sub update_status {
+    my ($r,$message) = @_;
+    $r->print('<script>'.
+              'window.document.sheet.spreadsheet_status.value="'.
+              $message.
+              '";</script>');
+    $r->rflush();
+    return;
+}
+
 sub compute {
     my $self = shift;
     my ($r) = @_;
@@ -376,10 +392,12 @@
     $self->initialize_safe_space();
     my %c = $self->constants();
     my %f = $self->formulas();
+    &update_status($r,'Initializing Course Structure');
     &Apache::studentcalc::initialize_package();
     my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
         ($r,&mt('Spreadsheet Computation Status'),
-         &mt('Spreadsheet Computation'), scalar(@Students));
+         &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) {
@@ -410,11 +428,13 @@
                                                  'last student');
     }
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
+    &update_status($r,'Done computing student sheets');
     $r->rflush();
     $self->constants(\%c);
     $self->formulas(\%f);
     $self->calcsheet();
     $self->save() if ($self->need_to_save());
+    &update_status($r,'Done!');
 }
 
 1;
Index: loncom/interface/spreadsheet/lonspreadsheet.pm
diff -u loncom/interface/spreadsheet/lonspreadsheet.pm:1.37 loncom/interface/spreadsheet/lonspreadsheet.pm:1.38
--- loncom/interface/spreadsheet/lonspreadsheet.pm:1.37	Mon Apr 26 10:06:00 2004
+++ loncom/interface/spreadsheet/lonspreadsheet.pm	Tue Jun  8 11:55:38 2004
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.37 2004/04/26 14:06:00 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.38 2004/06/08 15:55:38 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -473,8 +473,10 @@
             }
             $action_message .= '.';
         }
-        $r->print('<table><tr><td>'.$spreadsheet->html_header().'</td>'.
-                  '<td valign="bottom">'.$html."</td></tr></table>\n");
+        $r->print('<table><tr><td valign="top">'.
+                  $spreadsheet->html_header().
+                  '</td>'.
+                  '<td valign="center">'.$html."</td></tr></table>\n");
         if ($action_message ne '') {
             $r->print(<<END);
 <table>