summaryrefslogtreecommitdiff
path: root/lib/designsettings.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-06-29 14:52:38 -0700
committerZach Copley <zach@controlyourself.ca>2009-06-29 14:52:38 -0700
commit135927e42a36e2accce557419f8c7d9cb8b999c0 (patch)
treed7115dcfef07c084b209669e3db39b25bb57a959 /lib/designsettings.php
parentdd1fc46f0986e5675d24208199b88150f643925d (diff)
Allow users and groups to reset their design to system default colors
Diffstat (limited to 'lib/designsettings.php')
-rw-r--r--lib/designsettings.php41
1 files changed, 39 insertions, 2 deletions
diff --git a/lib/designsettings.php b/lib/designsettings.php
index 5def5053f..0b5a76b91 100644
--- a/lib/designsettings.php
+++ b/lib/designsettings.php
@@ -272,8 +272,8 @@ class DesignSettingsAction extends AccountSettingsAction
if ($this->arg('save')) {
$this->saveDesign();
- } else if ($this->arg('reset')) {
- $this->resetDesign();
+ } else if ($this->arg('defaults')) {
+ $this->restoreDefaults();
} else {
$this->showForm(_('Unexpected form submission.'));
}
@@ -359,6 +359,12 @@ class DesignSettingsAction extends AccountSettingsAction
return $design;
}
+ /**
+ * Save the background image, if any, and set its disposition
+ *
+ * @return nothing
+ */
+
function saveBackgroundImage($design) {
// Now that we have a Design ID we can add a file to the design.
@@ -404,4 +410,35 @@ class DesignSettingsAction extends AccountSettingsAction
}
}
+ /**
+ * Restore the user or group design to system defaults
+ *
+ * @return nothing
+ */
+
+ 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->setDisposition(false, true, false);
+
+ $result = $design->update($original);
+
+ if ($result === false) {
+ common_log_db_error($design, 'UPDATE', __FILE__);
+ $this->showForm(_('Couldn\'t update your design.'));
+ return;
+ }
+
+ $this->showForm(_('Design defaults restored.'), true);
+ }
+
}