version 1.58, 2010/12/03 21:33:56
|
version 1.59, 2011/09/26 12:15:39
|
Line 218 sub handler {
|
Line 218 sub handler {
|
$r->uri.":opa:0:0:Cannot modify spreadsheet"; |
$r->uri.":opa:0:0:Cannot modify spreadsheet"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
my ($sheettype) = ($r->uri=~/\/(\w+)$/); |
my $courseid = $env{'request.course.id'}; |
my $courseid = $env{'request.course.id'}; |
|
|
|
## |
|
## Check permissions |
|
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
|
$env{'request.course.id'}); |
|
# Only those instructors/tas/whatevers with complete access |
|
# (not section restricted) are able to modify spreadsheets. |
|
my $allowed_to_view = &Apache::lonnet::allowed('vgr', |
|
$env{'request.course.id'}); |
|
if (! $allowed_to_view) { |
|
$allowed_to_view = &Apache::lonnet::allowed('vgr', |
|
$env{'request.course.id'}.'/'.$env{'request.course.sec'}); |
|
# Those who are restricted by section are allowed to view. |
|
# The routines in lonstatistics which decide which students' |
|
# will be shown take care of the restriction by section. |
|
} |
|
|
# |
# |
# Do not allow students to continue if standard or external grading is in |
# Do not allow users without vgr or mgr priv to continue unless |
# effect. |
# grading type is set to spreadsheet. |
# |
# |
if ($env{'request.role'} =~ /^st\./) { |
|
if ($env{'course.'.$courseid.'.grading'} eq 'standard' || |
if ((!$allowed_to_view) && (!$allowed_to_edit)) { |
$env{'course.'.$courseid.'.grading'} eq 'external' ) { |
if ($env{'course.'.$courseid.'.grading'} eq 'spreadsheet') { |
return HTTP_NOT_ACCEPTABLE; |
if ($sheettype ne 'studentcalc') { |
|
$r->internal_redirect('/adm/studentcalc'); |
|
return OK; |
|
} |
|
} else { |
|
$r->internal_redirect('/adm/quickgrades'); |
|
return OK; |
} |
} |
} |
} |
# |
# |
Line 244 sub handler {
|
Line 268 sub handler {
|
} |
} |
# |
# |
# Determine basic information about the spreadsheet |
# Determine basic information about the spreadsheet |
my ($sheettype) = ($r->uri=~/\/(\w+)$/); |
|
# |
# |
my $symb = undef; |
my $symb = undef; |
$symb = $env{'form.usymb'} if (exists($env{'form.usymb'})); |
$symb = $env{'form.usymb'} if (exists($env{'form.usymb'})); |
Line 267 sub handler {
|
Line 290 sub handler {
|
$env{'request.course.id'}); |
$env{'request.course.id'}); |
} |
} |
|
|
## |
|
## Check permissions |
|
my $allowed_to_edit = &Apache::lonnet::allowed('mgr', |
|
$env{'request.course.id'}); |
|
# Only those instructors/tas/whatevers with complete access |
|
# (not section restricted) are able to modify spreadsheets. |
|
my $allowed_to_view = &Apache::lonnet::allowed('vgr', |
|
$env{'request.course.id'}); |
|
if (! $allowed_to_view) { |
|
$allowed_to_view = &Apache::lonnet::allowed('vgr', |
|
$env{'request.course.id'}.'/'.$env{'request.course.sec'}); |
|
# Those who are restricted by section are allowed to view. |
|
# The routines in lonstatistics which decide which students' |
|
# will be shown take care of the restriction by section. |
|
} |
|
# |
# |
# Only those able to view others grades will be allowed to continue |
# Only those able to view others grades will be allowed to continue |
# if they are not requesting their own. |
# if they are not requesting their own. |
if ($sheettype eq 'classcalc') { |
if ($sheettype eq 'classcalc') { |
if (! $allowed_to_view) { |
if (!$allowed_to_view) { |
$env{'user.error.msg'}= |
$r->internal_redirect('/adm/studentcalc'); |
$r->uri.":vgr:0:0:Access Permission Denied"; |
return OK; |
return HTTP_NOT_ACCEPTABLE; |
|
} |
} |
} |
} |
if ((($name ne $env{'user.name'} ) || |
if ((($name ne $env{'user.name'} ) || |