Skip to content

Commit 5e9af0e

Browse files
Merge pull request #913 from turnitin/qa
Release to Production
2 parents 60c7469 + d8fd483 commit 5e9af0e

File tree

125 files changed

+4069
-1917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4069
-1917
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
### Date: 2025-October-29
2+
### Release: v2025102901
3+
4+
---
5+
6+
#### Online Text Submission Now Working with Group Submissions
7+
Students now able to submit online text with Group Submissions.
8+
9+
#### Online Text Quiz Attempts Fixed
10+
The identifier hash was being calculated incorrectly when looking up online text quiz attempts for students, this has now been fixed.
11+
12+
#### Eula Only Displays When Plugin Enabled In Quizzes
13+
The Eula was mistakenly being shown to all users who have not accepted it when opening a quiz, even when the plugin was not enabled, this no longer occurs.
14+
15+
#### Behat Updates
16+
Tests updated so they now can be run with the Moodle's wider behat suite.
17+
18+
#### Clarified Text
19+
Updated some wording around anonymous marking for clarification.
20+
21+
#### Code Cleanup & General Improvements
22+
Performance upgrades, refactoring deprecated code.
23+
24+
---
25+
126
### Date: 2025-July-02
227
### Release: v2025070201
328

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Announcement - Issues page merged with Turnitin's support page
2+
================
3+
4+
In order to be able to better monitor incoming issues, we are consolidating the 3 issues pages for the 2 plagiarism plugins and Direct v2 with our existing support area.
5+
6+
The support area is how our team currently monitors issues for every other area of Turnitin. Therefore, we will be closing the Issues pages. If you have issues with the Turnitin plagiarism plugin, please raise them here: https://helpcenter.turnitin.com/hc/en-us/requests/new
7+
8+
The team appreciates your ongoing support and contributions. Thank you!
9+
110
Turnitin Plagiarism plugin for Moodle
211
=====================================
312

@@ -30,3 +39,14 @@ Plagiarism plugins also need to be enabled before this plugin can be used. You c
3039
You can set default values and whether the plugin is enabled within Moodle modules by going to `"Site Administration" > "Plugins" > "Plagiarism prevention" > "Turnitin plagiarism plugin"`.
3140

3241
To create/update assignments, process submissions and update grades your moodle environment will need to have cron job running regularly. For information on how to do this please consult https://docs.moodle.org/en/Cron.
42+
43+
On Behat tests
44+
=====================================
45+
46+
Recently we fixed our existing Behat tests to work with Moodle 4.5 and 5.0. As is sometimes the case with Gherkin tests, there could be occasional timeouts or slight variations between browsers.
47+
48+
If you would like them yourself along with the other Moodle tests, please include these Environment variables (you can find them in your Site administration -> Plugin configuration):
49+
50+
TII_ACCOUNT: [your Turnitin account ID]
51+
TII_SECRET: [your 8-character secret]
52+
TII_APIBASEURL: "https://api.turnitin.com"

ajax.php

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

