I propose we refactor Extension:UploadWizard and related tools to outline a better technical environment for frontend upload tools.
Where are we now?
UploadWizard is the giant, in many ways, of frontend upload tools. Its code is very complex and difficult to unravel, however, as Rahul21 found while attempting to use its upload transport classes in his GSoC project, Extension:PronunciationRecording. We have plenty of other extensions and projects that are interested in uploading files from many parts of the interface. The ones immediately coming to mind are
Where would we like to be?
It would be amazing if these extensions, and any gadgets that wanted it, could have relatively friendly support for popping up an interface, or some subset of an interface, for uploading files from other pages on the site. I would particularly like to have:
- Support for a full UploadWizard experience, possibly in a modal dialog that fills the screen to give us even more space to work with than we have had in UploadWizard before.
- Support for a simple "Upload File" interface that can be extremely tiny, with hints to fill in descriptions etc. after the upload is finished.
- Support for a mid-size interface that would be similar to UploadWizard but with a more compact appearance - drop some of the more complex controls like custom licenses and geolocation, and shunt some stuff into modals that can be separate (use OOjs-ui!)
- Lower-level support for uploading files (so VE can do cool stuff like copy/paste and drag/drop file uploads without much hassle).
- Maintain support for UploadWizard in its current form.
What stands in our way?
We would need to
- Clean up and refactor UploadWizard's code so it can be reasonably stripped out and put into core or another extension (upon which UW would depend).
- Split the code into multiple ResourceLoader modules - Rahul21 started this work, but more needs to be done.
- Build out any interface-building bits involved in a more general uploader.
- This may involve new interfaces of multiple types - design will need to be brought in.
- Start implementing example gadgets or extensions and clear up documentation.
Why don't we just do it?
Uploads are a pretty neglected part of the wiki contribution pipeline in general, and while it would be a good idea to start implementing these things on some level, before getting too far in, it would also be good to have some consensus from the wider MediaWiki community that we want to go for a general solution here, and that we want UploadWizard's existing code to be the scaffolding for that solution. This won't just be some side project that one or two people maintain on a really low level, this will be a lasting core component that we'll all need to be mindful of.
What about the Multimedia team?
Well, the Multimedia team does have UploadWizard on their radar. In fact, there's a plan to do incremental work on UploadWizard in the coming quarter. However, that work will likely take the form of bugfixes and refactoring of UploadWizard in its current form, rather than drastic changes. Having a more general library for the action of "hey, I want to upload this" is not in the scope of the Multimedia plan, so this RFC should still be taken on.
Write a new upload tool for MediaWiki
This could be tempting, since it means we would have to deal with less tech debt on the UploadWizard side. But there's no other major WMF project focused on uploading files on the frontend, so fixing UploadWizard and benefiting core at the same time is killing two birds rather deftly with one stone - we're going to need to port UploadWizard to the new tool anyway, so we may as well have that tool be supported from the start.
Use the upload transport/handlers from another MediaWiki tool
This would be tricky because there aren't really very many tools out there that aren't of the form-submit model. If there is a viable one out there, we should consider it as part of this process.
Use a third-party uploading library as our base
A cursory search brings up:
- dropzone.js, which seems similar to how UW works on a UX front but could maybe use some work on the support for older browsers
- resumable.js, has a nice feature to it, but likely relies on too new of technology
- jQuery File Upload, which has the benefit of being a jQuery plugin, supporting drag-n-drop, and seems to have pretty stable support for lots of browsers
- And Many More