version 1.149, 2002/11/22 19:21:59
|
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 965 sub templaterow {
|
Line 966 sub templaterow {
|
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z', |
'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', |
'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') { |
'n','o','p','q','r','s','t','u','v','w','x','y','z') { |
my $fm=$sheet->{'f'}->{'template_'.$_}; |
|
$fm=~s/[\'\"]/\&\#34;/g; |
|
push(@cols,{ name => 'template_'.$_, |
push(@cols,{ name => 'template_'.$_, |
formula => $fm, |
formula => $sheet->{'f'}->{'template_'.$_}, |
value => $fm }); |
value => $sheet->{'f'}->{'template_'.$_} }); |
} |
} |
return ($rowlabel,@cols); |
return ($rowlabel,@cols); |
} |
} |
Line 993 sub outrowassess {
|
Line 992 sub outrowassess {
|
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z', |
'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', |
'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') { |
'n','o','p','q','r','s','t','u','v','w','x','y','z') { |
my $fm=$sheet->{'f'}->{$_.$n}; |
|
$fm=~s/[\'\"]/\&\#34;/g; |
|
push(@cols,{ name => $_.$n, |
push(@cols,{ name => $_.$n, |
formula => $fm, |
formula => $sheet->{'f'}->{$_.$n}, |
value => $sheet->{'values'}->{$_.$n}}); |
value => $sheet->{'values'}->{$_.$n}}); |
} |
} |
return ($rowlabel,@cols); |
return ($rowlabel,@cols); |
Line 1019 sub outrow {
|
Line 1016 sub outrow {
|
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z', |
'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', |
'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') { |
'n','o','p','q','r','s','t','u','v','w','x','y','z') { |
my $fm=$sheet->{'f'}->{$_.$n}; |
|
$fm=~s/[\'\"]/\&\#34;/g; |
|
push(@cols,{ name => $_.$n, |
push(@cols,{ name => $_.$n, |
formula => $fm, |
formula => $sheet->{'f'}->{$_.$n}, |
value => $sheet->{'values'}->{$_.$n}}); |
value => $sheet->{'values'}->{$_.$n}}); |
} |
} |
return ($rowlabel,@cols); |
return ($rowlabel,@cols); |
Line 1253 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); |
} |
} |
|
# Make the formula safe for outputting |
|
$formula =~ s/\'/\"/g; |
|
# The formula will be parsed by the browser *twice* before being |
|
# displayed to the user for editing. |
|
$formula = &HTML::Entities::encode(&HTML::Entities::encode($formula)); |
|
# Escape newlines so they make it into the edit window |
$formula =~ s/\n/\\n/gs; |
$formula =~ s/\n/\\n/gs; |
$result .= '<a href="javascript:celledit(\''. |
# Glue everything together |
$name.'\',\''.$formula.'\');">'.$value.'</a>'; |
$result .= "<a href=\"javascript:celledit(\'". |
|
$name."','".$formula."');\">".$value."</a>"; |
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 1334 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 2988 sub handler {
|
Line 2992 sub handler {
|
|
|
function celledit(cellname,cellformula) { |
function celledit(cellname,cellformula) { |
var edit_text = ''; |
var edit_text = ''; |
|
// cellformula may contain less-than and greater-than symbols, so |
|
// we need to escape them? |
edit_text +='<html><head><title>Cell Edit Window</title></head><body>'; |
edit_text +='<html><head><title>Cell Edit Window</title></head><body>'; |
edit_text += '<form name="editwinform">'; |
edit_text += '<form name="editwinform">'; |
edit_text += '<center><h3>Cell '+cellname+'</h3>'; |
edit_text += '<center><h3>Cell '+cellname+'</h3>'; |
Line 3081 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'}) { |
Line 3221 ENDSCRIPT
|
Line 3228 ENDSCRIPT
|
} |
} |
$r->print('>'.$mode.'</option>'."\n"); |
$r->print('>'.$mode.'</option>'."\n"); |
} |
} |
if ($sheet->{'sheettype'} eq 'classcalc') { |
# |
$r->print('<option value="recursive excel"'); |
# Mulit-sheet excel takes too long and does not work at all for large |
if ($ENV{'form.output'} eq 'recursive excel') { |
# classes. Future inclusion of this option may be possible with the |
$r->print(' selected '); |
# Spreadsheet::WriteExcel::Big and speed improvements. |
} |
# |
$r->print(">Multi-Sheet Excel</option>\n"); |
# if ($sheet->{'sheettype'} eq 'classcalc') { |
} |
# $r->print('<option value="recursive excel"'); |
|
# if ($ENV{'form.output'} eq 'recursive excel') { |
|
# $r->print(' selected '); |
|
# } |
|
# $r->print(">Multi-Sheet Excel</option>\n"); |
|
# } |
$r->print("</select>\n"); |
$r->print("</select>\n"); |
# |
# |
if ($sheet->{'sheettype'} eq 'classcalc') { |
if ($sheet->{'sheettype'} eq 'classcalc') { |