Commit 85122b03 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add checkbox to set configurable theme colours to default (bug #814354)



Change-Id: I899308f41457696d3c4578e5f3105d7d32685d23
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 921930ee
......@@ -351,6 +351,12 @@ if ($institution || $add) {
'defaultvalue' => isset($customtheme[$name]) ? $customtheme[$name] : $styledata['value'],
);
}
$elements['customthemefs']['elements']['resetcustom'] = array(
'type' => 'checkbox',
'class' => 'nojs-hidden-inline',
'title' => get_string('resetcolours', 'admin'),
'description' => get_string('resetcoloursdesc', 'admin'),
);
$elements['showonlineusers'] = array(
'type' => 'select',
'title' => get_string('showonlineusers', 'admin'),
......@@ -591,6 +597,10 @@ function institution_submit(Pieform $form, $values) {
$newinstitution->style = null;
}
if (!empty($values['resetcustom']) && !empty($oldinstitution->style)) {
$newinstitution->style = null;
}
if ($USER->get('admin') || get_config_plugin('artefact', 'file', 'institutionaloverride')) {
$newinstitution->defaultquota = empty($values['defaultquota']) ? get_config_plugin('artefact', 'file', 'defaultquota') : $values['defaultquota'];
}
......@@ -668,6 +678,11 @@ function institution_submit(Pieform $form, $values) {
update_record('institution', $newinstitution, $where);
}
if (is_null($newinstitution->style) && !empty($oldinstitution->style)) {
delete_records('style_property', 'style', $oldinstitution->style);
delete_records('style', 'id', $oldinstitution->style);
}
// Set the logo after updating the institution, because the institution
// needs to exist before it can own the logo artefact.
if ($values['logo']) {
......
......@@ -688,6 +688,8 @@ $string['customtheme.sidebarfg'] = 'Side block content background';
$string['customtheme.sidebarlink'] = 'Side block link';
$string['customtheme.rowbg'] = 'Row background';
$string['customstylesforinstitution'] = 'Custom styles for %s';
$string['resetcolours'] = 'Reset colours';
$string['resetcoloursdesc'] = 'Restore default colours';
$string['authenticatedby'] = 'Authentication Method';
$string['authenticatedbydescription'] = 'How this user authenticates to Mahara';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment