Commit caef859b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Better message when changing site/institution theme

parent 7066ae1e
......@@ -166,6 +166,7 @@ function siteoptions_submit(Pieform $form, $values) {
'defaultaccountlifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn',
'allowpublicviews', 'searchplugin');
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
foreach ($fields as $field) {
if (!set_config($field, $values[$field])) {
siteoptions_fail($form, $field);
......@@ -186,7 +187,11 @@ function siteoptions_submit(Pieform $form, $values) {
siteoptions_fail($form, $checkbox);
}
}
$form->reply(PIEFORM_OK, array('message' => get_string('siteoptionsset', 'admin'), 'goto' => '/admin/site/options.php'));
$message = get_string('siteoptionsset', 'admin');
if ($oldtheme != $values['theme']) {
$message .= ' ' . get_string('usersseenewthemeonlogin', 'admin');
}
$form->reply(PIEFORM_OK, array('message' => $message, 'goto' => '/admin/site/options.php'));
}
$thispage = json_encode(get_config('wwwroot') . 'admin/site/options.php');
......
......@@ -380,6 +380,7 @@ function institution_submit(Pieform $form, $values) {
else {
$where = new StdClass;
$where->name = $institution;
$oldtheme = get_field('institution', 'theme', 'name', $institution);
update_record('institution', $newinstitution, $where);
}
......@@ -395,15 +396,19 @@ function institution_submit(Pieform $form, $values) {
db_commit();
if ($add) {
$message = 'institutionaddedsuccessfully';
$message = get_string('institutionaddedsuccessfully', 'admin');
$nexturl = '/admin/users/institutions.php?i='.urlencode($institution);
}
else {
$message = 'institutionupdatedsuccessfully';
$message = get_string('institutionupdatedsuccessfully', 'admin');
if ($oldtheme != $values['theme']
&& (!empty($oldtheme) || $values['theme'] != 'sitedefault')) {
$message .= ' ' . get_string('usersseenewthemeonlogin', 'admin');
}
$nexturl = '/admin/users/institutions.php';
}
$SESSION->add_ok_msg(get_string($message, 'admin'));
$SESSION->add_ok_msg($message);
redirect($nexturl);
}
......
......@@ -121,12 +121,13 @@ $string['sitelanguagedescription'] = 'The default language for the site';
$string['sitename'] = 'Site name';
$string['sitenamedescription'] = 'The site name appears in certain places around the site and in e-mails sent from the site';
$string['siteoptionspagedescription'] = 'Here you can set some global options that will apply by default throughout the entire site.';
$string['siteoptionsset'] = 'Site options have been updated';
$string['siteoptionsset'] = 'Site options have been updated.';
$string['sitethemedescription'] = 'The default theme for the site';
$string['theme'] = 'Theme';
$string['updatesiteoptions'] = 'Update site options';
$string['usersallowedmultipleinstitutions'] = 'Users allowed multiple institutions';
$string['usersallowedmultipleinstitutionsdescription'] = 'If checked, users can be members of several institutions at the same time';
$string['usersseenewthemeonlogin'] = 'Users will see the new theme the next time they log in.';
$string['viruschecking'] = 'Virus checking';
$string['viruscheckingdescription'] = 'If checked, virus checking will be enabled for all uploaded files using ClamAV';
......@@ -306,7 +307,7 @@ $string['institutiondeletedsuccessfully'] = 'Institution deleted successfully';
$string['institutionname'] = 'Institution name';
$string['institutionnamealreadytaken'] = 'This institution name is already taken';
$string['institutiondisplayname'] = 'Institution display name';
$string['institutionupdatedsuccessfully'] = 'Institution updated successfully';
$string['institutionupdatedsuccessfully'] = 'Institution updated successfully.';
$string['registrationallowed'] = 'Registration allowed?';
$string['registrationalloweddescription'] = 'Whether users can register for the system with this institution';
$string['defaultmembershipperiod'] = 'Default membership period';
......
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