version 1.43, 2006/04/06 16:43:49
|
version 1.49, 2006/10/31 18:35:51
|
Line 266 sub handler {
|
Line 266 sub handler {
|
$env{'form.sdomain'} = $domain; |
$env{'form.sdomain'} = $domain; |
my $section = &Apache::lonnet::getsection($domain,$name, |
my $section = &Apache::lonnet::getsection($domain,$name, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
|
my @groups; |
|
if (($env{'user.name'} eq $name) && ($env{'user.domain'} eq $domain)) { |
|
@groups = &Apache::lonnet::sort_course_groups($env{'request.course.id'}, |
|
split(':',$env{'request.course.groups'})); |
|
} else { |
|
@groups = &Apache::lonnet::get_users_groups($domain,$name, |
|
$env{'request.course.id'}); |
|
} |
|
|
## |
## |
## Check permissions |
## Check permissions |
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
Line 316 sub handler {
|
Line 325 sub handler {
|
# |
# |
# Header.... |
# Header.... |
# |
# |
$r->print('<html><head><title>LON-CAPA Spreadsheet</title>'); |
|
my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); |
my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); |
## |
## |
## Spit out the javascript required for editing |
## Spit out the javascript required for editing |
## |
## |
|
my $js; |
if ($allowed_to_edit) { |
if ($allowed_to_edit) { |
my %lt=( |
my %lt=( |
'ce' => 'Cell', |
'ce' => 'Cell', |
Line 329 sub handler {
|
Line 338 sub handler {
|
); |
); |
my $extra_javascript = |
my $extra_javascript = |
&Apache::loncommon::browser_and_searcher_javascript(); |
&Apache::loncommon::browser_and_searcher_javascript(); |
$r->print(<<ENDSCRIPT); |
|
|
my $cell_edit_start = |
|
&Apache::loncommon::start_page('Cell Edit Window',undef, |
|
{'only_body' => 1, |
|
'js_ready' => 1,}); |
|
my $cell_edit_end = |
|
&Apache::loncommon::end_page({'js_ready' => 1,}); |
|
|
|
$js = <<ENDSCRIPT; |
<script type="text/javascript"> |
<script type="text/javascript"> |
//<!-- |
//<!-- |
$extra_javascript |
$extra_javascript |
Line 340 sub handler {
|
Line 357 sub handler {
|
var edit_text = ''; |
var edit_text = ''; |
// 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 +='<html><head><title>Cell Edit Window</title></head><body>'; |
edit_text +='$cell_edit_start'; |
edit_text += '<form name="editwinform">'; |
edit_text += '<form name="editwinform">'; |
edit_text += '<center><h3>$lt{'ce'} '+cellname+'</h3>'; |
edit_text += '<center><h3>$lt{'ce'} '+cellname+'</h3>'; |
edit_text += '<textarea name="newformula" cols="60" rows="12"'; |
edit_text += '<textarea name="newformula" cols="60" rows="12"'; |
Line 358 sub handler {
|
Line 375 sub handler {
|
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></body></html>'; |
edit_text += '</center>$cell_edit_end'; |
|
|
if (editwin != null && !(editwin.closed) ) { |
if (editwin != null && !(editwin.closed) ) { |
editwin.close(); |
editwin.close(); |
Line 378 ENDSCRIPT
|
Line 395 ENDSCRIPT
|
text => 'Spreadsheet', |
text => 'Spreadsheet', |
faq => 134, |
faq => 134, |
bug => 'Spreadsheet'}); |
bug => 'Spreadsheet'}); |
$r->print('</head>'.&Apache::loncommon::bodytag('Grades Spreadsheet'). |
$r->print(&Apache::loncommon::start_page('Grades Spreadsheet',$js). |
&Apache::lonhtmlcommon::breadcrumbs(undef,'Spreadsheet'). |
&Apache::lonhtmlcommon::breadcrumbs('Spreadsheet', |
|
'Spreadsheet_About'). |
'<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 441 ENDSCRIPT
|
Line 459 ENDSCRIPT
|
my $spreadsheet = undef; |
my $spreadsheet = undef; |
if ($sheettype eq 'classcalc') { |
if ($sheettype eq 'classcalc') { |
$spreadsheet = Apache::classcalc->new($name,$domain,$filename,undef, |
$spreadsheet = Apache::classcalc->new($name,$domain,$filename,undef, |
$section); |
$section,\@groups); |
} elsif ($sheettype eq 'studentcalc') { |
} elsif ($sheettype eq 'studentcalc') { |
$spreadsheet = Apache::studentcalc->new($name,$domain,$filename,undef, |
$spreadsheet = Apache::studentcalc->new($name,$domain,$filename,undef, |
$section); |
$section,\@groups); |
} elsif ($sheettype eq 'assesscalc' && |
} elsif ($sheettype eq 'assesscalc' && |
defined($symb) && |
defined($symb) && |
$allowed_to_edit) { |
$allowed_to_edit) { |
$spreadsheet = Apache::assesscalc->new($name,$domain,$filename,$symb, |
$spreadsheet = Apache::assesscalc->new($name,$domain,$filename,$symb, |
$section); |
$section,\@groups); |
} else { |
} else { |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
Line 532 END
|
Line 550 END
|
$r->rflush(); |
$r->rflush(); |
$spreadsheet->display($r); |
$spreadsheet->display($r); |
} |
} |
$r->print('</form></body></html>'); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
$spreadsheet->clear_package(); |
$spreadsheet->clear_package(); |
return OK; |
return OK; |
} |
} |