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

banghart lon-capa-cvs-allow@mail.lon-capa.org
Thu, 26 Apr 2007 20:26:38 -0000


banghart		Thu Apr 26 16:26:38 2007 EDT

  Modified files:              
    /loncom/interface	multidownload.pl 
  Log:
  	use mkpath instead of multiple mkdir
  
  
Index: loncom/interface/multidownload.pl
diff -u loncom/interface/multidownload.pl:1.10 loncom/interface/multidownload.pl:1.11
--- loncom/interface/multidownload.pl:1.10	Thu Apr 26 15:13:26 2007
+++ loncom/interface/multidownload.pl	Thu Apr 26 16:26:36 2007
@@ -2,7 +2,7 @@
 # CGI-script to allow download of all essay submissions of 
 # multiple students.
 #
-# $Id: multidownload.pl,v 1.10 2007/04/26 19:13:26 banghart Exp $
+# $Id: multidownload.pl,v 1.11 2007/04/26 20:26:36 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,7 +33,6 @@
 use File::Basename;
 use File::Copy;
 use IO::File;
-use Image::Magick;
 use Apache::lonhtmlcommon();
 use Apache::lonnet;
 use Apache::grades;
@@ -82,17 +81,13 @@
     my ($partlist,$handgrade,$responseType) = &Apache::grades::response_type($symb);
     my $uname = $env{'user.name'};
     my $udom = $env{'user.domain'};
-    mkdir($doc_zip_root."/zipdir",0700);
-    mkdir($doc_zip_root."/zipdir/$uname$udom",0700);
-    mkdir($doc_zip_root."/zipdir/$uname$udom/$unique_path",0700);
+    &mkpath($doc_zip_root."/zipdir/$uname$udom/$unique_path",0,0700);
     foreach my $stu (@stuchecked) {
         my ($stuname,$studom,$fullname) = split(/:/,$stu);
-        mkdir($doc_zip_root."/zipdir/$uname$udom/$unique_path/$stuname",0700);
         my %record = &Apache::lonnet::restore($symb,$courseid,$studom,$stuname);
         foreach my $part (@part_response_id) {
             my ($partid,$respid) = @{$part};
-            mkdir($doc_zip_root."/zipdir/$uname$udom/$unique_path/$stuname/part$partid",0700);
-            mkdir($doc_zip_root."/zipdir/$uname$udom/$unique_path/$stuname/part$partid/resp$respid",0700);
+            &mkpath($doc_zip_root."/zipdir/$uname$udom/$unique_path/$stuname/part$partid/resp$respid",0,0700);
             my $files = &Apache::grades::get_submitted_files($studom,$stuname,$partid,$respid,\%record);
             foreach my $file (@$files) {
                 $file =~ /(^.*\/)(.+$)/;
@@ -107,7 +102,7 @@
             }
         }
     }
-    mkdir($doc_zip_root."/zipout/$uname$udom",0700);
+    &mkpath($doc_zip_root."/zipout/$uname$udom",0,0700);
     my $statement = "cd $doc_zip_root/zipdir/$uname$udom/$unique_path\n";
     $statement .= "zip -r $doc_zip_root/zipout/$uname$udom/$zipout * > /dev/null";
     system($statement);