Skip to content

Commit

Permalink
Merge pull request #602 from turnitin/develop
Browse files Browse the repository at this point in the history
Release 2020111801
  • Loading branch information
CharlotteSpinks authored Nov 18, 2020
2 parents bf0299b + b6dd395 commit ccf756e
Show file tree
Hide file tree
Showing 55 changed files with 4,943 additions and 2,517 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
### Date: 2020-Nov-18
### Release: v2020111801

---

#### :wrench: Fixes and enhancements

#### Rubrics sync back to the assignment
A bug could cause a rubric that is attached to a multi-part assignment from within the Turnitin viewer to become detached after opening it again. Rubrics will now correctly sync to the assignment and remain attached.

#### Tooltip shows correct maximum file size limit
Turnitin updated our maximum file size limit quite some time ago, but the file size provided in the tooltip had slipped through the net! It will now accurately reflect the maximum file size.

---

### Date: 2020-Jul-22
### Release: v2020072201

Expand Down
6 changes: 5 additions & 1 deletion ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@
$updatefromtii = ($refreshrequested || $turnitintooltwoassignment->turnitintooltwo->autoupdates == 1) ? 1 : 0;
$istutor = (has_capability('mod/turnitintooltwo:grade', context_module::instance($cm->id))) ? true : false;

if ($refreshrequested && $start == 0) {
$turnitintooltwoassignment->update_assignment_from_tii();
}

if ($updatefromtii && $start == 0) {
$turnitintooltwoassignment->get_submission_ids_from_tii($parts[$partid]);
$total = count($_SESSION["TiiSubmissions"][$partid]);
Expand Down Expand Up @@ -603,7 +607,7 @@

$modules = $DB->get_record('modules', array('name' => 'turnitintooltwo'));

$return = turnitintooltwo_get_courses_from_tii($tiiintegrationids, $title, $courseintegration, $enddate, $source);
$return = turnitintooltwo_get_courses_from_tii(turnitintooltwo_get_integration_ids(), $title, $courseintegration, $enddate, $source);
echo json_encode($return);
break;

Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_turnitintooltwo_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function define_structure() {
'studentreports', 'dateformat', 'usegrademark', 'gradedisplay', 'autoupdates', 'commentedittime', 'commentmaxsize',
'autosubmission', 'shownonsubmission', 'excludebiblio', 'excludequoted', 'excludevalue', 'excludetype', 'erater',
'erater_handbook', 'erater_dictionary', 'erater_spelling', 'erater_grammar', 'erater_usage', 'erater_mechanics',
'erater_style', 'transmatch', 'allownonor'
'erater_style', 'transmatch', 'rubric', 'allownonor'
));

