Last modified: 2012-05-14 14:26:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38693, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36693 - [SD] Add new parser function #drilldownlink
[SD] Add new parser function #drilldownlink
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SemanticDrilldown (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Yaron Koren
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-09 11:20 UTC by MWJames
Modified: 2012-05-14 14:26 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch has been made against SD SVN revision 115163 (7.42 KB, application/octet-stream)
2012-05-09 11:20 UTC, MWJames
Details
Version 2 of the patch related to #drilldownlink and changes (5.87 KB, patch)
2012-05-09 14:53 UTC, MWJames
Details

Description MWJames 2012-05-09 11:20:08 UTC
Created attachment 10566 [details]
Patch has been made against SD SVN revision 115163

A patch which introduces a new parser function called #drilldown to enable links [2] pointing to Semantic Drilldown much like #formlink does in Semantic Forms.

==Example ==
{{#drilldown:Psychology|subcat=Bounded rationality|link text=Drilldown on Bounded rationality|single}}

{{#drilldown:category=Psychology|subcat=Bounded rationality|filter=Subject=Decision making|link text=Drilldown on Bounded rationality|single}}

==Parameter ==
# category parameter is either empty, or specified through [cat=], [category=] 
# subcategory parameter is identified by either [subcat=] or [subcategory=]
# filter parameters can be specified through [filter=Subject=Advertising&Keyword=Branding] or [filter=Subject=Advertising] [filter=Keyword=Branding]
# [single] is a parameter identifier to achieve [1]
# other supported parameters are [link text=], [tooltip=]

==Notes ==
[1] http://www.mediawiki.org/wiki/SD#Removing_the_list_of_categories
Comment 1 Yaron Koren 2012-05-09 13:31:48 UTC
Hi, thanks for this patch! SD has needed something like this for a long time.

The calls to array_merge_recursive_distinct() and http_build_query() seem like overkill here - are you sure they're needed? In the case of #formlink, they're used because #formlink allows arbitrary parameters (it adds them all to the query string) - #drilldown doesn't do that. And #formlink didn't use them until a few months ago:

r1=110324&r2=110685">http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php?r1=110324&r2=110685

Also, any objections to renaming this function to #drilldownlink? Or to changing the name of the parameter "filter" to "filters"?
Comment 2 Yaron Koren 2012-05-09 13:32:46 UTC
That URL didn't display very well - let me try that again:

svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php?r1=110324&r2=110685
Comment 3 MWJames 2012-05-09 14:53:55 UTC
Created attachment 10568 [details]
Version 2 of the patch related to #drilldownlink and changes

Changes are:
# renamed parser function to #drilldownlink
# renamed filter parameter to filters
# replaced array_merge_recursive_distinct() with simple array_merge
# for the time http_build_query() is kept to ensure the query string is correctly escaped 

Changes have been tested against:
* {{#drilldownlink:Book|Subject=Psychology&Keyword=Cognitive_psychology&Language=en|subcat=Textbook}}
* {{#drilldownlink:Book|filters=Subject=Psychology&Keyword=Cognitive psychology|filters=Language=en|subcat=Textbook}}
* {{#drilldownlink:Book|filters=Subject=Psychology&Keyword=Cognitive psychology|filters=Language=en|subcat=Textbook|single|link text=Single mode}}
* {{#drilldownlink:Book|filters=Subject=Psychology&Keyword=Cognitive psychology|filters=Language=en|subcat=Textbook|single|link text=Single mode|tooltip=Display related info}}
Comment 4 Yaron Koren 2012-05-14 14:26:52 UTC
I just checked this in to the SD code on SVN, with some minor adjustments. I hope everything still works. And thanks again for the patch!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links