Skip to content

Commit d3c248a

Browse files
committed
Merge branch '8330/updates-pt-2' into 'main'
Pull requests for 5.1 See merge request amc/moodle/moodle-mod_publication!149
2 parents bd55024 + 2e5ab3a commit d3c248a

File tree

16 files changed

+239
-30
lines changed

16 files changed

+239
-30
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Moodle Plugin CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-22.04
8+
9+
services:
10+
postgres:
11+
image: postgres:15
12+
env:
13+
POSTGRES_USER: 'postgres'
14+
POSTGRES_HOST_AUTH_METHOD: 'trust'
15+
ports:
16+
- 5432:5432
17+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
18+
19+
mariadb:
20+
image: mariadb:10
21+
env:
22+
MYSQL_USER: 'root'
23+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
24+
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
25+
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
26+
ports:
27+
- 3306:3306
28+
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- php: '8.2'
35+
moodle-branch: 'MOODLE_501_STABLE'
36+
database: pgsql
37+
- php: '8.3'
38+
moodle-branch: 'MOODLE_501_STABLE'
39+
database: pgsql
40+
- php: '8.4'
41+
moodle-branch: 'MOODLE_501_STABLE'
42+
database: pgsql
43+
- php: '8.2'
44+
moodle-branch: 'MOODLE_501_STABLE'
45+
database: mariadb
46+
- php: '8.3'
47+
moodle-branch: 'MOODLE_501_STABLE'
48+
database: mariadb
49+
- php: '8.4'
50+
moodle-branch: 'MOODLE_501_STABLE'
51+
database: mariadb
52+
53+
steps:
54+
- name: Check out repository code
55+
uses: actions/checkout@v4
56+
with:
57+
path: plugin
58+
59+
- name: Setup PHP ${{ matrix.php }}
60+
uses: shivammathur/setup-php@v2
61+
with:
62+
php-version: ${{ matrix.php }}
63+
extensions: ${{ matrix.extensions }}
64+
ini-values: max_input_vars=5000
65+
# If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug".
66+
# If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems).
67+
coverage: none
68+
69+
- name: Initialise moodle-plugin-ci
70+
run: |
71+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
72+
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
73+
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
74+
sudo locale-gen en_AU.UTF-8
75+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
76+
77+
- name: Install moodle-plugin-ci
78+
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
79+
env:
80+
DB: ${{ matrix.database }}
81+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
82+
CODECHECKER_IGNORE_PATHS: 'pdfjs-5.4.394-dist,pdfjs-5.4.394-legacy-dist'
83+
IGNORE_PATHS: 'pdfjs-5.4.394-dist,pdfjs-5.4.394-legacy-dist'
84+
PHPCS_IGNORE_PATHS: /^pdfjs-5.4.394-dist/,/^pdfjs-5.4.394-legacy-dist/
85+
PHPDOCCHECKER_IGNORE_PATHS: /^pdfjs-5.4.394-dist/,/^pdfjs-5.4.394-legacy-dist/
86+
87+
- name: PHP Lint
88+
if: ${{ !cancelled() }}
89+
run: moodle-plugin-ci phplint
90+
91+
- name: PHP Mess Detector
92+
continue-on-error: true # This step will show errors but will not fail
93+
if: ${{ !cancelled() }}
94+
run: moodle-plugin-ci phpmd
95+
96+
- name: Moodle Code Checker
97+
if: ${{ !cancelled() }}
98+
run: moodle-plugin-ci phpcs --max-warnings 0
99+
100+
- name: Moodle PHPDoc Checker
101+
if: ${{ !cancelled() }}
102+
run: moodle-plugin-ci phpdoc --max-warnings 0
103+
104+
- name: Validating
105+
if: ${{ !cancelled() }}
106+
run: moodle-plugin-ci validate
107+
108+
- name: Check upgrade savepoints
109+
if: ${{ !cancelled() }}
110+
run: moodle-plugin-ci savepoints
111+
112+
- name: Mustache Lint
113+
if: ${{ !cancelled() }}
114+
run: moodle-plugin-ci mustache
115+
116+
- name: Grunt
117+
if: ${{ !cancelled() }}
118+
run: moodle-plugin-ci grunt --max-lint-warnings 0
119+
120+
- name: PHPUnit tests
121+
if: ${{ !cancelled() }}
122+
run: moodle-plugin-ci phpunit --fail-on-warning
123+
124+
- name: Behat features
125+
id: behat
126+
if: ${{ !cancelled() }}
127+
run: moodle-plugin-ci behat --profile chrome --scss-deprecations
128+
129+
- name: Upload Behat Faildump
130+
if: ${{ failure() && steps.behat.outcome == 'failure' }}
131+
uses: actions/upload-artifact@v4
132+
with:
133+
name: Behat Faildump (${{ join(matrix.*, ', ') }})
134+
path: ${{ github.workspace }}/moodledata/behat_dump
135+
retention-days: 7
136+
if-no-files-found: ignore
137+
138+
- name: Mark cancelled jobs as failed.
139+
if: ${{ cancelled() }}
140+
run: exit 1

