Skip to content

Commit 2609e4a

Browse files
authored
Merge pull request #711 from ixiongtii/fix/anonymous_field_required
Fix reveal anonymous button
2 parents ed897d1 + c9af0ce commit 2609e4a

4 files changed

+22
-18
lines changed

ajax.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,12 @@
569569
$turnitintooltwosubmission = new turnitintooltwo_submission($submissionid, "turnitin");
570570
if ($turnitintooltwosubmission->unanonymise_submission($reason)) {
571571
if ($turnitintooltwosubmission->userid == 0) {
572-
573572
$tmpuser = new stdClass();
574-
$tmpuser->firstname = $turnitintooltwosubmission->nmfirstname;
575-
$tmpuser->lastname = $turnitintooltwosubmission->nmlastname;
576-
573+
$tmpuser->firstname = $turnitintooltwosubmission->firstname;
574+
$tmpuser->lastname = $turnitintooltwosubmission->lastname;
577575
$return["name"] = fullname($tmpuser);
578576
} else {
579-
$user = new turnitintooltwo_user($turnitintooltwosubmission->userid);
580-
$return["name"] = fullname($user);
577+
$return["name"] = $turnitintooltwosubmission->fullname;
581578
}
582579
$return["status"] = "success";
583580
$return["userid"] = $turnitintooltwosubmission->userid;

jquery/turnitintooltwo-2023032701.js

+17-11
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,14 @@
10941094
}
10951095
$("#submission_id").html(submission_id);
10961096
$('#cboxLoadedContent .mod_turnitintooltwo_unanonymise_form').show();
1097-
$('#id_reveal').unbind("click");
1098-
$('#id_reveal').click(function () {
1097+
$('#id_reveal').prop('disabled', true);
1098+
1099+
$('#id_anonymous_reveal_reason').on('input', function() {
1100+
var reason_text = $(this).val();
1101+
$('#id_reveal').prop('disabled', reason_text === ''); // Enable/disable button based on textarea content
1102+
});
1103+
1104+
$('#id_reveal').on('click', function() {
10991105
$.ajax({
11001106
"dataType": 'json',
11011107
"type": "POST",
@@ -1158,10 +1164,10 @@
11581164
// ZIP containing all files in original format.
11591165
function initialiseZipDownloads(part_id) {
11601166
// Unbind the event first to stop it being binded multiple times.
1161-
$('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').unbind("click");
1167+
$('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').off("click");
11621168

11631169
// Open a spreadsheet or a zip file containing all the relevant data.
1164-
$('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').click(function () {
1170+
$('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').on(function () {
11651171
var idStr = $(this).attr("id").split("_");
11661172
downloadZipFile(idStr[0] + "_" + idStr[1], idStr[2]);
11671173
});
@@ -1233,9 +1239,9 @@
12331239

12341240
function initialiseHiddenZipDownloads(part_id) {
12351241
// Unbind the event first to stop it being binded multiple times.
1236-
$('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').unbind("click");
1242+
$('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').off("click");
12371243
// Seperate binder for hidden zip file link.
1238-
$('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').click(function () {
1244+
$('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').on(function () {
12391245
var idStr = $(this).attr("id").split("_");
12401246
downloadZipFile(idStr[0] + "_" + idStr[1], part_id);
12411247
return false;
@@ -1249,9 +1255,9 @@
12491255
}
12501256

12511257
// Unbind the event first to stop it being binded multiple times.
1252-
$(identifier).unbind("click");
1258+
$(identifier).off("click");
12531259

1254-
$(identifier).click(function () {
1260+
$(identifier).on(function () {
12551261
$(this).hide();
12561262
$(this).siblings('.fa-spinner').css("display", "inline-block").addClass('fa-lg');
12571263
var idStr = $(this).parent().attr("id").split("_");
@@ -1267,9 +1273,9 @@
12671273
}
12681274

12691275
// Unbind the event first to stop it being binded multiple times.
1270-
$(identifier).unbind("click");
1276+
$(identifier).off("click");
12711277

1272-
$(identifier).click(function () {
1278+
$(identifier).on(function () {
12731279
var idStr = $(this).attr("id").split("_");
12741280
// Don't open OR DV if score is pending.
12751281
if (!$(this).children('.score_colour').hasClass('score_colour_')) {
@@ -1419,7 +1425,7 @@
14191425
$('#tabs-' + part_id + ' .mod_turnitintooltwo_zip_downloads button').removeAttr("title");
14201426
initialiseHiddenZipDownloads(part_id);
14211427
} else {
1422-
$('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').unbind('click');
1428+
$('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').off('click');
14231429
$('#tabs-' + part_id + ' .mod_turnitintooltwo_zip_downloads button').prop("disabled", true);
14241430
$('#tabs-' + part_id + ' .mod_turnitintooltwo_zip_downloads button').prop("title", M.str.turnitintooltwo.download_button_warning);
14251431
}

jquery/turnitintooltwo-2023032701.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery/turnitintooltwo-2023032701.min.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)