Module:Protection banner/config: Difference between revisions
(Pp-template needs to be small by default) |
m (137 revisions imported from wikipedia:Module:Protection_banner/config: see Topic:Vtixlm0q28eo6jtf) |
||
| (65 intermediate revisions by 25 users not shown) | |||
| Line 4: | Line 4: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | |||
-- BANNER DATA | -- BANNER DATA | ||
-- | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | --[[ | ||
-- Banner data consists of six fields: | |||
-- * text - the main protection text that appears at the top of protection | |||
-- banners. | |||
-- * explanation - the text that appears below the main protection text, used | |||
-- to explain the details of the protection. | |||
-- * tooltip - the tooltip text you see when you move the mouse over a small | |||
-- padlock icon. | |||
-- * link - the page that the small padlock icon links to. | |||
-- * alt - the alt text for the small padlock icon. This is also used as tooltip | |||
-- text for the large protection banners. | |||
-- * image - the padlock image used in both protection banners and small padlock | |||
-- icons. | |||
-- | |||
-- The module checks in three separate tables to find a value for each field. | |||
-- First it checks the banners table, which has values specific to the reason | |||
-- for the page being protected. Then the module checks the defaultBanners | |||
-- table, which has values specific to each protection level. Finally, the | |||
-- module checks the masterBanner table, which holds data for protection | |||
-- templates to use if no data has been found in the previous two tables. | |||
-- | -- | ||
-- The values in the banner data can take parameters. These are specified | -- The values in the banner data can take parameters. These are specified | ||
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name | -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name | ||
-- enclosed in curly braces). Available parameters: | -- enclosed in curly braces). | ||
-- | |||
-- Available parameters: | |||
-- | -- | ||
-- ${CURRENTVERSION} - a link to the page history or the move log, with the | -- ${CURRENTVERSION} - a link to the page history or the move log, with the | ||
| Line 18: | Line 41: | ||
-- | -- | ||
-- ${EDITREQUEST} - a link to create an edit request for the current page. | -- ${EDITREQUEST} - a link to create an edit request for the current page. | ||
-- | -- | ||
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes | -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes | ||
| Line 60: | Line 80: | ||
-- ${VANDAL} - links for the specified username (or the root page name) | -- ${VANDAL} - links for the specified username (or the root page name) | ||
-- using Module:Vandal-m. | -- using Module:Vandal-m. | ||
-- | |||
-- Functions | |||
-- | |||
-- For advanced users, it is possible to use Lua functions instead of strings | |||
-- in the banner config tables. Using functions gives flexibility that is not | |||
-- possible just by using parameters. Functions take two arguments, the | |||
-- protection object and the template arguments, and they must output a string. | |||
-- | |||
-- For example: | |||
-- | |||
-- text = function (protectionObj, args) | |||
-- if protectionObj.level == 'autoconfirmed' then | |||
-- return 'foo' | |||
-- else | |||
-- return 'bar' | |||
-- end | |||
-- end | |||
-- | |||
-- Some protection object properties and methods that may be useful: | |||
-- protectionObj.action - the protection action | |||
-- protectionObj.level - the protection level | |||
-- protectionObj.reason - the protection reason | |||
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set | |||
-- to indefinite, and the protection time in unix time if temporary. | |||
-- protectionObj.protectionDate - the protection date in unix time, or nil if | |||
-- unspecified. | |||
-- protectionObj.bannerConfig - the banner config found by the module. Beware | |||
-- of editing the config field used by the function, as it could create an | |||
-- infinite loop. | |||
-- protectionObj:isProtected - returns a boolean showing whether the page is | |||
-- protected. | |||
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is | |||
-- temporary. | |||
-- protectionObj:isIncorrect - returns a boolean showing whether the protection | |||
-- template is incorrect. | |||
--]] | --]] | ||
-- The master banner data, used if no values have been found in banners or | |||
-- defaultBanners. | |||
-- | |||
masterBanner = { | masterBanner = { | ||
text = '${INTROBLURB}', | text = '${INTROBLURB}', | ||
explanation = '${EXPLANATIONBLURB}', | explanation = '${EXPLANATIONBLURB}', | ||
tooltip = '${TOOLTIPBLURB} | tooltip = '${TOOLTIPBLURB}', | ||
link = '${IMAGELINK}', | link = '${IMAGELINK}', | ||
alt = 'Page ${PROTECTIONLEVEL}' | alt = 'Page ${PROTECTIONLEVEL}' | ||
}, | }, | ||
-- The default banner data. This holds banner data for different protection | |||
-- levels. | |||
-- *required* - this table needs edit, move, autoreview and upload subtables. | |||
defaultBanners = { | defaultBanners = { | ||
edit = {}, | edit = {}, | ||
move = {}, | move = {}, | ||
autoreview = { | autoreview = { | ||
default = { | default = { | ||
alt = 'Page protected with pending changes | alt = 'Page protected with pending changes', | ||
tooltip = 'All edits by users | tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users', | ||
image = 'Pending-protection-shackle.svg' | |||
} | } | ||
} | }, | ||
upload = {} | |||
}, | }, | ||
--------------- | -- The banner data. This holds banner data for different protection reasons. | ||
-- | -- In fact, the reasons specified in this table control which reasons are | ||
--- | -- valid inputs to the first positional parameter. | ||
-- | |||
-- There is also a non-standard "description" field that can be used for items | |||
-- in this table. This is a description of the protection reason for use in the | |||
-- module documentation. | |||
-- | |||
-- *required* - this table needs edit, move, autoreview and upload subtables. | |||
banners = { | banners = { | ||
edit = { | edit = { | ||
| Line 106: | Line 157: | ||
description = 'For pages protected to promote compliance with the' | description = 'For pages protected to promote compliance with the' | ||
.. ' [[Wikipedia:Biographies of living persons' | .. ' [[Wikipedia:Biographies of living persons' | ||
.. '|biographies of living persons]] policy | .. '|biographies of living persons]] policy', | ||
text = '${INTROFRAGMENT} to promote compliance with' | text = '${INTROFRAGMENT} to promote compliance with' | ||
.. ' [[Wikipedia:Biographies of living persons' | .. ' [[Wikipedia:Biographies of living persons' | ||
.. "|Wikipedia's policy on the biographies" | .. "|Wikipedia's policy on the biographies" | ||
.. ' of living people]].', | .. ' of living people]].', | ||
tooltip = '${ | tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' | ||
.. ' living | .. ' biographies of living persons', | ||
}, | }, | ||
dmca = { | dmca = { | ||
description = 'For pages protected by the Wikimedia Foundation' | description = 'For pages protected by the Wikimedia Foundation' | ||
.. ' due to Digital Millennium Copyright Act takedown requests | .. ' due to [[Digital Millennium Copyright Act]] takedown requests', | ||
explanation = function (protectionObj, args) | explanation = function (protectionObj, args) | ||
local ret = 'Pursuant to a rights owner notice under the Digital' | local ret = 'Pursuant to a rights owner notice under the Digital' | ||
| Line 134: | Line 185: | ||
return ret | return ret | ||
end, | end, | ||
image = ' | image = 'Office-protection-shackle.svg', | ||
}, | }, | ||
dispute = { | dispute = { | ||
description = 'For pages protected due to editing disputes | description = 'For pages protected due to editing disputes', | ||
text = function (protectionObj, args) | text = function (protectionObj, args) | ||
-- Find the value of "disputes". | -- Find the value of "disputes". | ||
| Line 165: | Line 216: | ||
explanation = "This protection is '''not''' an endorsement of the" | explanation = "This protection is '''not''' an endorsement of the" | ||
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', | .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', | ||
tooltip = '${ | tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', | ||
}, | |||
ecp = { | |||
description = 'For articles in topic areas authorized by' | |||
.. ' [[Wikipedia:Arbitration Committee|ArbCom]] or' | |||
.. ' meets the criteria for community use', | |||
tooltip = 'This ${PAGETYPE} is extended-confirmed protected', | |||
alt = 'Extended-protected ${PAGETYPE}', | |||
}, | }, | ||
mainpage = { | mainpage = { | ||
description = 'For pages protected for being displayed on the [[Main Page]] | description = 'For pages protected for being displayed on the [[Main Page]]', | ||
text = 'This file is currently' | text = 'This file is currently' | ||
.. ' [[Wikipedia:This page is protected|protected]] from' | .. ' [[Wikipedia:This page is protected|protected]] from' | ||
| Line 181: | Line 239: | ||
}, | }, | ||
office = { | office = { | ||
description = 'For pages protected by the Wikimedia Foundation | description = 'For pages protected by the Wikimedia Foundation', | ||
text = function (protectionObj, args) | text = function (protectionObj, args) | ||
local ret = 'This ${PAGETYPE} is currently under the' | local ret = 'This ${PAGETYPE} is currently under the' | ||
| Line 196: | Line 254: | ||
.. " page unless you are authorized by the Wikimedia Foundation to do" | .. " page unless you are authorized by the Wikimedia Foundation to do" | ||
.. " so.'''", | .. " so.'''", | ||
image = ' | image = 'Office-protection-shackle.svg', | ||
}, | }, | ||
reset = { | reset = { | ||
description = 'For pages protected by the Wikimedia Foundation and' | description = 'For pages protected by the Wikimedia Foundation and' | ||
.. ' "reset" to a bare-bones version | .. ' "reset" to a bare-bones version', | ||
text = 'This ${PAGETYPE} is currently under the' | text = 'This ${PAGETYPE} is currently under the' | ||
.. ' scrutiny of the' | .. ' scrutiny of the' | ||
| Line 233: | Line 291: | ||
return ret | return ret | ||
end, | end, | ||
image = ' | image = 'Office-protection-shackle.svg', | ||
}, | }, | ||
sock = { | sock = { | ||
description = 'For pages protected due to' | description = 'For pages protected due to' | ||
.. ' [[Wikipedia:Sock puppetry|sock puppetry]] | .. ' [[Wikipedia:Sock puppetry|sock puppetry]]', | ||
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of' | text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of' | ||
.. ' [[Wikipedia:Blocking policy|blocked]] or' | .. ' [[Wikipedia:Blocking policy|blocked]] or' | ||
.. ' [[Wikipedia: | .. ' [[Wikipedia:Banning policy|banned users]]' | ||
.. ' from editing it.', | .. ' from editing it.', | ||
tooltip = '${ | tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' | ||
.. ' editing it', | .. ' editing it', | ||
}, | }, | ||
template = { | template = { | ||
description = 'For [[Wikipedia:High-risk templates|high-risk]]' | description = 'For [[Wikipedia:High-risk templates|high-risk]]' | ||
.. ' templates and Lua modules | .. ' templates and Lua modules', | ||
text = 'This is a permanently [[Help:Protection|protected]] ${PAGETYPE},' | text = 'This is a permanently [[Help:Protection|protected]] ${PA | ||