Edición de «Módulo:Protection banner»
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces publica los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 3: | Línea 3: | ||
-- Initialise necessary modules. | -- Initialise necessary modules. | ||
require(' | require('Module:No globals') | ||
local makeFileLink = require('Module: | local makeFileLink = require('Module:Link de arquivo')._main | ||
local effectiveProtectionLevel = require('Module: | local effectiveProtectionLevel = require('Module:Nível efetivo de proteção')._main | ||
local effectiveProtectionExpiry = require('Module: | local effectiveProtectionExpiry = require('Module:Expiração efetiva de proteção')._main | ||
local yesno = require('Module:Yesno') | local yesno = require('Module:Yesno') | ||
Línea 169: | Línea 169: | ||
end | end | ||
return setmetatable(obj, Protection) | return setmetatable(obj, Protection) | ||
end | end | ||
Línea 182: | Línea 174: | ||
return self.level ~= '*' | return self.level ~= '*' | ||
end | end | ||
function Protection:isTemporary() | function Protection:isTemporary() | ||
Línea 196: | Línea 180: | ||
function Protection:makeProtectionCategory() | function Protection:makeProtectionCategory() | ||
if not self: | local cfg = self._cfg | ||
local title = self.title | |||
-- Exit if the page is not protected. | |||
if not self:isProtected() then | |||
return '' | return '' | ||
end | end | ||
-- Get the expiry key fragment. | -- Get the expiry key fragment. | ||
Línea 216: | Línea 201: | ||
namespaceFragment = 'talk' | namespaceFragment = 'talk' | ||
end | end | ||
-- Define the order that key fragments are tested in. This is done with an | -- Define the order that key fragments are tested in. This is done with an | ||
-- array of tables containing the value to be tested, along with its | -- array of tables containing the value to be tested, along with its | ||
Línea 324: | Línea 309: | ||
function Protection:isIncorrect() | function Protection:isIncorrect() | ||
local expiry = self.expiry | local expiry = self.expiry | ||
return not self: | return not self:isProtected() | ||
or type(expiry) == 'number' and expiry < os.time() | or type(expiry) == 'number' and expiry < os.time() | ||
end | end | ||
Línea 339: | Línea 324: | ||
function Protection:makeCategoryLinks() | function Protection:makeCategoryLinks() | ||
local msg = self._cfg.msg | local msg = self._cfg.msg | ||
local ret = {self:makeProtectionCategory()} | local ret = { self:makeProtectionCategory() } | ||
if self:isIncorrect() then | if self:isIncorrect() then | ||
ret[#ret + 1] = makeCategoryLink( | ret[#ret + 1] = makeCategoryLink( | ||
Línea 458: | Línea 443: | ||
function Blurb:_makeEditRequestParameter() | function Blurb:_makeEditRequestParameter() | ||
local mEditRequest = require('Module: | local mEditRequest = require('Module:Submeter um pedido de edição') | ||
local action = self._protectionObj.action | local action = self._protectionObj.action | ||
local level = self._protectionObj.level | local level = self._protectionObj.level | ||
Línea 652: | Línea 637: | ||
function Blurb:_makeVandalTemplateParameter() | function Blurb:_makeVandalTemplateParameter() | ||
return | return require('Module:Vandal-m')._main{ | ||
self._args.user or self._protectionObj.title.baseText | |||
} | } | ||
end | end | ||
Línea 843: | Línea 827: | ||
-- protection from some other action, then don't bother displaying anything | -- protection from some other action, then don't bother displaying anything | ||
-- for the other action (except categories). | -- for the other action (except categories). | ||
if | if protectionObj.action == 'edit' or | ||
args.demolevel or | args.demolevel or | ||
not getReachableNodes( | not getReachableNodes( | ||
cfg.hierarchy, | cfg.hierarchy, | ||
protectionObj.level | protectionObj.level | ||
)[effectiveProtectionLevel('edit', protectionObj.title)] | )[effectiveProtectionLevel('edit', protectionObj.title)] | ||
then | then | ||
-- Initialise the blurb object | -- Initialise the blurb object | ||
Línea 854: | Línea 838: | ||
-- Render the banner | -- Render the banner | ||
if protectionObj: | if protectionObj:isProtected() then | ||
ret[#ret + 1] = tostring( | ret[#ret + 1] = tostring( | ||
(yesno(args.small) and Padlock or Banner) | (yesno(args.small) and Padlock or Banner) | ||
Línea 875: | Línea 859: | ||
-- Find default args, if any. | -- Find default args, if any. | ||
local parent = frame.getParent and frame:getParent() | local parent = frame.getParent and frame:getParent() | ||
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/ | local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/Testes$', '')] | ||
-- Find user args, and use the parent frame if we are being called from a | -- Find user args, and use the parent frame if we are being called from a |