Ticket #2701: old color settings now get reset when changing themes, so you don't end up with the previous theme's colors.

This commit is contained in:
Brion Vibber 2010-09-13 13:37:13 -07:00
parent 0021c16bd1
commit ead2f3375a
1 changed files with 15 additions and 2 deletions

View File

@ -154,9 +154,22 @@ class DesignadminpanelAction extends AdminPanelAction
$config->query('BEGIN');
// Only update colors if the theme has not changed.
if ($themeChanged) {
// If the theme has changed, reset custom colors and let them pick
// up the new theme's defaults.
$colors = array('background', 'content', 'sidebar', 'text', 'link');
foreach ($colors as $colorKey) {
// Clear from global config so we see defaults on this page...
$GLOBALS['config']['design'][$colorKey . 'color'] = false;
if (!$themeChanged) {
// And remove old settings from DB...
$this->deleteSetting('design', $colorKey . 'color');
}
} else {
// Only save colors from the form if the theme has not changed.
//
// @fixme a future more ajaxy form should allow theme switch
// and color customization in one step.
$bgcolor = new WebColor($this->trimmed('design_background'));
$ccolor = new WebColor($this->trimmed('design_content'));