CHANGELOG.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ CHANGELOG
55
5.1.0 (2026-01-14)
66
-------------------
77
* Moodle 5.1.0 compatible version
8-
* [BUG] #8440 - fix resetting of filters after applying changes on All files table - github #104
9-
* [FEATURE] #8332 - add support for multilang filter v2 in course name, activity name and group name when saving zip file
108
* [BUG] #8092 - only show students/teachers who have mod/publication:upload in the table
11-
* [FEATURE] #8441 - use original filenames in zip file
9+
* [BUG] #8440 - fix resetting of filters after applying changes on All files table - github #104
1210
* [BUG] #8567 - fix incorrect count and title in group mode
11+
* [BUG] #8676 - use the correct notification setting for status changes - github #94 & github pull request #110 - pleboucherenssib
1312
* [FEATURE] #8094 - implement new completion criteria for imported files from assignment activities
14-
* [FEAUTRE] #8581 - show which group the user belongs to, and also groups members
15-
* [FEATURE] #8617 - implement overview class - github #105
13+
* [FEATURE] #8332 - add support for multilang filter v2 in course name, activity name and group name when saving zip file
14+
* [FEATURE] #8441 - use original filenames in zip file
15+
* [FEATURE] #8581 - show which group the user belongs to, and also groups members
16+
* [FEATURE] #8617 - support further information in the activity overview
17+
* [FEATURE] #8677 - support Moodle Plugin CI and adhere to Moodle coding guidelines - github pull request #111 - lucaboesch
18+
* [FEATURE] #8678 - implement overview class - github #105 & github pull request #106 - lucaboesch
1619

