Skip to content

Commit

Permalink
Merge tag 'v4.3.7' into LAE_2505_STABLE
Browse files Browse the repository at this point in the history
MOODLE_4037
  • Loading branch information
mackensen committed Sep 3, 2024
2 parents 0e0d57e + e28403c commit a75f267
Show file tree
Hide file tree
Showing 76 changed files with 818 additions and 390 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches-ignore:
- '*PACKAGE*'
- master
- main
- MOODLE_[0-9]+_STABLE
tags-ignore:
- v[0-9]+.[0-9]+.[0-9]+*
Expand Down
10 changes: 5 additions & 5 deletions LAE_readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [Moodle Liberal Arts Edition v4.3.6-LAE25.0.4]
# [Moodle Liberal Arts Edition v4.3.7-LAE25.0.5]

Welcome to the Moodle Liberal Arts Edition. The goal of the LAE is to provide a coherent package for modules, patches, and code developed (or improved) by the Collaborative Liberal Arts Moodle Project (CLAMP).

Expand All @@ -16,7 +16,7 @@ https://www.clamp-it.org/collaboration-and-development-tools/

## Contents

Moodle 4.3.6+LAE25.0.4 consists of the core Moodle 4.3.6 release plus a number of CLAMP-developed features and bug fixes.
Moodle 4.3.7+LAE25.0.5 consists of the core Moodle 4.3.7 release plus a number of CLAMP-developed features and bug fixes.

The following core features are included:

Expand Down Expand Up @@ -62,10 +62,10 @@ You can get the LAE in two ways:
* Download the tar and zip packages from the CLAMP web site: <http://www.clamp-it.org/code/>
* Download the current release branch from the CLAMP code repository:

git clone https://github.com/CLAMP-IT/moodle v4.3.6-LAE25.0.4
git checkout -b v4.3.6-LAE25.0.4
git clone https://github.com/CLAMP-IT/moodle v4.3.7-LAE25.0.5
git checkout -b v4.3.7-LAE25.0.5

By default this is the "Package" version which includes the contributed modules. If you just want the core version of the LAE checkout the v4.3.6-LAE25.0.4-base tag instead.
By default this is the "Package" version which includes the contributed modules. If you just want the core version of the LAE checkout the v4.3.7-LAE25.0.5-base tag instead.

CLAMP maintains two branches for each major version:

Expand Down
11 changes: 11 additions & 0 deletions admin/classes/table/plugin_management_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,15 @@ protected function supports_disabling(): bool {
protected function supports_ordering(): bool {
return $this->plugininfoclass::plugintype_supports_ordering();
}

/**
* Check if the user has the capability to access this table.
*
* Default implementation for plugin management tables is to require 'moodle/site:config' capability
*
* @return bool Return true if capability check passed.
*/
public function has_capability(): bool {
return has_capability('moodle/site:config', $this->get_context());
}
}
10 changes: 3 additions & 7 deletions admin/cli/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));

require_once($CFG->libdir.'/classes/component.php');

require_once($CFG->libdir.'/classes/text.php');
require_once($CFG->libdir.'/classes/string_manager.php');
require_once($CFG->libdir.'/classes/string_manager_install.php');
Expand All @@ -192,13 +193,8 @@
require_once($CFG->libdir.'/componentlib.class.php');
require_once($CFG->dirroot.'/cache/lib.php');

// Register our classloader, in theory somebody might want to replace it to load other hacked core classes.
// Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes.
if (defined('COMPONENT_CLASSLOADER')) {
spl_autoload_register(COMPONENT_CLASSLOADER);
} else {
spl_autoload_register('core_component::classloader');
}
// Register our classloader.
\core_component::register_autoloader();

require($CFG->dirroot.'/version.php');
$CFG->target_release = $release;
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting_configcheckbox.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
}
}}
<div class="form-checkbox defaultsnext">
<input type="hidden" name="{{name}}" value="{{no}}">
{{^readonly}}<input type="hidden" name="{{name}}" value="{{no}}">{{/readonly}}
<input {{#readonly}}disabled{{/readonly}} type="checkbox" name="{{name}}" value="{{value}}" id="{{id}}" {{#checked}}checked{{/checked}}>
</div>
2 changes: 1 addition & 1 deletion admin/templates/setting_configmulticheckbox.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
}}
<div class="form-multicheckbox">
<input type="hidden" name="{{name}}[xxxxx]" value="1">
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
{{#hasoptions}}
<ul>
{{#options}}
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting_configmultiselect.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
Setting configmultiselect.
}}
<div class="form-select">
<input type="hidden" name="{{name}}[xxxxx]" value="1">
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
Setting configmultiselect with optgroup support.
}}
<div class="form-select">
<input type="hidden" name="{{name}}[xxxxx]" value="1">
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
Expand Down
22 changes: 0 additions & 22 deletions admin/tests/behat/task_logs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,3 @@ Feature: View task logs report and use its filters
| operator | shouldornotsee |
| Less than | should not see |
| Greater than | should see |

