Problems with integration of file uploading

Moderator: kcleung

Post Reply
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Problems with integration of file uploading

Post by imslp »

Well... integration of file uploading into the file form has hit a problem: how do we verify the form prior to the files being uploaded?

I say this because if otherwise, the user will have to upload the entire thing again if he messes up some (unrelated) part of the submission form. This could especially present a huge problem for the multiple file submission form.

Javascript is nice, but not everyone has it turned on, and MediaWiki was designed to work without JS...
Leonard Vertighel
Groundskeeper
Posts: 553
Joined: Fri Feb 16, 2007 8:55 am

Re: Problems with integration of file uploading

Post by Leonard Vertighel »

imslp wrote:how do we verify the form prior to the files being uploaded?
You don't. There simply is no way of accomplishing this without JS.

Now I can't tell you how to implement it technically, but I think the procedure should basically be the following: upload file in every case; verify submitted data; if it does not pass verification, return submission form without upload form, and with the previous user input + uploaded file name in the form fields (and a message saying what's wrong). It is probably unavoidable that if the user aborts at this point, we are left with an orphaned file, but I hope that this will occur much less frequently than now where the two steps are completely separated. Do you think that could work?
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Re: Problems with integration of file uploading

Post by imslp »

Leonard Vertighel wrote:Now I can't tell you how to implement it technically, but I think the procedure should basically be the following: upload file in every case; verify submitted data; if it does not pass verification, return submission form without upload form, and with the previous user input + uploaded file name in the form fields (and a message saying what's wrong). It is probably unavoidable that if the user aborts at this point, we are left with an orphaned file, but I hope that this will occur much less frequently than now where the two steps are completely separated. Do you think that could work?
Wow, I haven't thought of that. It could work, but will require rather extensive knowledge of the upload feature of Mediawiki (which currently does the same thing for warnings). About orphaned files, it is already present in the current setup (if someone aborts an upload when there's a warning) so we don't have to worry about it (except for me periodically deleting all the files in the temp folder).

But yes, that's a very nice idea that works nicely, and uses standard MW protocol :)
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Post by imslp »

Ok... beta version out (if you can't see the link on the pages, force cache purge and view the page in English). Even though I call it a "beta" version, I've tested it extensively myself, and should not break easily :) The 6 hours of coding wasn't for nothing ;)

P.S. It'd be nice if someone can test it in Opera and IE... I changed the table settings a little... theoretically should be for the better, but you never know with IE ;)
Leonard Vertighel
Groundskeeper
Posts: 553
Joined: Fri Feb 16, 2007 8:55 am

Post by Leonard Vertighel »

Great work. Looks fine in Opera 9/Linux.

There are a few XHTML errors that you may wish to fix. Change

Code: Select all

<option SELECTED value=""></option>
to

Code: Select all

<option selected="selected" value=""></option>
(attributes must be lowercase and have a value)

Code: Select all

<option SELECTED>File (default)</option>
to

Code: Select all

<option selected="selected">File (default)</option>
(idem)

Code: Select all

- Admin Tools -
to

Code: Select all

</ul>- Admin Tools -<ul>
(you can't have text inside the "ul" element but outside of "li").
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Post by imslp »

All fixed :) Also finished porting the file upload to the Multi file page, so I'm going to change the links to point only to the file-upload versions (people can switch back to the old ones from that page if so desired). :)
Leonard Vertighel
Groundskeeper
Posts: 553
Joined: Fri Feb 16, 2007 8:55 am

Post by Leonard Vertighel »

