--- loncom/homework/grades.pm 2010/04/16 18:29:33 1.620 +++ loncom/homework/grades.pm 2010/04/17 16:38:38 1.621 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.620 2010/04/16 18:29:33 www Exp $ +# $Id: grades.pm,v 1.621 2010/04/17 16:38:38 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1845,6 +1845,11 @@ sub files_exist { sub download_all_link { my ($r,$symb) = @_; + unless (&files_exist($r, $symb)) { + $r->print(&mt('There are currently no submitted documents.')); + return; + } + my $all_students = join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo')); @@ -1857,7 +1862,14 @@ sub download_all_link { 'cgi.'.$identifier.'.parts' => $parts,}); $r->print(''. &mt('Download All Submitted Documents').''); - return + return; +} + +sub submit_download_link { + my ($request,$symb) = @_; + if (!$symb) { return ''; } +#FIXME: Figure out which type of problem this is and provide appropriate download + &download_all_link($request,$symb); } sub build_section_inputs { @@ -1903,10 +1915,7 @@ sub submission { # header info if ($counter == 0) { &sub_page_js($request); - &sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); - if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) { - &download_all_link($request, $symb); - } + &sub_page_kw_js($request); $request->print('

 '.&mt('Submission Record').'

'); # option to display problem, only once else it cause problems @@ -8386,6 +8395,9 @@ sub grading_menu { $fields{'command'}='all_for_one'; my $url1d=&Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'}='downloadfilesselect'; + my $url1e=&Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'} = 'csvform'; my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); @@ -8424,6 +8436,12 @@ sub grading_menu { permission => 'F', icon => 'edit-find-replace.png', linktitle => 'Grade all resources in current page/sequence/folder for one student.' + }, + { linktext => 'Download submissions', + url => $url1e, + permission => 'F', + icon => 'edit-find-replace.png', + linktitle => 'Download all students submissions.' }]}, { categorytitle=>'Automated Grading', items =>[ @@ -8517,8 +8535,28 @@ sub submit_options_table { return $result; } +sub submit_options_download { + my ($request,$symb) = @_; + if (!$symb) {return '';} + + &commonJSfunctions($request); + + my $result='
'."\n". + ''."\n"; + $result.=' +

+ '.&mt('Select Students for Which to Download Submissions').' +

'.&selectfield(1).' + + + + +
'; + return $result; +} + #--- Displays the submissions first page ------- sub submit_options { my ($request,$symb) = @_; @@ -9292,7 +9330,15 @@ sub handler { $request->print(&scantron_download_scantron_data($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)); + $request->print(&checkscantron_results($request,$symb)); + } elsif ($command eq 'downloadfilesselect' && $perm{'vgr'}) { + &startpage($request,$symb,[{href=>'', text=>'Select which submissions to download'}]); + $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 submissions'}]); + &submit_download_link($request,$symb); } elsif ($command) { &startpage($request,$symb,[{href=>'', text=>'Access denied'}]); $request->print('

'.&mt('Access Denied ([_1])',$command).'

');