Jump to content

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',
explanation = 'Please discuss any changes on the ${TALKPAGELINK}; you'
},
.. ' may ${EDITREQUEST} to ask an'
['temp-all-blp-autoconfirmed-edit'] = {
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
category = 'Wikipedia temporarily semi-protected biographies of living people',
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
},
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
['all-all-dispute-autoconfirmed-edit'] = {
.. '|consensus]]. You may also [[Wikipedia:Requests for'
category = 'Wikipedia pages semi-protected due to dispute',
.. ' page protection#Current requests for reduction in protection level'
},
.. '|request]] that this page be unprotected.',
['all-all-sock-autoconfirmed-edit'] = {
tooltip = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.',
category = 'Wikipedia pages semi-protected from banned users',
alt = 'Page ${PROTECTIONLEVEL}',
},
image = 'Transparent.gif',
['all-all-vandalism-autoconfirmed-edit'] = {
category = 'Wikipedia protected pages'
category = 'Wikipedia pages semi-protected against vandalism',
}
},
 
['all-category-all-autoconfirmed-edit'] = {
-- Move-protection defaults.
category = 'Wikipedia semi-protected categories',
cfg.bannerData['all-all-all-all-move'] = {
},
explanation = 'The page may still be edited but cannot be moved'
['all-file-all-autoconfirmed-edit'] = {
.. ' until unprotected. Please discuss any suggested moves on the'
category = 'Semi-protected images',
.. ' ${TALKPAGELINK} or at [[Wikipedia:Requested moves]]. You can also'
},
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
['all-portal-all-autoconfirmed-edit'] = {
.. ' unprotected.',
category = 'Semi-protected portals',
}
},
 
['all-project-all-autoconfirmed-edit'] = {
-- Create-protection defaults.
category = 'Semi-protected project pages',
cfg.bannerData['all-all-all-all-create'] = {
},
explanation = '${DELETIONBLURB} If you would like to create a page'
['all-talk-all-autoconfirmed-edit'] = {
.. ' at this title, you must first'
category = 'Semi-protected talk pages',
.. ' [[Wikipedia:Requests for page protection|request]] for it to be'
},
.. ' unprotected, or contact the administrator who deleted the page for the'
['all-template-all-autoconfirmed-edit'] = {
.. ' deleted material to be restored. If unsuccessful, you can use'
category = 'Wikipedia semi-protected templates',
.. ' [[Wikipedia:Deletion review|deletion review]].',
},
}
['all-template-all-autoconfirmed-edit'] = {
 
category = 'Wikipedia semi-protected templates',
-- Don't make an unprotection request link for pages in the MediaWiki namespace.
},
cfg.bannerData['all-mediawiki-all-all-all'] = {
['all-user-all-autoconfirmed-edit'] = {
text = introText.full .. '.',
category = 'Wikipedia semi-protected user and user talk pages',
explanation = 'Please discuss any changes on the ${TALKPAGELINK}; you'
},
.. ' may ${EDITREQUEST} to ask an'
['all-all-blp-sysop-edit'] = {
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
category = 'Wikipedia indefinitely protected biographies of living people',
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
},
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
['temp-all-blp-sysop-edit'] = {
.. '|consensus]].',
category = 'Wikipedia temporarily protected biographies of living people',
}
},
 
['all-all-dispute-sysop-edit'] = {
-- Set defaults for temporarily-protected pages.
category = 'Wikipedia pages protected due to dispute',
cfg.bannerData['temp-all-all-all-all'] = {
},
text = introText.full .. ' until ${EXPIRY}.',
['all-all-sock-sysop-edit'] = {
tooltip = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.'
category = 'Wikipedia pages protected from banned users',
}
},
 
