--- loncom/homework/grades.pm 2005/09/01 15:23:23 1.282
+++ loncom/homework/grades.pm 2005/09/23 16:57:42 1.289
@@ -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.289 2005/09/23 16:57:42 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1370,10 +1370,10 @@ sub gradeBox {
my $ctr = 0;
$result.='
'."\n"; # display radio buttons in a nice table 10 across
while ($ctr<=$wgt) {
- $result.= ' | \n";
+ ($score eq $ctr ? 'checked':'').' /> '.$ctr."\n";
$result.=(($ctr+1)%10 == 0 ? '
' : '');
$ctr++;
}
@@ -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']);
@@ -2394,6 +2394,7 @@ sub viewgrades_js {
}
for (i=0;i';
my $ctr = 0;
while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across
- $result.= ' | \n";
+ ','.$ctr.')" />'.$ctr."\n";
$result.=(($ctr+1)%10 == 0 ? '
' : '');
$ctr++;
}
@@ -3065,10 +3069,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 +3081,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 +3108,7 @@ CSVFORMJS
$upfile_select
-
'."\n";
@@ -3360,13 +3369,13 @@ LISTJAVASCRIPT
$result.=''."\n".
''."\n";
- $result.=' View Problems Text: no '."\n".
- ' yes '."
\n";
+ $result.=' View Problems Text: no '."\n".
+ ' yes '."
\n";
$result.=' Submission Details: '.
- ' none'."\n".
- ' by dates and submissions'."\n".
- ' all details'."\n";
+ ' none'."\n".
+ ' by dates and submissions'."\n".
+ ' all details'."\n";
$result.=''."\n".
''."\n".
@@ -3394,8 +3403,8 @@ LISTJAVASCRIPT
my ($uname,$udom) = split(/:/,$student);
$studentTable.=($ptr%2 == 1 ? '' : '');
$studentTable.=''.$ptr.' | ';
- $studentTable.=' '
- .&nameUserString(undef,$$fullname{$student},$uname,$udom)."\n";
+ $studentTable.=' | '
+ .&nameUserString(undef,$$fullname{$student},$uname,$udom)."\n";
$studentTable.=($ptr%2 == 0 ? ' |
' : '');
$ptr++;
}
@@ -3467,7 +3476,11 @@ sub displayPage {
my $navmap = Apache::lonnavmaps::navmap->new();
my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'});
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
-
+ if (!$map) {
+ $request->print('Unable to view requested sequence. ('.$resUrl.')');
+ $request->print(&show_grading_menu_form($symb,$url));
+ return;
+ }
my $iterator = $navmap->getIterator($map->map_start(),
$map->map_finish());
@@ -3673,7 +3686,12 @@ sub updateGradeByPage {
my $navmap = Apache::lonnavmaps::navmap->new();
my ($mapUrl, $id, $resUrl) = &Apache::lonnet::decode_symb( $env{'form.page'});
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
-
+ if (!$map) {
+ $request->print('Unable to grade requested sequence. ('.$resUrl.')');
+ my ($symb,$url)=&get_symb_and_url($request);
+ $request->print(&show_grading_menu_form($symb,$url));
+ return;
+ }
my $iterator = $navmap->getIterator($map->map_start(),
$map->map_finish());
@@ -4319,7 +4337,7 @@ sub scantron_process_corrections {
}
}
if ($err) {
- $r->print("Unable to accept last correction, an error occurred :$errmsg:");
+ $r->print("Unable to accept last correction, an error occurred :$errmsg:");
} else {
&scantron_put_line($scanlines,$scan_data,$which,$line,$skip);
&scantron_putfile($scanlines,$scan_data);
@@ -4373,14 +4391,26 @@ sub check_for_error {
sub scantron_warning_screen {
my ($button_text)=@_;
my $title=&Apache::lonnet::gettitle($env{'form.selectpage'});
+ my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
+ my $CODElist="a";
+ if ($scantron_config{'CODElocation'} &&
+ $scantron_config{'CODEstart'} &&
+ $scantron_config{'CODElength'}) {
+ $CODElist=$env{'form.scantron_CODElist'};
+ if ($CODElist eq '') { $CODElist='None'; }
+ $CODElist=
+ 'List of CODES to validate against: | '.
+ $CODElist.' |
';
+ }
return (<
Please double check the information
below before clicking on '$button_text'
-Sequence To be Graded: | $title |
+Sequence to be Graded: | $title |
Data File that will be used: | $env{'form.scantron_selectfile'} |
+$CODElist
@@ -5373,10 +5403,10 @@ GRADINGMENUJS
$result.='';
- $result.=''.
+ $result.=' |
'.
' '.''.&mt('Current Resource').': '.&mt('For one or more students').
- ' |
'."\n";
$result.=''.
- ' '.
- 'Current Resource: For all students in selected section or course |
'."\n";
+ 'Current Resource: For all students in selected section or course'."\n";
$result.=''.
- ' '.
- 'The complete set/page/sequence: For one student |
'."\n";
+ 'The complete set/page/sequence: For one student'."\n";
$result.=' '.
''.
@@ -5432,10 +5462,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 +5536,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'}) {
|