summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-09-13 13:37:13 -0700
committerBrion Vibber <brion@pobox.com>2010-09-13 13:37:13 -0700
commitead2f3375ad8f623b6b15aa4c7194224575b3c41 (patch)
tree6100201055e3212262fa1f936870884042f073fa
parent0021c16bd11be5c9e9f0196154b037e604d6bf37 (diff)
Ticket #2701: old color settings now get reset when changing themes, so you don't end up with the previous theme's colors.
-rw-r--r--actions/designadminpanel.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php
index 763737175..e3d772f7d 100644
--- a/actions/designadminpanel.php
+++ b/actions/designadminpanel.php
@@ -154,9 +154,22 @@ class DesignadminpanelAction extends AdminPanelAction
$config->query('BEGIN');
- // Only update colors if the theme has not changed.
-
- if (!$themeChanged) {
+ 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;
+
+ // 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'));