version 1.55.6.1, 2011/10/09 00:28:03
|
version 1.66, 2020/08/10 19:28:21
|
Line 64 use Apache::lonnet;
|
Line 64 use Apache::lonnet;
|
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::loncoursedata(); |
use Apache::loncoursedata(); |
|
use Apache::lonquickgrades(); |
use HTML::Entities(); |
use HTML::Entities(); |
|
|
## |
## |
Line 203 END
|
Line 204 END
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
# |
# |
# Overload checking |
|
# |
|
# Check this server |
|
my $loaderror=&Apache::lonnet::overloaderror($r); |
|
if ($loaderror) { return $loaderror; } |
|
# Check the course homeserver |
|
$loaderror= &Apache::lonnet::overloaderror($r, |
|
$env{'course.'.$env{'request.course.id'}.'.home'}); |
|
# if ($loaderror) { return $loaderror; } |
|
# |
|
# HTML Header |
# HTML Header |
# |
# |
if ($r->header_only) { |
if ($r->header_only) { |
Line 250 sub handler {
|
Line 241 sub handler {
|
} |
} |
|
|
# |
# |
|
# Check if display of course gradebook is blocked |
|
# |
|
|
|
if ($env{'request.course.id'}) { |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my ($blocked,$blocktext) = |
|
&Apache::loncommon::blocking_status('grades',$cnum,$cdom); |
|
if ($blocked) { |
|
my $checkrole = "cm./$cdom/$cnum"; |
|
if ($env{'request.course.sec'} ne '') { |
|
$checkrole .= "/$env{'request.course.sec'}"; |
|
} |
|
unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) && |
|
($env{'request.role'} !~ m{^st\./$cdom/$cnum})) { |
|
&Apache::lonquickgrades::grades_blocked($r,$blocktext,'spreadsheet'); |
|
return OK; |
|
} |
|
} |
|
} |
|
|
|
# |
# Do not allow users without vgr or mgr priv to continue unless |
# Do not allow users without vgr or mgr priv to continue unless |
# grading type is set to spreadsheet. |
# grading type is set to spreadsheet. |
# |
# |
|
|
if ((!$allowed_to_view) && (!$allowed_to_edit)) { |
if ((!$allowed_to_view) && (!$allowed_to_edit)) { |
Line 354 sub handler {
|
Line 367 sub handler {
|
## |
## |
my $js; |
my $js; |
if ($allowed_to_edit) { |
if ($allowed_to_edit) { |
my %lt=( |
my %lt=&Apache::lonlocal::texthash( |
'ce' => 'Cell', |
'ce' => 'Cell', |
'ac' => 'Accept', |
'ac' => 'Save', |
'dc' => 'Discard Changes' |
'dc' => 'Cancel' |
); |
); |
my $extra_javascript = |
my $extra_javascript = |
&Apache::loncommon::browser_and_searcher_javascript(); |
&Apache::loncommon::browser_and_searcher_javascript(); |
Line 386 sub handler {
|
Line 399 sub handler {
|
// cellformula may contain less-than and greater-than symbols, so |
// cellformula may contain less-than and greater-than symbols, so |
// we need to escape them? |
// we need to escape them? |
edit_text +='$cell_edit_start'; |
edit_text +='$cell_edit_start'; |
edit_text += '<form name="editwinform">'; |
edit_text += '<form name="editwinform" action="">'; |
edit_text += '<center><h3>$lt{'ce'} '+cellname+'</h3>'; |
edit_text += '<center><h3>$lt{'ce'} '+cellname+'</h3>'; |
edit_text += '<textarea id="LC_newformula" name="newformula" '; |
edit_text += '<textarea id="LC_newformula" name="newformula" '; |
edit_text += ' cols="60" rows="12"; wrap="off" style="width:100%">'; |
edit_text += ' cols="60" rows="12"; wrap="off" style="width:100%">'; |
edit_text += cellformula+'</textarea>'; |
edit_text += cellformula+'</textarea>'; |
edit_text += '<div id="LC_aftertextarea"><br />'; |
edit_text += '<div id="LC_aftertextarea"><br />'; |
edit_text += '<input type="button" name="accept" value="$lt{'ac'}"'; |
edit_text += '<input type="button" name="accept" value="$lt{'ac'}"'; |
edit_text += ' onClick=\\\'javascript:'; |
edit_text += ' onclick=\\\'javascript:'; |
edit_text += 'opener.document.sheet.cell.value='; |
edit_text += 'opener.document.sheet.cell.value='; |
edit_text += '"'+cellname+'";'; |
edit_text += '"'+cellname+'";'; |
edit_text += 'opener.document.sheet.newformula.value='; |
edit_text += 'opener.document.sheet.newformula.value='; |
Line 403 sub handler {
|
Line 416 sub handler {
|
edit_text += ' '; |
edit_text += ' '; |
edit_text += '<input type="button" name="abort" '; |
edit_text += '<input type="button" name="abort" '; |
edit_text += 'value="$lt{'dc'}"'; |
edit_text += 'value="$lt{'dc'}"'; |
edit_text += ' onClick="javascript:self.close()" />'; |
edit_text += ' onclick="javascript:self.close()" />'; |
edit_text += '</center></div></form>$cell_edit_end'; |
edit_text += '</center></div></form>$cell_edit_end'; |
|
|
if (editwin != null && !(editwin.closed) ) { |
if (editwin != null && !(editwin.closed) ) { |
Line 425 ENDSCRIPT
|
Line 438 ENDSCRIPT
|
text => 'Spreadsheet', |
text => 'Spreadsheet', |
faq => 134, |
faq => 134, |
bug => 'Spreadsheet'}); |
bug => 'Spreadsheet'}); |
my $settingslink = &Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'), |
|
'grading'); |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool('advtools',$settingslink); |
|
$r->print(&Apache::loncommon::start_page('Grades Spreadsheet',$js). |
$r->print(&Apache::loncommon::start_page('Grades Spreadsheet',$js). |
&Apache::lonhtmlcommon::breadcrumbs('Spreadsheet', |
&Apache::lonhtmlcommon::breadcrumbs('Spreadsheet', |
'Spreadsheet_About')); |
'Spreadsheet_About')); |
|
|
# |
# |
# Open the form |
# Tabs |
|
# |
|
&Apache::lonquickgrades::startGradeScreen($r,'spreadsheet'); |
|
|
# |
# |
|
# Open the form |
|
# |
if ($warning) { |
if ($warning) { |
$r->print('<p class="LC_info">'.$warning.'</p>'); |
$r->print('<p class="LC_info">'.$warning.'</p>'); |
} |
} |
Line 459 ENDSCRIPT
|
Line 475 ENDSCRIPT
|
if (exists($env{'form.recalc'})) { |
if (exists($env{'form.recalc'})) { |
&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 'expireallsheets') { |
&Apache::lonnet::logthis('spreadsheet expired: entire course'); |
&Apache::lonnet::logthis('spreadsheet expired: entire course'); |
# expire ALL spreadsheets |
# expire ALL spreadsheets |
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','studentcalc'); |
Line 541 ENDSCRIPT
|
Line 557 ENDSCRIPT
|
'</td>'. |
'</td>'. |
'<td valign="center">'.$html."</td></tr></table>\n"); |
'<td valign="center">'.$html."</td></tr></table>\n"); |
if ($action_message ne '') { |
if ($action_message ne '') { |
$r->print(<<END); |
$r->print( |
<table> |
&Apache::loncommon::confirmwrapper( |
<tr><td valign="top"><b>Last Action:</b></td> |
&mt('Last Action:') |
<td> </td> |
.$action_message) |
<td>$action_message</td> |
); |
</tr> |
|
</table> |
|
END |
|
} |
} |
$r->rflush(); |
$r->rflush(); |
} else { |
} else { |
Line 564 END
|
Line 577 END
|
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", |
'Spreadsheet Help'). |
&mt('Spreadsheet Help')). |
'</td>'); |
'</td>'); |
} |
} |
if ($allowed_to_edit) { |
if ($allowed_to_edit) { |
$r->print('<td>'. |
$r->print('<td>'. |
&Apache::loncommon::help_open_topic("Spreadsheet_Editing", |
&Apache::loncommon::help_open_topic("Spreadsheet_Editing", |
'Editing Help'). |
&mt('Editing Help')). |
'</td>'); |
'</td>'); |
} |
} |
$r->print('</tr></table>'); |
$r->print('</tr></table>'); |
Line 579 END
|
Line 592 END
|
$r->print(&hiddenfield('filename',$filename)); |
$r->print(&hiddenfield('filename',$filename)); |
# |
# |
# Keep track of the number of times we have been called, sort of. |
# Keep track of the number of times we have been called, sort of. |
$r->print(&hiddenfield('not_first_run','whatever')); |
$r->print(&hiddenfield('not_first_run','1')); |
# |
# |
if (exists($env{'form.not_first_run'}) || $sheettype ne 'classcalc') { |
if (exists($env{'form.not_first_run'}) || $sheettype ne 'classcalc') { |
$r->print($spreadsheet->get_html_title()); |
$r->print($spreadsheet->get_html_title()); |
Line 589 END
|
Line 602 END
|
$r->rflush(); |
$r->rflush(); |
$spreadsheet->display($r); |
$spreadsheet->display($r); |
} |
} |
$r->print('</form>'.&Apache::loncommon::end_page()); |
$r->print('</form>'); |
|
&Apache::lonquickgrades::endGradeScreen($r); |
|
$r->print(&Apache::loncommon::end_page()); |
$spreadsheet->clear_package(); |
$spreadsheet->clear_package(); |
return OK; |
return OK; |
} |
} |