['all-all-vandalism-sysop-edit'] = {
cfg.bannerData['all-all-all-autoconfirmed-edit'] = {
category = 'Wikipedia pages protected against vandalism',
text = introText.semi .. '.'
},
}
['all-category-all-sysop-edit'] = {
 
category = 'Wikipedia protected categories',
cfg.bannerData['temp-all-all-autoconfirmed-edit'] = {
},
text = introText.semi .. ' until ${EXPIRY}.'
['all-file-all-sysop-edit'] = {
}
category = 'Protected images',
 
},
--------------------------------------------------------------------------------
['all-project-all-sysop-edit'] = {
-- Protection categories
category = 'Protected project pages',
--------------------------------------------------------------------------------
},
 
['all-talk-all-sysop-edit'] = {
local bannerDataCategories = {
category = 'Protected talk pages',
['all-all-office-all-all'] = 'Wikipedia Office-protected pages',
},
['all-all-reset-all-all'] = 'Wikipedia Office-protected pages',
['all-template-all-sysop-edit'] = {
['all-template-all-all-edit'] = 'Wikipedia protected templates',
category = 'Wikipedia protected templates',
['all-all-all-autoconfirmed-edit'] = 'Wikipedia semi-protected pages',
},
['indef-all-all-autoconfirmed-edit'] = 'Wikipedia indefinitely semi-protected pages',
['all-user-all-sysop-edit'] = {
['all-all-blp-autoconfirmed-edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',
category = 'Wikipedia protected user and user talk pages',
['temp-all-blp-autoconfirmed-edit'] = 'Wikipedia temporarily semi-protected biographies of living people',
},
['all-all-dispute-autoconfirmed-edit'] = 'Wikipedia pages semi-protected due to dispute',
['all-all-all-sysop-move'] = {
['all-all-sock-autoconfirmed-edit'] = 'Wikipedia pages semi-protected from banned users',
category = 'Wikipedia move-protected pages',
['all-all-vandalism-autoconfirmed-edit'] = 'Wikipedia pages semi-protected against vandalism',
},
['all-category-all-autoconfirmed-edit'] = 'Wikipedia semi-protected categories',
['indef-all-all-sysop-move'] = {
['all-file-all-autoconfirmed-edit'] = 'Semi-protected images',
category = 'Wikipedia indefinitely move-protected pages',
['all-portal-all-autoconfirmed-edit'] = 'Semi-protected portals',
},
['all-project-all-autoconfirmed-edit'] = 'Semi-protected project pages',
['all-all-dispute-sysop-move'] = {
['all-talk-all-autoconfirmed-edit'] = 'Semi-protected talk pages',
category = 'Wikipedia pages move-protected due to dispute',
['all-template-all-autoconfirmed-edit'] = 'Wikipedia semi-protected templates',
},
['all-template-all-autoconfirmed-edit'] = 'Wikipedia semi-protected templates',
['all-all-vandalism-sysop-move'] = {
['all-user-all-autoconfirmed-edit'] = 'Wikipedia semi-protected user and user talk pages',
category = 'Wikipedia pages move-protected due to vandalism',
['all-all-blp-sysop-edit'] = 'Wikipedia indefinitely protected biographies of living people',
},
['temp-all-blp-sysop-edit'] = 'Wikipedia temporarily protected biographies of living people',
['all-portal-all-sysop-move'] = {
['all-all-dispute-sysop-edit'] = 'Wikipedia pages protected due to dispute',
category = 'Wikipedia move-protected portals',
['all-all-sock-sysop-edit'] = 'Wikipedia pages protected from banned users',
},
['all-all-vandalism-sysop-edit'] = 'Wikipedia pages protected against vandalism',
['all-portal-all-sysop-move'] = {
['all-category-all-sysop-edit'] = 'Wikipedia protected categories',
category = 'Wikipedia move-protected portals',
['all-file-all-sysop-edit'] = 'Protected images',
},
['all-project-all-sysop-edit'] = 'Protected project pages',
['all-project-all-sysop-move'] = {
['all-talk-all-sysop-edit'] = 'Protected talk pages',
category = 'Wikipedia move-protected project pages',
['all-template-all-sysop-edit'] = 'Wikipedia protected templates',
},
['all-user-all-sysop-edit'] = 'Wikipedia protected user and user talk pages',
['all-talk-all-sysop-move'] = {
['all-all-all-sysop-move'] = 'Wikipedia move-protected pages',
category = 'Wikipedia move-protected talk pages',
['indef-all-all-sysop-move'] = 'Wikipedia indefinitely move-protected pages',
},
['all-all-dispute-sysop-move'] = 'Wikipedia pages move-protected due to dispute',
['all-template-all-sysop-move'] = {
['all-all-vandalism-sysop-move'] = 'Wikipedia pages move-protected due to vandalism',
category = 'Wikipedia move-protected templates',
['all-portal-all-sysop-move'] = 'Wikipedia move-protected portals',
},
['all-portal-all-sysop-move'] = 'Wikipedia move-protected portals',
['all-user-all-sysop-move'] = {
['all-project-all-sysop-move'] = 'Wikipedia move-protected project pages',
category = 'Wikipedia move-protected user and user talk pages',
['all-talk-all-sysop-move'] = 'Wikipedia move-protected talk pages',
},
['all-template-all-sysop-move'] = 'Wikipedia move-protected templates',
['all-all-all-autoconfirmed-autoreview'] = {
['all-user-all-sysop-move'] = 'Wikipedia move-protected user and user talk pages',
category = 'Wikipedia pending changes protected pages (level 1)',
['all-all-all-autoconfirmed-autoreview'] = 'Wikipedia pending changes protected pages (level 1)',
},
['all-all-all-reviewer-autoreview'] = 'Wikipedia pending changes protected pages (level 2)',
['all-all-all-reviewer-autoreview'] = {
category = 'Wikipedia pending changes protected pages (level 2)',
},
}
}
for key, cat in pairs(bannerDataCategories) do
local t = cfg.bannerData[key] or {}
t.category = cat
cfg.bannerData[key] = t
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Line 617: Line 636:
msg['edit-request-semi-display'] = 'request an edit'
msg['edit-request-semi-display'] = 'request an edit'


