version 1.27, 2003/10/11 14:04:54
|
version 1.38, 2004/06/08 15:55:38
|
Line 72 use HTML::Entities();
|
Line 72 use HTML::Entities();
|
|
|
sub textfield { |
sub textfield { |
my ($title,$name,$value)=@_; |
my ($title,$name,$value)=@_; |
return "\n<p><b>$title:</b><br>". |
return "\n<p><b>$title:</b><br />". |
'<input type=text name="'.$name.'" size=80 value="'.$value.'">'; |
'<input type=text name="'.$name.'" size=80 value="'.$value.'" />'; |
} |
} |
|
|
sub hiddenfield { |
sub hiddenfield { |
Line 83 sub hiddenfield {
|
Line 83 sub hiddenfield {
|
|
|
sub selectbox { |
sub selectbox { |
my ($title,$name,$value,%options)=@_; |
my ($title,$name,$value,%options)=@_; |
my $selout="\n<p><b>$title:</b><br>".'<select name="'.$name.'">'; |
my $selout="\n<p><b>$title:</b><br />".'<select name="'.$name.'">'; |
foreach (sort keys(%options)) { |
foreach (sort keys(%options)) { |
$selout.='<option value="'.$_.'"'; |
$selout.='<option value="'.$_.'"'; |
if ($_ eq $value) { $selout.=' selected'; } |
if ($_ eq $value) { $selout.=' selected'; } |
Line 162 sub file_dialogs {
|
Line 162 sub file_dialogs {
|
END |
END |
my $default_filename_set = 0; |
my $default_filename_set = 0; |
foreach my $sheetfilename ($spreadsheet->othersheets()) { |
foreach my $sheetfilename ($spreadsheet->othersheets()) { |
$load_dialog .= ' <option name="'.$sheetfilename.'"'; |
$load_dialog .= ' <option value="'.$sheetfilename.'"'; |
if ($filename eq $sheetfilename) { |
if ($filename eq $sheetfilename) { |
$load_dialog .= ' selected'; |
$load_dialog .= ' selected'; |
$default_filename_set = 1; |
$default_filename_set = 1; |
Line 227 sub handler {
|
Line 227 sub handler {
|
} |
} |
my $courseid = $ENV{'request.course.id'}; |
my $courseid = $ENV{'request.course.id'}; |
# |
# |
# Do not allow students to continue if standard grading is in effect. |
# Do not allow students to continue if standard or external grading is in |
|
# effect. |
|
# |
if ($ENV{'request.role'} =~ /^st\./) { |
if ($ENV{'request.role'} =~ /^st\./) { |
if ($ENV{'course.'.$courseid.'.grading'} eq 'standard') { |
if ($ENV{'course.'.$courseid.'.grading'} eq 'standard' || |
|
$ENV{'course.'.$courseid.'.grading'} eq 'external' ) { |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
} |
} |
Line 237 sub handler {
|
Line 240 sub handler {
|
# Get query string for limited number of parameters |
# Get query string for limited number of parameters |
# |
# |
&Apache::loncommon::get_unprocessed_cgi |
&Apache::loncommon::get_unprocessed_cgi |
($ENV{'QUERY_STRING'},['sname','sdomain','usymb','filename','recalc']); |
($ENV{'QUERY_STRING'},['sname','sdomain','usymb','filename','recalc', |
|
'output_format','not_first_run']); |
# |
# |
# Deal with restricted student permissions |
# Deal with restricted student permissions |
# |
# |
Line 253 sub handler {
|
Line 257 sub handler {
|
$symb = $ENV{'form.usymb'} if (exists($ENV{'form.usymb'})); |
$symb = $ENV{'form.usymb'} if (exists($ENV{'form.usymb'})); |
my $name = $ENV{'user.name'}; |
my $name = $ENV{'user.name'}; |
my $domain = $ENV{'user.domain'}; |
my $domain = $ENV{'user.domain'}; |
if (exists($ENV{'form.sname'})) { |
if (exists($ENV{'form.sname'}) && $ENV{'form.sname'} ne '') { |
$name = $ENV{'form.sname'}; |
$name = $ENV{'form.sname'}; |
$domain = $ENV{'form.sdomain'}; |
$domain = $ENV{'form.sdomain'}; |
} |
} |
|
$ENV{'form.sname'} = $name; |
|
$ENV{'form.sdomain'} = $domain; |
## |
## |
## Check permissions |
## Check permissions |
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
Line 321 sub handler {
|
Line 327 sub handler {
|
my $extra_javascript = |
my $extra_javascript = |
&Apache::loncommon::browser_and_searcher_javascript(); |
&Apache::loncommon::browser_and_searcher_javascript(); |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script language="JavaScript"> |
<script type="text/javascript"> |
|
//<!-- |
$extra_javascript |
$extra_javascript |
|
|
var editwin; |
var editwin; |
Line 355 sub handler {
|
Line 361 sub handler {
|
editwin.close(); |
editwin.close(); |
} |
} |
|
|
editwin = window.open($nothing,'CellEditWin','height=280,width=480,scrollbars=no,resizeable=yes,alwaysRaised=yes,dependent=yes',true); |
editwin = window.open($nothing,'CellEditWin','height=280,width=480,scrollbars=no,resizable=yes,alwaysRaised=yes,dependent=yes',true); |
editwin.document.write(edit_text); |
editwin.document.write(edit_text); |
} |
} |
|
//--> |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
} |
} |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href => $r->uri, |
|
title => 'Spreadsheet', |
|
text => 'Spreadsheet', |
|
faq => 134, |
|
bug => 'Spreadsheet'}); |
$r->print('</head>'.&Apache::loncommon::bodytag('Grades Spreadsheet'). |
$r->print('</head>'.&Apache::loncommon::bodytag('Grades Spreadsheet'). |
|
&Apache::lonhtmlcommon::breadcrumbs(undef,'Spreadsheet'). |
'<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'}). |
Line 385 ENDSCRIPT
|
Line 400 ENDSCRIPT
|
&Apache::loncoursedata::delete_caches($ENV{'requres.course.id'}); |
&Apache::loncoursedata::delete_caches($ENV{'requres.course.id'}); |
} |
} |
if ($ENV{'form.recalc'} eq 'ilovewastingtime') { |
if ($ENV{'form.recalc'} eq 'ilovewastingtime') { |
&Apache::lonnet::logthis('ilovewastingtime'); |
&Apache::lonnet::logthis('spreadsheet expired: entire course'); |
# expire ALL spreadsheets |
# expire ALL spreadsheets |
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','assesscalc'); |
&Apache::lonnet::expirespread('','','assesscalc'); |
|
$r->print('<h3>'. |
|
&mt('Expired spreadsheet caches for all students'). |
|
'</h3>'); |
} elsif ($ENV{'form.recalc'} =~ /^symb:/) { |
} elsif ($ENV{'form.recalc'} =~ /^symb:/) { |
# expire for all students on this symb |
# expire for all students on this symb |
my ($symb) = ($ENV{'form.recalc'} =~ /^symb:(.*)$/); |
my ($symb) = ($ENV{'form.recalc'} =~ /^symb:(.*)$/); |
&Apache::lonnet::logthis('symb = '.$symb); |
&Apache::lonnet::logthis('spreadsheet expired: symb = '.$symb); |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','studentcalc'); |
|
$r->print('<h3>'. |
|
&mt('Expired spreadsheet caches for all students for symb [_1]', |
|
$symb). |
|
'</h3>'); |
} elsif ($ENV{'form.recalc'} =~ /^student:/) { |
} elsif ($ENV{'form.recalc'} =~ /^student:/) { |
# expire all assessment spreadsheets for this user |
# expire all assessment spreadsheets for this user |
my ($sname,$sdom) = ($ENV{'form.recalc'}=~/^student:(.*):(.*)$/); |
my ($sname,$sdom) = ($ENV{'form.recalc'}=~/^student:(.*):(.*)$/); |
&Apache::lonnet::logthis('student = '.$sname.':'.$sdom); |
&Apache::lonnet::logthis('spreadsheet expired: student = '. |
|
$sname.'@'.$sdom); |
if (defined($sname) && defined($sdom)) { |
if (defined($sname) && defined($sdom)) { |
&Apache::lonnet::expirespread($sname,$sdom,'assesscalc'); |
&Apache::lonnet::expirespread($sname,$sdom,'assesscalc'); |
&Apache::lonnet::expirespread($sname,$sdom,'studentcalc'); |
&Apache::lonnet::expirespread($sname,$sdom,'studentcalc'); |
|
$r->print('<h3>'. |
|
&mt('Expired spreadsheet caches for student [_1]', |
|
$sname.'@'.$sdom). |
|
'</h3>'); |
} |
} |
} |
} |
} |
} |
Line 446 ENDSCRIPT
|
Line 473 ENDSCRIPT
|
} |
} |
$action_message .= '.'; |
$action_message .= '.'; |
} |
} |
$r->print('<table><tr><td>'.$spreadsheet->html_header().'</td>'. |
$r->print('<table><tr><td valign="top">'. |
'<td valign="bottom">'.$html."</td></tr></table>\n"); |
$spreadsheet->html_header(). |
|
'</td>'. |
|
'<td valign="center">'.$html."</td></tr></table>\n"); |
if ($action_message ne '') { |
if ($action_message ne '') { |
$r->print(<<END); |
$r->print(<<END); |
<table> |
<table> |
Line 466 END
|
Line 495 END
|
$r->rflush(); |
$r->rflush(); |
# |
# |
$r->print("<table><tr>"); |
$r->print("<table><tr>"); |
if ($sheettype eq 'classcalc') { |
$r->print('<td><input type="submit" value="'. |
$r->print('<td><input type="submit" value="'. |
&mt('Generate Spreadsheet').'" />'. |
&mt('Generate Spreadsheet').'" />'. |
'</td>'); |
'</td>'); |
|
} |
|
if ($allowed_to_view) { |
if ($allowed_to_view) { |
$r->print('<td>'. |
$r->print('<td>'. |
&Apache::loncommon::help_open_topic("Spreadsheet_About", |
&Apache::loncommon::help_open_topic("Spreadsheet_About", |