--- loncom/interface/spreadsheet/Spreadsheet.pm 2005/12/08 02:22:15 1.60
+++ loncom/interface/spreadsheet/Spreadsheet.pm 2006/02/27 19:36:20 1.63
@@ -1,5 +1,5 @@
#
-# $Id: Spreadsheet.pm,v 1.60 2005/12/08 02:22:15 albertel Exp $
+# $Id: Spreadsheet.pm,v 1.63 2006/02/27 19:36:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -378,10 +378,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;
}
@@ -1193,12 +1195,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 +1247,12 @@ sub html_export_row {
foreach my $cell (@rowdata) {
if ($cell->{'name'} =~ /^[A-Z]/) {
$row_html .= '
'.
- &html_editable_cell($cell,$color,$allowed).' | ';
+ &html_editable_cell($cell,$color,$allowed,
+ $self->{outputmode} eq 'source').'';
} else {
$row_html .= ''.
- &html_editable_cell($cell,'#DDCCFF',$allowed).' | ';
+ &html_editable_cell($cell,'#DDCCFF',$allowed,
+ $self->{outputmode} eq 'source').'';
}
}
return $row_html;
@@ -1261,14 +1272,15 @@ sub html_template_row {
&html_uneditable_cell($cell,'#FFDDDD',$allowed).'';
} else {
$row_html .= ''.
- &html_editable_cell($cell,'#EOFFDD',$allowed).' | ';
+ &html_editable_cell($cell,'#EOFFDD',$allowed,
+ $self->{outputmode} eq 'source').'';
}
}
return $row_html;
}
sub html_editable_cell {
- my ($cell,$bgcolor,$allowed) = @_;
+ my ($cell,$bgcolor,$allowed,$showsource) = @_;
my $result;
my ($name,$formula,$value);
if (defined($cell)) {
@@ -1278,7 +1290,13 @@ sub html_editable_cell {
}
$name = '' if (! defined($name));
$formula = '' if (! defined($formula));
- if (! defined($value)) {
+ if ($showsource) {
+ if (!defined($formula) || $formula =~ /^\s*$/) {
+ $value = '#';
+ } else {
+ $value = &HTML::Entities::encode($formula, '<>&"');
+ }
+ } elsif (! defined($value)) {
$value = '#';
if ($formula ne '') {
$value = 'undefined value';
@@ -1331,7 +1349,8 @@ sub html_row {
$row_html .= &html_uneditable_cell($cell,'#FFDDDD');
} else {
$row_html .= '';
- $row_html .= &html_editable_cell($cell,'#E0FFDD',$allowed);
+ $row_html .= &html_editable_cell($cell,'#E0FFDD',$allowed,
+ $self->{outputmode} eq 'source');
}
$row_html .= ' | ';
}
@@ -1355,6 +1374,8 @@ sub output_options {
description => 'HTML'},
{value => 'excel',
description => 'Excel'},
+ {value => 'source',
+ description => 'Show Source'},
# {value => 'xml',
# description => 'XML'},
{value => 'csv',