Page MenuHomePhabricator

Provide url parameters to prefill the fields of upload wizard
Closed, ResolvedPublic

Description

It should be possible to provide through url parameters default values for some (all?) upload entries.

See 'Upload Wizard with prefilled ID-field' thread in wikilovesmonuments list (linked at URL), requesting specifically that the ID can be set through the url, for providing direct upload links from the lists.


Version: unspecified
Severity: normal
URL: http://lists.wikimedia.org/pipermail/wikilovesmonuments/2011-December/thread.html#2275

Details

Reference
bz33341

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:06 AM
bzimport added a project: UploadWizard.
bzimport set Reference to bz33341.

philinje wrote:

Looking at a similar mechanism for connecting the process of uploading photos from the starting point of a Wikipedia article.

It is not very hard to accept url arguments for all configuration settings that can already be set via upload campaigns. This does not cover the values of ALL fields, but I sort of wonder if anything more then what the campaigns support is needed.

alexxw83 wrote:

@Jeroen: We want to prefill the ID-field per link iE from monumant-maps. So we need a URL-parameter to provide the ID to the upload-wizzard.

I don't know what you mean with configuration settings, but the question is basically that if you define an extra field in the form, for example with WLM the monument-id, you want to be able to make a url where you can prefill that value.

Again taking WLM as an example, on the lists on wikipedia, you can imagine that if there is no picture you put a link 'upload a picture' where you then link to the WLM campaign, with the ID already prefilled, as that is already known there.

I can imagine strategies like this much wider, but this is about all the fields you define in the upload form to fill in.

ew-nospam wrote:

Good news to hear that, Jeroen. Additionally to what AleXXw and Andre said, it would be nice to have as much flexibility as possible - e.g. prefilling categories, as there are countries that do not have the unique identifier and for them it would be very helpful to prefill other fields.

Category prefilling - from my point of view - would anyway be a good perspective for uploading images directly from Wikipedia.

Apparently there was no option to do this yet. I added one in r113584 which can be set as part of upload campaigns, or be overridden using the "id" url parameter, ie &url=42.

alexxw83 wrote:

Does in mean we can use "http://commons.wikimedia.org/w/index.php?title=Special:UploadWizard&uselang=de&campaign=wlm-at&url=12345" to prefill the ID-field in step 4? If yes: great start, but it just helps some countries ;) (see elya) It would be great to also be able to prefill description, coordinates, categories...

There is no magic solution to simply support all fields. It is very easy to url param support or upload campaign support for the existing settings, but like I already noted, these don't include initial values for all fields.

I added support for setting initial value of description, coordinates and categories fields via both url args and upload campaigns in r113591

The url args are:

  • id
  • description
  • lat
  • lon
  • alt
  • categories (the value is either a single category name or several separated using |, such as categories=Foo|Bar)

Is that sufficient?

Can't you do something like &field=<name:value>;... or instead of a ; separated list, make it possible to use field multiple time?

(In reply to comment #9)

Can't you do something like &field=<name:value>;... or instead of a ; separated
list, make it possible to use field multiple time?

Sorry, I don't understand what you are getting at. Where is semicolon used as separator?? And why would you want to put stuff in a single url arg with some weird syntax? Seems like asking for problems for no benefit at all...

(In reply to comment #10)

(In reply to comment #9)

Can't you do something like &field=<name:value>;... or instead of a ; separated
list, make it possible to use field multiple time?

Sorry, I don't understand what you are getting at. Where is semicolon used as
separator?? And why would you want to put stuff in a single url arg with some
weird syntax? Seems like asking for problems for no benefit at all...

The semicolon is used as separator if you want to prefill more fields. I am just trying to think along to have a generic way to prefill any field you can.

And indeed, I see the problem in making a long variable, I don't know the language and methods behind this, so I don't know if having duplicate parameters is easy. So that is why I mentioned both.

But the proposal is that say you have a campaign were you have a field country and a field id, which you both want to prefill, you can either say:

&field=id:12345;country:nl

or

&field=id:12345&field=country:nl

Hope this makes it more clear.

Andre, it'd be more appropiate to have &defaultid=12345&defaultcountry=nl (I'm using 'default' as prefix to avoid colliding with existing parameters, such as title)
But I think Jeroen mentioned that it can't be done in a loop for any thinkable parameter (which would be the cool thing to do). So the discussion about the most appropiate url schema would be moot.

You don't have to loop over all possible parameters, you should loop over all parameters given in the url, check if it is indeed a field in the campaign, and if so prefill it, that seems more doable to me.

But of course, I don't know the code, and Jeroen is in a better position to judge, I just try to brainstorm along, of course also because I see this functionality as a 'should have'.

I'd rather to with prefixes in the param names then having a single param holding all the stuff.

you should loop over all parameters given in the url, check if it is indeed a field in the campaign

It's not quite as simple as seeing if it's there and setting it. Some parameters require some handling, such as splitting them into a list, and all of them benefit a lot from having their name mapped since the internal names are not meant for usage in urls (they are a bit long for that). So right now there is a list of url args that maps to the internal names. Since we have this list, it's easy to avoid name collisions so I'd say we do not need any prefixing at this point.

So I could add url args for all campaign args and figure out sane url arg names for all of those. Do we really need/want this though?

ew-nospam wrote:

Thanks Jeroen! I will forward this news to the WLM community and let them test it - let's see how it works (e.g. with multiple upload etc.) and if it's what most of the people want. I'm sure they will discover multiple ideas to use this new option.

Great, closing the bug in that case. Please create a new one if more stuff needs to be added :)

Gilles raised the priority of this task from Medium to Unbreak Now!.Dec 4 2014, 10:29 AM
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to Medium.Dec 4 2014, 11:22 AM