version 1.5, 2003/05/27 19:17:07
|
version 1.10, 2003/06/18 15:32:37
|
Line 58 use Apache::classcalc();
|
Line 58 use Apache::classcalc();
|
use Apache::studentcalc(); |
use Apache::studentcalc(); |
use Apache::assesscalc(); |
use Apache::assesscalc(); |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::lonmenu(); |
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use HTML::Entities(); |
use HTML::Entities(); |
Line 127 sub file_dialogs {
|
Line 126 sub file_dialogs {
|
## |
## |
## Create the save and load dialogs |
## Create the save and load dialogs |
my $filename = $spreadsheet->filename(); |
my $filename = $spreadsheet->filename(); |
$filename = '' if ($filename =~ /^default\.$sheettype/i); |
my $truefilename = $filename; |
$filename =~ s/_$sheettype$//; |
if ($spreadsheet->is_default()) { |
|
$filename = 'Default'; |
|
} |
my $save_dialog = '<nobr>'. |
my $save_dialog = '<nobr>'. |
'<input type="submit" name="save" value="Save as" /> '. |
'<input type="submit" name="save" value="Save as" /> '. |
'<input type="text" name="savefilename" size="30" value="'. |
'<input type="text" name="savefilename" size="30" value="'. |
$filename.'" />'. |
$truefilename.'" />'. |
'</nobr>'; |
'</nobr>'; |
my $makedefault_dialog = '<input type="submit" name="makedefault" '. |
my $makedefault_dialog = '<input type="submit" name="makedefault" '. |
'value="Make This Sheet the Default"/>'; |
'value="Make This Sheet the Default"/>'; |
# |
# |
my $link = '<a href="javascript:openbrowser'. |
my $link = '<a href="javascript:openbrowser'. |
"('sheet','loadfilename','spreadsheet')\">Browse</a>"; |
"('sheet','loadfilename','spreadsheet')\">Select Spreadsheet File</a>"; |
my $load_dialog = <<END; |
my $load_dialog = <<END; |
<table bgcolor="$bgcolor"> |
<table bgcolor="$bgcolor"> |
<tr><td><input type="submit" name="load" value="Load" /></td> |
<tr><td><input type="submit" name="load" value="Load" /></td> |
<td><nobr> |
<td><nobr> |
<input type="text" name="loadfilename" size="25" value="$filename" /> |
<input type="text" name="loadfilename" size="20" value="$filename" /> |
$link</nobr> |
$link</nobr> |
</td></tr> |
</td></tr> |
<tr><td> </td><td> |
<tr><td> </td><td> |
<select name="fileselect" onchange="document.sheet.loadfilename.value=document.sheet.fileselect.value" > |
<select name="fileselect" onchange="document.sheet.loadfilename.value=document.sheet.fileselect.value" > |
<option name="Default">Default</option> |
|
END |
END |
|
my $default_filename_set = 0; |
foreach my $sheetfilename ($spreadsheet->othersheets()) { |
foreach my $sheetfilename ($spreadsheet->othersheets()) { |
$sheetfilename =~ s/_$sheettype$//; |
|
$load_dialog .= ' <option name="'.$sheetfilename.'"'; |
$load_dialog .= ' <option name="'.$sheetfilename.'"'; |
if ($filename eq $sheetfilename) { |
if ($filename eq $sheetfilename) { |
$load_dialog .= ' selected'; |
$load_dialog .= ' selected'; |
|
$default_filename_set = 1; |
} |
} |
$load_dialog .= '>'.$sheetfilename."</option>\n"; |
$load_dialog .= '>'.$sheetfilename."</option>\n"; |
} |
} |
Line 313 ENDSCRIPT
|
Line 314 ENDSCRIPT
|
'<form action="'.$r->uri.'" name="sheet" method="post">'); |
'<form action="'.$r->uri.'" name="sheet" method="post">'); |
$r->print(&hiddenfield('sname' ,$ENV{'form.sname'}). |
$r->print(&hiddenfield('sname' ,$ENV{'form.sname'}). |
&hiddenfield('sdomain',$ENV{'form.sdomain'}). |
&hiddenfield('sdomain',$ENV{'form.sdomain'}). |
&hiddenfield('usymb' ,$ENV{'form.usymb'}). |
&hiddenfield('usymb' ,$ENV{'form.usymb'})); |
&Apache::lonmenu::regflush()); |
|
$r->rflush(); |
$r->rflush(); |
## |
## |
## Determine the filename to use |
## Determine the filename to use |
Line 324 ENDSCRIPT
|
Line 324 ENDSCRIPT
|
# |
# |
if (exists($ENV{'form.load'}) && exists($ENV{'form.loadfilename'})) { |
if (exists($ENV{'form.load'}) && exists($ENV{'form.loadfilename'})) { |
$filename = $ENV{'form.loadfilename'}; |
$filename = $ENV{'form.loadfilename'}; |
|
$ENV{'form.workcopy'} = 'no'; |
} |
} |
} |
} |
## |
## |
Line 345 ENDSCRIPT
|
Line 346 ENDSCRIPT
|
# error error - run in circles, scream and shout |
# error error - run in circles, scream and shout |
return; |
return; |
} |
} |
|
$spreadsheet->initialize(); |
# |
# |
# Output selector |
# Output selector |
$r->print('<input type="submit" value="Update Display" /><br />'); |
|
## |
## |
## Editing/loading/saving |
## Editing/loading/saving |
if ($allowed_to_edit) { |
if ($allowed_to_edit) { |
|
if ($ENV{'form.makedefault'}) { |
|
$spreadsheet->make_default(); |
|
} |
$r->print('<table><tr><td>'.$spreadsheet->html_header().'</td>'. |
$r->print('<table><tr><td>'.$spreadsheet->html_header().'</td>'. |
'<td valign="bottom">'. |
'<td valign="bottom">'. |
&file_dialogs($spreadsheet)."</td></tr></table>\n"); |
&file_dialogs($spreadsheet)."</td></tr></table>\n"); |
Line 360 ENDSCRIPT
|
Line 364 ENDSCRIPT
|
"</td></tr></table>\n"); |
"</td></tr></table>\n"); |
} |
} |
# |
# |
|
if (! exists($ENV{'form.not_first_run'}) && $sheettype eq 'classcalc') { |
|
$r->print('<input type="submit" value="Generate Spreadsheet" /><br />'); |
|
} |
|
# |
# Keep track of the filename |
# Keep track of the filename |
$r->print(&hiddenfield('filename',$filename)); |
$r->print(&hiddenfield('filename',$filename)); |
# |
# |
Line 372 ENDSCRIPT
|
Line 380 ENDSCRIPT
|
$r->print($spreadsheet->parent_link()); |
$r->print($spreadsheet->parent_link()); |
} |
} |
$spreadsheet->display($r); |
$spreadsheet->display($r); |
} else { |
|
$r->print("<h2>Make your selections and bonk the 'update display' button</h2>"); |
|
} |
} |
$r->print('</form></body></html>'); |
$r->print('</form></body></html>'); |
return OK; |
return OK; |