From c8218a42fa066d01b773ccd05020270275571baa Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 17 Sep 2006 12:11:23 +0000 Subject: [PATCH] Partial fix for missing deafult values in upgradesettings.php script - MDL-6577 --- lib/adminlib.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/adminlib.php b/lib/adminlib.php index 02f976311d..b361cdadfe 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -1239,7 +1239,7 @@ class admin_setting_configtext extends admin_setting { function get_setting() { global $CFG; - return (isset($CFG->{$this->name}) ? $CFG->{$this->name} : $this->defaultsetting); + return (isset($CFG->{$this->name}) ? $CFG->{$this->name} : NULL); } function write_setting($data) { @@ -1258,8 +1258,13 @@ class admin_setting_configtext extends admin_setting { } function output_html() { + if ($this->get_setting() === NULL) { + $current = $this->defaultsetting; + } else { + $current = $this->get_setting(); + } return '' . $this->visiblename . '' . - '' . + '' . ' ' . $this->description . ''; } @@ -1285,8 +1290,13 @@ class admin_setting_configcheckbox extends admin_setting { } function output_html() { + if ($this->get_setting() === NULL) { + $current = $this->defaultsetting; + } else { + $current = $this->get_setting(); + } return '' . $this->visiblename . '' . - 'get_setting() == true ? 'checked="checked"' : '') . ' />' . + '' . ' ' . $this->description . ''; } @@ -1317,9 +1327,14 @@ class admin_setting_configselect extends admin_setting { } function output_html() { + if ($this->get_setting() === NULL) { + $current = $this->defaultsetting; + } else { + $current = $this->get_setting(); + } $return = '' . $this->visiblename . ' ' . $this->description . ''; return $return; @@ -1364,6 +1379,7 @@ class admin_setting_configtime extends admin_setting { } function output_html() { + //TO DO: fix handling of default values here! $setvalue = $this->get_setting(); if (!is_array($setvalue)) { $setvalue = array(0,0); @@ -1404,6 +1420,7 @@ class admin_setting_configmultiselect extends admin_setting_configselect { } function output_html() { + //TO DO: fix handling of default values here! $currentsetting = $this->get_setting(); if (!is_array($currentsetting)) { $currentsetting = array(); @@ -1505,6 +1522,7 @@ class admin_setting_courselist_frontpage extends admin_setting_configselect { } function output_html() { + //TO DO: fix handling of default values here! $currentsetting = $this->get_setting(); if (!is_array($currentsetting)) { -- 2.39.5