$parts = new backup_nested_element('parts');
Expand Down
7 changes: 1 addition & 6 deletions classes/digitalreceipt/instructor_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ public function send_instructor_message($instructors, $message, $courseid) {

$subject = get_string('receipt_instructor_copy_subject', 'turnitintooltwo');

// Pre 2.9 does not have \core\message\message()
if ($CFG->branch >= 29) {
$eventdata = new \core\message\message();
} else {
$eventdata = new stdClass();
}
$eventdata = new \core\message\message();

$eventdata->component = 'mod_turnitintooltwo';
$eventdata->name = 'notify_instructor_of_submission'; // This is the message name from messages.php.
Expand Down
7 changes: 1 addition & 6 deletions classes/digitalreceipt/receipt_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ public function send_message($userid, $message, $courseid) {

$subject = get_string('digital_receipt_subject', 'turnitintooltwo');

// Pre 2.9 does not have \core\message\message()
if ($CFG->branch >= 29) {
$eventdata = new \core\message\message();
} else {
$eventdata = new stdClass();
}
$eventdata = new \core\message\message();

$eventdata->component = 'mod_turnitintooltwo';
$eventdata->name = 'submission'; // This is the message name from messages.php.
Expand Down
2 changes: 1 addition & 1 deletion classes/v1migration/v1migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ private function log_success_migration_event($turnitintooltwoid, $course_id, $v1
}

/**
* Get assignments for migrated data table. Called from ajax.php via turnitintooltwo_extra-2018102601.min.js.
* Get assignments for migrated data table. Called from ajax.php via turnitintooltwo_extra-2020111101.min.js.
*
* @global type $DB
* @return array return array of assignments to display
Expand Down
7 changes: 3 additions & 4 deletions classes/view/members.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,17 @@ public function __construct($course=null, $coursemodule=null, $turnitintooltwovi
* @return string Members HTML for a role
*/
public function build_members_view($displayrole = "students") {
$output = "";
$istutor = $this->is_tutor();

if (!$istutor) {
turnitintooltwo_print_error('permissiondeniederror', 'turnitintooltwo');
exit();
}

$wrapperclass = $displayrole == "tutors" ? "members members-instructors" : "members members-students";
$wrapperclass = $displayrole == "tutors" ? "members-instructors" : "members-students";

// wrapper element for strong CSS selectors
$output .= html_writer::start_tag("div", array("class" => $wrapperclass));
// Wrapper element for strong CSS selectors.
$output = html_writer::start_tag("div", array("class" => "mod_turnitintooltwo_members " . $wrapperclass));

$output .= $this->build_intro_message($displayrole);
$output .= $this->build_members_table($displayrole);
Expand Down
23 changes: 9 additions & 14 deletions css/student_noscript.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
.mod_turnitintooltwo .submissionsDataTable {
.mod_turnitintooltwo_submissions_data_table {
margin-top:16px;
}

.mod_turnitintooltwo .submissionsDataTable th {
.mod_turnitintooltwo_submissions_data_table th {
border:1px solid #999999;
}

.mod_turnitintooltwo .submissionsDataTable td {
.mod_turnitintooltwo_submissions_data_table td {
border:1px solid #999999;
}

.mod_turnitintooltwo #tabs ul#part_tabs_menu, .mod_turnitintooltwo a.toggle_summary, .mod_turnitintooltwo a.toggle_peermarks,
.mod_turnitintooltwo a.toggle_peermark_instructions, .mod_turnitintooltwo .turnitin_ula, .mod_turnitintooltwo a.messages_inbox,
.mod_turnitintooltwo .noscript_hide, .mod_turnitintooltwo .download_original_open, .mod_turnitintooltwo th.raw_data,
.mod_turnitintooltwo td.raw_data, .mod_turnitintooltwo .submissionsDataTable th.cpart,
.mod_turnitintooltwo .submissionsDataTable th.ccheckbox, .mod_turnitintooltwo .submissionsDataTable td.c0,
.mod_turnitintooltwo .submissionsDataTable td.c1 {
.mod_turnitintooltwo #tabs ul#part_tabs_menu, .mod_turnitintooltwo a.toggle_summary, .mod_turnitintooltwo a.toggle_peermarks,
.mod_turnitintooltwo a.toggle_peermark_instructions, .mod_turnitintooltwo .mod_turnitintooltwo_eula, .mod_turnitintooltwo_messages_inbox,
.mod_turnitintooltwo .noscript_hide, .mod_turnitintooltwo .download_original_open, .mod_turnitintooltwo th.raw_data,
.mod_turnitintooltwo td.raw_data, .mod_turnitintooltwo_submissions_data_table th.cpart,
.mod_turnitintooltwo_submissions_data_table th.ccheckbox, .mod_turnitintooltwo_submissions_data_table td.c0,
.mod_turnitintooltwo_submissions_data_table td.c1 {
display:none;
}

.mod_turnitintooltwo .peermark_instructions {
display: block;
}

.mod_turnitintooltwo .turnitin_ula_noscript {
line-height: 28px;
margin-top:16px;
}

.mod_turnitintooltwo .part_table {
background:#EFEFEF;
border:1px solid #DEDEDE;
Expand Down
6 changes: 3 additions & 3 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<FIELD NAME="transmatch" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="erater_style" NEXT="rubric"/>
<FIELD NAME="rubric" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="transmatch" NEXT="allownonor"/>
<FIELD NAME="allownonor" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="rubric" NEXT="needs_updating"/>
<FIELD NAME="needs_updating" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="allownonor" NEXT="syncreport"/>
<FIELD NAME="needs_updating" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="allownonor" NEXT="syncreport"/>
<FIELD NAME="syncreport" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="needs_updating" NEXT="anongradebook"/>
<FIELD NAME="anongradebook" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="syncreport" NEXT="legacy"/>
<FIELD NAME="legacy" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="anongradebook"/>
Expand All @@ -79,8 +79,8 @@
<FIELD NAME="maxmarks" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" PREVIOUS="dtpost" NEXT="deleted"/>
<FIELD NAME="deleted" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" PREVIOUS="maxmarks" NEXT="migrated"/>
<FIELD NAME="migrated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="deleted" NEXT="unanon"/>
<FIELD NAME="unanon" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="migrated" NEXT="submitted"/>
<FIELD NAME="submitted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="unanon" NEXT="gradesupdated"/>
<FIELD NAME="unanon" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="migrated" NEXT="submitted"/>
<FIELD NAME="submitted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="unanon" NEXT="gradesupdated"/>
<FIELD NAME="gradesupdated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" PREVIOUS="submitted"/>
</FIELDS>
<KEYS>
Expand Down
53 changes: 52 additions & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field2)) {
$dbman->add_field($table, $field2);
}
upgrade_mod_savepoint(true, 2014012401, 'turnitintooltwo');
}

if ($oldversion < 2014012404) {
Expand All @@ -54,6 +55,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2014012404, 'turnitintooltwo');
}

if ($oldversion < 2014012405) {
Expand Down Expand Up @@ -89,6 +91,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
upgrade_mod_savepoint(true, 2014012405, 'turnitintooltwo');
}

if ($oldversion < 2014012412) {
Expand All @@ -97,6 +100,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2014012412, 'turnitintooltwo');
}

if ($oldversion < 2015040101) {
Expand All @@ -115,6 +119,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
upgrade_mod_savepoint(true, 2015040101, 'turnitintooltwo');
}

if ($oldversion < 2015040104) {
Expand All @@ -128,6 +133,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
} else {
$dbman->change_field_unsigned($table, $field);
}
upgrade_mod_savepoint(true, 2015040104, 'turnitintooltwo');
}

if ($oldversion < 2015040107) {
Expand All @@ -138,18 +144,21 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2015040107, 'turnitintooltwo');
}

if ($oldversion < 2015040109) {
// Update URL for UK accounts.
$apiurl = get_config('turnitintooltwo', 'apiurl');
$newurl = str_replace('submit.ac.uk', 'api.turnitinuk.com', strtolower($apiurl));
set_config('apiurl', $newurl, 'turnitintooltwo');
upgrade_mod_savepoint(true, 2015040109, 'turnitintooltwo');
}

if ($oldversion < 2015040111) {
// Update gradedisplay value to be consistent with V1 plugin.
$DB->set_field("turnitintooltwo", "gradedisplay", 2);
upgrade_mod_savepoint(true, 2015040111, 'turnitintooltwo');
}

if ($oldversion < 2016011101) {
Expand All @@ -165,6 +174,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2016011101, 'turnitintooltwo');
}

