mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-44357 theme_more: New customizable theme
AMOS BEGIN CPY [choosereadme,theme_clean],[choosereadme,theme_more] CPY [configtitle,theme_clean],[configtitle,theme_more] CPY [customcss,theme_clean],[customcss,theme_more] CPY [customcssdesc,theme_clean],[customcssdesc,theme_more] CPY [footnote,theme_clean],[footnote,theme_more] CPY [footnotedesc,theme_clean],[footnotedesc,theme_more] CPY [invert,theme_clean],[invert,theme_more] CPY [invertdesc,theme_clean],[invertdesc,theme_more] CPY [logo,theme_clean],[logo,theme_more] CPY [logodesc,theme_clean],[logodesc,theme_more] CPY [pluginname,theme_clean],[pluginname,theme_more] CPY [region-side-post,theme_clean],[region-side-post,theme_more] CPY [region-side-pre,theme_clean],[region-side-pre,theme_more] AMOS END
This commit is contained in:
parent
08823e5f03
commit
833511a005
@ -1113,7 +1113,7 @@ class core_plugin_manager {
|
||||
'theme' => array(
|
||||
'afterburner', 'anomaly', 'arialist', 'base', 'binarius', 'bootstrapbase',
|
||||
'boxxie', 'brick', 'canvas', 'clean', 'formal_white', 'formfactor',
|
||||
'fusion', 'leatherbound', 'magazine', 'nimble',
|
||||
'fusion', 'leatherbound', 'magazine', 'more', 'nimble',
|
||||
'nonzero', 'overlay', 'serenity', 'sky_high', 'splash',
|
||||
'standard', 'standardold'
|
||||
),
|
||||
|
@ -39,8 +39,6 @@ $THEME->name = 'clean';
|
||||
$THEME->doctype = 'html5';
|
||||
$THEME->parents = array('bootstrapbase');
|
||||
$THEME->sheets = array('custom');
|
||||
$THEME->lessfile = 'moodle';
|
||||
$THEME->parents_exclude_sheets = array('bootstrapbase' => array('moodle'));
|
||||
$THEME->supportscssoptimisation = false;
|
||||
$THEME->yuicssmodules = array();
|
||||
$THEME->enable_dock = true;
|
||||
@ -52,4 +50,4 @@ $THEME->csspostprocess = 'theme_clean_process_css';
|
||||
$THEME->blockrtlmanipulations = array(
|
||||
'side-pre' => 'side-post',
|
||||
'side-post' => 'side-pre'
|
||||
);
|
||||
);
|
||||
|
@ -116,6 +116,9 @@ function theme_clean_set_customcss($css, $customcss) {
|
||||
/**
|
||||
* Returns an object containing HTML for the areas affected by settings.
|
||||
*
|
||||
* Do not add Clean specific logic in here, child themes should be able to
|
||||
* rely on that function just by declaring settings with similar names.
|
||||
*
|
||||
* @param renderer_base $output Pass in $OUTPUT.
|
||||
* @param moodle_page $page Pass in $PAGE.
|
||||
* @return stdClass An object with the following properties:
|
||||
|
43
theme/more/config.php
Normal file
43
theme/more/config.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Theme More config file.
|
||||
*
|
||||
* @package theme_more
|
||||
* @copyright 2014 Frédéric Massart
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$THEME->name = 'more';
|
||||
$THEME->parents = array('clean', 'bootstrapbase');
|
||||
|
||||
$THEME->doctype = 'html5';
|
||||
$THEME->sheets = array('custom');
|
||||
$THEME->lessfile = 'moodle';
|
||||
$THEME->parents_exclude_sheets = array('bootstrapbase' => array('moodle'), 'clean' => array('custom'));
|
||||
$THEME->supportscssoptimisation = false;
|
||||
$THEME->yuicssmodules = array();
|
||||
$THEME->enable_dock = true;
|
||||
$THEME->editor_sheets = array();
|
||||
|
||||
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
|
||||
$THEME->csspostprocess = 'theme_more_process_css';
|
||||
|
||||
$THEME->blockrtlmanipulations = array(
|
||||
'side-pre' => 'side-post',
|
||||
'side-post' => 'side-pre'
|
||||
);
|
47
theme/more/lang/en/theme_more.php
Normal file
47
theme/more/lang/en/theme_more.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Theme More lang file.
|
||||
*
|
||||
* @package theme_more
|
||||
* @copyright 2014 Frédéric Massart
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['choosereadme'] = 'More is a theme that allows you to easily customize Moodle\'s look and feel.';
|
||||
|
||||
$string['configtitle'] = 'More';
|
||||
|
||||
$string['customcss'] = 'Custom CSS';
|
||||
$string['customcssdesc'] = 'Whatever CSS rules you add to this textarea will be reflected in every page, making for easier customization of this theme.';
|
||||
|
||||
$string['footnote'] = 'Footnote';
|
||||
$string['footnotedesc'] = 'Whatever you add to this textarea will be displayed in the footer throughout your Moodle site.';
|
||||
|
||||
$string['invert'] = 'Invert navbar';
|
||||
$string['invertdesc'] = 'Swaps text and background for the navbar at the top of the page between black and white.';
|
||||
|
||||
$string['logo'] = 'Logo';
|
||||
$string['logodesc'] = 'Please upload your custom logo here if you want to add it to the header.<br>
|
||||
If the height of your logo is more than 75px add the following CSS rule to the Custom CSS box below.<br>
|
||||
a.logo {height: 100px;} or whatever height in pixels the logo is.';
|
||||
|
||||
$string['pluginname'] = 'More';
|
||||
|
||||
$string['region-side-post'] = 'Right';
|
||||
$string['region-side-pre'] = 'Left';
|
||||
|
108
theme/more/lib.php
Normal file
108
theme/more/lib.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Theme More lib.
|
||||
*
|
||||
* @package theme_more
|
||||
* @copyright 2014 Frédéric Massart
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parses CSS before it is cached.
|
||||
*
|
||||
* This function can make alterations and replace patterns within the CSS.
|
||||
*
|
||||
* @param string $css The CSS
|
||||
* @param theme_config $theme The theme config object.
|
||||
* @return string The parsed CSS The parsed CSS.
|
||||
*/
|
||||
function theme_more_process_css($css, $theme) {
|
||||
|
||||
// Set the background image for the logo.
|
||||
$logo = $theme->setting_file_url('logo', 'logo');
|
||||
$css = theme_more_set_logo($css, $logo);
|
||||
|
||||
// Set custom CSS.
|
||||
if (!empty($theme->settings->customcss)) {
|
||||
$customcss = $theme->settings->customcss;
|
||||
} else {
|
||||
$customcss = null;
|
||||
}
|
||||
$css = theme_more_set_customcss($css, $customcss);
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the logo to CSS.
|
||||
*
|
||||
* @param string $css The CSS.
|
||||
* @param string $logo The URL of the logo.
|
||||
* @return string The parsed CSS
|
||||
*/
|
||||
function theme_more_set_logo($css, $logo) {
|
||||
$tag = '[[setting:logo]]';
|
||||
$replacement = $logo;
|
||||
if (is_null($replacement)) {
|
||||
$replacement = '';
|
||||
}
|
||||
|
||||
$css = str_replace($tag, $replacement, $css);
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serves any files associated with the theme settings.
|
||||
*
|
||||
* @param stdClass $course
|
||||
* @param stdClass $cm
|
||||
* @param context $context
|
||||
* @param string $filearea
|
||||
* @param array $args
|
||||
* @param bool $forcedownload
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
function theme_more_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo') {
|
||||
$theme = theme_config::load('more');
|
||||
return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
|
||||
} else {
|
||||
send_file_not_found();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds any custom CSS to the CSS before it is cached.
|
||||
*
|
||||
* @param string $css The original CSS.
|
||||
* @param string $customcss The custom CSS to add.
|
||||
* @return string The CSS which now contains our custom CSS.
|
||||
*/
|
||||
function theme_more_set_customcss($css, $customcss) {
|
||||
$tag = '[[setting:customcss]]';
|
||||
$replacement = $customcss;
|
||||
if (is_null($replacement)) {
|
||||
$replacement = '';
|
||||
}
|
||||
|
||||
$css = str_replace($tag, $replacement, $css);
|
||||
|
||||
return $css;
|
||||
}
|
BIN
theme/more/pix/favicon.ico
Normal file
BIN
theme/more/pix/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
theme/more/pix/screenshot.jpg
Normal file
BIN
theme/more/pix/screenshot.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
71
theme/more/settings.php
Normal file
71
theme/more/settings.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Theme More settings.
|
||||
*
|
||||
* Each setting that is defined in the parent theme Clean should be
|
||||
* defined here too, and use the exact same config name. The reason
|
||||
* is that theme_more does not define any layout files to re-use the
|
||||
* ones from theme_clean. But as those layout files use the function
|
||||
* {@link theme_clean_get_html_for_settings} that belong to Clean,
|
||||
* we have to make sure it works as expected by having the same settings
|
||||
* in our theme.
|
||||
*
|
||||
* @see theme_clean_get_html_for_settings
|
||||
* @package theme_more
|
||||
* @copyright 2014 Frédéric Massart
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
|
||||
// Invert Navbar to dark background.
|
||||
$name = 'theme_more/invert';
|
||||
$title = get_string('invert', 'theme_more');
|
||||
$description = get_string('invertdesc', 'theme_more');
|
||||
$setting = new admin_setting_configcheckbox($name, $title, $description, 0);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// Logo file setting.
|
||||
$name = 'theme_more/logo';
|
||||
$title = get_string('logo','theme_more');
|
||||
$description = get_string('logodesc', 'theme_more');
|
||||
$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// Custom CSS file.
|
||||
$name = 'theme_more/customcss';
|
||||
$title = get_string('customcss', 'theme_more');
|
||||
$description = get_string('customcssdesc', 'theme_more');
|
||||
$default = '';
|
||||
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// Footnote setting.
|
||||
$name = 'theme_more/footnote';
|
||||
$title = get_string('footnote', 'theme_more');
|
||||
$description = get_string('footnotedesc', 'theme_more');
|
||||
$default = '';
|
||||
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
}
|
21
theme/more/style/custom.css
Normal file
21
theme/more/style/custom.css
Normal file
@ -0,0 +1,21 @@
|
||||
/* Custom CSS
|
||||
-------------------------*/
|
||||
a.logo {
|
||||
background: url([[setting:logo]]) no-repeat 0 0;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 75px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dir-rtl a.logo {
|
||||
background: url([[setting:logo]]) no-repeat 100% 0;
|
||||
display: block;
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Custom CSS Settings
|
||||
-------------------------*/
|
||||
[[setting:customcss]]
|
33
theme/more/version.php
Normal file
33
theme/more/version.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Theme More version file.
|
||||
*
|
||||
* @package theme_more
|
||||
* @copyright 2014 Frédéric Massart
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2013110500;
|
||||
$plugin->requires = 2013110500;
|
||||
$plugin->component = 'theme_more';
|
||||
$plugin->dependencies = array(
|
||||
'theme_bootstrapbase' => 2013110500,
|
||||
'theme_clean' => 2013110500,
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user