This page is protected against editing.

Template:WatchlistNotice

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:WatchlistNotice/doc.

Displays a watchlist notice if all of the conditions are met. Some criteria allow specifying lists. If one of the list entries fullfills the condition, the whole criterion is considered fulfilling the condition. For example, if you specify DE:US, the message might be shown in Germany and the United States. For use at MediaWiki:WatchlistNotice. See also: Help:Watchlist messages

Usage

{{WatchlistNotice
 |id            =
 |text          =
 |type          =
 |from          =
 |until         =
 |countries     =
 |cities        =
 |latFrom       =
 |latTo         =
 |lonFrom       =
 |lonTo         =
 |preferences   =
 |languages     =
 |groups        =
 |browser       =
 |browserVerMin =
 |browserVerMax =
 |browserLang   =
 |condition     =
}}

This template makes use of LUA (server side) and JavaScript (client side) to accomplish its tasks.

Using the following sample doesn't make sense but it shows how each of the parameters could be used:

{{WatchlistNotice
|id=0
|text={{LangSwitch
  |de=German translation
  |en=English translation
}}
|type=i18n
|from=2014-01-01 22:00:00
|until=2014-07-01 22:00:00
|countries=DE:US
|cities=Lynchburg:Petersburg:Frankfort:Kassel:Essen:Berlin:Köln
|latFrom=40.0
|latTo=50.0
|lonFrom=-120.0
|lonTo=20.0
|preferences=gadget-AjaxQuickDelete=1;fancysig=1
|languages=en:de:fr
|groups=licensereviewer autopatrolled
|browser=opera
|browserVerMin=3
|browserVerMax=100
|browserLang=en:de:fr
}}

Template parameters

ParameterDescriptionDefaultStatus
idNumbers only. Each message should have a unique id. An exception are messages with the same content. They may share the same ID.emptyrequired
textThe text to be displayed. You may use {{LangSwitch}} here.emptyrequired
typeOne of the following types: policy_new|policy_change|technical_new|technical_change|technical_issue|poty complete, customizable list of supported typesemptyrequired
fromTime (UTC) in format YYYY-MM-DD hh:mm:ss from which on the notice should be shown. YYYY is the four digit year (e.g. 2023); MM is the month of the year (e.g. 06 for June); DD is the day of the month (e.g. 31); hh is the hour (e.g. 01); mm is the minute of the hour (e.g. 05); ss — Second of the minute (e.g. 02). The number of letters corresponds with the number of digits required. Therefore, single digit numbers must be padded with 0.LUAemptyoptional
untilTime (UTC) in format YYYY-MM-DD hh:mm:ss until which the notice should be shown.LUAemptyoptional
countriesA colon (:)-separated list of ISO 3166-1 Alpha 2 country codes. E.g. DE for Germany and US for the United States of America. Complete list (list with flags) (en:ISO 3166-1)JSemptyoptional
citiesA colon (:)-separated list of cities. Note that in case it is unknown to the server, (null) will be returned. Usually in the country's native language. View your city.JSemptyoptional
latFromGeographical latitude (in degree [°]); from -90.00 to 90.00; A negative sign means South, a positive value means North. Note the dot (.) as a decimal mark. With latFrom, latTo, latFrom and lonTo you are able to specify a rectangle. Message is shown to users who live inside this region. All four values must be specified or none of them. LatFrom and LonFrom specify the the top left corner of the recangle if the north is on top.JSemptyoptional
latTosee latFromJSemptyoptional
lonFromGeographical longitude; from -180.00 to 180.00; A negative number means West, a positive value means East.JSemptyoptional
lonTosee lonFromJSemptyoptional
preferencesA semicolon-separated list of user options in the following format: key=value;key=value;key!=value;. This allows you to target messages e.g. to users who make use of UploadWizard or who prefer having the categories on top of the page or to check for inequality != with a user preference. The expression is only evaluated if the user preference is available to the script. Otherwise it is implicitly passed. List visible in a JavaScript browser console executing mw.user.options.values. Every value is converted to String automatically. Please do not add quotation marks. (cf. example above)JSemptyoptional
languagesA colon (:)-separated list of ISO 639-1 language codes which will be checked against the Commons user language. Language variants (e.g. pt-br) will be considered as matching the condition if only the main language as specified by ISO 639-1 is supplied. No further fallback mechanism is used. Cf. {{List of supported languages}}LUAemptyoptional
groupsA space separated list of user groups for whom to show the message. One or more of the following: licensereviewer autopatrolled filemover patroller adminonly OTRS (or take the values from this list). As always, at least one of the values must be met by the user to fulfill this criterion. Example: User:EuroHawk is a patroller. If you specify "filemover patroller adminonly", the message will be possibly — provided that the remaining criteria set up by other parameters of this template are met — shown to them. CSSLUAemptyoptional
browserA colon (:)-separated list of internal browser names so that the message is only shown in these particular browsers (aka user agents, clients). Useful if there are known issues with special browsers. You can pick them from this list's value column.JSemptyoptional
browserVerMinMessage (possibly) shown if the browser version is equal or greater than browserVerMin. See browser.JSemptyoptional
browserVerMaxMessage (possibly) shown if the browser version is equal or less than browserVerMax. See browser.JSemptyoptional
browserLangA colon (:)-separated list of RFC 4646 identifiers.The Language Identifier (LCID) “consists of its [ISO-639] language code, its [ISO-3166] country/region code, and an optional [ISO-15924] script tag for the written language, as described in [RFC4646].”[1] Either the browser language setting or the OS language setting (depending on what can be retrieved) will be checked against this list. Providing only the ISO-639 (language) code (omitting country/region) allows you to target the message to all the language variants.JSemptyoptional
conditionHere, you can add a condition à la façon {{#expr:{{PAGESINCAT:User needing help|pages}}>=3}}. A result of 0 will prevent the message from being shown, any other result will be considered as fulfilling the condition. This way, you can avoid wrapping something around the template when you are in need of additional conditions.LUA1optional
bugReserved for later extension. It's possible to query the Bugzilla API for a bug status. [1] [2] en:MediaWiki:Gadget-BugStatusUpdate.js JSemptyoptional

Additional information

The template is intended to be used in the following namespaces: the Special namespace

The template is intended to be used by the following user groups: Administrators

Relies on:

Localization

This template is not intended to be localized.

References

  1. http://msdn.microsoft.com/en-us/library/cc233967.aspx