17+
/**
18+
* Turnitin ajax file
19+
*
20+
* @package plagiarism_turnitin
21+
* @copyright 2013 iParadigms LLC
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
1725
use Integrations\PhpSdk\TiiClass;
1826

1927
require_once(__DIR__.'/../../config.php');
@@ -23,6 +31,10 @@
2331

2432
require_login();
2533

34+
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
35+
\core\session\manager::write_close();
36+
}
37+
2638
$action = required_param('action', PARAM_ALPHAEXT);
2739
$cmid = optional_param('cmid', 0, PARAM_INT);
2840
$itemid = optional_param('itemid', 0, PARAM_INT);
@@ -45,7 +57,7 @@
4557

4658
$pathnamehash = optional_param('pathnamehash', "", PARAM_ALPHANUM);
4759
$submissiontype = optional_param('submission_type', "", PARAM_ALPHAEXT);
48-
$return = array();
60+
$return = [];
4961

5062
// Initialise plugin class.
5163
$pluginturnitin = new plagiarism_plugin_turnitin();
@@ -79,14 +91,14 @@
7991
$userrole,
8092
''
8193
),
82-
array('style' => 'display: none')
94+
['style' => 'display: none']
8395
);
8496
}
8597
break;
8698

8799
case "update_grade":
88100
if (!confirm_sesskey()) {
89-
throw new moodle_exception('invalidsesskey', 'error');
101+
throw new \moodle_exception('invalidsesskey', 'error');
90102
}
91103

92104
include_once($CFG->libdir."/gradelib.php");
@@ -102,7 +114,7 @@
102114

103115
// If we have a turnitin timestamp stored then update it, otherwise create it.
104116
if ($timestampid = $DB->get_record('plagiarism_turnitin_config',
105-
array('cm' => $cm->id, 'name' => 'grades_last_synced'), 'id')) {
117+
['cm' => $cm->id, 'name' => 'grades_last_synced'], 'id')) {
106118
$moduleconfigvalue->id = $timestampid->id;
107119
$DB->update_record('plagiarism_turnitin_config', $moduleconfigvalue);
108120
} else {
@@ -119,10 +131,10 @@
119131

120132
case "refresh_peermark_assignments":
121133
if (!confirm_sesskey()) {
122-
throw new moodle_exception('invalidsesskey', 'error');
134+
throw new \moodle_exception('invalidsesskey', 'error');
123135
}
124136

125-
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', array('cm' => $cm->id, 'name' => 'turnitin_assignid'));
137+
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', ['cm' => $cm->id, 'name' => 'turnitin_assignid']);
126138
$pluginturnitin->refresh_peermark_assignments($cm, $tiiassignment->value);
127139
break;
128140

@@ -132,7 +144,7 @@
132144
$plagiarismpluginturnitin = new plagiarism_plugin_turnitin();
133145
$coursedata = $plagiarismpluginturnitin->get_course_data($cm->id, $cm->course);
134146

135-
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', array('cm' => $cm->id, 'name' => 'turnitin_assignid'));
147+
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', ['cm' => $cm->id, 'name' => 'turnitin_assignid']);
136148

137149
if ($tiiassignment) {
138150
$tiiassignmentid = $tiiassignment->value;
@@ -148,10 +160,10 @@
148160
echo html_writer::tag(
149161
'div',
150162
turnitin_view::output_lti_form_launch('peermark_manager', 'Instructor', $tiiassignmentid),
151-
array(
163+
[
152164
'class' => 'launch_form',
153-
'style' => 'display:none;'
154-
)
165+
'style' => 'display:none;',
166+
]
155167
);
156168

157169
echo html_writer::script("<!--
@@ -161,18 +173,8 @@
161173
break;
162174

163175
case "rubricview":
164-
if ($cm->modname == "forum") {
165-
$isstudent = has_capability('mod/forum:replypost', $context);
166-
}
167-
elseif ($cm->modname == "quiz") {
168-
$isstudent = !has_capability('mod/quiz:viewoverrides', $context);
169-
}
170-
else {
171-
$isstudent = has_capability('mod/'.$cm->modname.':submit', $context);
172-
}
173-
174-
if ($isstudent) {
175-
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', array('cm' => $cm->id, 'name' => 'turnitin_assignid'));
176+
if (is_enrolled($context)) {
177+
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', [ 'cm' => $cm->id, 'name' => 'turnitin_assignid' ]);
176178

177179
$user = new turnitin_user($USER->id, "Learner");
178180
$coursedata = turnitin_assignment::get_course_data($cm->course);
@@ -181,10 +183,10 @@
181183
echo html_writer::tag(
182184
'div',
183185
turnitin_view::output_lti_form_launch('rubric_view', 'Learner', $tiiassignment->value),
184-
array(
186+
[
185187
'class' => 'launch_form',
186-
'style' => 'display:none;'
187-
)
188+
'style' => 'display:none;',
189+
]
188190
);
189191

190192
echo html_writer::script("<!--
@@ -199,7 +201,7 @@
199201
$isstudent = ($cm->modname == "forum") ? has_capability($replypost, $context) : has_capability($submit, $context);
200202

201203
if ($userrole == 'Instructor' || $isstudent) {
202-
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', array('cm' => $cm->id, 'name' => 'turnitin_assignid'));
204+
$tiiassignment = $DB->get_record('plagiarism_turnitin_config', ['cm' => $cm->id, 'name' => 'turnitin_assignid']);
203205

204206
$user = new turnitin_user($USER->id, $userrole);
205207
$coursedata = turnitin_assignment::get_course_data($cm->course);
@@ -208,10 +210,10 @@
208210
echo html_writer::tag(
209211
'div',
210212
turnitin_view::output_lti_form_launch('peermark_reviews', $userrole, $tiiassignment->value),
211-
array(
213+
[
212214
'class' => 'launch_form',
213-
'style' => 'display:none;'
214-
)
215+
'style' => 'display:none;',
216+
]
215217
);
216218

217219
echo html_writer::script("<!--
@@ -222,13 +224,13 @@
222224

223225
case "actionuseragreement":
224226
if (!confirm_sesskey()) {
225-
throw new moodle_exception('invalidsesskey', 'error');
227+
throw new \moodle_exception('invalidsesskey', 'error');
226228
}
227229

228230
$message = optional_param('message', '', PARAM_ALPHAEXT);
229231

230232
// Get the id from the plagiarism_turnitin_users table so we can update.
231-
$turnitinuser = $DB->get_record('plagiarism_turnitin_users', array('userid' => $USER->id));
233+
$turnitinuser = $DB->get_record('plagiarism_turnitin_users', ['userid' => $USER->id]);
232234

233235
// Build user object for update.
234236
$eulauser = new stdClass();
@@ -250,31 +252,31 @@
250252

251253
case "resubmit_event":
252254
if (!confirm_sesskey()) {
253-
throw new moodle_exception('invalidsesskey', 'error');
255+
throw new \moodle_exception('invalidsesskey', 'error');
254256
}
255257

256-
$forumdata = optional_param('forumdata', '', PARAM_ALPHAEXT);
257-
$forumpost = optional_param('forumpost', '', PARAM_ALPHAEXT);
258+
$forumdata = optional_param('forumdata', '', PARAM_ALPHANUMEXT);
259+
$forumpost = optional_param('forumpost', '', PARAM_BASE64);
258260
$submissionid = required_param('submissionid', PARAM_INT);
259261

260262
$tiisubmission = new turnitin_submission($submissionid,
261-
array('forumdata' => $forumdata, 'forumpost' => $forumpost));
263+
['forumdata' => $forumdata, 'forumpost' => $forumpost]);
262264

263265
if ($tiisubmission->recreate_submission_event()) {
264-
$return = array('success' => true);
266+
$return = ['success' => true];
265267
}
266268
break;
267269

268270
case "resubmit_events":
269271

270272
if (!confirm_sesskey()) {
271-
throw new moodle_exception('invalidsesskey', 'error');
273+
throw new \moodle_exception('invalidsesskey', 'error');
272274
}
273275

274-
$submissionids = optional_param_array('submission_ids', array(), PARAM_INT);
276+
$submissionids = optional_param_array('submission_ids', [], PARAM_INT);
275277

276-
$submissionids = optional_param_array('submission_ids', array(), PARAM_INT);
277-
$errors = array();
278+
$submissionids = optional_param_array('submission_ids', [], PARAM_INT);
279+
$errors = [];
278280
$return['success'] = true;
279281
foreach ($submissionids as $submissionid) {
280282
$tiisubmission = new turnitin_submission($submissionid);
@@ -288,9 +290,9 @@
288290

289291
case "test_connection":
290292
if (!confirm_sesskey()) {
291-
throw new moodle_exception('invalidsesskey', 'error');
293+
throw new \moodle_exception('invalidsesskey', 'error');
292294
}
293-
$data = array("connection_status" => "fail", "msg" => get_string('connecttestcommerror', 'plagiarism_turnitin'));
295+
$data = ["connection_status" => "fail", "msg" => get_string('connecttestcommerror', 'plagiarism_turnitin')];
294296

295297
$PAGE->set_context(context_system::instance());
296298
if (is_siteadmin()) {
@@ -306,7 +308,7 @@
306308
if (empty($config)) {
307309
$config = plagiarism_plugin_turnitin::plagiarism_turnitin_admin_config();
308310
}
309-
if (!isset($config->plagiarism_turnitin_enablediagnostic)) {
311+
if (empty($config->plagiarism_turnitin_enablediagnostic)) {
310312
$turnitincomms->set_diagnostic(0);
311313
} else {
312314
if ($config->plagiarism_turnitin_enablediagnostic != 2) {
@@ -336,7 +338,7 @@
336338
header('Content-type: application/json; charset=utf-8');
337339
echo json_encode(turnitin_user::plagiarism_turnitin_getusers());
338340
} else {
339-
throw new moodle_exception('accessdenied', 'admin');
341+
throw new \moodle_exception('accessdenied', 'admin');
340342
}
341343
break;
342344

@@ -353,7 +355,7 @@
353355
$instructor->set_user_values_from_tii();
354356
$instructorrubrics = $instructor->get_instructor_rubrics();
355357

356-
$options = array(0 => get_string('norubric', 'plagiarism_turnitin')) + $instructorrubrics;
358+
$options = [0 => get_string('norubric', 'plagiarism_turnitin')] + $instructorrubrics;
357359

358360
// Get rubrics that are shared on the Turnitin account.
359361
$turnitinclass = new turnitin_class($courseid);
@@ -385,7 +387,7 @@
385387
}
386388
}
387389
} else {
388-
$options = array();
390+
$options = [];
389391
}
390392

391393
echo json_encode($options);

amd/build/new_rubric.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)