Last modified: 2011-12-07 21:52:57 UTC
If you select more than the configured maxUploads, the UI will add all the files anyway. There is some asynchrony that was not an issue before. - an "upload" is not necessarily a filled upload. The file input hovering over the "add a file" button belongs to an unfilled upload. Filled uploads are added to the wizard's list of uploads. Unfilled uploads are just sort of UI elements waiting to turn into the real thing. - in newUpload(), there is a check of the wizard's count of uploads; it returns false if current length = max - but, there is a very slight delay between creating a new upload and marking it filled (this is async). And the upload is only added to the wizard at the "filled" trigger event - there is some attempt to fix this with the change() invocation for synthetically created providedFile -- maybe this should be the filled trigger. Or both?
Fixed by r104103. Maybe it can be done in a nicer way, but I did not see any after poking at the code a bit.
This will work but I think the solution needs to be a bit better. 1 - it's really inelegant to do all the work of adding uploads and then removing them. There are all sorts of side effects (for one, there are a few static "counters" in various classes). Multiple files are launched around line 333 of mw.UploadWizardUpload.js, maybe start from there? 2 - after someone goes over the limit, we need to throw up a dialog to explain to them what happened. Otherwise they will probably not notice. By the way, after they are over the limit, check that the 'new upload' button is properly disabled
Right. > Multiple files are launched around line 333 of mw.UploadWizardUpload.js, maybe start from there? Ah, that seems more promising then where I was looking :)
Second attempt in r104117 - still need to do the warning thing though.
Any suggestion on how to display such a warning? Is there any appropriate warning display thinghy yet, or do I need to create something new?
(In reply to comment #5) > Any suggestion on how to display such a warning? Is there any appropriate > warning display thinghy yet, or do I need to create something new? do a modal dialog with jQuery UI dialog. There are some examples in the codebase.
Dialog added in r104167
The current fix seems to have an off-by-one error and a few other problems. For all below cases, in LocalSettings.php $wgUploadWizardConfig['maxUploads'] = 5 1) Off by one error: - Uploading files, selected File1..10.jpg - Dialog triggered correctly, saying I had 10 files and 5 would be dropped - However, only File1..4 were shown. - At this point, the "Add another upload" button was still enabled - Adding another upload brings the total to 5. No dialog is shown saying any will be dropped. "Add another upload" button is disabled. So that seems to work. 2) Does not track current total - Add 3 files to UploadWizard, successful as usual - Add 5 more - Dialog triggered, incorrectly stating: "You can only upload 5 files at once. You tried to add 8 files, so 3 files have been removed." It would be more correct to say: "You can only upload 5 files at once. You tried to upload 8 files in total, so 3 files have been removed".
1) Ok, did not notice this myself during testing :/ 2) So the only thing you want me to do is add "in total" to the message? I could also go for something like "You tried to upload 5 files while already having 3, so 3 of those have been removed." if that's clearer.
(In reply to comment #9) > 2) So the only thing you want me to do is add "in total" to the message? No, I also changed "add" to "upload". I just think that "You tried to add 8 files" seems wrong, as it implies that I *just* tried to add 8 files.
Should be fixed by r105441
Looks good. Thanks for the quick fix.