Skip to content

Commit

Permalink
V405.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Dec 3, 2024
1 parent 30230c5 commit a9dca1c
Show file tree
Hide file tree
Showing 24 changed files with 355 additions and 295 deletions.
15 changes: 15 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Change Log in version 405.1.1 (2024100502)
==========================================
1. Fix 'Class "core\external\output\icon_system" not found' - #35.
2. Add theme user settings, initially 'My courses custom sort' - Sponsors only functionality.
3. Larger tools menu title and field setting boxes. The former to help with multilang support.
4. Fix navbar search magnifying glass position.
5. Add user favourites menu - Sponsors only functionality.
6. Tools menu settings should be 'PARAM_TEXT'.
7. Allow sub-sub menus.
8. Add 'navbardisplaytitles' setting to show / hide the navbar titles, disabled when 'navbardisplayicons' is unset.
9. Rename 'navbardisplaysubmenuarrow' to 'navbardisplaymenuarrow' and fix places where this didn't apply.
10. Fix original header search icon colour when open.
11. Fix header search position and default setting value.
12. Tidy header search.

Change Log in version 405.1.0 (2024100501)
==========================================
1. Stable release for Moodle 4.5.
Expand Down
6 changes: 5 additions & 1 deletion classes/admin_setting_getprops.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ public function output_html($data, $query = '') {

$draftjson->delete(); // Finished with draft.

$savepropsfilestoofileresult = get_string('propertiesexportfilestoofilesuccess', $this->pluginfrankenstyle, $settingfile->get_filename());
$savepropsfilestoofileresult = get_string(
'propertiesexportfilestoofilesuccess',
$this->pluginfrankenstyle,
$settingfile->get_filename()
);
} else {
$savepropsfilestoofileresult = get_string('propertiesexportfilestoofilefail', $this->pluginfrankenstyle);
$alertstate = 'warning';
Expand Down
7 changes: 5 additions & 2 deletions classes/output/core_renderer_layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ public function yesheader($sidepostdrawer) {
// Display user profile menu.
// Only used when user is logged in and not on the secure layout.
if ((isloggedin()) && ($this->page->pagelayout != 'secure')) {
$headercontext['loginoruser'] = '<li class="nav-item dropdown ml-3 ml-md-2 mr-2 mr-md-0">' . $this->user_menu() . '</li>';
$headercontext['loginoruser'] =
'<li class="nav-item dropdown ml-3 ml-md-2 mr-2 mr-md-0">' . $this->user_menu() . '</li>';
} else {
$headercontext['loginoruser'] = '';
}
Expand All @@ -247,6 +248,7 @@ public function yesheader($sidepostdrawer) {
$headercontext['shownavbar'] = [
'navigationmenu' => $this->navigation_menu('main-navigation'),
'output' => $this,
'userfavmenu' => $this->userfav_menu(),
'toolsmenu' => $this->tools_menu(),
];

Expand Down Expand Up @@ -544,7 +546,8 @@ protected function sidepostheader() {

$sideposthtml = $this->blocks('side-post');
// Blocks or add block button.
$hassidepost = ((strpos($sideposthtml, 'data-block=') !== false) || (strpos($sideposthtml, 'data-key="addblock"') !== false));
$hassidepost =
((strpos($sideposthtml, 'data-block=') !== false) || (strpos($sideposthtml, 'data-key="addblock"') !== false));
if (!$hassidepost) {
$sidepostopen = false;
}
Expand Down
345 changes: 122 additions & 223 deletions classes/output/core_renderer_toolbox.php

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions classes/output/custom_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@

use core\output\custom_menu_item;
use core\url;
use custom_menu as core_custom_menu;

/**
* Adaptable's custom menu.
*/
class custom_menu extends \custom_menu {
class custom_menu extends core_custom_menu {
/**
* Creates the custom menu
*
Expand All @@ -41,7 +42,7 @@ class custom_menu extends \custom_menu {
*/
public function __construct($definition = '', $currentlanguage = null) {
$this->currentlanguage = $currentlanguage;
custom_menu_item::__construct('root'); // create virtual root element of the menu
custom_menu_item::__construct('root'); // Create virtual root element of the menu.
if (!empty($definition)) {
$this->override_children(self::convert_text_to_menu_nodes($definition, $currentlanguage));
}
Expand All @@ -54,7 +55,7 @@ public function __construct($definition = '', $currentlanguage = null) {
* @param string $currentlanguage The current language code, null disables multilang support.
* @param string $menu Other menu to add to (optional).
*/
public function add_custom_menu_items($definition = '', $currentlanguage = null, custom_menu_item $menu = null) {
public function add_custom_menu_items($definition = '', ?string $currentlanguage = null, ?custom_menu_item $menu = null) {
if (!empty($definition)) {
$items = self::convert_text_to_menu_nodes($definition, $currentlanguage);
if (empty($menu)) {
Expand Down
2 changes: 1 addition & 1 deletion classes/output/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
use core_external\external_single_structure;
use core_external\external_value;
use core_external\external_warnings;
use core\external\output\icon_system;
use core\external\output\icon_system\load_fontawesome_map;
use core\output\icon_system;
use core_user;

/**
Expand Down
11 changes: 11 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ function xmldb_theme_adaptable_upgrade($oldversion = 0) {
upgrade_plugin_savepoint(true, 2024032803, 'theme', 'adaptable');
}

if ($oldversion < 2024100502) {
$value = get_config('theme_adaptable', 'navbardisplaysubmenuarrow');
if (!empty($value)) {
set_config('navbardisplaymenuarrow', $value, 'theme_adaptable');
// Prevent replacement when upgrade has already happened in a version for an older Moodle!
unset_config('navbardisplaysubmenuarrow', 'theme_adaptable');
}

upgrade_plugin_savepoint(true, 2024100502, 'theme', 'adaptable');
}

// Automatic 'Purge all caches'....
purge_all_caches();

Expand Down
33 changes: 27 additions & 6 deletions lang/en/theme_adaptable.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,13 @@
$string['navbarlinksettingsdesc'] = 'Allows you to control the links that appear on the navigation bar.';

$string['navbardisplayicons'] = 'Display icons';
$string['navbardisplayiconsdesc'] = 'Display icons next to main menu headings';
$string['navbardisplayiconsdesc'] = 'Display an icon next to the menu title. Note: This is ignored when \'custommenutitle\' isn\'t set for the custom menu.';

$string['navbardisplaysubmenuarrow'] = 'Display sub-menu arrow';
$string['navbardisplaysubmenuarrowdesc'] = 'Display sub-menu arrow (downward facing) when a menu heading has sub-menu options.';
$string['navbardisplaytitles'] = 'Display titles';
$string['navbardisplaytitlesdesc'] = 'Display the menu title. Notes: Ignored when \'navbardisplayicons\' is unset and also ignored when \'custommenutitle\' isn\'t set for the custom menu.';

$string['navbardisplaymenuarrow'] = 'Display menu arrow';
$string['navbardisplaymenuarrowdesc'] = 'Display menu arrow (downward facing) for a menu title.';

$string['home'] = 'Home';
$string['enablemy'] = 'Dashboard';
Expand Down Expand Up @@ -588,11 +591,14 @@
$string['enablemysitesrestriction'] = 'Restrict user\'s courses dropdown to a custom profile field';
$string['enablemysitesrestrictiondesc'] = 'Restrict dropdown with a user\'s courses by custom profile field. E.g. usertype=staff.';

$string['mysitessortoverride'] = 'Enable my courses custom sort';
$string['mysitessortoverride'] = 'My courses custom sort';
$string['mysitessortoverridedesc'] = 'Use custom profile fields or generic strings (year etc) to collapse past courses in sub menu.';
$string['mysitessortoverridefield'] = 'My Courses Custom Profile Field(s) or Strings';
$string['mysitessortoverridefielddesc'] = 'Comma delimited list of profile fields or strings to check for in course short codes.';

$string['enableusermysitessortoverride'] = 'Enable user my courses custom sort';
$string['enableusermysitessortoverridedesc'] = 'Allow the user to set their own value for \'My courses custom sort\', including defaulting to the theme setting value set by \'mysitessortoverride\'.';

$string['mysitessortoverrideoff'] = 'Display all enrolled courses in single flat list';
$string['mysitessortoverridestrings'] = 'Display enrolled containing strings in first list, others in sub menu';
$string['mysitessortoverrideprofilefields'] = 'Display courses found in profile fields in first list, others in sub menu';
Expand Down Expand Up @@ -1488,8 +1494,8 @@
$string['helptarget'] = 'Help target';
$string['helptargetdesc'] = 'Do you want the help link to open in a new window?';

$string['hideinforum'] = 'Hide help and tools in forums';
$string['hideinforumdesc'] = 'When using fixed width and all menu options the forum search box spills onto the line below. Turning this option on will hide tools and help menu items in forums allowing it to display properly.';
$string['hideinforum'] = 'Hide help, user favourites and tools in forums';
$string['hideinforumdesc'] = 'When using fixed width and all menu options the forum search box spills onto the line below. Turning this option on will hide help, user favourites and tools menu items in forums allowing it to display properly.';

$string['targetnewwindow'] = 'New window';
$string['targetsamewindow'] = 'Same window';
Expand Down Expand Up @@ -1599,6 +1605,21 @@
$string['newmenutitledesc'] = 'The title of the dropdown list that will appear in the header of your site.';
$string['newmenutitledefault'] = 'Menu';

$string['navbaruserfavtoolsmenus'] = 'Navbar user favourites and tools menus';

$string['userfavmenu'] = 'User favourites menu';
$string['userfavmenudesc'] = 'The user will be able to create their own favourites menu saved as a user preference. The format of each line is \'text|url|title|langs|fontawesome classes\'. Only enter what you require. If you don\'t need something but do need another thing further along then leave it blank but still use the \'|\' delimiter. For example: \'text|url|||fontawesome classes\'. To find the FontAwesome(Free) classes for the icon you wish to use, go to <a href="https://fontawesome.com/search?o=r&m=free" target="_blank">Font Awesome free</a> and search for the icon. You can use the name, such as \'graduation-cap\' or the complete list of classes \'fa-solid fa-graduation-cap\'. For example:<pre>
Courses
-All courses|/course/|||graduation-cap
-Course search|/course/search.php
-###
-FAQ|https://example.org/faq
-Exam Clock|https://mysite.localhost|Exam Clock||clock
</pre>';

$string['enableuserfavmenu'] = 'Enable user favourites menu';
$string['enableuserfavmenudesc'] = 'It is recommended you leave this off if the menu is not in use for preformance reasons.';

$string['enabletoolsmenus'] = 'Enable tool menus';
$string['enabletoolsmenusdesc'] = 'It is recommended you leave this off if menus are not in use for preformance reasons.';

Expand Down
12 changes: 9 additions & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ function theme_adaptable_pre_scss($theme) {
$fontcolorrgba = \theme_adaptable\toolbox::hex2rgba($fontcolor, 0.25);
$prescss = '$body-bg: ' . $regionmaincolor . ';' . PHP_EOL;
$prescss = '$body-color: ' . $fontcolor . ';' . PHP_EOL;
$prescss .= '$primary: ' . \theme_adaptable\toolbox::get_setting('primarycolour', false, $theme->name, '#00796b') . ';' . PHP_EOL;
$prescss .= '$secondary: ' . \theme_adaptable\toolbox::get_setting('secondarycolour', false, $theme->name, '#009688') . ';' . PHP_EOL;
$prescss .= '$loadingcolor: ' . \theme_adaptable\toolbox::get_setting('loadingcolor', false, $theme->name, '#00B3A1') . ';' . PHP_EOL;
$prescss .= '$primary: ' .
\theme_adaptable\toolbox::get_setting('primarycolour', false, $theme->name, '#00796b') . ';' . PHP_EOL;
$prescss .= '$secondary: ' .
\theme_adaptable\toolbox::get_setting('secondarycolour', false, $theme->name, '#009688') . ';' . PHP_EOL;
$prescss .= '$loadingcolor: ' .
\theme_adaptable\toolbox::get_setting('loadingcolor', false, $theme->name, '#00B3A1') . ';' . PHP_EOL;
$loadingcolor = \theme_adaptable\toolbox::get_setting('loadingcolor', false, $theme->name, '#00B3A1');
$loadingcolorrgba = \theme_adaptable\toolbox::hex2rgba($loadingcolor, 0.2);
$prescss .= '$loadingcolor: ' . $loadingcolor . ';' . PHP_EOL;
Expand Down Expand Up @@ -440,6 +443,9 @@ function theme_adaptable_process_scss($scss, $theme) {
$defaults['[[setting:linkcolorrgba]]'] = \theme_adaptable\toolbox::hex2rgba($defaults['[[setting:linkcolor]]'], 0.75);
$defaults['[[setting:linkhoverrgba]]'] = \theme_adaptable\toolbox::hex2rgba($defaults['[[setting:linkhover]]'], 0.75);

// The navbardisplaymenuarrow setting.
$defaults['[[setting:navbardisplaymenuarrow]]'] = (empty($theme->settings->navbardisplaymenuarrow)) ? 'content: none;' : '';

// Replace the CSS with values from the $defaults array.
$scss = strtr($scss, $defaults);
if (empty($theme->settings->tilesshowallcontacts) || $theme->settings->tilesshowallcontacts == false) {
Expand Down
1 change: 1 addition & 0 deletions scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@import "nosettings/grade";
@import "nosettings/header";
@import "nosettings/layout";
@import "nosettings/menu";
@import "nosettings/messages";
@import "nosettings/mod";
@import "nosettings/modal";
Expand Down
30 changes: 30 additions & 0 deletions scss/nosettings/_menu.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// 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/>.
//
//
// Adaptable Menu style sheet
//
// @package theme_adaptable
// @copyright 2024 G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
//

.dropdown-toggle::after {
content: "\f0d7";
font-size: 14px;
vertical-align: baseline;
width: 14px;
}
8 changes: 8 additions & 0 deletions scss/nosettings/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
&.modal-in-page {
z-index: 1;
}

ul {
list-style-type: none;
}
}

.modal-backdrop {
Expand Down Expand Up @@ -78,6 +82,10 @@
.modal-body {
overflow-y: auto;
padding: 15px;

li {
line-height: $line-height-base;
}
}

.modal-form {
Expand Down
7 changes: 6 additions & 1 deletion scss/settings/adaptable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@

// Main elements selectors.
html,
body {
body,
.body {
background-color: [[setting:maincolor]];
color: [[setting:fontcolor]];
font-family: [[setting:fontname]], sans-serif;
font-size: [[setting:fontsize]];
font-weight: [[setting:fontweight]] !important;
}

html,
body {
line-height: normal;
margin: 0;
padding: 0;
Expand Down
30 changes: 9 additions & 21 deletions scss/settings/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@
margin-right: -[[setting:menufontpadding]];
}

// Remove caret from main navbar menu.
#adaptable-page-header-wrapper #main-navbar .dropdown-toggle::after {
content: none;
// Remove caret from navbar menus.
#adaptable-page-header-wrapper {
.above-header,
#main-navbar {
.dropdown-toggle::after {
[[setting:navbardisplaymenuarrow]]
}
}
}

#adaptable-page-header-wrapper {
Expand Down Expand Up @@ -162,11 +167,8 @@
color: inherit;
}

#adaptable-page-header-wrapper #header2 a i {
padding-right: 4px;
}

#adaptable-page-header-wrapper .above-header a.dropdown-toggle {
margin-bottom: 2px;
margin-top: 2px;
}

Expand Down Expand Up @@ -369,7 +371,6 @@

#adaptable-page-header-wrapper #main-navbar .navbar-nav .nav-item .dropdown-menu > .nav-item .dropdown-menu {
max-height: 400px;
overflow-x: auto;
top: -1px;
}

Expand Down Expand Up @@ -405,19 +406,6 @@
padding: 0;
}

#adaptable-page-header-wrapper #main-navbar .action-menu .dropdown-toggle::after {
border-bottom: 0;
border-left: .5em solid transparent;
border-right: .5em solid transparent;
border-top: .5em solid;
content: "";
display: inline-block;
height: 0;
margin-left: .255em;
vertical-align: .255em;
width: 0;
}

#adaptable-page-header-wrapper #main-navbar .action-menu a.dropdown-toggle i {
padding: 0;
}
Expand Down
Loading

0 comments on commit a9dca1c

Please sign in to comment.