Module:Protection banner/config: Difference between revisions
get rid of the last of the numbered parameters, and move the binary matrix explanation down to the protectionCategories section
(further conversion) |
(get rid of the last of the numbered parameters, and move the binary matrix explanation down to the protectionCategories section) |
||
Line 7: | Line 7: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- PARAMETERS | ||
-- | -- | ||
-- The values in the banner data can take parameters. These are specified | -- The values in the banner data can take parameters. These are specified | ||
Line 148: | Line 71: | ||
-- create a blurb like "This template is semi-protected", or "This article is | -- create a blurb like "This template is semi-protected", or "This article is | ||
-- move-protected until DD Month YYYY". | -- move-protected until DD Month YYYY". | ||
-- | |||
-- ${VANDAL} - links for the specified username (or the root page name) | |||
-- using Module:Vandal-m. | |||
--]] | --]] | ||
Line 160: | Line 86: | ||
-- specific banner config. | -- specific banner config. | ||
cfg.masterBanner = { | |||
cfg. | |||
text = '${INTROBLURB}.', | text = '${INTROBLURB}.', | ||
explanation = '${EXPLANATIONBLURB}', | explanation = '${EXPLANATIONBLURB}', | ||
Line 196: | Line 98: | ||
create = {}, | create = {}, | ||
autoreview = {} | autoreview = {} | ||
} | |||
cfg.defaultBanners.autoreview.autoconfirmed = { | |||
alt = 'Page protected with pending changes level 1', | |||
tooltip = 'All edits by unregistered and new users are subject to review', | |||
image = 'Padlock-silver-light.svg' | |||
} | |||
cfg.defaultBanners.autoreview.default = { | |||
alt = 'Page protected with pending changes level 2', | |||
tooltip = 'All edits by users who are not reviewers or administrators are' | |||
.. ' subject to review', | |||
} | } | ||
Line 286: | Line 200: | ||
cfg.banners.edit.usertalk = { | cfg.banners.edit.usertalk = { | ||
text = '${INTROBLURB} to prevent $ | text = '${INTROBLURB} to prevent ${VANDAL} from using it to make disruptive edits,' | ||
.. ' such as abusing the' | .. ' such as abusing the' | ||
.. ' {{[[Template:unblock|unblock]]}} template', | .. ' {{[[Template:unblock|unblock]]}} template', | ||
Line 309: | Line 223: | ||
cfg.banners.move.dispute = { | cfg.banners.move.dispute = { | ||
explanation = "This protection is '''not''' an endorsement of the $ | explanation = "This protection is '''not''' an endorsement of the" | ||
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', | |||
image = 'Padlock-olive.svg' | image = 'Padlock-olive.svg' | ||
} | } | ||
cfg.banners.move.vandalism = { | cfg.banners.move.vandalism = { | ||
} | } | ||
Line 403: | Line 306: | ||
-- Protection categories | -- Protection categories | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
--[[ | |||
-- The protection categories are stored in the cfg.protectionCategories table. | |||
-- Keys to this table are made up of the following strings: | |||
-- | |||
-- 1. the expiry date | |||
-- 2. the namespace | |||
-- 3. the protection reason (e.g. "dispute" or "vandalism") | |||
-- 4. the protection level (e.g. "sysop" or "autoconfirmed") | |||
-- 5. the action (e.g. "edit" or "move") | |||
-- | |||
-- When the module looks up a category in the table, first it will will check to | |||
-- see a key exists that corresponds to all five parameters. For example, a | |||
-- user page semi-protected from vandalism for two weeks would have the key | |||
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module | |||
-- changes the first part of the key to "all" and checks the table again. It | |||
-- keeps checking increasingly generic key combinations until it finds the | |||
-- field, or until it reaches the key "all-all-all-all-all". | |||
-- | |||
-- The module uses a binary matrix to determine the order in which to search. | |||
-- This is best demonstrated by a table. In this table, the "0" values | |||
-- represent "all", and the "1" values represent the original data (e.g. | |||
-- "indef" or "file" or "vandalism"). | |||
-- | |||
-- expiry namespace reason level action | |||
-- order | |||
-- 1 1 1 1 1 1 | |||
-- 2 0 1 1 1 1 | |||
-- 3 1 0 1 1 1 | |||
-- 4 0 0 1 1 1 | |||
-- 5 1 1 0 1 1 | |||
-- 6 0 1 0 1 1 | |||
-- 7 1 0 0 1 1 | |||
-- 8 0 0 0 1 1 | |||
-- 9 1 1 1 0 1 | |||
-- 10 0 1 1 0 1 | |||
-- 11 1 0 1 0 1 | |||
-- 12 0 0 1 0 1 | |||
-- 13 1 1 0 0 1 | |||
-- 14 0 1 0 0 1 | |||
-- 15 1 0 0 0 1 | |||
-- 16 0 0 0 0 1 | |||
-- 17 1 1 1 1 0 | |||
-- 18 0 1 1 1 0 | |||
-- 19 1 0 1 1 0 | |||
-- 20 0 0 1 1 0 | |||
-- 21 1 1 0 1 0 | |||
-- 22 0 1 0 1 0 | |||
-- 23 1 0 0 1 0 | |||
-- 24 0 0 0 1 0 | |||
-- 25 1 1 1 0 0 | |||
-- 26 0 1 1 0 0 | |||
-- 27 1 0 1 0 0 | |||
-- 28 0 0 1 0 0 | |||
-- 29 1 1 0 0 0 | |||
-- 30 0 1 0 0 0 | |||
-- 31 1 0 0 0 0 | |||
-- 32 0 0 0 0 0 | |||
-- | |||
-- In this scheme the action has the highest priority, as it is the last | |||
-- to change, and the expiry has the least priority, as it changes the most. | |||
-- The priorities of the expiry, the protection level and the action are | |||
-- fixed, but the priorities of the reason and the namespace can be swapped | |||
-- through the use of the cfg.bannerDataNamespaceHasPriority table. | |||
--]] | |||
cfg.reasonsWithNamespacePriority = { | cfg.reasonsWithNamespacePriority = { |