version 1.151, 2002/12/02 16:39:30
|
version 1.152, 2002/12/02 21:22:39
|
Line 62 use Safe;
|
Line 62 use Safe;
|
use Safe::Hole; |
use Safe::Hole; |
use Opcode; |
use Opcode; |
use GDBM_File; |
use GDBM_File; |
|
use HTML::Entities(); |
use HTML::TokeParser; |
use HTML::TokeParser; |
use Spreadsheet::WriteExcel; |
use Spreadsheet::WriteExcel; |
|
|
Line 1247 sub html_editable_cell {
|
Line 1248 sub html_editable_cell {
|
if ($formula ne '') { |
if ($formula ne '') { |
$value = '<i>undefined value</i>'; |
$value = '<i>undefined value</i>'; |
} |
} |
} |
} elsif ($value =~ /^\s*$/ ) { |
if ($value =~ /^\s*$/ ) { |
|
$value = '<font color="'.$bgcolor.'">#</font>'; |
$value = '<font color="'.$bgcolor.'">#</font>'; |
|
} else { |
|
$value = &HTML::Entities::encode($value); |
} |
} |
&Apache::lonnet::logthis($name.' formula = '.$formula) if ($formula); |
# Make the formula safe for outputting |
$formula =~ s/</\</g; |
$formula =~ s/\'/\"/g; |
$formula =~ s/>/\>/g; |
# The formula will be parsed by the browser *twice* before being |
$formula =~ s/\&/\&/g; |
# displayed to the user for editing. |
$formula =~ s/\"/\"/g; |
$formula = &HTML::Entities::encode(&HTML::Entities::encode($formula)); |
$formula =~ s/\'/\"/g; |
# Escape newlines so they make it into the edit window |
$formula =~ s/\n/\\n/gs; |
$formula =~ s/\n/\\n/gs; |
&Apache::lonnet::logthis($name.' formula = '.$formula) if ($formula); |
# Glue everything together |
$result .= "<a href=\"javascript:celledit(\'". |
$result .= "<a href=\"javascript:celledit(\'". |
$name."','".$formula."');\">".$value."</a>"; |
$name."','".$formula."');\">".$value."</a>"; |
&Apache::lonnet::logthis('result = '.$result) if ($formula); |
|
return $result; |
return $result; |
} |
} |
|
|
sub html_uneditable_cell { |
sub html_uneditable_cell { |
my ($cell,$bgcolor) = @_; |
my ($cell,$bgcolor) = @_; |
my $value = (defined($cell) ? $cell->{'value'} : ''); |
my $value = (defined($cell) ? $cell->{'value'} : ''); |
|
$value = &HTML::Entities::encode($value); |
return ' '.$value.' '; |
return ' '.$value.' '; |
} |
} |
|
|
Line 1336 END
|
Line 1338 END
|
#################################### |
#################################### |
# Print out summary/export row |
# Print out summary/export row |
#################################### |
#################################### |
my ($rowlabel,@rowdata) = &get_row($sheet,'0'); |
($rowlabel,@rowdata) = &get_row($sheet,'0'); |
$row_html = '<tr><td>'.&format_html_rowlabel($sheet,$rowlabel).'</td>'; |
$row_html = '<tr><td>'.&format_html_rowlabel($sheet,$rowlabel).'</td>'; |
$num_cols_output = 0; |
$num_cols_output = 0; |
foreach my $cell (@rowdata) { |
foreach my $cell (@rowdata) { |
Line 3085 ENDSCRIPT
|
Line 3087 ENDSCRIPT
|
if ($ENV{'form.unewfield'}) { |
if ($ENV{'form.unewfield'}) { |
$r->print('<h2>Modified Workcopy</h2>'); |
$r->print('<h2>Modified Workcopy</h2>'); |
$ENV{'form.unewformula'}=~s/\'/\"/g; |
$ENV{'form.unewformula'}=~s/\'/\"/g; |
$r->print('<p>New formula: '.$ENV{'form.unewfield'}.'='. |
$r->print('<p>Cell '.$ENV{'form.unewfield'}.' = <pre>'); |
$ENV{'form.unewformula'}.'<p>'); |
$r->print(&HTML::Entities::encode($ENV{'form.unewformula'}). |
|
'</pre></p>'); |
$sheet->{'filename'} = $ENV{'form.ufn'}; |
$sheet->{'filename'} = $ENV{'form.ufn'}; |
&tmpread($sheet,$ENV{'form.unewfield'},$ENV{'form.unewformula'}); |
&tmpread($sheet,$ENV{'form.unewfield'},$ENV{'form.unewformula'}); |
} elsif ($ENV{'form.saveas'}) { |
} elsif ($ENV{'form.saveas'}) { |