Moodle

Add an optional $preventdoublesubmit parameter to print_single_button

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.9
  • Fix Version/s: 1.9.6
  • Component/s: Libraries
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

Some idiot double-clicked on a grade export button, when we were using the feature that only exports grades that have not been exported. As part of the fix, I want to implement the fairly standard idea of a button that disables itself after it is clicked.

Activity

Hide
Tim Hunt added a comment -

Is it OK to commit the attached patches to 1.9 and HEAD? I've tested, and the JavaScript works in IE and Firefox.

Show
Tim Hunt added a comment - Is it OK to commit the attached patches to 1.9 and HEAD? I've tested, and the JavaScript works in IE and Firefox.
Hide
Petr Škoda (skodak) added a comment -

going to test it with more browsers later today...

Show
Petr Škoda (skodak) added a comment - going to test it with more browsers later today...
Hide
Petr Škoda (skodak) added a comment -

The trouble is that the button does not work if you use Back in browser.
Alternative solution could be to ignore abort from browser and always complete the export before starting a new one from the second click.

Show
Petr Škoda (skodak) added a comment - The trouble is that the button does not work if you use Back in browser. Alternative solution could be to ignore abort from browser and always complete the export before starting a new one from the second click.
Hide
Petr Škoda (skodak) added a comment -

funny, the button is disabled after Back only in FF
IE6/7/8, Konqueror, Opera - all work fine

Show
Petr Škoda (skodak) added a comment - funny, the button is disabled after Back only in FF IE6/7/8, Konqueror, Opera - all work fine
Hide
Tim Hunt added a comment -

I think we do that, at least here at the OU, because we use session locking, so only one request can be active on a session at one time. However, the problem with that is that you end up seeing the results of the second export, which is blank, because you are only exporting grades that have changed since the previous export, which was half a second ago.

I don't think it is a major problem if the button stays disabled when you click back. If clicking the button changes the state of Moodle, the it is probably good that you have to reload the first page to re-enable the button, because that will repeat any checks that are done before the button is shown.

For example, my new code would be useful in backup and restore. You know the way that if you:

1. try a backup and get an error message
2. click back once
3. click the backup button again

You then get an error about there not being a backup with that id.

You actually have to click back about 4 times, then go through all the forms again. Well, the functionality I have just implemented would be perfect for that situation.

Show
Tim Hunt added a comment - I think we do that, at least here at the OU, because we use session locking, so only one request can be active on a session at one time. However, the problem with that is that you end up seeing the results of the second export, which is blank, because you are only exporting grades that have changed since the previous export, which was half a second ago. I don't think it is a major problem if the button stays disabled when you click back. If clicking the button changes the state of Moodle, the it is probably good that you have to reload the first page to re-enable the button, because that will repeat any checks that are done before the button is shown. For example, my new code would be useful in backup and restore. You know the way that if you: 1. try a backup and get an error message 2. click back once 3. click the backup button again You then get an error about there not being a backup with that id. You actually have to click back about 4 times, then go through all the forms again. Well, the functionality I have just implemented would be perfect for that situation.
Hide
Petr Škoda (skodak) added a comment -

I doubt you disable abort of PHP scripts, at present only a few areas of Moodle do that - upgrade code and proposed send_temp_file()

Show
Petr Škoda (skodak) added a comment - I doubt you disable abort of PHP scripts, at present only a few areas of Moodle do that - upgrade code and proposed send_temp_file()
Hide
Petr Škoda (skodak) added a comment -

1/ my +0.9 for this, going to ask MD tomorrow for confirmation
we should imho document the disabled button when going back in FF somewhere

2/ my +1 to implement the same option in formslib - modedit would be the first user

3/ we could sprinkle some ignore abort directives, not everybody has it in php.ini like OU - candidates are grade xml export and modedit form

Show
Petr Škoda (skodak) added a comment - 1/ my +0.9 for this, going to ask MD tomorrow for confirmation we should imho document the disabled button when going back in FF somewhere 2/ my +1 to implement the same option in formslib - modedit would be the first user 3/ we could sprinkle some ignore abort directives, not everybody has it in php.ini like OU - candidates are grade xml export and modedit form
Hide
Tim Hunt added a comment -

Judging by the lack of any action here, we don't acutally want this in core. Closing.

Show
Tim Hunt added a comment - Judging by the lack of any action here, we don't acutally want this in core. Closing.

People

Vote (0)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: