Permalink
Browse files

GUI for category themes.

New language strings.
  • Loading branch information...
1 parent cb63031 commit a907c54043ba22c1d36bb3ea25e9d8c0d7212575 ikawhero committed May 3, 2007
Showing with 32 additions and 0 deletions.
  1. +1 −0 admin/settings/appearance.php
  2. +24 −0 course/category.php
  3. +2 −0 lang/en_utf8/admin.php
  4. +1 −0 lang/en_utf8/moodle.php
  5. +4 −0 theme/standard/styles_layout.css
@@ -8,6 +8,7 @@
$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,
View
@@ -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 '<input type="submit" value="'.$strrename.'" />';
echo '</div></form>';
echo '<br />';
+
+ if (!empty($CFG->allowcategorythemes)) {
+ $choices = array();
+ $choices[''] = get_string('default');
+ $choices += get_list_of_themes();
+
+ echo '<form id="themeform" action="category.php" method="post"><div>';
+ echo '<input type="hidden" name="id" value="'.$category->id.'" />';
+ echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
+ choose_from_menu($choices, 'categorytheme', $category->theme);
+ echo '<input type="submit" value="'.get_string('setcategorytheme').'" />';
+ echo '</div></form>';
+ echo '<br />';
+ }
}
+
print_course_search();
View
@@ -7,6 +7,7 @@
$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['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 <strong>ourcollege.edu.au .gov.au</strong>';
$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.';
View
@@ -1252,6 +1252,7 @@
$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';
@@ -1879,6 +1879,10 @@ body#course-info .generalbox.info {
text-align:center;
}
+#course-category #themeform {
+ text-align: center;
+}
+
#course-category .singlebutton {
text-align:center;
}

0 comments on commit a907c54

Please sign in to comment.