]> git.mjollnir.org Git - moodle.git/commitdiff
Minor fixes in the restore form when restoring from within SITEID. Merged from 19_STABLE
authorstronk7 <stronk7>
Sun, 13 Apr 2008 23:29:07 +0000 (23:29 +0000)
committerstronk7 <stronk7>
Sun, 13 Apr 2008 23:29:07 +0000 (23:29 +0000)
backup/restore_form.html

index 187d6d01c7dd34f240c4cd66b6b51cbeadddc989..aeb7651fbce705f69752c9c1eec8eb739c20e97e 100644 (file)
@@ -193,7 +193,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
     // permission should have been checked already
 
     /**
-     * if user has manageactivities in any course, we show
+     * if user has manageactivities in any course and we are not restoring from within SITEID
      *      existingcoursedeleting
      *      existingcourseadding
      * else we show
@@ -209,14 +209,13 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
     } else {
         $accessinfo = get_user_access_sitewide($USER->id);
     }
-    
+
     $mycourses = get_user_courses_bycap($USER->id, 'moodle/site:restore', $accessinfo, true);
-    // if the user can manage 2 or more courses,
-    // or if the only course the user can manage is not the current course
+
+    // if the user can manage 2 or more courses and we are not restoring from within SITEID,
     // we show options for existing courses
-    
-    if (count($mycourses) > 1) {
-        // if user can manage more than 1 course, or if user can restore to a single different course
+
+    if (count($mycourses) > 1 && $id != SITEID) {
         $restore_restoreto_options[0] = get_string("existingcoursedeleting");
         $restore_restoreto_options[1] = get_string("existingcourseadding");
     // else if the user can write to current course
@@ -243,8 +242,14 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
         echo '<label for="menurestore_restorecatto">'.get_string ('category').'</label>';
         echo "</td>";
         echo "<td>";
-        make_categories_list($categories, $parents);
-        choose_from_menu($categories, "restore_restorecatto", $course_header->category->id, "");
+        // Category selection isn't alowed if restoring from within SITEID course
+        if ($id != SITEID) {
+            make_categories_list($categories, $parents);
+            choose_from_menu($categories, "restore_restorecatto", $course_header->category->id, "");
+        } else {
+            print_string('notavailable');
+            echo '<input type="hidden" name="restore_restorecatto" id="menurestore_restorecatto" value="0" />';
+        }
         echo "</td>";
         echo "</tr>";
 
@@ -274,13 +279,13 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
     /// from 0 produces crazy dates. MDL-10125
         if ($form1->startdate) {
             print_date_selector("startday", "startmonth", "startyear", $form1->startdate);
+            helpbutton("coursestartdate", get_string("startdate"));
         } else {
             print_string('notavailable');
             echo '<input type="hidden" name="startyear" value="0" />';
             echo '<input type="hidden" name="startmonth" value="0" />';
             echo '<input type="hidden" name="startday" value="0" />';
         }
-        helpbutton("coursestartdate", get_string("startdate"));
         echo "</td></tr>";
     }
     //Line