--- loncom/homework/grades.pm 2005/09/01 15:23:23 1.282
+++ loncom/homework/grades.pm 2005/09/21 21:44:55 1.286
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.282 2005/09/01 15:23:23 www Exp $
+# $Id: grades.pm,v 1.286 2005/09/21 21:44:55 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2332,7 +2332,7 @@ sub version_portfiles {
} else {
my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,'copy',
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
- push(@v_portfiles, $answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
+ push(@v_portfiles, $directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
&Apache::lonnet::mark_as_readonly($domain,$stuname,
['/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]],
[$symb,$env{'request.course.id'},'graded']);
@@ -3065,10 +3065,7 @@ sub csvuploadmap_footer {
ENDPICK
}
-sub upcsvScores_form {
- my ($request) = shift;
- my ($symb,$url)=&get_symb_and_url($request);
- if (!$symb) {return '';}
+sub checkforfile_js {
my $result =<
function checkUpload(formname) {
@@ -3080,6 +3077,14 @@ sub upcsvScores_form {
}
CSVFORMJS
+ return $result;
+}
+
+sub upcsvScores_form {
+ my ($request) = shift;
+ my ($symb,$url)=&get_symb_and_url($request);
+ if (!$symb) {return '';}
+ my $result=&checkforfile_js();
$env{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
my ($table) = &showResourceInfo($url,$env{'form.probTitle'});
$result.=$table;
@@ -3099,7 +3104,7 @@ CSVFORMJS
$upfile_select
-
-Sequence To be Graded: | $title |
+Sequence to be Graded: | $title |
Data File that will be used: | $env{'form.scantron_selectfile'} |
+$CODElist
@@ -5432,10 +5449,32 @@ GRADINGMENUJS
return $result;
}
+sub reset_perm {
+ undef(%perm);
+}
+
+sub init_perm {
+ &reset_perm();
+ if (!($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) {
+ if ($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
+ $perm{'vgr_section'}=$env{'request.course.sec'};
+ } else {
+ delete($perm{'vgr'});
+ }
+ }
+ if (!($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}))) {
+ if ($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
+ $perm{'mgr_section'}=$env{'request.course.sec'};
+ } else {
+ delete($perm{'mgr'});
+ }
+ }
+}
+
sub handler {
my $request=$_[0];
- undef(%perm);
+ &reset_perm();
if ($env{'browser.mathml'}) {
&Apache::loncommon::content_type($request,'text/xml');
} else {
@@ -5484,20 +5523,7 @@ sub handler {
}
}
} else {
- if (!($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) {
- if ($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
- $perm{'vgr_section'}=$env{'request.course.sec'};
- } else {
- delete($perm{'vgr'});
- }
- }
- if (!($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}))) {
- if ($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
- $perm{'mgr_section'}=$env{'request.course.sec'};
- } else {
- delete($perm{'mgr'});
- }
- }
+ &init_perm();
if ($command eq 'submission' && $perm{'vgr'}) {
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) {