diff options
author | Zach Copley <zach@status.net> | 2009-12-02 16:44:23 -0800 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2009-12-02 16:44:23 -0800 |
commit | 4f359d2a8baa89f3ced8b9d7ac2c9dd1b4cfb73b (patch) | |
tree | 40486532c0e9a09caf3d0c8b1de508947694b805 /lib/designsettings.php | |
parent | 3e38d376a9ed53d6a6268106a7a85c1e9f131034 (diff) |
Delete design when user chooses to restore default design, instead
of saving a design with site defaults.
Diffstat (limited to 'lib/designsettings.php')
-rw-r--r-- | lib/designsettings.php | 66 |
1 files changed, 8 insertions, 58 deletions
diff --git a/lib/designsettings.php b/lib/designsettings.php index 99f44b5b7..b70ba0dfc 100644 --- a/lib/designsettings.php +++ b/lib/designsettings.php @@ -334,49 +334,6 @@ class DesignSettingsAction extends AccountSettingsAction } /** - * Get a default design - * - * @return Design design - */ - - function defaultDesign() - { - $defaults = common_config('site', 'design'); - - $design = new Design(); - - try { - - $color = new WebColor(); - - $color->parseColor($defaults['backgroundcolor']); - $design->backgroundcolor = $color->intValue(); - - $color->parseColor($defaults['contentcolor']); - $design->contentcolor = $color->intValue(); - - $color->parseColor($defaults['sidebarcolor']); - $design->sidebarcolor = $color->intValue(); - - $color->parseColor($defaults['textcolor']); - $design->textcolor = $color->intValue(); - - $color->parseColor($defaults['linkcolor']); - $design->linkcolor = $color->intValue(); - - $design->backgroundimage = $defaults['backgroundimage']; - - $design->disposition = $defaults['disposition']; - - } catch (WebColorException $e) { - common_log(LOG_ERR, _('Bad default color settings: ' . - $e->getMessage())); - } - - return $design; - } - - /** * Save the background image, if any, and set its disposition * * @param Design $design a working design to attach the img to @@ -445,24 +402,17 @@ class DesignSettingsAction extends AccountSettingsAction function restoreDefaults() { - $design = $this->getWorkingDesign(); - $default = $this->defaultDesign(); - $original = clone($design); - - $design->backgroundcolor = $default->backgroundcolor; - $design->contentcolor = $default->contentcolor; - $design->sidebarcolor = $default->sidebarcolor; - $design->textcolor = $default->textcolor; - $design->linkcolor = $default->linkcolor; + $design = $this->getWorkingDesign(); - $design->setDisposition(false, true, false); + if (!empty($design)) { - $result = $design->update($original); + $result = $design->delete(); - if ($result === false) { - common_log_db_error($design, 'UPDATE', __FILE__); - $this->showForm(_('Couldn\'t update your design.')); - return; + if ($result === false) { + common_log_db_error($design, 'DELETE', __FILE__); + $this->showForm(_('Couldn\'t update your design.')); + return; + } } $this->showForm(_('Design defaults restored.'), true); |