From a907c54043ba22c1d36bb3ea25e9d8c0d7212575 Mon Sep 17 00:00:00 2001 From: ikawhero Date: Thu, 3 May 2007 07:00:55 +0000 Subject: [PATCH] GUI for category themes. New language strings. --- admin/settings/appearance.php | 1 + course/category.php | 24 ++++++++++++++++++++++++ lang/en_utf8/admin.php | 2 ++ lang/en_utf8/moodle.php | 1 + theme/standard/styles_layout.css | 4 ++++ 5 files changed, 32 insertions(+) diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 355221bf51b..2764c972d35 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -8,6 +8,7 @@ $temp = new admin_settingpage('themesettings', get_string('themesettings', 'admi $temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS)); $temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0)); +$temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1)); $temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0)); $temp->add(new admin_setting_configselect('hideactivitytypecrumb', get_string('hideactivitytypecrumb', 'admin'), get_string('confighideactivitytypecrumb', 'admin'), 0, diff --git a/course/category.php b/course/category.php index aaad8155736..2690cb26fc2 100644 --- a/course/category.php +++ b/course/category.php @@ -17,6 +17,7 @@ $moveto = optional_param('moveto', 0, PARAM_INT); $rename = optional_param('rename', '', PARAM_NOTAGS); $resort = optional_param('resort', 0, PARAM_BOOL); + $categorytheme= optional_param('categorytheme', false, PARAM_CLEAN); if (!$site = get_site()) { error("Site isn't defined!"); @@ -59,6 +60,14 @@ } } + /// Set the category theme if requested + if (($categorytheme !== false) and confirm_sesskey()) { + $category->theme = $categorytheme; + if (! set_field('course_categories', 'theme', $category->theme, 'id', $category->id)) { + notify('An error occurred while setting the theme'); + } + } + /// Resort the category if requested if ($resort and confirm_sesskey()) { @@ -449,7 +458,22 @@ echo ''; echo ''; echo '
'; + + if (!empty($CFG->allowcategorythemes)) { + $choices = array(); + $choices[''] = get_string('default'); + $choices += get_list_of_themes(); + + echo '
'; + echo ''; + echo ''; + choose_from_menu($choices, 'categorytheme', $category->theme); + echo ''; + echo '
'; + echo '
'; + } } + print_course_search(); diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index da4165d657b..c53a2ca2d9b 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -7,6 +7,7 @@ $string['accounts'] = 'Accounts'; $string['adminseesall'] = 'Admins See All'; $string['adminseesallevents'] = 'Administrators see all events'; $string['adminseesownevents'] = 'Administrators are just like other users'; +$string['allowcategorythemes'] = 'Allow category themes'; $string['allowcoursethemes'] = 'Allow course themes'; $string['allowemailaddresses'] = 'Allowed email domains'; $string['allowobjectembed'] = 'Allow EMBED and OBJECT tags'; @@ -45,6 +46,7 @@ $string['cleanup'] = 'Cleanup'; $string['componentinstalled'] = 'Component Installed'; $string['confeditorhidebuttons'] = 'Select the buttons that should be hidden in the HTML editor.'; $string['configallowassign'] = 'Allow the roles on the left side to assign the roles in each column'; +$string['configallowcategorythemes'] = 'If you enable this, then themes can be set at the category level. This will affect all child categories and courses unless they have specifically set their own theme. WARNING: Enabling category themes may affect performance.'; $string['configallowcoursethemes'] = 'If you enable this, then courses will be allowed to set their own themes. Course themes override all other theme choices (site, user, or session themes)'; $string['configallowemailaddresses'] = 'If you want to restrict all new email addresses to particular domains, then list them here separated by spaces. All other domains will be rejected. eg ourcollege.edu.au .gov.au'; $string['configallowobjectembed'] = 'As a default security measure, normal users are not allowed to embed multimedia (like Flash) within texts using explicit EMBED and OBJECT tags in their HTML (although it can still be done safely using the mediaplugins filter). If you wish to allow these tags then enable this option.'; diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index e2d2b0ace42..f2743ec19e8 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -1252,6 +1252,7 @@ $string['senddetails'] = 'Send my details via email'; $string['separate'] = 'Separate'; $string['separateandconnected'] = 'Separate and Connected ways of knowing'; $string['serverlocaltime'] = 'Server\'s local time'; +$string['setcategorytheme'] = 'Set Category Theme'; $string['settings'] = 'Settings'; $string['shortname'] = 'Short name'; $string['shortnamecollisionwarning'] = '[*] = This shortname is already in use by a course and will need to be changed upon approval'; diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index fc6780f7a84..ace43337278 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -1879,6 +1879,10 @@ body#course-info .generalbox.info { text-align:center; } +#course-category #themeform { + text-align: center; +} + #course-category .singlebutton { text-align:center; }