Merge branch 'MDL-44912-master-core' of git://github.com/FMCorz/moodle

This commit is contained in:
Sam Hemelryk 2014-04-08 11:42:29 +12:00
commit 3fb4d8fa88
2 changed files with 18 additions and 7 deletions

View File

@ -8142,6 +8142,11 @@ class admin_setting_configcolourpicker extends admin_setting {
*/
protected $previewconfig = null;
/**
* Use default when empty.
*/
protected $usedefaultwhenempty = true;
/**
*
* @param string $name
@ -8150,8 +8155,10 @@ class admin_setting_configcolourpicker extends admin_setting {
* @param string $defaultsetting
* @param array $previewconfig Array('selector'=>'.some .css .selector','style'=>'backgroundColor');
*/
public function __construct($name, $visiblename, $description, $defaultsetting, array $previewconfig=null) {
public function __construct($name, $visiblename, $description, $defaultsetting, array $previewconfig = null,
$usedefaultwhenempty = true) {
$this->previewconfig = $previewconfig;
$this->usedefaultwhenempty = $usedefaultwhenempty;
parent::__construct($name, $visiblename, $description, $defaultsetting);
}
@ -8242,7 +8249,11 @@ class admin_setting_configcolourpicker extends admin_setting {
} else if (($data == 'transparent') || ($data == 'currentColor') || ($data == 'inherit')) {
return $data;
} else if (empty($data)) {
return $this->defaultsetting;
if ($this->usedefaultwhenempty){
return $this->defaultsetting;
} else {
return '';
}
} else {
return false;
}

View File

@ -40,7 +40,7 @@ if ($ADMIN->fulltree) {
$title = get_string('textcolor', 'theme_more');
$description = get_string('textcolor_desc', 'theme_more');
$default = '#333366';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
@ -49,7 +49,7 @@ if ($ADMIN->fulltree) {
$title = get_string('linkcolor', 'theme_more');
$description = get_string('linkcolor_desc', 'theme_more');
$default = '#FF6500';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
@ -58,7 +58,7 @@ if ($ADMIN->fulltree) {
$title = get_string('bodybackground', 'theme_more');
$description = get_string('bodybackground_desc', 'theme_more');
$default = '';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
@ -120,7 +120,7 @@ if ($ADMIN->fulltree) {
$title = get_string('contentbackground', 'theme_more');
$description = get_string('contentbackground_desc', 'theme_more');
$default = '#FFFFFF';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
@ -129,7 +129,7 @@ if ($ADMIN->fulltree) {
$title = get_string('secondarybackground', 'theme_more');
$description = get_string('secondarybackground_desc', 'theme_more');
$default = '#FFFFFF';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);