print(&mt('There are currently no submitted documents.'));
- return;
+ $r->print(&mt('There are currently no submitted documents.'));
+ return;
}
my $all_students =
join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo'));
@@ -2047,33 +2204,23 @@ sub download_all_link {
sub submit_download_link {
my ($request,$symb) = @_;
if (!$symb) { return ''; }
-#FIXME: Figure out which type of problem this is and provide appropriate download
my $res_error;
- my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);
- if (ref($res_error)) {
- if ($$res_error) {
- $request->print(&mt('An error occurred retrieving response types'));
- return;
- }
+ my ($partlist,$handgrade,$responseType,$numresp,$numessay,$numdropbox) =
+ &response_type($symb,\$res_error);
+ if ($res_error) {
+ $request->print(&mt('An error occurred retrieving response types'));
+ return;
}
- my ($numupload,$numessay) = (0,0);
- if (ref($responseType) eq 'HASH') {
- foreach my $part (sort(keys(%$responseType))) {
- foreach my $id (sort(keys(%{ $responseType->{$part} }))) {
- my $responsetype = $responseType->{$part}->{$id};
- if ($responsetype eq 'essay') {
- my $uploadedfiletypes =
- &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes",$symb);
- if ($uploadedfiletypes) {
- $numupload++;
- } else {
- $numessay++;
- }
- }
- }
- }
+ unless ($numessay) {
+ $request->print(&mt('No essayresponse items found'));
+ return;
}
- if (($numupload) || ($numessay)) {
+ my @chosenparts = &Apache::loncommon::get_env_multiple('form.vPart');
+ if (@chosenparts) {
+ $request->print(&showResourceInfo($symb,$partlist,$responseType,
+ undef,undef,1));
+ }
+ if ($numessay) {
my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'};
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'};
my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'};
@@ -2082,10 +2229,12 @@ sub submit_download_link {
my @students = map { $_.':'.$fullname->{$_} } (keys(%{$fullname}));
if (@students) {
@{$env{'form.stuinfo'}} = @students;
- if ($numupload) {
+ if ($numdropbox) {
&download_all_link($request,$symb);
+ } else {
+ $request->print(&mt('No essayrespose items with dropbox found'));
}
-# FIXME Need to provide a mechanism to download essays, i.e., if $numessay > 0
+# FIXME Need a mechanism to download essays, i.e., if $numessay > $numdropbox
# Needs to omit user's identity if resource instance is for an anonymous survey.
} else {
$request->print(&mt('No students match the criteria you selected'));
@@ -2114,14 +2263,14 @@ sub build_section_inputs {
# --------------------------- show submissions of a student, option to grade
sub submission {
- my ($request,$counter,$total,$symb) = @_;
+ my ($request,$counter,$total,$symb,$divforres,$calledby) = @_;
my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'});
$udom = ($udom eq '' ? $env{'user.domain'} : $udom); #has form.userdom changed for a student?
my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'});
$env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq '';
- my $probtitle=&Apache::lonnet::gettitle($symb);
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; }
+ my $probtitle=&Apache::lonnet::gettitle($symb);
my $is_tool = ($symb =~ /ext\.tool$/);
my ($essayurl,%coursedesc_by_cid);
@@ -2135,11 +2284,22 @@ sub submission {
return;
}
+ my $res_error;
+ my ($partlist,$handgrade,$responseType,$numresp,$numessay) =
+ &response_type($symb,\$res_error);
+ if ($res_error) {
+ $request->print(&navmap_errormsg());
+ return;
+ }
+
if (!$env{'form.lastSub'}) { $env{'form.lastSub'} = 'datesub'; }
unless ($is_tool) {
if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; }
if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; }
}
+ if (($numessay) && ($calledby eq 'submission') && (!exists($env{'form.compmsg'}))) {
+ $env{'form.compmsg'} = 1;
+ }
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : '');
my $checkIcon = '');
+ } else {
+ $request->print('
');
+ }
&sub_page_js($request);
- &sub_page_kw_js($request);
+ &sub_grademessage_js($request) if ($env{'form.compmsg'});
+ &sub_page_kw_js($request) if ($numessay);
# option to display problem, only once else it cause problems
# with the form later since the problem has a form.
@@ -2165,24 +2334,27 @@ sub submission {
$request->print(&show_problem($request,$symb,$uname,$udom,0,1,$mode));
}
- # kwclr is the only variable that is guaranteed not to be blank
- # if this subroutine has been called once.
my %keyhash = ();
-# if ($env{'form.kwclr'} eq '' && $env{'form.handgrade'} eq 'yes') {
- if (1) {
+ if (($env{'form.kwclr'} eq '' && $numessay) || ($env{'form.compmsg'})) {
%keyhash = &Apache::lonnet::dump('nohist_handgrade',
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
-
+ }
+ # kwclr is the only variable that is guaranteed not to be blank
+ # if this subroutine has been called once.
+ if ($env{'form.kwclr'} eq '' && $numessay) {
my $loginuser = $env{'user.name'}.':'.$env{'user.domain'};
$env{'form.keywords'} = $keyhash{$symb.'_keywords'} ne '' ? $keyhash{$symb.'_keywords'} : '';
$env{'form.kwclr'} = $keyhash{$loginuser.'_kwclr'} ne '' ? $keyhash{$loginuser.'_kwclr'} : 'red';
$env{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0';
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
- $env{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ?
+ }
+ if ($env{'form.compmsg'}) {
+ $env{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ?
$keyhash{$symb.'_subject'} : $probtitle;
$env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0';
}
+
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'};
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
$request->print('';
return $result;
}
@@ -10024,7 +10627,7 @@ sub reset_perm {
sub init_perm {
&reset_perm();
- foreach my $test_perm ('vgr','mgr','opa') {
+ foreach my $test_perm ('vgr','mgr','opa','usc') {
my $scope = $env{'request.course.id'};
if (!($perm{$test_perm}=&Apache::lonnet::allowed($test_perm,$scope))) {
@@ -10212,12 +10815,12 @@ ENDUPFORM
ENDGRADINGFORM
- $result.=''.&Apache::loncommon::end_data_table_row().
+ $result.=''.&Apache::loncommon::end_data_table_row().
&Apache::loncommon::start_data_table_row().''.(<$pcorrect:
-'
+
ENDPERCFORM
$result.=' | '.
&Apache::loncommon::end_data_table_row().
@@ -10226,7 +10829,7 @@ ENDPERCFORM
}
sub process_clicker_file {
- my ($r,$symb)=@_;
+ my ($r,$symb) = @_;
if (!$symb) {return '';}
my %Saveable_Parameters=&clicker_grading_parameters();
@@ -10556,7 +11159,7 @@ sub turning_eval {
sub assign_clicker_grades {
- my ($r,$symb)=@_;
+ my ($r,$symb) = @_;
if (!$symb) {return '';}
# See which part we are saving to
my $res_error;
@@ -10567,11 +11170,11 @@ sub assign_clicker_grades {
# FIXME: This should probably look for the first handgradeable part
my $part=$$partlist[0];
# Start screen output
- my $result=&Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().
- ''.&mt('Assigning grades based on clicker file').' | '.
- &Apache::loncommon::end_data_table_header_row().
- &Apache::loncommon::start_data_table_row().'';
+ my $result = &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ ' | '.&mt('Assigning grades based on clicker file').' | '.
+ &Apache::loncommon::end_data_table_header_row().
+ &Apache::loncommon::start_data_table_row().'';
# Get correct result
# FIXME: Possibly need delimiter other than ":"
my @correct=();
@@ -10633,7 +11236,7 @@ sub assign_clicker_grades {
for (my $i=0;$i<$number;$i++) {
if ($correct[$i] eq '-') {
$realnumber--;
- } elsif (($answer[$i]) || ($answer[$i]=~/^[0\.]+$/)) {
+ } elsif (($answer[$i]) || ($answer[$i]=~/^[0\.]+$/)) {
if ($gradingmechanism eq 'attendance') {
$sum+=$pcorrect;
} elsif ($correct[$i] eq '*') {
@@ -10692,7 +11295,7 @@ sub navmap_errormsg {
}
sub startpage {
- my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag,$stuvcurrent,$stuvdisp,$nomenu,$js,$onload) = @_;
+ my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag,$stuvcurrent,$stuvdisp,$nomenu,$js,$onload,$divforres) = @_;
my %args;
if ($onload) {
my %loaditems = (
@@ -10707,17 +11310,19 @@ sub startpage {
unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"});
$args{'bread_crumbs'} = $crumbs;
$r->print(&Apache::loncommon::start_page('Grading',$js,\%args));
- &Apache::lonquickgrades::startGradeScreen($r,($env{'form.symb'}?'probgrading':'grading'));
+ if ($env{'request.course.id'}) {
+ &Apache::lonquickgrades::startGradeScreen($r,($env{'form.symb'}?'probgrading':'grading'));
+ }
}
unless ($nodisplayflag) {
- $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag,$stuvcurrent,$stuvdisp));
+ $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag,$stuvcurrent,$stuvdisp,$divforres));
}
}
sub select_problem {
my ($r)=@_;
$r->print(''.&mt('Select the problem or one of the problems you want to grade').'');
}
@@ -10774,18 +11379,24 @@ sub handler {
&select_problem($request);
} else {
if ($command eq 'submission' && $perm{'vgr'}) {
- my ($stuvcurrent,$stuvdisp,$versionform,$js);
+ my ($stuvcurrent,$stuvdisp,$versionform,$js,$onload);
if (($env{'form.student'} ne '') && ($env{'form.userdom'} ne '')) {
($stuvcurrent,$stuvdisp,$versionform,$js) =
&choose_task_version_form($symb,$env{'form.student'},
$env{'form.userdom'});
}
- &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}],undef,undef,$stuvcurrent,$stuvdisp,undef,$js);
+ my $divforres;
+ if ($env{'form.student'} eq '') {
+ $js .= &part_selector_js();
+ $onload = "toggleParts('gradesub');";
+ } else {
+ $divforres = 1;
+ }
+ &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}],undef,undef,$stuvcurrent,$stuvdisp,undef,$js,$onload,$divforres);
if ($versionform) {
$request->print($versionform);
}
- $request->print(' ');
- ($env{'form.student'} eq '' ? &listStudents($request,$symb) : &submission($request,0,0,$symb));
+ ($env{'form.student'} eq '' ? &listStudents($request,$symb,'',$divforres) : &submission($request,0,0,$symb,$divforres,$command));
} elsif ($command eq 'versionsub' && $perm{'vgr'}) {
my ($stuvcurrent,$stuvdisp,$versionform,$js) =
&choose_task_version_form($symb,$env{'form.student'},
@@ -10815,7 +11426,7 @@ sub handler {
&updateGradeByPage($request,$symb);
} elsif ($command eq 'processGroup' && $perm{'vgr'}) {
&startpage($request,$symb,[{href=>'',text=>'...'},
- {href=>'',text=>'Modify grades'}]);
+ {href=>'',text=>'Modify grades'}],undef,undef,undef,undef,undef,undef,undef,1);
&processGroup($request,$symb);
} elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {
&startpage($request,$symb);
@@ -10824,7 +11435,10 @@ sub handler {
&startpage($request,$symb,[{href=>'',text=>'Select individual students to grade'}]);
$request->print(&submit_options($request,$symb));
} elsif ($command eq 'ungraded' && $perm{'vgr'}) {
- &startpage($request,$symb,[{href=>'',text=>'Grade ungraded submissions'}]);
+ my $js = &part_selector_js();
+ my $onload = "toggleParts('gradesub');";
+ &startpage($request,$symb,[{href=>'',text=>'Grade ungraded submissions'}],
+ undef,undef,undef,undef,undef,$js,$onload);
$request->print(&listStudents($request,$symb,'graded'));
} elsif ($command eq 'table' && $perm{'vgr'}) {
&startpage($request,$symb,[{href=>"", text=>"Grading table"}]);
@@ -10903,30 +11517,35 @@ sub handler {
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
$request->print(&scantron_process_students($request,$symb));
} elsif ($command eq 'scantronupload' &&
- (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})||
- &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {
+ (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || $perm{'usc'})) {
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1,
undef,undef,undef,undef,'toggleScantab(document.rules);');
$request->print(&scantron_upload_scantron_data($request,$symb));
} elsif ($command eq 'scantronupload_save' &&
- (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})||
- &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {
+ (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || $perm{'usc'})) {
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
$request->print(&scantron_upload_scantron_data_save($request,$symb));
- } elsif ($command eq 'scantron_download' &&
- &Apache::lonnet::allowed('usc',$env{'request.course.id'})) {
+ } elsif ($command eq 'scantron_download' && ($perm{'usc'} || $perm{'mgr'})) {
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
$request->print(&scantron_download_scantron_data($request,$symb));
+ } elsif ($command eq 'scantronupload_delete' &&
+ (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || $perm{'usc'})) {
+ &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
+ &scantron_upload_delete($request,$symb);
} elsif ($command eq 'checksubmissions' && $perm{'vgr'}) {
&startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
$request->print(&checkscantron_results($request,$symb));
} elsif ($command eq 'downloadfilesselect' && $perm{'vgr'}) {
- &startpage($request,$symb,[{href=>'', text=>'Select which submissions to download'}]);
+ my $js = &part_selector_js();
+ my $onload = "toggleParts('gradingMenu');";
+ &startpage($request,$symb,[{href=>'', text=>'Select which submissions to download'}],
+ undef,undef,undef,undef,undef,$js,$onload);
$request->print(&submit_options_download($request,$symb));
} elsif ($command eq 'downloadfileslink' && $perm{'vgr'}) {
&startpage($request,$symb,
[{href=>&href_symb_cmd($symb,'downloadfilesselect'), text=>'Select which submissions to download'},
- {href=>'', text=>'Download submitted files'}]);
+ {href=>'', text=>'Download submitted files'}],
+ undef,undef,undef,undef,undef,undef,undef,1);
&submit_download_link($request,$symb);
} elsif ($command) {
&startpage($request,$symb,[{href=>'', text=>'Access denied'}]);
@@ -10938,7 +11557,7 @@ sub handler {
}
if ($env{'form.inhibitmenu'}) {
$request->print(&Apache::loncommon::end_page());
- } else {
+ } elsif ($env{'request.course.id'}) {
&Apache::lonquickgrades::endGradeScreen($request);
}
&reset_caches();
@@ -11176,7 +11795,12 @@ Side Effects: None.
=item scantron_upload_scantron_data_save() :
Adds a provided bubble information data file to the course if user
- has the correct privileges to do so.
+ has the correct privileges to do so.
+
+= item scantron_upload_delete() :
+
+ Deletes a previously uploaded bubble information data file, if user
+ was the one who uploaded the file, and has the privileges to do so.
=item valid_file() :
|