Diff for /loncom/interface/spreadsheet/Spreadsheet.pm between versions 1.65 and 1.70

version 1.65, 2006/03/05 21:38:27 version 1.70, 2006/09/03 00:39:57
Line 60  use HTML::TokeParser; Line 60  use HTML::TokeParser;
 use Spreadsheet::WriteExcel;  use Spreadsheet::WriteExcel;
 use Time::HiRes;  use Time::HiRes;
 use Apache::lonlocal;  use Apache::lonlocal;
   use lib '/home/httpd/lib/perl/';
   use LONCAPA;
    
   
 ##  ##
 ## Package Variables  ## Package Variables
Line 85  sub new { Line 88  sub new {
     my $class = ref($this) || $this;      my $class = ref($this) || $this;
     my ($stype) = ($class =~ /Apache::(.*)$/);      my ($stype) = ($class =~ /Apache::(.*)$/);
     #      #
     my ($name,$domain,$filename,$usymb)=@_;      my ($name,$domain,$filename,$usymb,$section,$groups)=@_;
     if (defined($usymb) && ref($usymb)) {      if (defined($usymb) && ref($usymb)) {
         $usymb = $usymb->symb;          $usymb = $usymb->symb;
     }      }
Line 95  sub new { Line 98  sub new {
     if (! defined($domain) || $domain eq '') {      if (! defined($domain) || $domain eq '') {
         $domain = $env{'user.domain'};          $domain = $env{'user.domain'};
     }      }
       if (! defined($section) || $section eq '') {
           $section = &Apache::lonnet::getsection($domain,$name,
          $env{'request.course.id'});
       }
       if (! defined($groups)) {
   
           my @usersgroups = &Apache::lonnet::get_users_groups($domain,$name,
                                                       $env{'request.course.id'});
           $groups = \@usersgroups;
       }
     #      #
     my $self = {      my $self = {
         name     => $name,          name     => $name,
         domain   => $domain,          domain   => $domain,
           section  => $section,
           groups   => $groups, 
         type     => $stype,          type     => $stype,
         symb     => $usymb,          symb     => $usymb,
         errorlog => '',          errorlog => '',
Line 1271  sub html_template_row { Line 1286  sub html_template_row {
     $row_html .= '<td bgcolor="'.$importcolor.'">'.      $row_html .= '<td bgcolor="'.$importcolor.'">'.
                 &html_uneditable_cell($cell,'#FFDDDD',$allowed).'</td>';                  &html_uneditable_cell($cell,'#FFDDDD',$allowed).'</td>';
         } else {          } else {
     $row_html .= '<td bgcolor="#EOFFDD">'.      $row_html .= '<td bgcolor="#E0FFDD">'.
                 &html_editable_cell($cell,'#EOFFDD',$allowed,                  &html_editable_cell($cell,'#E0FFDD',$allowed,
                                     $self->{outputmode} eq 'source').'</td>';                                      $self->{outputmode} eq 'source').'</td>';
         }          }
     }      }
Line 1348  sub html_row { Line 1363  sub html_row {
     $row_html .= '<td bgcolor="'.$color.'">';      $row_html .= '<td bgcolor="'.$color.'">';
     $row_html .= &html_uneditable_cell($cell,'#FFDDDD');      $row_html .= &html_uneditable_cell($cell,'#FFDDDD');
  } else {   } else {
     $row_html .= '<td bgcolor="#EOFFDD">';      $row_html .= '<td bgcolor="#E0FFDD">';
     $row_html .= &html_editable_cell($cell,'#E0FFDD',$allowed,      $row_html .= &html_editable_cell($cell,'#E0FFDD',$allowed,
                                              $self->{outputmode} eq 'source');                                               $self->{outputmode} eq 'source');
  }   }
Line 1803  sub save_tmp { Line 1818  sub save_tmp {
         my %f = $self->formulas();          my %f = $self->formulas();
         while( my ($cell,$formula) = each(%f)) {          while( my ($cell,$formula) = each(%f)) {
             next if ($formula eq 'import');              next if ($formula eq 'import');
             print $fh &Apache::lonnet::escape($cell)."=".              print $fh &escape($cell)."=".
                 &Apache::lonnet::escape($formula)."\n";                  &escape($formula)."\n";
         }          }
         $fh->close();          $fh->close();
     }      }
Line 1822  sub load_tmp { Line 1837  sub load_tmp {
         while (<$spreadsheet_file>) {          while (<$spreadsheet_file>) {
     chomp;      chomp;
             my ($cell,$formula) = split(/=/);              my ($cell,$formula) = split(/=/);
             $cell    = &Apache::lonnet::unescape($cell);              $cell    = &unescape($cell);
             $formula = &Apache::lonnet::unescape($formula);              $formula = &unescape($formula);
             $formulas{$cell} = $formula;              $formulas{$cell} = $formula;
         }          }
         $spreadsheet_file->close();          $spreadsheet_file->close();

Removed from v.1.65  
changed lines
  Added in v.1.70


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