Skip to content

Commit 06523a9

Browse files
authored
Merge pull request #529 from turnitin/develop
Develop to master for release
2 parents 66429d2 + 6e51d4a commit 06523a9

Some content is hidden

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

50 files changed

+378
-253
lines changed

.travis.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cache:
99
php:
1010
- 5.5
1111
# - 5.6
12-
- 7.0
12+
- 7.1
1313

1414
env:
1515
global:
@@ -20,15 +20,17 @@ env:
2020
- DB=mysqli MOODLE_BRANCH=MOODLE_32_STABLE
2121
- DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE
2222
- DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE
23-
- DB=pgsql MOODLE_BRANCH=MOODLE_30_STABLE
24-
- DB=mysqli MOODLE_BRANCH=MOODLE_30_STABLE
2523

2624
matrix:
2725
exclude:
28-
- env: DB=pgsql MOODLE_BRANCH=MOODLE_32_STABLE
29-
php: 5.5
30-
- env: DB=mysqli MOODLE_BRANCH=MOODLE_32_STABLE
31-
php: 5.5
26+
- env: DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE
27+
php: 7.1
28+
- env: DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE
29+
php: 7.1
30+
- env: DB=pgsql MOODLE_BRANCH=MOODLE_32_STABLE
31+
php: 5.5
32+
- env: DB=mysqli MOODLE_BRANCH=MOODLE_32_STABLE
33+
php: 5.5
3234

3335
before_install:
3436
- phpenv config-rm xdebug.ini

CHANGELOG.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
### Date: 2019-May-01
2+
### Release: v2019050101
3+
4+
#### :wrench: Fixes and enhancements
5+
6+
#### Migration tool modal improvements
7+
8+
We've made sure that the modal displays when using our migration tool. If your migration is successful, then a green notification box will be displayed to confirm this.
9+
10+
#### Download student file button visibility
11+
We’ve been improving usability by clarifying available options to instructors. Previously, the download student files button was hidden until a student was selected. We’ve now made the button visible at all times, but it is only possible to invoke the button once a student has been selected.
12+
13+
#### Migration bugs resolved
14+
There were some bugs affecting the migration process. One was causing assignment parts that had been deleted in V1 to reappear after the migration to V2. The other was placing new parts of migrated assignments in the incorrect class within Turnitin. These issues have been resolved.
15+
16+
#### Student grades hidden until post date
17+
Now students will be unable to see grades in the Moodle grade book until the post date has passed. Big thanks to Neill Magill for the pull request with the fix to this issue!
18+
19+
#### Privacy settings updates
20+
We now carry over privacy settings from Moodle V1 to Moodle V2 when the user migrates.
21+
22+
---
23+
124
### Date: 2019-January-24
225
### Release: v2019012401
326

@@ -149,7 +172,7 @@ We've made the Moodle V2 repository settings much clearer, by providing easy-to-
149172

