--- loncom/interface/multidownload.pl 2007/04/25 00:32:49 1.4 +++ loncom/interface/multidownload.pl 2007/04/26 18:30:38 1.9 @@ -2,7 +2,7 @@ # CGI-script to allow download of all essay submissions of # multiple students. # -# $Id: multidownload.pl,v 1.4 2007/04/25 00:32:49 banghart Exp $ +# $Id: multidownload.pl,v 1.9 2007/04/26 18:30:38 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,10 +44,6 @@ use Apache::lonnet; use LONCAPA::Enrollment; use strict; -sub is_student { - return ($env{'request.role'}=~/^st\./); -} - $|=1; if (! &LONCAPA::loncgi::check_cookie_and_load_env()) { print <$doc_zip_root/zipdir/$uname/part$partid/resp$respid/$file_name_only")) { + if (open(my $fh,">$doc_zip_root/zipdir/$uname$udom/$unique_path/$stuname/part$partid/resp$respid/$file_name_only")) { print($fh $file_content); close($fh); } else { @@ -100,14 +104,15 @@ if ($role eq 'cc') { } } } - mkdir($doc_zip_root."/zipout",0777); - my $statement = "zip -r $doc_zip_root/zipout/output.zip $doc_zip_root/zipdir/* > /dev/null"; + mkdir($doc_zip_root."/zipout/$uname$udom",0700); + my $statement = "cd $doc_zip_root/zipdir/$uname$udom/$unique_path\n"; + $statement .= "zip -r $doc_zip_root/zipout/$uname$udom/output.zip * > /dev/null"; system($statement); - $statement = "rm -rf $doc_zip_root/zipdir"; + $statement = "rm -rf $doc_zip_root/zipdir/$uname$udom/$unique_path"; system($statement); - print('Click to download
'); + print('Click to download
'); } else { print('You are not authorized to download student submissions.'); } -# print($env{'request.role'}.' == roles
'); -return 1; +1; +__END__;