1720
5.0.1 (2025-09-29)
1821
-------------------

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Moodle Plugin CI](https://github.com/academic-moodle-cooperation/moodle-mod_publication/actions/workflows/moodle-plugin-ci.yml/badge.svg)](https://github.com/academic-moodle-cooperation/moodle-mod_publication/actions/workflows/moodle-plugin-ci.yml)
2+
13
Student Folder
24
=====================
35

classes/event/publication_file_uploaded.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public static function create_from_object(\stdClass $cm, $dobj) {
6767
* @return string
6868
*/
6969
public function get_description() {
70-
return "The user with id '" . $this->data['other']['userid'] . "' uploaded a new file with id '" . $this->data['other']['id'] .
71-
"' to publication with id '" . $this->data['other']['publication'] . "'";
70+
return "The user with id '" . $this->data['other']['userid'] . "' uploaded a new file with id '" .
71+
$this->data['other']['id'] . "' to publication with id '" . $this->data['other']['publication'] . "'";
7272
}
7373

7474
/**

classes/local/allfilestable/base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function print_nothing_to_display() {
177177

178178
$this->print_initials_bar();
179179

180-
echo $OUTPUT->box(get_string('nofilestodisplay', 'publication'), 'font-italic');
180+
echo $OUTPUT->box(get_string('nofilestodisplay', 'publication'), 'fst-italic');
181181
}
182182

183183
/**

classes/local/allfilestable/group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function print_nothing_to_display() {
174174

175175
$this->print_initials_bar();
176176

177-
echo $OUTPUT->box(get_string('nofilestodisplay', 'publication'), 'font-italic');
177+
echo $OUTPUT->box(get_string('nofilestodisplay', 'publication'), 'fst-italic');
178178
}
179179

180180
/**

db/upgrade.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,16 @@ function xmldb_publication_upgrade($oldversion) {
378378
if ($oldversion < 2025102900) {
379379
// Define field completionassignsubmission to be added to publication.
380380
$table = new xmldb_table('publication');
381-
$field = new xmldb_field('completionassignsubmission', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'completionupload');
381+
$field = new xmldb_field(
382+
'completionassignsubmission',
383+
XMLDB_TYPE_INTEGER,
384+
'2',
385+
null,
386+
XMLDB_NOTNULL,
387+
null,
388+
'0',
389+
'completionupload'
390+
);
382391

383392
// Conditionally launch add field completionassignsubmission.
384393
if (!$dbman->field_exists($table, $field)) {

index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
$id = required_param('id', PARAM_INT); // We need a course!
3131

32+
if ($CFG->version > 2025041400) {
33+
\core_courseformat\activityoverviewbase::redirect_to_overview_page($id, 'publication');
34+
}
35+
3236
if (!$course = $DB->get_record('course', ['id' => $id])) {
3337
throw new \moodle_exception('coursemisconf');
3438
}

lang/en/publication.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555
$string['availabilityrestriction_admin_desc'] = 'Users who cannot access the activity due to availability restrictions will be removed from the list.<br>This only includes conditions which are marked as being applied to user lists. For example, group conditions are included but date conditions are not included.';
5656
$string['availabilityrestriction_help'] = 'Users who cannot access the activity due to availability restrictions will be removed from the list.<br>This only includes conditions which are marked as being applied to user lists. For example, group conditions are included but date conditions are not included.';
5757
$string['choose'] = 'Please choose ...';
58-
$string['completiondetail:upload'] = 'Upload a file';
58+
$string['completionassignsubmission'] = 'Student or group must make a submission in the linked assignment activity';
5959
$string['completiondetail:assignsubmission'] = 'Make a submission in the linked assignment activity';
60+
$string['completiondetail:upload'] = 'Upload a file';
6061
$string['completionupload'] = 'Student must upload a file';
61-
$string['completionassignsubmission'] = 'Student or group must make a submission in the linked assignment activity';
6262
$string['configautoimport'] = 'If you prefer to have student submissions be automatically imported into student folder instances. This feature can be enabled/disabled for each student folder instance separately.';
6363
$string['configmaxbytes'] = 'Default maximum size for all files in the student folder.';
6464
$string['configmaxfiles'] = 'Default maximum number of attachments allowed per user.';

locallib.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2525
*/
2626

27-
defined('MOODLE_INTERNAL') || die();
28-
2927
define('PUBLICATION_MODE_UPLOAD', 0);
3028
define('PUBLICATION_MODE_IMPORT', 1);
3129
// Used in DB to mark online-text-files!
@@ -568,7 +566,7 @@ public function display_allfilesform() {
568566
$allfiles = get_string('allfiles', 'publication');
569567
$publicfiles = get_string('publicfiles', 'publication');
570568
$title = (has_capability('mod/publication:approve', $context) && $this->allfilespage) ? $allfiles : $publicfiles;
571-
$output .= html_writer::tag('legend', $title, ['class' => 'ftoggler h3']);
569+
$output .= html_writer::tag('legend', $title, ['class' => 'ftoggler h3 fw-bold']);
572570
$output .= html_writer::start_div('fcontainer clearfix mb-3');
573571

574572
$f = groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/publication/view.php?id=' . $cm->id, true);
@@ -1792,12 +1790,12 @@ public static function send_notification_statuschange(
17921790
$publication = new publication($cm);
17931791
}
17941792

1795-
$notifyfilechange = $publication->get_instance()->notifyfilechange;
1793+
$notifystatuschange = $publication->get_instance()->notifystatuschange;
17961794
$receivers = [];
1797-
if ($notifyfilechange == PUBLICATION_NOTIFY_TEACHER || $notifyfilechange == PUBLICATION_NOTIFY_ALL) {
1795+
if ($notifystatuschange == PUBLICATION_NOTIFY_TEACHER || $notifystatuschange == PUBLICATION_NOTIFY_ALL) {
17981796
$receivers = $publication->get_graders($userfrom);
17991797
}
1800-
if ($notifyfilechange == PUBLICATION_NOTIFY_STUDENT || $notifyfilechange == PUBLICATION_NOTIFY_ALL) {
1798+
if ($notifystatuschange == PUBLICATION_NOTIFY_STUDENT || $notifystatuschange == PUBLICATION_NOTIFY_ALL) {
18011799
if ($publication->get_mode() == PUBLICATION_MODE_ASSIGN_TEAMSUBMISSION) {
18021800
$usersingroup = $publication->get_submissionmembers($pubfile->userid);
18031801
$receivers += $usersingroup;
@@ -1831,6 +1829,7 @@ public static function send_notification_statuschange(
18311829
$posttext = $publication->email_statuschange_text($info, $receiver->lang, $includeheader);
18321830
$posthtml = $publication->email_statuschange_html($info, $receiver->lang, $includeheader);
18331831

1832+
// phpcs:disable moodle.Commenting.TodoComment
18341833
// TODO maybe add check here is receiver is the same as user from. Unless already checked in get_graders().
18351834
if (!isset(self::$pendingnotifications[PUBLICATION_NOTIFY_STATUSCHANGE][$cm->id][$receiver->id])) {
18361835
$message = new \core\message\message();
@@ -1921,6 +1920,7 @@ public static function send_notification_filechange($cm, $file, $user = null, $p
19211920
$posttext = $publication->email_filechange_text($info, $receiver->lang, $stridentifier, $includeheader);
19221921
$posthtml = $publication->email_filechange_html($info, $receiver->lang, $stridentifier, $includeheader);
19231922

1923+
// phpcs:disable moodle.Commenting.TodoComment
19241924
// TODO maybe add check here is receiver is the same as user from. Unless already checked in get_graders().
19251925

19261926
if (!isset(self::$pendingnotifications[PUBLICATION_NOTIFY_FILECHANGE][$cm->id][$receiver->id])) {
@@ -2008,6 +2008,7 @@ public static function export_onlinetext_for_preview($itemid, $publicationid, $c
20082008
false
20092009
);
20102010
foreach ($resources as $resource) {
2011+
// phpcs:disable moodle.Commenting.TodoComment
20112012
// TODO watch the encoding of the file's names, in the event of core changing it, we have to change too!
20122013
$filename = rawurlencode($resource->get_filename());
20132014
$search = './resources/' . $filename;

0 commit comments

Comments
 (0)