150173
Moodle has released two plugins with privacy features to assist with GDPR compliance. While we've successfully implemented [Moodle's new privacy features](https://docs.moodle.org/dev/Privacy_API), Moodle's update is only available to those using Moodle 3.3.5+, 3.4.2+, or 3.5. Therefore, if you're using an earlier version, you must upgrade to have access to these new features.
151174

152-
To inform you about the data we store in relation to our users, we now provide a detailed list via the Moodle Privacy and Policies page. Learn more about the data we're reporting on via our [Moodle Plugins and GDPR](https://guides.turnitin.com/03_Integrations/Turnitin_Partner_Integrations/Moodle/Moodle_Plugins_and_GDPR) page.
175+
To inform you about the data we store in relation to our users, we now provide a detailed list via the Moodle Privacy and Policies page. Learn more about the data we're reporting on via our [Moodle Plugins and GDPR](https://help.turnitin.com/feedback-studio/moodle/moodle-plugins-and-gdpr.htm) page.
153176

154177
#### Students can request to download their data
155178

@@ -159,7 +182,7 @@ Students have the ability to request an export of their data stored in Moodle. T
159182

160183
Students can also request their data to be removed from Moodle. This requested can be accepted or declined by their Moodle administrator. If accepted, the administrator will remove the student data from Moodle. However, administrators must contact [email protected] to request that student data be removed from Turnitin itself.
161184

162-
> If you're a Moodle administrator, and using version 3.3.5+, 3.4.2+, or 3.5, follow the steps on the [Moodle Plugins and GDPR](https://guides.turnitin.com/03_Integrations/Turnitin_Partner_Integrations/Moodle/Moodle_Plugins_and_GDPR) page to view the data we store in Moodle.
185+
> If you're a Moodle administrator, and using version 3.3.5+, 3.4.2+, or 3.5, follow the steps on the [Moodle Plugins and GDPR](https://help.turnitin.com/feedback-studio/moodle/moodle-plugins-and-gdpr.htm) page to view the data we store in Moodle.
163186
164187

165188
#### You can now send all papers to your institutional repository by default!

amd/build/migration_tool_launch.min.js

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

amd/build/migration_tool_migrate.min.js

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

amd/build/modal_migration_tool.min.js

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

amd/src/migration_tool_launch.js

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Javascript controller for launching the migration tool modal.
3+
*
4+
* @package turnitintooltwo
5+
* @copyright Turnitin
6+
* @author 2019 David Winn <[email protected]>
7+
* @module mod_turnitintooltwo/migration_tool_launch
8+
*/
9+
10+
define(['jquery',
11+
'core/templates',
12+
'core/modal_factory',
13+
'core/modal_events',
14+
'mod_turnitintooltwo/modal_migration_tool',
15+
'mod_turnitintooltwo/migration_tool_migrate'
16+
],
17+
function($, Templates, ModalFactory, ModalEvents, ModalMigrationTool, MigrationToolMigrate) {
18+
return {
19+
migration_tool_launch: function() {
20+
// Check whether this assignment has been migrated in this session and redirect if so.
21+
$.ajax({
22+
"dataType": 'json',
23+
"type": "POST",
24+
"url": M.cfg.wwwroot + "/mod/turnitintooltwo/ajax.php",
25+
"data": {
26+
action: "check_migrated",
27+
turnitintoolid: $("#migrate_type").data("turnitintoolid"),
28+
sesskey: M.cfg.sesskey
29+
},
30+
"success": function(data) {
31+
if (data.migrated === true) {
32+
window.location.href = M.cfg.wwwroot + "/mod/turnitintooltwo/view.php?id="+data.v2id;
33+
} else {
34+
ModalFactory.create({
35+
type: ModalMigrationTool.TYPE
36+
})
37+
.then(function(modal) {
38+
modal.show();
39+
40+
// During automatic migration, we don't need to ask to migrate.
41+
if ($('#migrate_type').data("migratetype") === 2) {
42+
$('.asktomigrate').hide();
43+
$('.migrating').show();
44+
45+
MigrationToolMigrate.migration_tool_migrate(
46+
$("#migrate_type").data("courseid"),
47+
$("#migrate_type").data("turnitintoolid")
48+
);
49+
}
50+
});
51+
}
52+
}
53+
});
54+
}
55+
};
56+
}
57+
);

amd/src/migration_tool_migrate.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Javascript module for handling the migration of an assignment.
3+
*
4+
* @package turnitintooltwo
5+
* @copyright Turnitin
6+
* @author 2019 David Winn <[email protected]>
7+
* @module mod_turnitintooltwo/migration_tool_migrate
8+
*/
9+
10+
define(['jquery'],
11+
function($) {
12+
return {
13+
migration_tool_migrate: function(courseid, turnitintoolid) {
14+
$.ajax({
15+
"dataType": 'json',
16+
"type": "POST",
17+
url: M.cfg.wwwroot + "/mod/turnitintooltwo/ajax.php",
18+
"data": {action: "begin_migration", courseid: courseid, turnitintoolid: turnitintoolid, sesskey: M.cfg.sesskey},
19+
success: function(data) {
20+
window.location.href = M.cfg.wwwroot + "/mod/turnitintooltwo/view.php?id="+data.id;
21+
},
22+
error: function(error) {
23+
var data = error.responseJSON;
24+
$('#turnitintool_style')
25+
.prepend('<div id="full-error" class="box generalbox noticebox">' +
26+
data.error + ' ' + data.message + '</div>');
27+
}
28+
});
29+
}
30+
};
31+
}
32+
);

amd/src/modal_migration_tool.js

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
* Javascript controller for the migration tool modal.
3+
*
4+
* @package turnitintooltwo
5+
* @copyright Turnitin
6+
* @author 2019 David Winn <[email protected]>
7+
* @module mod_turnitintooltwo/migration_tool
8+
*/
9+
10+
define([
11+
'jquery',
12+
'core/notification',
13+
'core/custom_interaction_events',
14+
'core/modal',
15+
'core/modal_registry',
16+
'core/modal_events',
17+
'core/config',
18+
'mod_turnitintooltwo/migration_tool_migrate'
19+
],
20+
function($, Notification, CustomEvents, Modal, ModalRegistry, ModalEvents, Config, MigrationToolMigrate) {
21+
22+
var registered = false;
23+
var SELECTORS = {
24+
MIGRATE_BUTTON: '[data-action="migrate-assignment"]',
25+
CANCEL_BUTTON: '[data-action="cancel"]'
26+
};
27+
28+
/**
29+
* Constructor for the Modal.
30+
*
31+
* @param {object} root The root jQuery element for the modal
32+
*/
33+
var ModalMigrationTool = function(root) {
34+
Modal.call(this, root);
35+
};
36+
37+
ModalMigrationTool.TYPE = 'mod_turnitintooltwo-migration_tool';
38+
ModalMigrationTool.prototype = Object.create(Modal.prototype);
39+
ModalMigrationTool.prototype.constructor = ModalMigrationTool;
40+
41+
/**
42+
* Set up all of the event handling for the modal.
43+
*
44+
* @method registerEventListeners
45+
*/
46+
ModalMigrationTool.prototype.registerEventListeners = function() {
47+
// Apply parent event listeners.
48+
Modal.prototype.registerEventListeners.call(this);
49+
50+
// Fired during a manual migration when clicking to migrate the assignment. Initiate the migration process.
51+
this.getModal().on(CustomEvents.events.activate, SELECTORS.MIGRATE_BUTTON, function() {
52+
$('.asktomigrate').hide();
53+
$('.migrating').show();
54+
55+
MigrationToolMigrate.migration_tool_migrate(
56+
$("#migrate_type").data("courseid"),
57+
$("#migrate_type").data("turnitintoolid")
58+
);
59+
}.bind(this));
60+
61+
// On cancel, then hide the modal.
62+
this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, function(e, data) {
63+
64+
var cancelEvent = $.Event(ModalEvents.cancel);
65+
this.getRoot().trigger(cancelEvent, this);
66+
67+
if (!cancelEvent.isDefaultPrevented()) {
68+
this.hide();
69+
data.originalEvent.preventDefault();
70+
}
71+
}.bind(this));
72+
};
73+
74+
// Automatically register with the modal registry the first time this module is imported so that
75+
// you can create modals of this type using the modal factory.
76+
if (!registered) {
77+
ModalRegistry.register(ModalMigrationTool.TYPE, ModalMigrationTool, 'mod_turnitintooltwo/modal_migration_tool');
78+
registered = true;
79+
}
80+
81+
return ModalMigrationTool;
82+
}
83+
);

