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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 06 Jun 2007 18:51:52 -0000


albertel		Wed Jun  6 14:51:52 2007 EDT

  Modified files:              
    /loncom/interface	multidownload.pl 
  Log:
  - style
  
  
Index: loncom/interface/multidownload.pl
diff -u loncom/interface/multidownload.pl:1.35 loncom/interface/multidownload.pl:1.36
--- loncom/interface/multidownload.pl:1.35	Wed May 23 16:40:44 2007
+++ loncom/interface/multidownload.pl	Wed Jun  6 14:51:49 2007
@@ -2,7 +2,7 @@
 # CGI-script to allow download of all essay submissions of 
 # multiple students.
 #
-# $Id: multidownload.pl,v 1.35 2007/05/23 20:40:44 banghart Exp $
+# $Id: multidownload.pl,v 1.36 2007/06/06 18:51:49 albertel Exp $
 # Copyright Michigan State University Board of Trustees
 #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -31,10 +31,8 @@
 use File::Path;
 use File::Basename;
 use File::Copy;
-use IO::File;
 use Apache::lonhtmlcommon();
-use Apache::lonnavmaps;
-use Apache::lonnet;
+use Apache::lonnavmaps();
 use Apache::loncommon();
 use Apache::lonlocal;
 use Apache::lonmsg();
@@ -57,6 +55,8 @@
     }
     return ($flat_part, $flat_resp);
 }
+
+
 sub get_part_resp_path {
     my ($flat_part, $flat_resp, $part_id, $resp_id) = @_;
     my $part_resp_path = "";
@@ -69,6 +69,8 @@
     $part_resp_path =~ s/\/^//; 
     return('/'.$part_resp_path);
 }
+
+
 $|=1;
 if (! &LONCAPA::loncgi::check_cookie_and_load_env()) {
     print <<END;
@@ -83,6 +85,7 @@
 END
     return;
 }
+
 &Apache::lonlocal::get_language_handle();
 &Apache::loncommon::content_type(undef,'text/html');
 my $identifier = $ENV{'QUERY_STRING'};
@@ -120,6 +123,7 @@
     print MANIFEST (&mt("Zip file generated on [_1]",&Apache::lonlocal::locallocaltime(time()))."\n");
     print MANIFEST (&mt("Course: [_1]",$env{"course.$courseid.description"})."\n");
     print MANIFEST (&mt("Problem: [_1]",$res->compTitle)."\n");
+    print MANIFEST (&mt("Files contained in this zip:")."\n");
     print MANIFEST (&mt("Files contained in this zip:\n"));
     my $file_problem = 0;
     my $current_student = 0;
@@ -131,10 +135,11 @@
         my %record = &Apache::lonnet::restore($symb,$courseid,$studom,$stuname);
         my $file_url = '/uploaded/'.$studom.'/'.$stuname.'/portfolio';
         print MANIFEST ($fullname."\n");
+         
         my $submission_count = 0;
         foreach my $partid (@$partlist) {
             my @ids = $res->responseIds($partid);
-            foreach my $respid(@ids) {
+            foreach my $respid (@ids) {
                 my $part_resp_path = &get_part_resp_path($flat_part,$flat_resp, $partid, $respid);
                 &mkpath($doc_zip_root."/zipdir/$unique_user/$unique_path/$stuname/$part_resp_path",0,0700);
                 foreach my $file (split(',',$record{"resource.$partid.$respid.portfiles"})) {
@@ -150,12 +155,12 @@
                         # file has already been saved once
                         my ($file_name,$file_ext) = ($destination =~ /(^.*)(\..+$)/);
                         $destination = $file_name.$files_saved{$destination}.$file_ext;
-                        $files_saved{$destination} ++;
+                        $files_saved{$destination}++;
                     }
                     $files_saved{$destination}++;
                     if (!&copy($source,$destination)) {
                         if (!$file_problem) {
-                            print(&mt("Unable to create: <br />"));
+                            print(&mt("Unable to create: ")."<br />");
                             $file_problem = 1;
                         }
                         print("$stuname/part$partid/resp$respid/$file_name_only <br />");