msg['request-unprotection-blurb'] = ' You may also [[Wikipedia:Requests for'
.. ' page protection#Current requests for reduction in protection level'
.. '|request]] that this page be unprotected.'
msg['semi-subject-page-links'] = ' $12, discuss changes on the $11,'
msg['semi-subject-page-links'] = ' $12, discuss changes on the $11,'


Line 628: Line 644:
msg['deletion-discussion-blurb-noxfd'] = 'Please see the $17 for'
msg['deletion-discussion-blurb-noxfd'] = 'Please see the $17 for'
.. ' details of why this page was deleted.'
.. ' details of why this page was deleted.'
msg['explanation-text-semi'] = 'If you cannot edit this $4 and you wish to make'
.. ' a change, you can$14 [[Wikipedia:Requests for page protection#Current'
.. ' requests for reduction in protection level|request unprotection]],'
.. ' [[Special:Userlogin|log in]], or [[Special:UserLogin/signup|'
.. 'create an account]].'
msg['explanation-text-move'] = 'The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves on the $11 or at'
.. ' [[Wikipedia:Requested moves]]. You can also [[Wikipedia:Requests for'
.. ' page protection|request]] that the page be unprotected.'
msg['explanation-text-create'] = '$15 If you would like to create a page at this title,'
.. ' you must first [[Wikipedia:Requests for page protection|request]] for'
.. ' it to be unprotected, or contact the administrator who deleted the'
.. ' page for the deleted material to be restored. If unsuccessful, you can'
.. ' use [[Wikipedia:Deletion review|deletion review]].'
msg['explanation-text-default'] = 'Please discuss any changes on the $11; you'
.. ' may $12 to ask an [[Wikipedia:Administrators|administrator]] to make'
.. ' an edit if it is [[Help:Minor edit#When to mark an edit as a minor'
.. ' edit|uncontroversial]] or supported by [[Wikipedia:Consensus|'
.. 'consensus]].$13'


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Cookies help us deliver our services. By using our services, you agree to our use of cookies.