mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
MDL-52506 mod_assign: Fix return links for atto auto save
This commit is contained in:
parent
1e72daa899
commit
e6858c084a
2 changed files with 44 additions and 0 deletions
|
@ -3899,6 +3899,12 @@ class assign {
|
|||
// Need submit permission to submit an assignment.
|
||||
$userid = optional_param('userid', $USER->id, PARAM_INT);
|
||||
$user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
|
||||
|
||||
// This variation on the url will link direct to this student.
|
||||
// The benefit is the url will be the same every time for this student, so Atto autosave drafts can match up.
|
||||
$returnparams = array('userid' => $userid, 'rownum' => 0, 'useridlistid' => 0);
|
||||
$this->register_return_link('editsubmission', $returnparams);
|
||||
|
||||
if ($userid == $USER->id) {
|
||||
if (!$this->can_edit_submission($userid, $USER->id)) {
|
||||
print_error('nopermission');
|
||||
|
|
|
@ -49,3 +49,41 @@ Feature: In an assignment, students can add and edit text online
|
|||
Then I should see "Submitted for grading"
|
||||
And I should see "I'm the student second submission"
|
||||
And I should not see "I'm the student first submission"
|
||||
|
||||
@javascript
|
||||
Scenario: Auto-draft save online text submission
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following config values are set as admin:
|
||||
| autosavefrequency | 1 | editor_atto |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment name |
|
||||
| Description | Submit your online text |
|
||||
| assignsubmission_onlinetext_enabled | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test assignment name"
|
||||
When I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | text submission |
|
||||
# Wait for the draft auto save.
|
||||
And I wait "2" seconds
|
||||
And I follow "Course 1"
|
||||
And I follow "Test assignment name"
|
||||
When I press "Add submission"
|
||||
# Confirm draft was restored.
|
||||
Then I should see "text submission" in the "#id_onlinetext_editoreditable" "css_element"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue