[LON-CAPA-cvs] cvs: loncom /homework grades.pm
www
www@source.lon-capa.org
Sat, 17 Apr 2010 16:38:38 -0000
www Sat Apr 17 16:38:38 2010 EDT
Modified files:
/loncom/homework grades.pm
Log:
Move submissions downloading one level up.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.620 loncom/homework/grades.pm:1.621
--- loncom/homework/grades.pm:1.620 Fri Apr 16 18:29:33 2010
+++ loncom/homework/grades.pm Sat Apr 17 16:38:38 2010
@@ -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 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 @@
'cgi.'.$identifier.'.parts' => $parts,});
$r->print('<a href="/cgi-bin/multidownload.pl?'.$identifier.'">'.
&mt('Download All Submitted Documents').'</a>');
- 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 @@
# 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('<h3> <span class="LC_info">'.&mt('Submission Record').'</span></h3>');
# option to display problem, only once else it cause problems
@@ -8386,6 +8395,9 @@
$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 @@
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 @@
return $result;
}
+sub submit_options_download {
+ my ($request,$symb) = @_;
+ if (!$symb) {return '';}
+
+ &commonJSfunctions($request);
+
+ my $result='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
+ $result.='
+<h2>
+ '.&mt('Select Students for Which to Download Submissions').'
+</h2>'.&selectfield(1).'
+ <input type="hidden" name="command" value="downloadfileslink" />
+ <input type="submit" value="'.&mt('Next').' →" />
+ </div>
+ </div>
+ </form>';
+ return $result;
+}
+
#--- Displays the submissions first page -------
sub submit_options {
my ($request,$symb) = @_;
@@ -9292,7 +9330,15 @@
$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('<p class="LC_error">'.&mt('Access Denied ([_1])',$command).'</p>');