Diff for /loncom/interface/spreadsheet/Spreadsheet.pm between versions 1.21 and 1.21.2.1

version 1.21, 2003/08/26 19:14:06 version 1.21.2.1, 2003/12/05 22:24:20
Line 659  sub calc { Line 659  sub calc {
             return $lastcalc.': Maximum calculation depth exceeded';              return $lastcalc.': Maximum calculation depth exceeded';
         }          }
     }      }
     return '';      return 'okay';
 }  }
   
 # ------------------------------------------- End of "Inside of the safe space"  # ------------------------------------------- End of "Inside of the safe space"
Line 1121  sub calcsheet { Line 1121  sub calcsheet {
 #    $self->logthis($self->get_errorlog());  #    $self->logthis($self->get_errorlog());
     %{$self->{'values'}} = %{$self->{'safe'}->varglob('sheet_values')};      %{$self->{'values'}} = %{$self->{'safe'}->varglob('sheet_values')};
 #    $self->logthis($self->get_errorlog());  #    $self->logthis($self->get_errorlog());
       if ($result ne 'okay') {
           $self->set_calcerror($result);
       }
     return $result;      return $result;
 }  }
   
   
   sub set_badcalc {
       my $self = shift();
       $self->{'badcalc'} =1;
       return;
   }
   
   sub badcalc {
       my $self = shift;
       if (exists($self->{'badcalc'}) && $self->{'badcalc'}) {
           return 1;
       } else {
           return 0;
       }
   }
   
   sub set_calcerror {
       my $self = shift;
       if (@_) {
           $self->set_badcalc();
           if (exists($self->{'calcerror'})) {
               $self->{'calcerror'}.="\n".$_[0];
           } else {
               $self->{'calcerror'}.=$_[0];
           }
       }
   }
   
   sub calcerror {
       my $self = shift;
       if ($self->badcalc()) {
           if (exists($self->{'calcerror'})) {
               return $self->{'calcerror'};
           }
       }
       return;
   }
   
   
 ###########################################################  ###########################################################
 ##  ##
 ## Output Helpers  ## Output Helpers
Line 1150  sub display { Line 1192  sub display {
 ############################################  ############################################
 ##         HTML output routines           ##  ##         HTML output routines           ##
 ############################################  ############################################
   sub html_report_error {
       my $self = shift();
       my $Str = '';
       if ($self->badcalc()) {
           $Str = '<h3 style="color:red">'.
               'An error occurred while calculating this spreadsheet'.
               "</h3>\n".
               '<pre>'.$self->calcerror()."</pre>\n";
       }
       return $Str;
   }
   
 sub html_export_row {  sub html_export_row {
     my $self = shift();      my $self = shift();
     my ($color) = @_;      my ($color) = @_;
Line 1365  sub outsheet_excel { Line 1419  sub outsheet_excel {
     #      #
     # Close the excel file      # Close the excel file
     $workbook->close();      $workbook->close();
       $r->print($self->html_report_error());
     #      #
     # Write a link to allow them to download it      # Write a link to allow them to download it
     $r->print('<br />'.      $r->print('<br />'.
Line 1405  sub outsheet_csv   { Line 1460  sub outsheet_csv   {
     #      #
     # Close the csv file      # Close the csv file
     close($file);      close($file);
       $r->print($self->html_report_error());
     $r->print('<br /><br />'.      $r->print('<br /><br />'.
               '<a href="'.$filename.'">Your CSV spreadsheet.</a>'."\n");                '<a href="'.$filename.'">Your CSV spreadsheet.</a>'."\n");
     #      #

Removed from v.1.21  
changed lines
  Added in v.1.21.2.1


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