classes/privacy/provider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class provider implements
4040
\core_privacy\local\request\plugin\provider {
4141

4242
// This is the trait to be included to actually benefit from the polyfill.
43-
use \core_privacy\local\legacy_polyfill;
43+
use \core_privacy\local\legacy_polyfill;
4444

4545
/**
4646
* Return the fields which contain personal data.
@@ -93,6 +93,7 @@ public static function _get_metadata(collection $collection) {
9393
'lastname' => 'privacy:metadata:turnitintooltwo_client:lastname',
9494
'submission_title' => 'privacy:metadata:turnitintooltwo_client:submission_title',
9595
'submission_filename' => 'privacy:metadata:turnitintooltwo_client:submission_filename',
96+
'submission_content' => 'privacy:metadata:turnitintooltwo_client:submission_content',
9697
], 'privacy:metadata:turnitintooltwo_client');
9798

9899
return $collection;

classes/v1migration/v1migration.php

+3-32
Original file line numberDiff line numberDiff line change
@@ -102,46 +102,17 @@ public static function output_progress_bar() {
102102
}
103103

104104
/**
105-
* Return the true if the user proceeds with the migration.
105+
* Since April 2019 the parameters taken in are not used, however we leave them in to avoid forcing a V1 release/update.
106106
*
107107
* @param int $courseid - The course ID.
108108
* @param int $turnitintooltwoid - The turnitintooltwoid.
109-
* @return string $output The HTML for the modal.
110109
*/
111110
public function migrate_modal($courseid, $turnitintoolid) {
112111
global $PAGE;
113-
$cssurl = new moodle_url('/mod/turnitintooltwo/jquery/colorbox.css');
114-
$PAGE->requires->css($cssurl);
115112
$cssurl = new moodle_url('/mod/turnitintooltwo/css/font-awesome.min.css');
116113
$PAGE->requires->css($cssurl);
117-
$PAGE->requires->jquery_plugin('turnitintooltwo-colorbox', 'mod_turnitintooltwo');
118-
$PAGE->requires->jquery_plugin('turnitintooltwo-turnitintooltwo', 'mod_turnitintooltwo');
119-
$PAGE->requires->jquery_plugin('turnitintooltwo-migration_tool', 'mod_turnitintooltwo');
120-
121-
$PAGE->requires->string_for_js('closebutton', 'turnitintooltwo');
122-
123-
$migratelink = html_writer::tag('button', get_string('migrateassignment', 'turnitintooltwo'),
124-
array('class' => 'migrate_link btn-primary', 'id' => 'migrate_link',
125-
'data-courseid' => $courseid, 'data-turnitintoolid' => $turnitintoolid));
126-
$dontmigratelink = html_writer::tag('button', get_string('dontmigrateassignment', 'turnitintooltwo'),
127-
array('class' => 'dontmigrate_link btn-default', 'id' => 'dontmigrate_link'));
128-
129-
$spinner = html_writer::tag('i', '', array('class' => 'fa fa-spinner fa-spin fa-2x'));
130-
$spinner = html_writer::tag('div', $spinner, array('class' => 'migration-spinner'));
131114

132-
$migrating = html_writer::tag('div', html_writer::tag('p', get_string('migrating', 'turnitintooltwo'))
133-
. $spinner
134-
. html_writer::tag('p', get_string('migrationredirect', 'turnitintooltwo')),
135-
array('id' => 'migrating', 'class' => 'hide'));
136-
137-
$asktomigrate = html_writer::tag('div', html_writer::tag('p', get_string('migrationtooltitle', 'turnitintooltwo'), array('class' => 'migrationtitle'))
138-
. html_writer::tag('p', get_string('migrationtoolinfo', 'turnitintooltwo'), array('class' => 'migrationtoolinfo'))
139-
. $migratelink . $dontmigratelink
140-
, array('id' => 'asktomigrate', 'class' => 'hide'));
141-
142-
$output = html_writer::tag('div', $asktomigrate . $migrating, array('id' => 'migration_alert', 'class' => 'hide'));
143-
144-
return $output;
115+
$PAGE->requires->js_call_amd('mod_turnitintooltwo/migration_tool_launch', 'migration_tool_launch');
145116
}
146117

147118
/**
@@ -171,7 +142,7 @@ public function migrate() {
171142
$this->setup_v2_module($this->courseid, $turnitintooltwoid);
172143

173144
// Get the assignment parts.
174-
$v1parts = $DB->get_records('turnitintool_parts', array('turnitintoolid' => $this->v1assignment->id));
145+
$v1parts = $DB->get_records('turnitintool_parts', array('turnitintoolid' => $this->v1assignment->id, 'deleted' => 0));
175146

176147
// Migrate the parts.
177148
foreach ($v1parts as $v1part) {

0 commit comments

Comments
 (0)