Skip to content

Commit

Permalink
resolved version differences
Browse files Browse the repository at this point in the history
  • Loading branch information
mhughes2k committed Mar 22, 2024
2 parents 5f4e6b9 + 3423193 commit 525d840
Show file tree
Hide file tree
Showing 244 changed files with 4,582 additions and 1,142 deletions.
14 changes: 6 additions & 8 deletions admin/classes/reportbuilder/local/systemreports/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function initialise(): void {
$this->add_actions();

// Set if report can be downloaded.
$this->set_downloadable(false);
$this->set_downloadable(true);
}

/**
Expand All @@ -135,17 +135,15 @@ public function add_columns(): void {
$entityuser = $this->get_entity('user');
$entityuseralias = $entityuser->get_table_alias('user');

$this->add_column($entityuser->get_column('fullnamewithlink'));
$this->add_column($entityuser->get_column('fullnamewithpicturelink'));

// Include identity field columns.
$identitycolumns = $entityuser->get_identity_columns($this->get_context(), ['city', 'country', 'lastaccesstime']);
$identitycolumns = $entityuser->get_identity_columns($this->get_context());
foreach ($identitycolumns as $identitycolumn) {
$this->add_column($identitycolumn);
}

// These columns are always shown in the users list.
$this->add_column($entityuser->get_column('city'));
$this->add_column($entityuser->get_column('country'));
// Add "Last access" column.
$this->add_column(($entityuser->get_column('lastaccess'))
->set_callback(static function ($value, \stdClass $row): string {
if ($row->lastaccess) {
Expand All @@ -155,7 +153,7 @@ public function add_columns(): void {
})
);

if ($column = $this->get_column('user:fullnamewithlink')) {
if ($column = $this->get_column('user:fullnamewithpicturelink')) {
$column
->add_fields("{$entityuseralias}.suspended, {$entityuseralias}.confirmed")
->add_callback(static function(string $fullname, \stdClass $row): string {
Expand All @@ -171,7 +169,7 @@ public function add_columns(): void {
});
}

$this->set_initial_sort_column('user:fullnamewithlink', SORT_ASC);
$this->set_initial_sort_column('user:fullnamewithpicturelink', SORT_ASC);
$this->set_default_no_results_notice(new lang_string('nousersfound', 'moodle'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tags:

## Description

Most Moodle icons are rendered using the 6.4 versions of [Fontawesome](https://fontawesome.com/v6/search). Iconnames are mapped from the Moodle icon name to the Font Awesome icon names in `/lib/classes/output/icon_system_fontawesome.php`
Most Moodle icons are rendered using the 6.5.1 versions of [Fontawesome](https://fontawesome.com/v6/search). Iconnames are mapped from the Moodle icon name to the Font Awesome icon names in `/lib/classes/output/icon_system_fontawesome.php`

If needed a theme can override this map and provide its own mapping.

Expand Down
15 changes: 15 additions & 0 deletions admin/tool/task/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,20 @@ function tool_task_status_checks(): array {
*/
function tool_task_mtrace_wrapper(string $message, string $eol): void {
$message = s($message);

// We autolink urls and emails here but can't use format_text as it does
// more than we need and has side effects which are not useful in this context.
$urlpattern = '/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/';
$message = preg_replace_callback($urlpattern, function($matches) {
$url = $matches[0];
return html_writer::link($url, $url, ['target' => '_blank']);
}, $message);

$emailpattern = '/[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/';
$message = preg_replace_callback($emailpattern, function($matches) {
$email = $matches[0];
return html_writer::link('mailto:' . $email, $email);
}, $message);

echo $message . $eol;
}
9 changes: 5 additions & 4 deletions admin/tool/task/run_adhoctasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ function ($t) use ($now) {
require_sesskey();

\core\session\manager::write_close();
echo $OUTPUT->footer();
echo $OUTPUT->select_element_for_append();

// Prepare to handle output via mtrace.
require_once("{$CFG->dirroot}/{$CFG->admin}/tool/task/lib.php");
Expand All @@ -124,7 +126,7 @@ function ($t) use ($now) {
if ($taskid) {
$repeat = $DB->get_record('task_adhoc', ['id' => $taskid]);

echo html_writer::start_tag('pre');
echo html_writer::start_tag('pre', ['class' => 'task-output']);
\core\task\manager::run_adhoc_from_cli($taskid);
echo html_writer::end_tag('pre');
} else {
Expand All @@ -133,13 +135,13 @@ function ($t) use ($now) {
// Run failed first (if any). We have to run them separately anyway,
// because faildelay is observed if failed flag is not true.
echo html_writer::tag('p', get_string('runningfailedtasks', 'tool_task'), ['class' => 'lead']);
echo html_writer::start_tag('pre');
echo html_writer::start_tag('pre', ['class' => 'task-output']);
\core\task\manager::run_all_adhoc_from_cli(true, $classname);
echo html_writer::end_tag('pre');

if (!$failedonly) {
echo html_writer::tag('p', get_string('runningalltasks', 'tool_task'), ['class' => 'lead']);
echo html_writer::start_tag('pre');
echo html_writer::start_tag('pre', ['class' => 'task-output']);
\core\task\manager::run_all_adhoc_from_cli(false, $classname);
echo html_writer::end_tag('pre');
}
Expand All @@ -161,4 +163,3 @@ function ($t) use ($now) {
)
);

echo $OUTPUT->footer();
3 changes: 1 addition & 2 deletions admin/tool/task/schedule_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@
echo $OUTPUT->select_element_for_append();

// Prepare to handle output via mtrace.
echo html_writer::start_tag('pre', ['style' => 'color: #fff; background: #333; padding: 1em; min-height: 24lh']);

require_once("{$CFG->dirroot}/{$CFG->admin}/tool/task/lib.php");
echo html_writer::start_tag('pre', ['class' => 'task-output', 'style' => 'min-height: 24lh']);
$CFG->mtrace_wrapper = 'tool_task_mtrace_wrapper';

// Run the specified task (this will output an error if it doesn't exist).
Expand Down
11 changes: 11 additions & 0 deletions admin/tool/task/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@
#page-admin-tool-task-scheduledtasks .task-clearfaildelay {
font-size: 0.75em;
}

.path-admin-tool-task .task-output {
color: #fff;
background: #333;
padding: 1em;

a {
color: #fff;
text-decoration: underline;
}
}
1 change: 0 additions & 1 deletion admin/tool/usertours/lang/en/deprecated.txt

This file was deleted.

3 changes: 0 additions & 3 deletions admin/tool/usertours/lang/en/tool_usertours.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,3 @@
$string['tour_gradebook_tour_name'] = 'Gradebook Grader Report';
$string['tour_final_step_title'] = 'End of tour';
$string['tour_final_step_content'] = 'This is the end of your user tour. It won\'t show again unless you reset it using the link in the footer.';

// Deprecated since Moodle 4.0.
$string['previousstep'] = 'Previous';
2 changes: 1 addition & 1 deletion admin/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
echo html_writer::start_div('', ['data-region' => 'report-user-list-wrapper']);

$bulkactions = new user_bulk_action_form(new moodle_url('/admin/user/user_bulk.php'),
['excludeactions' => ['displayonpage'], 'passuserids' => true, 'hidesubmit' => true],
['excludeactions' => ['displayonpage', 'download'], 'passuserids' => true, 'hidesubmit' => true],
'post', '',
['id' => 'user-bulk-action-form']);
$bulkactions->set_data(['returnurl' => $PAGE->url->out_as_local_url(false)]);
Expand Down
2 changes: 1 addition & 1 deletion auth/lti/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function complete_login(array $launchdata, moodle_url $returnurl, int $pr
if (isloggedin()) {
// If a different user is currently logged in, authenticate the linked user instead.
global $USER;
if ((int) $USER->id !== $user->id) {
if ($USER->id !== $user->id) {
complete_user_login($user);
}
// If the linked user is already logged in, skip the call to complete_user_login() because this affects deep linking
Expand Down
50 changes: 50 additions & 0 deletions auth/lti/classes/local/ltiadvantage/event/event_handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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/>.

namespace auth_lti\local\ltiadvantage\event;

use auth_lti\local\ltiadvantage\utility\cookie_helper;
use core\event\user_loggedin;

/**
* Event handler for auth_lti.
*
* @package auth_lti
* @copyright 2024 Jake Dallimore <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class event_handler {

/**
* Allows the plugin to augment Set-Cookie headers when the user_loggedin event is fired as part of complete_user_login() calls.
*
* @param user_loggedin $event the event
* @return void
*/
public static function handle_user_loggedin(user_loggedin $event): void {
// The event data isn't important here. The intent of this listener is to ensure that the MoodleSession cookie gets the
// 'Partitioned' attribute, when required - an opt-in flag needed to use Chrome's partitioning mechanism, CHIPS. During LTI
// auth, the auth class (auth/lti/auth.php) calls complete_user_login(), which generates a new session cookie as part of its
// login process. This handler makes sure that this new cookie is intercepted and partitioned, if needed.
if (cookie_helper::cookies_supported()) {
if (cookie_helper::get_cookies_supported_method() == cookie_helper::COOKIE_METHOD_EXPLICIT_PARTITIONING) {
global $CFG;
cookie_helper::add_attributes_to_cookie_response_header('MoodleSession' . $CFG->sessioncookie,
['Partitioned', 'Secure']);
}
}
}
}
Loading

0 comments on commit 525d840

Please sign in to comment.