--- loncom/interface/spreadsheet/Spreadsheet.pm 2006/01/10 16:38:47 1.61 +++ loncom/interface/spreadsheet/Spreadsheet.pm 2006/04/06 20:24:13 1.67 @@ -1,5 +1,5 @@ # -# $Id: Spreadsheet.pm,v 1.61 2006/01/10 16:38:47 albertel Exp $ +# $Id: Spreadsheet.pm,v 1.67 2006/04/06 20:24:13 raeburn 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,$group)=@_; if (defined($usymb) && ref($usymb)) { $usymb = $usymb->symb; } @@ -95,10 +95,25 @@ 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'}); + } + if (! defined($group) || $group eq '') { + my $grouplist = &Apache::lonnet::get_users_groups($domain,$name, + $env{'request.course.id'}); + if ($grouplist) { + my @groups = &Apache::lonnet::sort_course_groups($grouplist, + $env{'request.course.id'}); + $group = $groups[0]; + } + } # my $self = { name => $name, domain => $domain, + section => $section, + group => $group, type => $stype, symb => $usymb, errorlog => '', @@ -808,7 +823,7 @@ sub expandnamed { $result.=$thissum.'+'; } $result=~s/\+$//; - return $result; + return '('.$result.')'; } else { return 0; } @@ -1195,12 +1210,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); @@ -1240,10 +1262,12 @@ sub html_export_row { foreach my $cell (@rowdata) { if ($cell->{'name'} =~ /^[A-Z]/) { $row_html .= '