Diff for /loncom/interface/spreadsheet/assesscalc.pm between versions 1.28 and 1.34

version 1.28, 2003/11/11 15:36:28 version 1.34, 2004/11/02 20:48:02
Line 368  sub parmval { Line 368  sub parmval {
   
 sub get_html_title {  sub get_html_title {
     my $self = shift;      my $self = shift;
     my ($assess_title,$name,$time) = $self->get_title();      my ($assess_title,$name,$time) = $self->get_full_title();
     my $title = '<h1>'.$assess_title.'</h1>'.      my $title = '<h1>'.$assess_title.'</h1>'.
         '<h2>'.$name.', '.          '<h2>'.$name.', '.
         &Apache::loncommon::aboutmewrapper          &Apache::loncommon::aboutmewrapper
Line 380  sub get_html_title { Line 380  sub get_html_title {
   
 sub get_title {  sub get_title {
     my $self = shift;      my $self = shift;
     my @title = ();  
     if (($self->{'symb'} eq '_feedback') ||      if (($self->{'symb'} eq '_feedback') ||
         ($self->{'symb'} eq '_evaluation') ||          ($self->{'symb'} eq '_evaluation') ||
         ($self->{'symb'} eq '_discussion') ||          ($self->{'symb'} eq '_discussion') ||
         ($self->{'symb'} eq '_tutoring')) {          ($self->{'symb'} eq '_tutoring')) {
         my $assess_title = ucfirst($self->{'symb'});          my $assess_title = ucfirst($self->{'symb'});
         $assess_title =~ s/^_//;          $assess_title =~ s/^_//;
         push(@title,$assess_title);          return $assess_title;
     } else {      } else {
         push(@title,&Apache::lonnet::gettitle($self->{'symb'}));          return &Apache::lonnet::gettitle($self->{'symb'});
     }      }
   }
   
   sub get_full_title {
       my $self = shift;
       my @title = ($self->get_title());
     # Look up the users identifying information      # Look up the users identifying information
     # Get the users information      # Get the users information
     my %userenv = &Apache::loncoursedata::GetUserName($self->{'name'},      my $name = &Apache::loncommon::plainname($self->{'name'},
                                                       $self->{'domain'});       $self->{'domain'});
     my $name =   
         join(' ',@userenv{'firstname','middlename','lastname','generation'});  
     $name =~ s/\s+$//;  
     push (@title,$name);      push (@title,$name);
     push (@title,&Apache::lonlocal::locallocaltime(time));      push (@title,&Apache::lonlocal::locallocaltime(time));
     return @title;      return @title;
Line 415  sub parent_link { Line 416  sub parent_link {
 sub outsheet_html {  sub outsheet_html {
     my $self = shift;      my $self = shift;
     my ($r) = @_;      my ($r) = @_;
       ####################################
       # Report any calculation errors    #
       ####################################
       $r->print($self->html_report_error());
     ###################################      ###################################
     # Determine table structure      # Determine table structure
     ###################################      ###################################
Line 523  sub csv_rows { Line 528  sub csv_rows {
     # writes the meat of the spreadsheet to an excel worksheet.  Called      # writes the meat of the spreadsheet to an excel worksheet.  Called
     # by Spreadsheet::outsheet_excel;      # by Spreadsheet::outsheet_excel;
     my $self = shift;      my $self = shift;
     my ($filehandle) = @_;      my ($connection,$filehandle) = @_;
     #      #
     # Write a header row      # Write a header row
     $self->csv_output_row($filehandle,undef,      $self->csv_output_row($filehandle,undef,
Line 546  sub excel_rows { Line 551  sub excel_rows {
     # writes the meat of the spreadsheet to an excel worksheet.  Called      # writes the meat of the spreadsheet to an excel worksheet.  Called
     # by Spreadsheet::outsheet_excel;      # by Spreadsheet::outsheet_excel;
     my $self = shift;      my $self = shift;
     my ($worksheet,$cols_output,$rows_output) = @_;      my ($connection,$worksheet,$cols_output,$rows_output) = @_;
       return if (! ref($worksheet));
     #      #
     # Write a header row      # Write a header row
     $cols_output = 0;      $cols_output = 0;
     foreach my $value ('Parameter','Description','Value') {      foreach my $value ('Parameter','Description','Value') {
         $worksheet->write($rows_output,$cols_output++,&mt($value));          $worksheet->write($rows_output,$cols_output++,$value);
     }      }
     $rows_output++;          $rows_output++;    
     #      #
Line 772  sub compute { Line 778  sub compute {
     while (my ($parm,$value) = each(%parameters)) {      while (my ($parm,$value) = each(%parameters)) {
         my $cell = 'A'.$self->get_row_number_from_key($parm);          my $cell = 'A'.$self->get_row_number_from_key($parm);
         $f{$cell} = $parm;          $f{$cell} = $parm;
         $value = '"'.$value.'"' if ($value =~/[^0-9.]/);          if ($parm =~ /_submission$/ && $value =~ /(\{|\})/) {
               $value = 'witheld';
           }
           $value = 'q{'.$value.'}' if ($value =~/([^\d\.]|\.\.)/);
         $c{$parm} = $value;          $c{$parm} = $value;
     }      }
     $self->formulas(\%f);      $self->formulas(\%f);
Line 864  sub load_cached_export_rows { Line 873  sub load_cached_export_rows {
         # We only got one key, so we will access it directly.          # We only got one key, so we will access it directly.
         while (my ($key,$sheetdata) = each(%tmp)) {          while (my ($key,$sheetdata) = each(%tmp)) {
             my ($sname,$sdom,$sheettype,$symb) = split(':',$key);              my ($sname,$sdom,$sheettype,$symb) = split(':',$key);
               if (! defined($sname) || $sname eq '' ||
                   ! defined($sdom)  || $sdom eq '' ) {
                   next;
               }
             if ($symb =~ /\.time$/) {              if ($symb =~ /\.time$/) {
                 $symb =~ s/\.time$//;                  $symb =~ s/\.time$//;
                 $Exportrows{$symb}->{'time'} = $sheetdata;                  $Exportrows{$symb}->{'time'} = $sheetdata;
Line 907  sub export_data { Line 920  sub export_data {
         $self->compute($r);          $self->compute($r);
     }      }
     if ($connection->aborted()) { $self->cleanup(); return; }      if ($connection->aborted()) { $self->cleanup(); return; }
     my @Data = @{$Exportrows{$symb}->{$self->{'filename'}}};      my @Data;
     if ($Data[0] =~ /^(.*)___=___/) {      if ($self->badcalc()) {
         $self->{'sheetname'} = $1;          @Data = ();
         $Data[0] =~ s/^(.*)___=___//;      } else {
     }          @Data = @{$Exportrows{$symb}->{$self->{'filename'}}};
     for (my $i=0;$i<$#Data;$i++) {          if ($Data[0] =~ /^(.*)___=___/) {
         $Data[$i]="'".$Data[$i]."'" if ($Data[$i]=~/\D/ && defined($Data[$i]));              $self->{'sheetname'} = $1;
               $Data[0] =~ s/^(.*)___=___//;
           }
           for (my $i=0;$i<$#Data;$i++) {
               if ($Data[$i]=~/\D/ && defined($Data[$i])) {
                   $Data[$i]="'".$Data[$i]."'";
               }
           }
     }      }
     return @Data;      return @Data;
 }  }
Line 936  sub save_export_data { Line 956  sub save_export_data {
     return if ($self->temporary());      return if ($self->temporary());
     my $student = $self->{'name'}.':'.$self->{'domain'};      my $student = $self->{'name'}.':'.$self->{'domain'};
     my $symb    = $self->{'symb'};      my $symb    = $self->{'symb'};
       if ($self->badcalc()){
           # do not save data away when calculations have not been done properly.
           delete($Exportrows{$symb});
           return;
       }
     if (! exists($Exportrows{$symb}) ||       if (! exists($Exportrows{$symb}) || 
         ! exists($Exportrows{$symb}->{$self->{'filename'}})) {          ! exists($Exportrows{$symb}->{$self->{'filename'}})) {
         return;          return;

Removed from v.1.28  
changed lines
  Added in v.1.34


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