if ($oldversion < 2016011107) {
Expand All @@ -175,6 +185,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2016011107, 'turnitintooltwo');
}

if ($oldversion < 2017011301) {
Expand Down Expand Up @@ -236,6 +247,8 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
// Add hash as key after update.
$key = new xmldb_key('submission_hash', XMLDB_KEY_UNIQUE, array('submission_hash'));
$dbman->add_key($table, $key);

upgrade_mod_savepoint(true, 2017011301, 'turnitintooltwo');
}

if ($oldversion < 2017103001) {
Expand All @@ -251,7 +264,45 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2017103001, 'turnitintooltwo');
}

// This block is to solve a number of inconsistencies between the install and upgrade scripts
if ($oldversion < 2020081401) {
$table = new xmldb_table('turnitintooltwo');
// Ensure default for institution check is 0.
$field = new xmldb_field('institution_check', XMLDB_TYPE_INTEGER, '1', false, false, null, 0, 'journalcheck');
if ($dbman->field_exists($table, $field)) {
$dbman->change_field_default($table, $field);
}

// Ensure needs_updating allows null and int length is 1.
$field = new xmldb_field('needs_updating', XMLDB_TYPE_INTEGER, '1', null, false, null, 0, 'allownonor');
if ($dbman->field_exists($table, $field)) {
$dbman->change_field_notnull($table, $field);
$dbman->change_field_precision($table, $field);
}

$table = new xmldb_table('turnitintooltwo_parts');
// Ensure unanon length is 1.
$field = new xmldb_field('unanon', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0, 'migrated');
if ($dbman->field_exists($table, $field)) {
$dbman->change_field_precision($table, $field);
}
// Ensure submitted length is 1.
$field = new xmldb_field('submitted', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0, 'unanon');
if ($dbman->field_exists($table, $field)) {
$dbman->change_field_precision($table, $field);
}

$table = new xmldb_table('turnitintooltwo_users');
// Ensure user_agreement_accepted allows null.
$field = new xmldb_field('user_agreement_accepted', XMLDB_TYPE_INTEGER, '1', false, false, null, 0, 'instructor_rubrics');
if ($dbman->field_exists($table, $field)) {
$dbman->change_field_notnull($table, $field);
}
upgrade_mod_savepoint(true, 2020081401, 'turnitintooltwo');
}

