--- loncom/interface/spreadsheet/Spreadsheet.pm 2005/10/12 21:48:32 1.57 +++ loncom/interface/spreadsheet/Spreadsheet.pm 2006/04/06 16:43:49 1.66 @@ -1,5 +1,5 @@ # -# $Id: Spreadsheet.pm,v 1.57 2005/10/12 21:48:32 albertel Exp $ +# $Id: Spreadsheet.pm,v 1.66 2006/04/06 16:43:49 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,7 +85,7 @@ sub new { my $class = ref($this) || $this; my ($stype) = ($class =~ /Apache::(.*)$/); # - my ($name,$domain,$filename,$usymb)=@_; + my ($name,$domain,$filename,$usymb,$section)=@_; if (defined($usymb) && ref($usymb)) { $usymb = $usymb->symb; } @@ -95,10 +95,15 @@ sub new { if (! defined($domain) || $domain eq '') { $domain = $env{'user.domain'}; } + if (! defined($section) || $section eq '') { + $section = &Apache::lonnet::getsection($domain,$name, + $env{'request.course.id'}); + } # my $self = { name => $name, domain => $domain, + section => $section, type => $stype, symb => $usymb, errorlog => '', @@ -378,10 +383,12 @@ Calls the system EXT function to determi #------------------------------------------------------- sub EXT { - my ($parameter) = @_; + my ($parameter,$specific_symb) = @_; return '' if (! defined($parameter) || $parameter eq ''); $parameter =~ s/^parameter\./resource\./; - my $value = &Apache::lonnet::EXT($parameter,$symb,$domain,$name,$usection); + if ($specific_symb eq '') { $specific_symb = $symb; } + my $value = &Apache::lonnet::EXT($parameter,$specific_symb,$domain,$name, + $usection); return $value; } @@ -697,7 +704,7 @@ sub get_values { } return \@values; } else { - $num = '(\d+)'; + $num = '([1-9]\d*)'; } if (($la eq '*') || ($ua eq '*')) { $alpha='[A-z]'; @@ -806,7 +813,7 @@ sub expandnamed { $result.=$thissum.'+'; } $result=~s/\+$//; - return $result; + return '('.$result.')'; } else { return 0; } @@ -1193,12 +1200,19 @@ sub display { last; } } + $self->{outputmode} = $outputmode; if ($outputmode eq 'html') { $self->compute($r); $self->outsheet_html($r); } elsif ($outputmode eq 'htmlclasslist') { # No computation neccessary... This is kludgy $self->outsheet_htmlclasslist($r); + } elsif ($outputmode eq 'source') { + # No computation necessary. Rumor has it that this is some + # sort of kludge w.r.t. not "computing". It's also + # a bit of of a kludge that we call "outsheet_html" and + # let the 'outputmode' cause the outputting of source. + $self->outsheet_html($r); } elsif ($outputmode eq 'excel') { $self->compute($r); $self->outsheet_excel($r); @@ -1238,10 +1252,12 @@ sub html_export_row { foreach my $cell (@rowdata) { if ($cell->{'name'} =~ /^[A-Z]/) { $row_html .= '