Skip to content

Commit c61e698

Browse files
authored
Merge pull request #203 from trema-tech/dev
Dev
2 parents a129f5d + 29a5d86 commit c61e698

File tree

14 files changed

+142
-43
lines changed

14 files changed

+142
-43
lines changed

classes/output/core_renderer.php

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,41 @@ public function favicon() {
6363
global $CFG;
6464
static $favicon;
6565

66+
// Return cached value if available.
6667
if (!empty($favicon)) {
6768
return $favicon;
6869
}
6970

7071
// Use favicon configured in theme's settings.
7172
$favicon = $this->page->theme->setting_file_url('favicon', 'favicon');
7273

74+
// If no favicon set in the theme, see if theme includeds a favicon.ico file.
75+
if (empty($favicon) && (file_exists($this->page->theme->dir . '/pix/favicon.ico'))) {
76+
// Use pix/favicon.ico stored in the theme directory.
77+
$favicon = $this->page->theme->image_url('favicon', 'theme');
78+
}
79+
80+
// If no favicon found yet, check favicon settings in Moodle's Appearance/Logo settings.
81+
// Note: Only available in Moodle 4.1+.
82+
if (empty($favicon) && $CFG->branch >= 401) {
83+
// Use $CFG->themerev to prevent browser caching when the file changes.
84+
$favicon = \moodle_url::make_pluginfile_url(
85+
\context_system::instance()->id,
86+
'core_admin',
87+
'favicon',
88+
'64x64/',
89+
theme_get_revision(),
90+
get_config('core_admin', 'favicon')
91+
);
92+
}
93+
94+
// If still no favicon found, fallback to the webserver's favicon.ico.
7395
if (empty($favicon)) {
74-
if (file_exists($this->page->theme->dir . '/pix/favicon.ico')) {
75-
// Use pix/favicon.ico stored in the theme directory.
76-
$favicon = $this->page->theme->image_url('favicon', 'theme');
77-
} else {
78-
// Fallback to the webserver's favicon.ico.
79-
$parsedurl = parse_url($CFG->wwwroot);
80-
$favicon = $parsedurl['scheme'] . '://' . $parsedurl['host'] . '/favicon.ico';
81-
// If there isn't any, the browser will fallback to its own default favicon.
82-
}
96+
$parsedurl = parse_url($CFG->wwwroot);
97+
$favicon = $parsedurl['scheme'] . '://' . $parsedurl['host'] . '/favicon.ico';
98+
// If there isn't any, the browser will fallback to its own default favicon.
8399
}
100+
84101
return $favicon;
85102
}
86103

