Skip to content
Snippets Groups Projects
Commit d1fbd452 authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Setting to be able to upload own font files.

parent 2c4e42de
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2017-03-27 - Setting to be able to upload own font files.
* 2017-03-23 - Improved fonts on category overview page.
* 2017-03-21 - Improved design of mailto and broken links.
* 2017-03-21 - Setting to change position and style of the login form to work out with a greater variety of background images.
......
......@@ -89,6 +89,82 @@ In this setting you can add up to 10 files as a background image for the login p
With this setting you can optimize the login form to fit to a greater variety background images (if checked). This means that the login form will be moved to the left of the login page, will get smaller in width and will get a background that let the background image shine through. The login form will be placed on the left because many images have their main content rather in the center and so we keep this content visible. Note: You can also activate this setting if no background images are uploaded, of course.
#### Font files
With this dialogue you can upload own font files. The upload is resricted to the font files of type .eot, .woff, .woff2, .ttf and .svg.
Important: To be able to use the uploaded fonts within this theme, you have to add related code to your "Raw SCSS" area in the tab "Advanced Settings"!
First you have to add all font-faces correctly and then you can set the font as font-family to any tag. Set it for the body tag to use it all over the instance. With the following expamle you can see how the SCSS code should look like. Of course you have to adapt it for your individual font and the number and type of uploaded files.
```css
/* your-font-regular - latin */
@font-face {
font-family: "Your Font";
font-style: normal;
font-weight: 400;
/* IE9 Compat Modes */
src: url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.eot");
src: local("Your Font"), local("YourFont-Regular"),
/* IE6-IE8 */
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.eot?#iefix") format("embedded-opentype"),
/* Super Modern Browsers */
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.woff2") format("woff2"),
/* Modern Browsers */
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.woff") format("woff"),
/* Safari, Android, iOS */
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.ttf") format("truetype"),
/* Legacy iOS */
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.svg#YourFont") format("svg");
\}
/* your-font-italic - latin */
@font-face {
font-family: "Your Font";
font-style: italic;
font-weight: 400;
src: url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.eot");
src: local("Your Font Italic"), local("YourFont-Italic"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.eot?#iefix") format("embedded-opentype"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.woff2") format("woff2"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.woff") format("woff"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.ttf") format("truetype"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.svg#YourFont") format("svg");
}
/* your-font-700 - latin */
@font-face {
font-family: "Your Font";
font-style: normal;
font-weight: 700;
src: url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.eot");
src: local("Your Font Bold"), local("YourFont-Bold"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.eot?#iefix") format("embedded-opentype"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.woff2") format("woff2"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.woff") format("woff"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.ttf") format("truetype"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.svg#YourFont") format("svg");
}
/* your-font-700italic - latin */
@font-face {
font-family: "Your Font";
font-style: italic;
font-weight: 700;
src: url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700italic.eot");
src: local("Your Font Bold Italic"), local("YourFont-BoldItalic"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.eot?#iefix") format("embedded-opentype"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.woff2") format("woff2"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.woff") format("woff"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.ttf") format("truetype"),
url("/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.svg#YourFont") format("svg");
}
body {
font-family: "Your Font";
}
```
Please note: The code itself and the URLs have to fit exactly to your uploaded files, unless the fonts cannot be loaded! As the font files will be delivered with an expires header to the client but currently without a timestamp in the URL, emptying the Moodle cache unfortunately will not force a reload of the font files on the client side.
Further improvements to Boost core theme
----------------------------------------
......
......@@ -35,7 +35,7 @@ $string['designsettings'] = 'Design Settings';
$string['loginbackgroundimagesetting'] = 'Login page background images';
$string['loginbackgroundimagesetting_desc'] = 'Images uploaded in this setting will be randomly displayed on the login page as background images.';
$string['loginform'] = 'Login Form';
$string['loginform'] = 'Login form';
$string['loginform_desc'] = 'With this setting you can optimize the login form to fit to a greater variety background images (if checked). This means that the login form will be moved to the left of the login page, will get smaller in width and will get a background that let the background image shine through. The login form will be placed on the left because many images have their main content rather in the center and so we keep this content visible. Note: You can also activate this setting if no background images are uploaded, of course.';
$string['footerblocksheading'] = 'Footer blocks';
......@@ -63,3 +63,10 @@ $string['section0titlesetting_desc'] = 'This setting can change the behaviour Mo
$string['showswitchedroleincoursesetting'] = 'Position of switch role information';
$string['showswitchedroleincoursesetting_desc'] = 'With this setting you can choose the place where the information to which role a user has switched is being displayed. If not checked (default value), the role information will be displayed right beneath the user\'s name in the user menu (like in theme Boost). If checked, this information - together with a link to switch back - will be displayed beneath the course, as this functionality is course related.';
$string['switchedroleto'] = 'You are viewing this course currently with the role:';
$string['fontfilessetting'] = 'Font files';
$string['fontfilessetting_desc'] = 'With this dialogue you can upload own font files. The uplaod is resricted to the font files of type .eot, .woff, .woff2, .ttf and .svg. <br/>
Important: To be able to use the uploaded fonts within this theme, you have to add related code to your "Raw SCSS" area in the tab "Advanced Settings". A full example for this can be found in the README.md file.';
$string['loginpagedesignheadingsetting'] = 'Login page';
$string['fontdesignheadingsetting'] = 'Fonts';
......@@ -123,6 +123,8 @@ function theme_boost_campus_pluginfile($course, $cm, $context, $filearea, $args,
return $theme->setting_file_serve('favicon', $args, $forcedownload, $options);
} else if ($filearea === 'loginbackgroundimage') {
return $theme->setting_file_serve('loginbackgroundimage', $args, $forcedownload, $options);
} else if ($filearea === 'fontfiles') {
return $theme->setting_file_serve('fontfiles', $args, $forcedownload, $options);
} else {
send_file_not_found();
}
......
......@@ -160,6 +160,11 @@ if ($ADMIN->fulltree) {
// Create design settings tab.
$page = new admin_settingpage('theme_boost_campus_design', get_string('designsettings', 'theme_boost_campus'));
// Settings title to group login page related settings together with a common heading. We don't want a description here.
$setting = new admin_setting_heading('theme_boost_campus/loginpagedesignheading',
get_string('loginpagedesignheadingsetting', 'theme_boost_campus', null, true), null);
$page->add($setting);
// Login page background setting.
$name = 'theme_boost_campus/loginbackgroundimage';
$title = get_string('loginbackgroundimagesetting', 'theme_boost_campus');
......@@ -168,7 +173,7 @@ if ($ADMIN->fulltree) {
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Setting to display information of a switched role in the course header.
// Setting to change the position and design of the login form.
$setting = new admin_setting_configcheckbox('theme_boost_campus/loginform',
get_string('loginform', 'theme_boost_campus', null, true),
get_string('loginform_desc', 'theme_boost_campus', null, true), 'no', 'yes', 'no'); // Overriding default values
......@@ -177,6 +182,20 @@ if ($ADMIN->fulltree) {
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Settings title to group font related settings together with a common heading. We don't want a description here.
$setting = new admin_setting_heading('theme_boost_campus/fontdesignheading',
get_string('fontdesignheadingsetting', 'theme_boost_campus', null, true), null);
$page->add($setting);
// Font files upload.
$name = 'theme_boost_campus/fontfiles';
$title = get_string('fontfilessetting', 'theme_boost_campus');
$description = get_string('fontfilessetting_desc', 'theme_boost_campus');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'fontfiles', 0,
array('maxfiles' => 100, 'accepted_types' => array('.ttf', '.eot', '.woff', '.woff2')));
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Add tab to settings page.
$settings->add($page);
}
......@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'theme_boost_campus';
$plugin->version = '2017032200';
$plugin->version = '2017032700';
$plugin->release = 'v3.2-r1';
$plugin->requires = '2016070700';
$plugin->maturity = MATURITY_STABLE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment