Page MenuHomePhabricator

Add the ability to configure gadgets on a per site or wiki basis
Open, Needs TriagePublic

Description

Something else I'd like add to the gadget feature requests is allowing users to configure a gadget to some extent. A rough comparison might be using $wgExampleExtensionVariable to set something in LocalSettings.php.

As an example of how this might work in a js environment, take http://dev.wikia.com/wiki/AjaxRC which uses ajax to refresh the content of a page. By default this loads on RecentChanges and WikiActivity (something similar to RecentChanges made by Wikia to be more friendly to new users). However, the pages it loads can be altered to any page imaginable. A typical extra place for it to load might be a forum hub to track the latest changes to threads.

Currently, the user sets the variables and imports the script. If this script were moved to a gadget in it's current state there would be no way to configure it unless you did something like add a site dependency and configure it in MediaWiki:Common.js.

I think a better way would to be to add a way to set variables in a gadget preferences page, with a form that can accept pre-determined types, e.g. string (foo), array (foo, bar, baz, ...), number (12345), boolean (checkbox), etc. These variables could then be set using something like mw.user.gadgetPrefs.set( 'ajaxrc-someVar' ) (possibly namespaced to the gadget?) and then accessed by the gadget using mw.user.gadgetPrefs.get( 'ajaxrc-someVar' ) Ideally, this form would show the default values used as well.

A couple of things to mull over if this gets implemented:

  • Should we allow configuration on a wiki and/or user basis for default gadgets? Perhaps set sub-defaults, e.g. default < wiki < user
  • If global gadgets are introduced gadgets could be identified by hash values rather than names. How could we avoid clashes where the same variable is being inadvertently set twice or more by different scripts?

Version: unspecified
Severity: enhancement

Details

Reference
bz70019

Related Objects

StatusAssignedTask
OpenNone
OpenNone
ResolvedKrinkle
DeclinedNone
Resolvedkaldari
Resolvedkaldari
ResolvedKrinkle
OpenNone
ResolvedKrinkle
ResolvedKrinkle
ResolvedKrinkle
ResolvedKrinkle
OpenNone
DeclinedLegoktm
ResolvedLegoktm
DeclinedLegoktm
ResolvedLegoktm
ResolvedKrenair
ResolvedNone
ResolvedLegoktm
ResolvedLegoktm
ResolvedKrenair
ResolvedLegoktm
Resolvedkaldari
ResolvedKrinkle
Resolved Fhocutt
Resolvedkaldari
Resolvedkaldari
StalledNone
ResolvedNone
ResolvedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz70019.
bzimport added a subscriber: Unknown Object (MLST).
onei created this task.Aug 26 2014, 1:15 AM
He7d3r added a comment.EditedAug 26 2014, 1:29 AM

Customization of gadgets is in the roadmap for Gadgets 2.0 (T31272) / 3.0:
https://www.mediawiki.org/wiki/Extension:Gadgets/Roadmap#Gadgets_2.0
https://www.mediawiki.org/wiki/Roadmap/2012/April#MediaWiki_infrastructure

For notes on the implementation, see
https://www.mediawiki.org/wiki/User:Salvatore_Ingala/GSoC_2011_application
https://www.mediawiki.org/wiki/User:Salvatore_Ingala/Notes

However, I believe this will only be done after the implementation of global gadgets is finished...

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 30 2015, 10:27 AM
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptDec 10 2015, 11:00 PM