@@ -205,11 +222,16 @@ public function render_login(\core_auth\output\login $form) {
205222
*/
206223
public function standard_head_html() {
207224
global $CFG;
225+
208226
$additionalhtmlhead = $CFG->additionalhtmlhead;
209-
if (strpos($additionalhtmlhead, '}') !== false) {
210-
$CFG->additionalhtmlhead = format_text($CFG->additionalhtmlhead,
211-
FORMAT_HTML, ['noclean' => true, 'context' => $this->page->context]);
227+
228+
// If filtering of the primary custom menu is enabled, apply only the string filters.
229+
if (!empty(get_config('theme_trema', 'navfilter')) && strpos($CFG->additionalhtmlhead, '}') !== false) {
230+
// Apply filters that are enabled for Content and Headings.
231+
$filtermanager = filter_manager::instance();
232+
$CFG->additionalhtmlhead = $filtermanager->filter_string($CFG->additionalhtmlhead, \context_system::instance());
212233
}
234+
213235
$output = parent::standard_head_html();
214236
$CFG->additionalhtmlhead = $additionalhtmlhead;
215237
return $output;

classes/output/primary_navigation.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,11 @@ protected function get_custom_menu(renderer_base $output): array {
5555

5656
$custommenuitems = $CFG->custommenuitems;
5757

58-
// If setting is enabled, filter custom menu items but don't apply auto-linking filters.
59-
if (!empty(get_config('theme_trema', 'navfilter'))) {
60-
// Include default filters to skip.
61-
$skipfilters = 'activitynames,data,glossary,sectionnames,bookchapters,urltolink,'
62-
. get_config('theme_trema', 'navfiltersexcluded');
63-
// Convert to array, trim all items, and remove duplicates and empty values.
64-
$skipfilters = array_filter(array_unique(array_map('trim', explode(',', $skipfilters))));
65-
$filteroptions = ['originalformat' => FORMAT_HTML, 'noclean' => true];
58+
// If filtering of the primary custom menu is enabled, apply only the string filters.
59+
if (!empty(get_config('theme_trema', 'navfilter')) && strpos($CFG->custommenuitems, '}') !== false) {
60+
// Apply filters that are enabled for Content and Headings.
6661
$filtermanager = filter_manager::instance();
67-
$context = \context_system::instance();
68-
$CFG->custommenuitems = $filtermanager->filter_text($CFG->custommenuitems, $context, $filteroptions, $skipfilters);
62+
$CFG->custommenuitems = $filtermanager->filter_string($CFG->custommenuitems, \context_system::instance());
6963
}
7064
$nodes = parent::get_custom_menu($output);
7165

lang/en/theme_trema.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,14 @@
181181
$string['loginshowloginform_desc'] = 'Before disabling the login form, ensure that administrators have an alternate method to Sign in to the site.';
182182
$string['modal'] = 'Modal';
183183
$string['navfilter'] = 'Filter navigation';
184-
$string['navfilter_desc'] = 'Enable to process primary navigation through Moodle filters. Useful for dynamic custom menu items.';
185-
$string['navfiltersexcluded'] = 'Excluded navigation filters';
186-
$string['navfiltersexcluded_desc'] = 'These filters will not be applied to the primary navigation (custom menu). Must be a comma separated list of filter names. By default, the following auto-linking filters are always excluded: activitynames, data, glossary, sectionnames, bookchapters, urltolink.';
184+
$string['navfilter_desc'] = 'Process the custom menu through Moodle filters that are set to apply to <strong>Content and Headings</strong>. Useful for enabling dynamic custom menu items.';
187185
$string['numberofcards'] = 'Number of cards';
186+
$string['numberofcards_desc'] = 'Select the number of cards you want to add then click SAVE to show the input fields.';
188187
$string['numberofimages'] = "Number of images in frontpage banner";
189-
$string['numberofimages_desc'] = "Number of images to show in frontpage banner. If it is more than one, loads the carousel.";
188+
$string['numberofimages_desc'] = 'Select the number of images you want to add then click SAVE to show the input fields. If it is more than one, the carousel will be activated automatically.';
190189
$string['pluginname'] = 'Trema';
191190
$string['popover'] = 'Popover';
192-
$string['primarycolor'] = 'Primary colour';
191+
$string['primarycolor'] = 'Brand colour';
193192
$string['primarycolor_desc'] = 'The main colour.';
194193
$string['privacy:metadata'] = 'The Trema theme does not store any individual user data.';
195194
$string['region-side-admin'] = 'Only admins';

scss/preset/default.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
@import "trema/courselist";
2222
@import "trema/maintenance";
2323
@import "trema/modules";
24+
@import "trema/report";
2425
@import "trema/courseformats";
2526
@import "trema/admin";
2627
@import "trema/message";
2728
@import "trema/user";
29+
@import "trema/noprint";

scss/trema/dashboard.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,29 @@ body.pagelayout-mydashboard {
8989
}
9090

9191
body#page-message-index {
92-
#page-header {
93-
display: block;
92+
.container-fluid {
93+
padding-right: 0;
9494
}
9595

9696
#mydashboard-admin,
9797
#side-admin-blocks {
9898
display: none;
9999
}
100100

101+
#page-wrapper #page #page-content:before {
102+
content: none;
103+
}
104+
101105
.panel-header-container {
102106
margin-top: 25px;
103107
}
104108

105109
#region-main {
106110
margin-top: 0;
107111
}
112+
113+
.message-app.main {
114+
height: 100%;
115+
min-height: 80vh;
116+
}
108117
}

scss/trema/elements.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ body.path-mod-quiz {
565565
}
566566

567567
// For "Hidden from Student" badge (Moodle 4.4+).
568-
.badge.rounded-pill.bg-secondary.text-dark {
568+
// For "Parent category" when creating a course category.
569+
.bg-secondary.text-dark {
569570
color: white !important;
570571
}

scss/trema/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $editmodeon-color: choose-contrast-color($editmodeon-bg-color);
99
$dropdown-color: choose-contrast-color($dropdown-bg-color);
1010
$drawer-color: choose-contrast-color($drawer-bg-color);
1111

12-
.card {
12+
.card:not(.fp-navbar) {
1313
border: none;
1414
}
1515

scss/trema/message.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,18 @@ body#page-message-output-popup-notifications {
5555
margin-top: 1rem;
5656
padding: 2rem !important;
5757

58+
&:before {
59+
display: none;
60+
}
61+
5862
#region-main {
5963
background-color: #ffffff;
64+
padding: 0;
65+
66+
&:before,
67+
&:after {
68+
content: none;
69+
}
6070

6171
.notification-area {
6272
background-color: $white;

scss/trema/modules.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ body#page-mod-quiz-review {
9090
}
9191
}
9292

93+
// Fix the width of the quiz report.
94+
body#page-mod-quiz-report #attempts {
95+
width: 100%!important;
96+
}
97+
9398
body.path-mod-assign.pagelayout-embedded {
9499
#page {
95100
padding-top: 0;
@@ -128,6 +133,12 @@ body.path-mod-assign.pagelayout-embedded {
128133
}
129134
}
130135

136+
body#page-mod-assign-grading {
137+
.gradingtable {
138+
overflow-x: scroll;
139+
}
140+
}
141+
131142
body.path-mod-forum {
132143
.forumsearch {
133144
#search {

scss/trema/noprint.scss

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@media print {
2+
// Remove underline from all links.
3+
a {
4+
text-decoration: none!important;
5+
}
6+
// Remove margins to maximize space on paper.
7+
body #page #page-content,
8+
#region-main-box,
9+
#page {
10+
margin: 0!important;
11+
}
12+
// Display the page headers so we can show the logo.
13+
#page-header {
14+
display: block!important;
15+
}
16+
17+
// Unsticky the nav-bar so it doesn't repeat on every page.
18+
#page-wrapper nav.navbar {
19+
display: block;
20+
position:relative;
21+
border-bottom: none;
22+
}
23+
24+
// Elements we do not want to appear in print.
25+
#goto-top-link,
26+
#page-footer,
27+
#user-notifications,
28+
#page-navbar,
29+
.btn,
30+
.drawer-toggles,
31+
button,
32+
.navbar-nav,
33+
.navbar-toggler,
34+
.notifications,
35+
.secondary-navigation,
36+
nav.navbar .primary-navigation,
37+
nav.navbar #usernavigation,
38+
ul.nav.nav-tabs {
39+
display: none!important;
40+
}
41+
}

