Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-27862 Themes: Added button to un-select theme for devices, except…

… default device
  • Loading branch information...
commit f5ee52a7fe905960722fa28f076ff0d1b0108eb5 1 parent 06d0948
@rajeshtaneja rajeshtaneja authored
Showing with 16 additions and 3 deletions.
  1. +1 −0  lang/en/admin.php
  2. +15 −3 theme/index.php
View
1  lang/en/admin.php
@@ -958,6 +958,7 @@
$string['unicoderecommended'] = 'Storing all your data in Unicode (UTF-8) is recommended. New installations should be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).';
$string['unicoderequired'] = 'It is required that you store all your data in Unicode format (UTF-8). New installations must be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).';
$string['uninstallplugin'] = 'Uninstall';
+$string['unsettheme'] = 'Unset theme';
$string['unsupported'] = 'Unsupported';
$string['unsuspenduser'] = 'Activate user account';
$string['updateaccounts'] = 'Update existing accounts';
View
18 theme/index.php
@@ -25,6 +25,7 @@
$choose = optional_param('choose', '', PARAM_PLUGIN);
$reset = optional_param('reset', 0, PARAM_BOOL);
$device = optional_param('device', '', PARAM_TEXT);
+$unsettheme = optional_param('unsettheme', 0, PARAM_BOOL);
admin_externalpage_setup('themeselector');
@@ -42,8 +43,7 @@
if ($reset and confirm_sesskey()) {
theme_reset_all_caches();
-} else if ($choose && $device && confirm_sesskey()) {
-
+} else if ($choose && $device && !$unsettheme && confirm_sesskey()) {
// Load the theme to make sure it is valid.
$theme = theme_config::load($choose);
// Get the config argument for the chosen device.
@@ -71,6 +71,10 @@
echo $output->continue_button($CFG->wwwroot . '/theme/index.php');
echo $output->footer();
exit;
+} else if ($device && $unsettheme && confirm_sesskey() && ($device != 'default')) {
+ //Unset the theme and continue.
+ unset_config(get_device_cfg_var_name($device));
+ $device = '';
}
// Otherwise, show either a list of devices, or is enabledevicedetection set to no or a
@@ -100,6 +104,7 @@
}
$screenshotcell = $strthemenotselected;
+ $unsetthemebutton = '';
if ($themename) {
// Check the theme exists
$themename = clean_param($themename, PARAM_THEME);
@@ -115,6 +120,13 @@
// Show the name of the picked theme
$headingthemename = $OUTPUT->heading($strthemename, 3);
}
+ // If not default device then show option to unset theme.
+ if ($device != 'default') {
+ $unsetthemestr = get_string('unsettheme', 'admin');
+ $unsetthemeurl = new moodle_url('/theme/index.php', array('device' => $device, 'sesskey' => sesskey(), 'unsettheme' => true));
+ $unsetthemebutton = new single_button($unsetthemeurl, $unsetthemestr, 'get');
+ $unsetthemebutton = $OUTPUT->render($unsetthemebutton);
+ }
}
$deviceurl = new moodle_url('/theme/index.php', array('device' => $device, 'sesskey' => sesskey()));
@@ -123,7 +135,7 @@
$table->data[] = array(
$device,
$screenshotcell,
- $headingthemename . $OUTPUT->render($select)
+ $headingthemename . $OUTPUT->render($select) . $unsetthemebutton
);
}
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.