[LON-CAPA-cvs] cvs: loncom /interface multidownload.pl

banghart lon-capa-cvs-allow@mail.lon-capa.org
Thu, 26 Apr 2007 19:13:27 -0000


banghart		Thu Apr 26 15:13:27 2007 EDT

  Modified files:              
    /loncom/interface	multidownload.pl 
  Log:
  	Give the output zipfile a better name.
  
  
Index: loncom/interface/multidownload.pl
diff -u loncom/interface/multidownload.pl:1.9 loncom/interface/multidownload.pl:1.10
--- loncom/interface/multidownload.pl:1.9	Thu Apr 26 14:30:38 2007
+++ loncom/interface/multidownload.pl	Thu Apr 26 15:13:26 2007
@@ -2,7 +2,7 @@
 # CGI-script to allow download of all essay submissions of 
 # multiple students.
 #
-# $Id: multidownload.pl,v 1.9 2007/04/26 18:30:38 banghart Exp $
+# $Id: multidownload.pl,v 1.10 2007/04/26 19:13:26 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,6 +70,9 @@
 }
 if (&Apache::lonnet::allowed('vgr',$scope) eq 'F') {
     my $symb = $env{'cgi.'.$identifier.'.symb'};
+    $symb =~ /^.*\/(.+)\.problem$/;
+    my $zipout = $1.".zip";
+    $zipout =~ s/\s/_/g;
     my $courseid = $env{'request.course.id'};
     my @stuchecked = split(/\n/,$env{'cgi.'.$identifier.'.students'});
     my @parts = split(/\n/,$env{'cgi.'.$identifier.'.parts'});
@@ -106,11 +109,11 @@
     }
     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";
+    $statement .= "zip -r $doc_zip_root/zipout/$uname$udom/$zipout * > /dev/null";
     system($statement);
     $statement = "rm -rf $doc_zip_root/zipdir/$uname$udom/$unique_path";
     system($statement);
-    print('<a href="/zipspool/zipout/'.$uname.$udom.'/output.zip">Click to download</a><br />');
+    print('<a href="/zipspool/zipout/'.$uname.$udom.'/'.$zipout.'">Click to download</a><br />');
 } else {
     print('You are not authorized to download student submissions.');
 }