Content deleted Content added
Self-closing div, span, and other tags deprecated. |
MusikBot II (talk | contribs) m Protected "Module:Protected edit request/active": High-risk template or module: 300 transclusions (more info) ([Edit=Require autoconfirmed or confirmed access] (indefinite)) |
||
(19 intermediate revisions by 10 users not shown) | |||
Line 1:
require('
local yesno, makeMessageBox -- passed in from Module:Protected edit request
Line 29:
function title.getProtectionLevelText(protectionLevel)
-- Gets the text to use in anchors and urn links.
local levels = {unprotected = 'editunprotected', autoconfirmed = 'editsemiprotected', extendedconfirmed = 'editextendedprotected', templateeditor = 'edittemplateprotected', sysop = 'editprotected', interfaceadmin = 'editinterfaceprotected'}
return levels[protectionLevel]
end
Line 36:
local success, obj = pcall(mw.title.new, ...)
if not (success and obj) then return end
title.init(obj)
return obj▼
end
function title.init(obj)
-- Add a protectionLevel property.
obj.protectionLevel = effectiveProtectionLevel(obj.exists and 'edit' or 'create', obj)
Line 101 ⟶ 105:
return title.new(self.prefixedText .. '/' .. subpage)
end
function obj:getSandboxTitle()
▲ return obj
if self.isSubpage and self.contentModel == 'sanitized-css' then
local success2, obj2 = pcall(mw.title.makeTitle, self.namespace, self.baseText .. '/sandbox/' .. self.subpageText)
if success2 and obj2 then
title.init(obj2)
return obj2
end
end
return self:getSubpageTitle('sandbox')
end
end
Line 278 ⟶ 291:
function blurb:makeProtectionText()
local boxProtectionLevel = self.boxProtectionLevel
local levels = {['*'] = 'unprotected', autoconfirmed = 'semi-protected', extendedconfirmed = 'extended-confirmed-protected', templateeditor = 'template-protected', sysop = 'fully protected', interfaceadmin = 'interface-protected'}
for level, protectionText in pairs(levels) do
if level == boxProtectionLevel then
Line 308 ⟶ 321:
table.insert(tbargs, title:makeWhatLinksHereLink('links'))
-- Sandbox links.
local sandboxTitle = title:
if sandboxTitle and sandboxTitle.exists then
table.insert(tbargs, sandboxTitle:makeViewLink('sandbox'))
Line 324 ⟶ 337:
if title.namespace == 10 or title.namespace == 828 then -- Only add the transclusion count link for templates and modules.
local tclink = mw.uri.new{
host = '
path = '
query = {
lang = 'en',
Line 425 ⟶ 438:
else
local userText
local responseTemplate
if boxProtectionLevel == 'extendedconfirmed' then
userText = '[[Wikipedia:User access levels#Extended confirmed users|extended confirmed]] user'
responseTemplate = blurb.makeTemplateLink('EEp')
elseif boxProtectionLevel == 'autoconfirmed' then
userText = '[[Wikipedia:User access levels#Autoconfirmed|autoconfirmed]] user'
responseTemplate = blurb.makeTemplateLink('ESp')
elseif boxProtectionLevel == 'interfaceadmin' then
userText = '[[Wikipedia:User access levels#Interface administrators|interface administrator]]'
responseTemplate = blurb.makeTemplateLink('EIp')
else
userText = 'user'
responseTemplate = blurb.makeTemplateLink('ESp')
end
local answeredPara = blurb.makeParaText('answered', 'no')
Line 437 ⟶ 457:
.. "This is so that inactive or completed requests don't needlessly fill up the edit requests category. "
.. 'You may also wish to use the %s template in the response.'
smallText = mw.ustring.format(stringToFormat, userText, answeredPara,
end
Line 458 ⟶ 478:
smallText = smallText .. ' To request that a page be protected or unprotected, make a [[Wikipedia:Requests for page protection|protection request]].'
end
if boxProtectionLevel == 'sysop' or boxProtectionLevel == 'templateeditor' or boxProtectionLevel == 'interfaceadmin' then
smallText = smallText .. ' When the request has been completed or denied, please add the ' .. blurb.makeParaText('answered', 'yes') .. ' parameter to deactivate the template.'
end
Line 487 ⟶ 507:
local obj = getmetatable(box).new(protectionType, args)
setmetatable(obj, box)
local boxProtectionLevels = {semi = 'autoconfirmed', extended = 'extendedconfirmed', template = 'templateeditor', full = 'sysop', interface = 'interfaceadmin'}
obj.boxProtectionLevel = boxProtectionLevels[protectionType]
obj.demo = yesno(args.demo)
Line 504 ⟶ 524:
local padlock
if boxProtectionLevel == 'sysop' then
padlock = '
elseif boxProtectionLevel == 'interfaceadmin' then
padlock = 'Interface-protection-shackle.svg '
elseif boxProtectionLevel == 'templateeditor' then
padlock = '
elseif boxProtectionLevel == 'autoconfirmed' then
padlock = '
elseif boxProtectionLevel == 'extendedconfirmed' then
padlock = '
else
padlock = 'Padlock-bronze-open.svg'
Line 552 ⟶ 574:
extendedconfirmed = 'Wikipedia extended-confirmed-protected edit requests',
templateeditor = 'Wikipedia template-protected edit requests',
sysop = 'Wikipedia fully
interfaceadmin = 'Wikipedia interface-protected edit requests'
}
addCat(protectionCats[boxProtectionLevel])
Line 562 ⟶ 585:
function box:export()
if not title.isTalkPage and not self.demo and not yesno(self.args.skiptalk) then
return '<span class="error">Error: Protected edit requests can only be made on the talk page.</span>[[Category:Non-talk pages
end
local ret = {}
|