We have a problem: there are (if I'm not mistaken) 1567 work pages that do not contain the "AddFile" template. That's a bit too much to fix by hand. Thoughts? (I could try to code a bot, but this won't happen very soon, since right now I have almost no time. There exists also that pywikipedia bot framework thing, but unfortunately I know nothing about Python.)

I've also found 44 work pages that contain no "File*" template. Should I delete them straight away, or do you want to see the list?
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Post by imslp »

Leonard Vertighel wrote:We have a problem: there are (if I'm not mistaken) 1567 work pages that do not contain the "AddFile" template.
Oops! I forgot about that :/ I think I'll just do some special page renaming, and it should be fine (i.e. "AddFile"=>"AddFileOld" and "AddFileNew"=>"AddFile").
That's a bit too much to fix by hand. Thoughts? (I could try to code a bot, but this won't happen very soon, since right now I have almost no time. There exists also that pywikipedia bot framework thing, but unfortunately I know nothing about Python.)

I've also found 44 work pages that contain no "File*" template. Should I delete them straight away, or do you want to see the list?
It is in one of the transitional formats (I seem to remember Schumann had a few pages like that)? In that case it is probably a good idea to just recreate the page and resubmit the file to the page. :)
Leonard Vertighel
Groundskeeper
Posts: 553
Joined: Fri Feb 16, 2007 8:55 am

Post by Leonard Vertighel »

imslp wrote:
Leonard Vertighel wrote:We have a problem: there are (if I'm not mistaken) 1567 work pages that do not contain the "AddFile" template.
Oops! I forgot about that :/ I think I'll just do some special page renaming, and it should be fine (i.e. "AddFile"=>"AddFileOld" and "AddFileNew"=>"AddFile").
Fine. At some point however we should fix that nonetheless, so we can internationalize that part, too. A bot (if I get around to coding one) would actually cause less traffic and server load than human editors, since it can access the edit form directly, without loading the rendered page first. And it can be made to run arbitrarily slow to put minimum load on the server.
imslp wrote:
I've also found 44 work pages that contain no "File*" template. Should I delete them straight away, or do you want to see the list?
It is in one of the transitional formats (I seem to remember Schumann had a few pages like that)? In that case it is probably a good idea to just recreate the page and resubmit the file to the page. :)
I haven't looked through all of them, but it seems that they are just pages with no files at all. If there are no files (and the page is more than 24 hours old), delete and forget? Or do I have to notify the page creator for all 44 of them?
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Post by imslp »

I've finished fixing it :)

And also, I was thinking that you coding a bot may be a very good idea... because I have absolutely no idea about bot writing (or Python), and so it'd be the same thing for me. Comparatively I am quite familiar with the Mediawiki internals, so I can take care of that part pretty efficiently :) Plus, with bots you don't have to wait for me to include it in the code.
Leonard Vertighel
Groundskeeper
Posts: 553
Joined: Fri Feb 16, 2007 8:55 am

Post by Leonard Vertighel »

Actually I have no idea about Python either. The bots I had coded for the Italian Wikipedia were made in PHP, but they worked pretty well :)

By the way, how does the internationalization of the new templates (or rather, the underlying parser functions) work? Is it via MediaWiki messages, and if so, which?
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Post by imslp »

Leonard Vertighel wrote:Actually I have no idea about Python either. The bots I had coded for the Italian Wikipedia were made in PHP, but they worked pretty well :)
Good enough for me ;)
By the way, how does the internationalization of the new templates (or rather, the underlying parser functions) work? Is it via MediaWiki messages, and if so, which?
I didn't put them as Mediawiki messages due to load concerns (that'd be a lot of SQL queries). Instead, they are embedded into the code. I intend to set up an internationalization page for the new work pages soon. But let me rest for a few days first (I've been spending something like 8 hours per day the last two days on IMSLP stuff).

Also apparently I didn't see your last message when I posted... so here goes:
Fine. At some point however we should fix that nonetheless, so we can internationalize that part, too. A bot (if I get around to coding one) would actually cause less traffic and server load than human editors, since it can access the edit form directly, without loading the rendered page first. And it can be made to run arbitrarily slow to put minimum load on the server.
Well, the page will be automatically transformed the next time a file is submitted. So maybe we can wait for a while longer, and at the end of it clean up the remaining (hopefully very few) pages manually. :)
I haven't looked through all of them, but it seems that they are just pages with no files at all. If there are no files (and the page is more than 24 hours old), delete and forget? Or do I have to notify the page creator for all 44 of them?
Delete and forget :)
Leonard Vertighel
Groundskeeper
Posts: 553
Joined: Fri Feb 16, 2007 8:55 am

Post by Leonard Vertighel »

imslp wrote:I didn't put them as Mediawiki messages due to load concerns (that'd be a lot of SQL queries). Instead, they are embedded into the code. I intend to set up an internationalization page for the new work pages soon. But let me rest for a few days first (I've been spending something like 8 hours per day the last two days on IMSLP stuff).
There is no hurry, I'm not going to work on it very soon anyway.
imslp wrote:So maybe we can wait for a while longer, and at the end of it clean up the remaining (hopefully very few) pages manually. :)
Waiting is OK, I don't have time right now to work on it anyway. Nonetheless I think a bot might be useful. We shall see...
imslp wrote:Delete and forget :)
Done.

I'd suggest adding a message to the old upload forms explaining that file upload is now integrated into the submission forms. Then later (say, in one or two weeks) we can remove the two upload forms from the sidebar, since they should almost never be needed (they will still be accessible from Special:Specialpages). The number of unsubmitted files has grown quite a bit recently, and "hiding" the two upload forms will hopefully slow down the growth.
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Post by imslp »

Yep, I think that is a good idea :) You can add a message to this effect directly to the special page header.
Post Reply