1: #!/usr/bin/perl
2: # CGI-script to allow download of all essay submissions of
3: # multiple students.
4: #
5: # $Id: multidownload.pl,v 1.1 2007/03/30 22:57:39 banghart Exp $
6: #
7: # Copyright Michigan State University Board of Trustees
8: #
9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
10: #
11: # LON-CAPA is free software; you can redistribute it and/or modify
12: # it under the terms of the GNU General Public License as published by
13: # the Free Software Foundation; either version 2 of the License, or
14: # (at your option) any later version.
15: #
16: # LON-CAPA is distributed in the hope that it will be useful,
17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: # GNU General Public License for more details.
20: #
21: # You should have received a copy of the GNU General Public License
22: # along with LON-CAPA; if not, write to the Free Software
23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24: #
25: # /home/httpd/html/adm/gpl.txt
26: #
27: # http://www.lon-capa.org/
28: #
29:
30: use lib '/home/httpd/lib/perl';
31: use LONCAPA::loncgi;
32: use File::Path;
33: use File::Basename;
34: use File::Copy;
35: use IO::File;
36: use Image::Magick;
37: use Apache::lonhtmlcommon();
38: use Apache::lonnet;
39: use Apache::grades;
40: use Apache::loncommon();
41: use Apache::lonlocal;
42: use Apache::lonmsg();
43: use LONCAPA::Enrollment;
44:
45: use strict;
46:
47:
48: $|=1;
49: if (! &LONCAPA::loncgi::check_cookie_and_load_env()) {
50: print <<END;
51: Content-type: text/html
52:
53: <html>
54: <head><title>Bad Cookie</title></head>
55: <body>
56: Your cookie information is incorrect.
57: </body>
58: </html>
59: END
60: return;
61: }
62: &Apache::lonlocal::get_language_handle();
63: &Apache::loncommon::content_type(undef,'text/html');
64: my $identifier = $ENV{'QUERY_STRING'};
65: print(&Apache::loncommon::start_page('Multiple Downloads'));
66: my $symb = $env{'cgi.'.$identifier.'.symb'};
67: my $courseid = $env{'cgi.'.$identifier.'.courseid'};
68: my @stuchecked = split /\n/,$env{'cgi.'.$identifier.'.students'};
69: my @parts = split /\n/,$env{'cgi.'.$identifier.'.parts'};
70: my ($partlist,$handgrade,$responseType) = &Apache::grades::response_type($symb);
71: my @part_response_id = &Apache::grades::flatten_responseType($responseType);
72: print "number of parts is: ".@parts."<br />";
73: my ($partlist,$handgrade,$responseType) = &Apache::grades::response_type($symb);
74: print "in the CGI script <br />";
75: foreach (@stuchecked) {
76: my ($uname,$udom,$fullname) = split(/:/);
77: my %record = &Apache::lonnet::restore($symb,$courseid,$udom,$uname);
78: print $uname."<br />";
79: foreach my $part(@part_response_id) {
80: print $part."<br />";
81: my ($partid,$respid) = @{ $part };
82: my $files = &Apache::grades::get_submitted_files($udom,$uname,$partid,$respid,\%record);
83: foreach my $file(@$files) {
84: print $file."<br />";
85: }
86: }
87: }
88:
89: die;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>