Uploading a file and clicking 'Save changes' brings you back to that same page

The file has been uploaded

7. Create an assignment 'Upload a single file' activity
8. Login as an enrolled student
9. Upload a file to that assignment
10. Make sure that

The cancel button is present and brings you back to the assignment page

The file is uploaded successfully

NB: The cancel button appears when a referer has been passed, so that we can redirect the user to the correct page (upon cancel or submit). When no referer is passed, we don't need a cancel button as we will stay on the same page. That was the behaviour expected for the 'My private files' page.

1. Login as admin
2. Choose a random page, add a 'My private files' block
3. Click on the button 'Manage my private files' in the block
4. Make sure that
The navigation has selected 'Navigation > Home > My profile > My private files'
The cancel button brings you back to the page you were on
Uploading a file and clicking 'Save changes' brings you back to the page you were on
The file has been uploaded
5. Now click on 'My private files' from the navigation
6. Make sure that:
The navigation has selected 'Navigation > Home > My profile > My private files'
There is no cancel button (because no referer was passed to the form)
Uploading a file and clicking 'Save changes' brings you back to that same page
The file has been uploaded
7. Create an assignment 'Upload a single file' activity
8. Login as an enrolled student
9. Upload a file to that assignment
10. Make sure that
The cancel button is present and brings you back to the assignment page
The file is uploaded successfully
NB: The cancel button appears when a referer has been passed, so that we can redirect the user to the correct page (upon cancel or submit). When no referer is passed, we don't need a cancel button as we will stay on the same page. That was the behaviour expected for the 'My private files' page.

Description

Following up from MDL-23920 (1) the link in navigation to Private files should go straight to the "editing" screen with the filemanager. There is no point in forcing people to hit the "Manage files" button.

After saving changes, we can still go to "view" screen I guess. I can't think of a better place to go - we can't stay in the editing screen.

Martin Dougiamas
added a comment - 18/May/12 10:49 AM I really think it's worth doing this simple fix as it will really improve experience and performance for everyone, and it fits well with all the other file-related improvements in this release.

The code itself looks fine. Consider squashing the 3 commits into one. They each have limited value on their own.

Also, expand the testing instructions. In what scenario should there be a cancel button? When shouldn't there be a cancel button? I'd also probably include having the tester actually upload a file. Does the file picker in a different context, the assignment module for example, require a quick check to make sure that it still functions correctly?

Andrew Davis
added a comment - 21/May/12 11:44 AM The code itself looks fine. Consider squashing the 3 commits into one. They each have limited value on their own.
Also, expand the testing instructions. In what scenario should there be a cancel button? When shouldn't there be a cancel button? I'd also probably include having the tester actually upload a file. Does the file picker in a different context, the assignment module for example, require a quick check to make sure that it still functions correctly?

Frédéric Massart
added a comment - 21/May/12 1:12 PM Thanks Andrew! I have updated my branches so that there is only one commit. I wrote some testing instructions while you were already reviewing, but I will expand them a bit.

Dan Poltawski
added a comment - 22/May/12 10:22 AM Hi Fred,
There is one tiny thing - we don't allow underscores in variable names:
http://docs.moodle.org/dev/Coding_style#Variables
If you could fix that up with $cancel_button then it'll be perfect
thanks
dan