Okay, I think I understand the hack now - basically you're talking about being able to set the filename from the query string. There might be an easier way to do that, but that makes sense.

For the random string - isn't people's privacy compromised already by the fact that you can see file uploads in the "Recent changes" page?


On Thu, Mar 26, 2009 at 12:47 PM, Samuel Lampa <samuel.lampa.l@rilnet.com> wrote:
Yaron Koren skrev:

Here's documentation on the existing "unique number" feature:

Thanks, Ah Ok, well then it's not exactly what I'm looking for right here, as explained below.

By "anonymized", do you mean that you're generating a random number? If so, is there a reason for doing that, as opposed to going with the lowest unique number, i.e. incrementing the number every time?

Exactly, or actually a random _string_, with both letters and numbers, like "tKnEwqGWHKSeoFHWExAae8sN91bl49PwT"
We want it to be random since it's going to be used on a publicly available (bioinformatic) analysis tool, and if using a sequential number, it would be easy to find the other jobs posted, find out the senders' IP addresses et.c. which would affect the integrity of the researchers using it.

By the way, I just realized that this whole discussion has taken place on the SMW-users mailing list. For future discussions, it would be better to have them on the SF list.

You are right, sorry.

Okay, wow - your hack looks interesting, though I confess that I don't understand it in the slightest. :)

Thanks =) I'll try to explain better. I can understand if it is confusing, since this hack is used in combination with the changes in my first patch, and furthermore I had a rather confusing "placeholder string" ("destination_filename" ), which I have changed to "<<destination_filename>>" below for better readability.

What I do is basically just extending one of the parameters in a formlink button defenition, with another parameter, that "get's a free ride" with the first one (this should not be possible in theory I guess!), like so:

 {{#formlink:NameOfForm|Create new something|button|NameOfForm[Some Field]=Some value&sfDestFile=DesiredTitleOfUploadedFile }}

Compare this to how it normally looks:

 {{#formlink:NameOfForm|Create new something|button|NameOfForm[Some Field]=Some value }}

Then I snatch the extra parameter when the form is being processed (in SF_FormPrinter), using the global $wgRequest object, like so: $wgRequest->getVal('sfDestFile'), and uses it to replace any instance of the placeholder string "<<destination_filename>>" in the form.

This placeholder is used to set the destination filename (enabled by my first patch) for a file-upload-field, like so:

 {{{field|Job data|uploadable|destination filename=<<destination_filename>>|default= }}}

So, again: "<<destination_filename>>" get's replaced with the value of the sfDestFile parameter, which I managed to send to the form, by (as a dirty hack) extending one parameter with another one, that got a free ride.

Hope this is more easily understood!

// Samuel Lampa