return true;
}
}
14 changes: 4 additions & 10 deletions extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@

// Get course and module data that we've linked to here from and set context accordingly.
if ($id != 0) {
// Pre 2.8 does not have the function get_course_and_cm_from_cmid.
if ($CFG->branch >= 28) {
list($course, $cm) = get_course_and_cm_from_cmid($id, 'turnitintooltwo');
} else {
$cm = get_coursemodule_from_id('turnitintooltwo', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
}
list($course, $cm) = get_course_and_cm_from_cmid($id, 'turnitintooltwo');

if (!$cm) {
turnitintooltwo_print_error('coursemodidincorrect', 'turnitintooltwo');
Expand Down Expand Up @@ -91,7 +85,7 @@
'name' => 'search_course_title'));

$coursesearchform .= html_writer::label(get_string('integration', 'turnitintooltwo').': ', 'search_course_integration');
$coursesearchform .= html_writer::select($tiiintegrationids, 'search_course_integration', '', array('' => 'choosedots'),
$coursesearchform .= html_writer::select(turnitintooltwo_get_integration_ids(), 'search_course_integration', '', array('' => 'choosedots'),
array('id' => 'search_course_integration'));

$coursesearchform .= html_writer::label(get_string('ced', 'turnitintooltwo').': ', 'search_course_end_date');
Expand Down Expand Up @@ -127,12 +121,12 @@
$output .= $OUTPUT->box($categoryselectlabel." ".$categoryselect.$createassign.$createbutton, 'create_checkboxes navbar');

$table = new html_table();
$table->id = "courseBrowserTable";
$table->id = "mod_turnitintooltwo_course_browser_table";
$rows = array();

// Make up json array for drop down in table.
$integrationidsjson = array();
foreach ($tiiintegrationids as $k => $v) {
foreach (turnitintooltwo_get_integration_ids() as $k => $v) {
$integrationidsjson[] = array('value' => $k, 'label' => $v);
}
$output .= html_writer::script('var integration_ids = '.json_encode($integrationidsjson));
Expand Down
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var gulp = require('gulp');
var sass = require('gulp-sass');

var minifyCss = require('gulp-minify-css');
var minifyCss = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');
var notify = require('gulp-notify');
var uglify = require('gulp-uglify');
Expand Down Expand Up @@ -30,8 +30,8 @@ gulp.task('jsmin', function() {
});

gulp.task('watch', function() {
gulp.watch('./sass/**/*.scss', ['sass']);
gulp.watch('./jquery/turnitintooltwo*.js', ['jsmin']);
gulp.watch('./sass/**/*.scss', gulp.series('sass'));
gulp.watch('./jquery/turnitintooltwo*.js', gulp.series('jsmin'));
});

gulp.task('default', ['sass', 'jsmin', 'watch']);
gulp.task('default', gulp.series(['sass', 'jsmin', 'watch']));
6 changes: 3 additions & 3 deletions jquery/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
$plugins = array(
'turnitintooltwo-dataTables' => array('files' => array('jquery.dataTables.js', 'jquery.dataTables.css')),
'turnitintooltwo-dataTables_plugins' => array('files' => array('jquery.dataTables.plugins.js')),
'turnitintooltwo-turnitintooltwo' => array('files' => array('turnitintooltwo-2018102601.min.js')),
'turnitintooltwo-turnitintooltwo_extra' => array('files' => array('turnitintooltwo_extra-2018102601.min.js')),
'turnitintooltwo-turnitintooltwo_settings' => array('files' => array('turnitintooltwo_settings-2018102601.min.js')),
'turnitintooltwo-turnitintooltwo' => array('files' => array('turnitintooltwo-2020111101.min.js')),
'turnitintooltwo-turnitintooltwo_extra' => array('files' => array('turnitintooltwo_extra-2020111101.min.js')),
'turnitintooltwo-turnitintooltwo_settings' => array('files' => array('turnitintooltwo_settings-2020111101.min.js')),
'turnitintooltwo-datatables_columnfilter' => array('files' => array('jquery.dataTables.columnFilter.js')),
'turnitintooltwo-cookie' => array('files' => array('jquery.cookie.js')),
'turnitintooltwo-colorbox' => array('files' => array('jquery.colorbox.js', 'colorbox.css')),
Expand Down
3 changes: 0 additions & 3 deletions jquery/turnitintooltwo-2018102601.min.js

This file was deleted.

Loading

0 comments on commit ccf756e

Please sign in to comment.