version 1.40, 2005/04/07 06:56:23
|
version 1.46, 2006/04/10 22:59:16
|
Line 100 sub file_dialogs {
|
Line 100 sub file_dialogs {
|
my $message = ''; |
my $message = ''; |
## |
## |
## Deal with saving the spreadsheet |
## Deal with saving the spreadsheet |
|
$spreadsheet->check_formulas_loaded(); |
if ((exists($env{'form.save'}) || exists($env{'form.makedefault'})) && |
if ((exists($env{'form.save'}) || exists($env{'form.makedefault'})) && |
exists($env{'form.savefilename'})) { |
exists($env{'form.savefilename'})) { |
$spreadsheet->filename($env{'form.savefilename'}); |
$spreadsheet->filename($env{'form.savefilename'}); |
Line 263 sub handler {
|
Line 264 sub handler {
|
} |
} |
$env{'form.sname'} = $name; |
$env{'form.sname'} = $name; |
$env{'form.sdomain'} = $domain; |
$env{'form.sdomain'} = $domain; |
|
my $section = &Apache::lonnet::getsection($domain,$name, |
|
$env{'request.course.id'}); |
|
my $group; |
|
my @groups = (); |
|
if (($env{'user.name'} eq $name) && ($env{'user.domain'} eq $domain)) { |
|
@groups=&Apache::lonnet::sort_course_groups( |
|
$env{'request.course.groups'}, |
|
$env{'request.course.id'}); |
|
} else { |
|
my $grouplist = &Apache::lonnet::get_users_groups($domain,$name, |
|
$env{'request.course.id'}); |
|
if ($grouplist) { |
|
@groups=&Apache::lonnet::sort_course_groups($grouplist, |
|
$env{'request.course.id'}); |
|
} |
|
} |
|
if (@groups > 0) { |
|
$group = $groups[0]; |
|
} |
|
|
## |
## |
## Check permissions |
## Check permissions |
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
Line 313 sub handler {
|
Line 334 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 326 sub handler {
|
Line 347 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 337 sub handler {
|
Line 366 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 355 sub handler {
|
Line 384 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 375 ENDSCRIPT
|
Line 404 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(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'}). |
Line 437 ENDSCRIPT
|
Line 466 ENDSCRIPT
|
&Apache::Spreadsheet::initialize_spreadsheet_package(); |
&Apache::Spreadsheet::initialize_spreadsheet_package(); |
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,$group); |
} 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,$group); |
} 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,$group); |
} else { |
} else { |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
Line 526 END
|
Line 558 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(); |
return OK; |
return OK; |
} |
} |
|
|