summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-12-02 18:09:24 -0800
committerZach Copley <zach@status.net>2009-12-02 18:09:24 -0800
commit9e0f89ba4ff1695c0137faa89c08f8b5c60050ac (patch)
tree95c425cf66b92c3fedb13f851494a06a6488a7c5
parentbf63734359976a0bc32a45687fcda190b693b9d1 (diff)
parent56b3e13d4aec5649b5858597729a1af5e5407c9c (diff)
Merge branch 'fix-default-design' into 0.9.x
* fix-default-design: Reload the admin design panel page to show the new CSS when the Only pick up new default site colors if the theme has NOT changed.
-rw-r--r--actions/designadminpanel.php53
1 files changed, 29 insertions, 24 deletions
diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php
index 8bc8c4450..f862aff0e 100644
--- a/actions/designadminpanel.php
+++ b/actions/designadminpanel.php
@@ -129,8 +129,6 @@ class DesignadminpanelAction extends AdminPanelAction
$bgimage = $this->saveBackgroundImage();
- common_debug("background image: $bgimage");
-
static $settings = array('theme', 'logo');
$values = array();
@@ -141,13 +139,28 @@ class DesignadminpanelAction extends AdminPanelAction
$this->validate($values);
- // assert(all values are valid);
+ $oldtheme = common_config('site', 'theme');
+
+ $config = new Config();
+
+ $config->query('BEGIN');
+
+ // Only update colors if the theme has not changed.
+
+ if ($oldtheme == $values['theme']) {
- $bgcolor = new WebColor($this->trimmed('design_background'));
- $ccolor = new WebColor($this->trimmed('design_content'));
- $sbcolor = new WebColor($this->trimmed('design_sidebar'));
- $tcolor = new WebColor($this->trimmed('design_text'));
- $lcolor = new WebColor($this->trimmed('design_links'));
+ $bgcolor = new WebColor($this->trimmed('design_background'));
+ $ccolor = new WebColor($this->trimmed('design_content'));
+ $sbcolor = new WebColor($this->trimmed('design_sidebar'));
+ $tcolor = new WebColor($this->trimmed('design_text'));
+ $lcolor = new WebColor($this->trimmed('design_links'));
+
+ Config::save('design', 'backgroundcolor', $bgcolor->intValue());
+ Config::save('design', 'contentcolor', $ccolor->intValue());
+ Config::save('design', 'sidebarcolor', $sbcolor->intValue());
+ Config::save('design', 'textcolor', $tcolor->intValue());
+ Config::save('design', 'linkcolor', $lcolor->intValue());
+ }
$onoff = $this->arg('design_background-image_onoff');
@@ -162,9 +175,11 @@ class DesignadminpanelAction extends AdminPanelAction
$tile = $this->boolean('design_background-image_repeat');
- $config = new Config();
+ // Hack to use Design's bit setter
+ $scratch = new Design();
+ $scratch->setDisposition($on, $off, $tile);
- $config->query('BEGIN');
+ Config::save('design', 'disposition', $scratch->disposition);
foreach ($settings as $setting) {
Config::save('site', $setting, $values[$setting]);
@@ -174,21 +189,7 @@ class DesignadminpanelAction extends AdminPanelAction
Config::save('design', 'backgroundimage', $bgimage);
}
- Config::save('design', 'backgroundcolor', $bgcolor->intValue());
- Config::save('design', 'contentcolor', $ccolor->intValue());
- Config::save('design', 'sidebarcolor', $sbcolor->intValue());
- Config::save('design', 'textcolor', $tcolor->intValue());
- Config::save('design', 'linkcolor', $lcolor->intValue());
-
- // Hack to use Design's bit setter
- $scratch = new Design();
- $scratch->setDisposition($on, $off, $tile);
-
- Config::save('design', 'disposition', $scratch->disposition);
-
$config->query('COMMIT');
-
- return;
}
/**
@@ -212,6 +213,10 @@ class DesignadminpanelAction extends AdminPanelAction
}
// XXX: Should we restore the default dir settings, etc.? --Z
+
+ // XXX: I can't get it to show the new settings without forcing
+ // this terrible reload -- FIX ME!
+ common_redirect(common_local_url('designadminpanel'), 303);
}
/**