Module:Protection banner/config: Difference between revisions

more conversion of the data to the bannerConfig table
(use a new approach to the banner config, allowing more fine-grained control and less hopping around between parameter definitions)
(more conversion of the data to the bannerConfig table)
Line 4: Line 4:


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Banner data
--                               BANNER DATA
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


Line 84: Line 84:
--
--
--
--
--                         PARAMETERS
--                             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 93: Line 93:
-- Defined in the cfg.pagetypes table.
-- Defined in the cfg.pagetypes table.
--
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
--
-- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If
-- protection is indefinite or is not set, this is the blank string.
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${TALKPAGELINK} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${DELETIONREASONSBLURB} - a blurb about why the page was deleted. For
-- example, "Please see the deletion discussion or the protection log for
-- details of why this page was deleted." Uses the message
-- "deletion-discussion-blurb-xfd" if a link to a deletion discussion is
-- present, or "deletion-discussion-blurb-noxfd" if not.
--]]
--]]


Line 110: Line 125:
[  4] = 'project',
[  4] = 'project',
[  6] = 'file',
[  6] = 'file',
[  8] = 'mediawiki',
[ 10] = 'template',
[ 10] = 'template',
[ 12] = 'project',
[ 12] = 'project',
Line 116: Line 132:
}
}


cfg.bannerData = {
--------------------------------------------------------------------------------
-- The key strings follow this format:
-- Intro text
-- type, level, ns, reason, expiry
--------------------------------------------------------------------------------
['all-all-all-all-all'] = {
 
text = '',
-- Shared intro text for the bannerData table.
explanation = '',
 
tooltip = '',
local introText = {}
alt = '',
introText.full = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]'
category = 'Wikipedia protected pages',
.. ' from editing'
},
introText.semi = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access levels'
['all-all-office-all-all'] = {
.. '#New users|new]] or [[Wikipedia:User access levels#Unregistered users'
category = 'Wikipedia Office-protected pages',
.. '|unregistered]] users is currently [[Help:Protection|disabled]]'
},
introText.move = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]'
['all-all-reset-all-all'] = {
.. ' from [[Help:Moving a page|page moves]]'
category = 'Wikipedia Office-protected pages',
introText.create = '[[Help:Starting a new page|Recreation]] of this ${PAGETYPE}'
},
.. ' [[Help:Protection|has been disabled]]'
['all-template-all-all-edit'] = {
category = 'Wikipedia protected templates',
--------------------------------------------------------------------------------
},
-- Banner data table
['all-all-all-autoconfirmed-edit'] = {
--------------------------------------------------------------------------------
category = 'Wikipedia semi-protected pages',
 
},
cfg.bannerData = {}
['indef-all-all-autoconfirmed-edit'] = {
 
category = 'Wikipedia indefinitely semi-protected pages',
-- Set the defaults for all protection types.
},
cfg.bannerData['all-all-all-all-all'] = {
['all-all-blp-autoconfirmed-edit'] = {
text = introText.full .. '.',
category = 'Wikipedia indefinitely semi-protected biographies of living people'