Page MenuHomePhabricator

#formlink should be able to link to Special:RunQuery
Closed, ResolvedPublic

Description

Special:RunQuery forms do not work with #formlink. Links to Special:RunQuery forms need to be created as full URLs (protocol relative in MW 1.18+) with external wiki link syntax:

http://www.mediawiki.org/wiki/Help:Links#External_links_to_internal_pages

or with the fullurl magic word:

http://www.mediawiki.org/wiki/Help:Magic_words#URL_data

Both of those methods require the use of the plainlinks class to suppress the external link icon, like this:

<span class="plainlinks">[path/toindex.php/Special:RunQuery/form|template%5Bfield%5D=preload_data link text]</span>

or this:

<span class="plainlinks">[{{fullurl:Special:RunQuery/form|template%5Bfield%5D=preload_data}} link text]</span>

The Semantic Forms #formlink parser function seems to simplify the above two native MediaWiki constructs, and add some features specific to Semantic Forms:

http://www.mediawiki.org/wiki/Extension:Semantic_Forms/Linking_to_forms#Using_.23formlink

The documentation does not say anything about Special:RunQuery forms not being compatible with #formlink, so I assume that is either a bug or an oversight. I assume it was an oversight.


Version: unspecified
Severity: enhancement

Details

Reference
bz33425

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:02 AM
bzimport set Reference to bz33425.

What would you suggest as a syntax for such a call?

My intuitive guess when I first tried it was to specify the form as:

Special:RunQuery/form-name

Where the "Special:RunQuery/" prefix can be used to detect how to handle the form link, like this:

{{#formlink: form = Special:RunQuery/form-name

link text = Click this to go to a query form
query string = form-name[field1]=value1&form-name[field2]=value2

}}

I don't like it; I think a separate parameter would be better.

Though I should note that you can already link to Special:RunQuery, with query string values, using {{fullurl}}:

http://www.mediawiki.org/wiki/Help:Magic_words#URL_data

(In reply to comment #3)

I don't like it; I think a separate parameter would be better.

How about this:

{{#formlink: form = form-name

form type = runquery
link text = Click this to go to a query form
query string = form-name[field1]=value1&form-name[field2]=value2

}}

I supposed with a "form type" parameter syntax, it could make it possible to add other form types in the future, although I haven't thought of any specific possibilities for that yet.

Though I should note that you can already link to Special:RunQuery, with query
string values, using {{fullurl}}:

http://www.mediawiki.org/wiki/Help:Magic_words#URL_data

Yes, I mentioned that in my original report. I wonder if a "form type=runquery" parameter in #formlink could be used to solve this also:

https://bugzilla.wikimedia.org/show_bug.cgi?id=33426

Like this:

{{#formlink: form = form-name

form type = runquery, embedded
query string = form-name[field1]=value1&form-name[field2]=value2

}}

The link text parameter would have to be ignored, if present along with a form type=runquery, embedded.

I think that's better than just transcluding embedded forms the way it's currently done, since the #formlink parser function could preload the form data on embedded forms.

Renamed to "#formlink should be able to link to Special:RunQuery" for clarity.

  • Bug 34309 has been marked as a duplicate of this bug. ***

MWJames posted a patch in attachment 9977.

Marking as duplicate of the #queryformlink bug report.

  • This bug has been marked as a duplicate of bug 34309 ***