scss/trema/report.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
body.path-admin-reportbuilder {
2+
#page #page-content {
3+
max-width: none;
4+
padding: 0 2rem;
5+
.reportbuilder-sidebar-settings {
6+
right: 50px;
7+
}
8+
.dynamictabs {
9+
height: 85vh;
10+
.nav-tabs {
11+
width: calc(100% - 70px);
12+
background-color: transparent;
13+
}
14+
}
15+
.reportbuilder-sidebar-menu-cards {
16+
max-height: calc(100vh - 335px);
17+
}
18+
}
19+
}

settings/frontpage_settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
// Number of cards.
305305
$name = 'theme_trema/numberofcards';
306306
$title = get_string('numberofcards', 'theme_trema');
307-
$description = '';
307+
$description = get_string('numberofcards_desc', 'theme_trema');
308308
$default = 4;
309309
$choices = [
310310
2 => '2',

settings/general_settings.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@
6666
$setting->set_updatedcallback('theme_reset_all_caches');
6767
$page->add($setting);
6868

69-
// List of filters that should not be applied to the primary navigation (custom menu).
70-
$name = 'theme_trema/navfiltersexcluded';
71-
$title = get_string('navfiltersexcluded', 'theme_trema');
72-
$description = get_string('navfiltersexcluded_desc', 'theme_trema');
73-
$default = '';
74-
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT);
75-
$setting->set_updatedcallback('theme_reset_all_caches');
76-
$page->add($setting);
77-
7869
// Hide selected items in the primary navigation (custom menu).
7970
$hideitemsoptions = [];
8071
$hideitemsoptions['home'] = get_string('home');

version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
defined('MOODLE_INTERNAL') || die();
3030

31-
$plugin->version = 2024090700;
32-
$plugin->release = '4.4.0.7';
31+
$plugin->version = 2024100700;
32+
$plugin->release = '4.5.0.0';
3333
$plugin->maturity = MATURITY_STABLE;
3434
$plugin->requires = 2022021800; // Moodle 4.0 - Build: 20220218.
3535
$plugin->component = 'theme_trema';

0 commit comments

Comments
 (0)