--- loncom/interface/Attic/lonspreadsheet.pm 2002/10/22 13:13:15 1.121 +++ loncom/interface/Attic/lonspreadsheet.pm 2002/10/22 13:29:57 1.122 @@ -1,5 +1,5 @@ # -# $Id: lonspreadsheet.pm,v 1.121 2002/10/22 13:13:15 matthew Exp $ +# $Id: lonspreadsheet.pm,v 1.122 2002/10/22 13:29:57 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -208,7 +208,6 @@ sub initsheet { $safeeval->deny(":base_io"); $safehole->wrap(\&Apache::lonnet::EXT,$safeeval,'&EXT'); $safehole->wrap(\&Apache::lonspreadsheet::mask,$safeeval,'&mask'); - $safehole->wrap(\&Apache::lonspreadsheet::templaterow,$safeeval,'&templaterow'); $safeeval->share('$@'); my $code=<<'ENDDEFS'; # ---------------------------------------------------- Inside of the safe space @@ -945,19 +944,42 @@ sub calc { return ''; } +# ------------------------------------------- End of "Inside of the safe space" +ENDDEFS + $safeeval->reval($code); + return $safeeval; +} + # # This is actually used for the student spreadsheet, not the assessment sheet # Do not be fooled by the name! # +sub templaterow { + my $sheet = shift; + my @cols=(); + $cols[0]='Template'; + foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M', + 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z', + 'a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z') { + my $fm=$sheet->{'f'}->{'template_'.$_}; + $fm=~s/[\'\"]/\&\#34;/g; + push(@cols,"'template_$_','$fm'".'___eq___'.$fm); + } + return @cols; +} + + sub outrowassess { # $n is the current row number + my $sheet = shift; my $n=shift; - my $csv = shift; + my $csv = $ENV{'form.showcsv'}; my @cols=(); if ($n) { - my ($usy,$ufn)=split(/__&&&\__/,$f{'A'.$n}); - if ($rowlabel{$usy}) { - $cols[0]=$rowlabel{$usy}; + my ($usy,$ufn)=split(/__&&&\__/,$sheet->{'f'}->{'A'.$n}); + if ($sheet->{'rowlabel'}->{$usy}) { + $cols[0]=$sheet->{'rowlabel'}->{$usy}; if (! $csv) { $cols[0].='
'. '