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

banghart lon-capa-cvs-allow@mail.lon-capa.org
Thu, 05 Apr 2007 16:18:22 -0000


banghart		Thu Apr  5 12:18:22 2007 EDT

  Modified files:              
    /loncom/interface	multidownload.pl 
  Log:
  	Seems now to work. Needs some uniquifying of download zip file.
  	Needs some mechanism to clean up old zip files.
  
  
Index: loncom/interface/multidownload.pl
diff -u loncom/interface/multidownload.pl:1.2 loncom/interface/multidownload.pl:1.3
--- loncom/interface/multidownload.pl:1.2	Wed Apr  4 20:50:32 2007
+++ loncom/interface/multidownload.pl	Thu Apr  5 12:18:22 2007
@@ -2,7 +2,7 @@
 # CGI-script to allow download of all essay submissions of 
 # multiple students.
 #
-# $Id: multidownload.pl,v 1.2 2007/04/05 00:50:32 banghart Exp $
+# $Id: multidownload.pl,v 1.3 2007/04/05 16:18:22 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -90,10 +90,15 @@
                 print $fh $file_content;
                 close $fh;
             } else {
-                print "problem creating file <br />";
+                print("problem creating file <br />");
             }
         }
     }
 }
-print '<a href="../zipout/output.zip">Click to download</a>';
+mkdir($doc_root."/zipout",0777);
+my $statement = "zip -r $doc_root/zipout/output.zip $doc_root/zipdir/* > /dev/null";
+system($statement);
+$statement = "rm -rf $doc_root/zipdir";
+system($statement);
+print('<a href="../zipout/output.zip">Click to download</a>');
 return 1;