]> git.mjollnir.org Git - moodle.git/commitdiff
New CFG->zip and CFG->unzip valiables which specify programs to use
authormartin <martin>
Sun, 18 Aug 2002 15:26:04 +0000 (15:26 +0000)
committermartin <martin>
Sun, 18 Aug 2002 15:26:04 +0000 (15:26 +0000)
when zipping and unzipping files.  Unix only at this stage. (Zip interfaces
for Windows are much less standardised)

config-dist.php
files/index.php

index a58b7442d5b5882c34154b33138fe6a3780f73a0..87a676a9384c2da2d86bdf83b46a6f9d3d746a2e 100644 (file)
@@ -93,6 +93,13 @@ $CFG->gdversion = 1;
 $CFG->longtimenosee = 100;
 
 
+// These programs are used by the file management code to zip and unzip 
+// uploaded files.  This only works on Unix systems right now.
+
+$CFG->zip   = "/usr/bin/zip";
+$CFG->unzip = "/usr/bin/unzip";
+
+
 // You should not need to change anything else. To continue setting up 
 // Moodle, use your web browser to go to the moodle/admin web page.
 ///////////////////////////////////////////////////////////////////////////
index 0b6bdbe1cc69ed282a7f8e23cf32825c93187bc4..07f3cd9a9cae85e7298d01f2c3986c5909d8464a 100644 (file)
         error("Only teachers can edit files");
     }
 
+    if (!$CFG->zip) {
+        $CFG->zip = "/usr/bin/zip";
+    }
+
+    if (!$CFG->unzip) {
+        $CFG->unzip = "/usr/bin/unzip";
+    }
+
     function html_footer() {
         global $course;
         echo "</td></tr></table></body></html>";
     
     function html_header($formfield=""){
         global $course;
+
+        $strfiles = get_string("files");
     
-        print_header("$course->shortname: Files", "$course->shortname: Files", 
-                    "<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> -> Files", $formfield);
+        print_header("$course->shortname: $strfiles", "$course->fullname", 
+                    "<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> -> $strfiles", $formfield);
         echo "<table border=0 align=center cellspacing=3 cellpadding=3 width=640>";
         echo "<tr>";
         echo "<td colspan=\"2\">";
                     $files .= basename($file);
                     $files .= " ";
                 }
-                $command = "cd $basedir/$wdir ; /usr/bin/zip -r $name $files";
+                $command = "cd $basedir/$wdir ; $CFG->zip -r $name $files";
                 Exec($command);
                 clearfilelist();
                 displaydir($wdir);
                 print_simple_box_start("center");
                 echo "<PRE>";
                 $file = basename($file);
-                $command = "cd $basedir/$wdir ; /usr/bin/unzip -o $file 2>&1";
+                $command = "cd $basedir/$wdir ; $CFG->unzip -o $file 2>&1";
                 passthru($command);
                 echo "</PRE>";
                 print_simple_box_end();