@javascript
Scenario: Reset task log filters
Given I log in as "admin"
And I change window size to "large"
And I navigate to "Server > Tasks > Task logs" in site administration
When I click on "Filters" "button"
And I set the following fields in the "Result" "core_reportbuilder > Filter" to these values:
| Result operator | Is equal to |
| Result value | Fail |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then I should see "Filters applied"
And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
And I should see "Nothing to display"
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
And I should see "Filters reset"
And I should not see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
And I should see "Filters" in the "#dropdownFiltersButton" "css_element"
And "[data-region='report-filters']" "css_element" should be visible
And the following fields in the "Result" "core_reportbuilder > Filter" match these values:
| Result operator | Is any value |
And I should not see "Nothing to display"
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ public function luminosity(string $r, string $r2, string $g, string $g2, string
return $luminosity;
}


/**
* Returns the decimal equivalents for a HEX color. Returns null if it cannot be determined.
* @param string $color The hex color value
Expand All @@ -268,13 +267,21 @@ public function get_rgb(string $color): ?array {
*/
public function convert_color(string $color): string {
$color = trim($color);
if (strpos($color, ' ') !== false) {
$colors = explode(' ', $color);
foreach ($colors as $backgroundpart) {
if (substr(trim($backgroundpart), 0, 1) == '#' ||
in_array(trim($backgroundpart), array_keys($this->colornames)) ||
strtolower(substr(trim($backgroundpart), 0, 3)) == 'rgb') {
$color = $backgroundpart;
// Search for color in rgb format first, as this can potentially contain a space.
if (strpos($color, 'rgb') !== false) {
$colors = explode('rgb', $color, 2); // Getting 2 only in array.
// Getting end point of rgb value, i.e. the end bracket.
$endpos = strpos($colors[1], ')');
$color = 'rgb' . substr($colors[1], 0, ($endpos + 1)); // Recompiling rgb value.
} else {
// Splitting multi-value css background value.
if (strpos($color, ' ') !== false) {
$colors = explode(' ', $color);
foreach ($colors as $backgroundpart) {
if (substr(trim($backgroundpart), 0, 1) == '#' ||
in_array(trim($backgroundpart), array_keys($this->colornames))) {
$color = $backgroundpart;
}
}
}
}
Expand All @@ -296,9 +303,20 @@ public function convert_color(string $color): string {
}
// RGB values.
if (strtolower(substr($color, 0, 3)) == 'rgb') {
$colors = explode(',', trim(str_replace('rgb(', '', $color), '()'));
if (count($colors) != 3) {
return false;
if (strpos($color, 'rgba') !== false) {
$tmpbg = $this->get_rgb($this->defaultbackground);
$colors = explode(',', trim(str_replace('rgba(', '', $color), '()'));
if (count($colors) != 4) {
return false;
}
$colors[0] = round(((1 - $colors[3]) * $tmpbg['r']) + ($colors[3] * $colors[0]));
$colors[1] = round((1 - $colors[3]) * $tmpbg['g']) + ($colors[3] * $colors[1]);
$colors[2] = round((1 - $colors[3]) * $tmpbg['b']) + ($colors[3] * $colors[2]);
} else {
$colors = explode(',', trim(str_replace('rgb(', '', $color), '()'));
if (count($colors) != 3) {
return false;
}
}
$r = intval($colors[0]);
$g = intval($colors[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,18 @@ public function check(): void {
foreach ($entries as $element) {
$style = $this->css->get_style($element);

if (isset($style['background-color']) || isset($style['color'])) {
if (isset($style['background-color']) || isset($style['color']) || isset($style['background'])) {
if (!isset($style['background-color'])) {
$style['background-color'] = $this->defaultbackground;
if (isset($style['background'])) {
// Parsing background-color from CSS background shortcut string.
$style['background-color'] = '#' . $this->convert_color($style['background']);
// If value is empty after hash, then use defaultbackground.
if ($style['background-color'] == '#') {
$style['background-color'] = $this->defaultbackground;
}
} else {
$style['background-color'] = $this->defaultbackground;
}
}

if (!isset($style['color'])) {
Expand All @@ -82,11 +91,7 @@ public function check(): void {
$style['color'] = '#' . $this->convert_color($style['color']);
$style['background-color'] = '#' . $this->convert_color($background);

if (substr($background, 0, 3) == "rgb") {
$background = '#' . $this->convert_color($background);
}

$luminosity = $this->get_luminosity($style['color'], $background);
$luminosity = $this->get_luminosity($style['color'], $style['background-color']);
$fontsize = 0;
$bold = false;
$italic = false;
Expand Down
Loading

0 comments on commit a75f267

Please sign in to comment.