summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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);
+ }
+
}