MDL-24329 reverting previous patch, it should be imo better to not should discouraged...
authorPetr Skoda <skodak@moodle.org>
Wed, 22 Sep 2010 08:18:18 +0000 (08:18 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 22 Sep 2010 08:18:18 +0000 (08:18 +0000)
admin/settings/courses.php
course/edit_form.php

index 59a6aa5..0e2a670 100644 (file)
@@ -42,8 +42,10 @@ if ($hassiteconfig
     $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), get_string('coursehelpmaximumupload'), key($choices), $choices));
 
 
-    $choices = array('0'=>get_string('no'), '2'=>get_string('yes'));
-    $temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', get_string('courselegacyfiles'), get_string('courselegacyfiles_help'), key($choices), $choices));
+    if (!empty($CFG->legacyfilesinnewcourses)) {
+        $choices = array('0'=>get_string('no'), '2'=>get_string('yes'));
+        $temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', get_string('courselegacyfiles'), get_string('courselegacyfiles_help'), key($choices), $choices));
+    }
 
     $temp->add(new admin_setting_heading('groups', get_string('groups', 'group'), ''));
     $choices = array();
index c46c8d4..3de0d33 100644 (file)
@@ -163,6 +163,10 @@ class course_edit_form extends moodleform {
             }
             $mform->addElement('select', 'legacyfiles', get_string('courselegacyfiles'), $choices);
             $mform->addHelpButton('legacyfiles', 'courselegacyfiles');
+            if (!isset($courseconfig->legacyfiles)) {
+                // in case this was not initialised properly due to switching of $CFG->legacyfilesinnewcourses
+                $courseconfig->legacyfiles = 0;
+            }
             $mform->setDefault('legacyfiles', $courseconfig->legacyfiles);
         }