]> git.mjollnir.org Git - moodle.git/commitdiff
Minor changes to support the "restore" option with zip files. Only
authorstronk7 <stronk7>
Wed, 14 May 2003 23:09:34 +0000 (23:09 +0000)
committerstronk7 <stronk7>
Wed, 14 May 2003 23:09:34 +0000 (23:09 +0000)
showed if the backup utility is installed ($CFG->backup_version exists)
and the user is an admin. Sent email to Martin to say him this !!

files/index.php

index 8e2d800a4bf2cff642af26d37eb3b366731843c4..31cecb1debfbc049de53552c99f7dcf046f6c2fd 100644 (file)
             html_footer();
             break;
 
-
+        case "restore":
+            html_header($course, $wdir);
+            if (!empty($file)) {
+                echo "<P ALIGN=CENTER>".get_string("youaregoingtorestorefrom")."</P>";
+                print_simple_box_start("center");
+                echo $file;
+                print_simple_box_end();
+                echo "<BR>";
+                //MODIFY RELATIVE PATH TO restore.php
+                $restore_path = "../contrib/stronk7/backup/restore.php";
+                //END MODIFY
+                notice_yesno (get_string("areyousuretorestorethis"),
+                                $restore_path."?file=".$id.$wdir."/".$file,
+                                "index.php?id=$id&wdir=$wdir&action=cancel");
+            } else {
+                displaydir($wdir);
+            }
+            html_footer();
+            break;
+          
         case "cancel";
             clearfilelist();
 
@@ -634,6 +653,7 @@ function displaydir ($wdir) {
     $stredit   = get_string("edit");
     $strunzip  = get_string("unzip");
     $strlist   = get_string("list");
+    $strrestore= get_string("restore");
 
 
     echo "<FORM ACTION=\"index.php\" METHOD=post NAME=dirform>";
@@ -716,6 +736,9 @@ function displaydir ($wdir) {
             } else if ($icon == "zip.gif") {
                 $edittext = "<A HREF=\"index.php?id=$id&wdir=$wdir&file=$fileurl&action=unzip\">$strunzip</A>&nbsp;";
                 $edittext .= "<A HREF=\"index.php?id=$id&wdir=$wdir&file=$fileurl&action=listzip\">$strlist</A> ";
+                if ($CFG->backup_version && isadmin()) {
+                    $edittext .= "<A HREF=\"index.php?id=$id&wdir=$wdir&file=$filesafe&action=restore\">$strrestore</A> ";
+                }
             } else {
                 $edittext = "";
             }