Open main menu

Changes

Module:Protection banner

71 bytes added, 18:40, 28 June 2014
put Protection in charge of generating its own category links
end
function Protection:makeExpiryCategoryneedsExpiry()
local cfg = self._cfg
if return not self.expiry
and cfg.expiryCheckActions[self.action]
and self.reason -- the old {{pp-protected}} didn't check for expiry
and not cfg.reasonsWithoutExpiryCheck[self.reason]
then
return makeCategoryLink(self._cfg.msg['tracking-category-expiry'])
end
end
function Protection:makeErrorCategoryisIncorrect()
local expiry = self.expiry
if return not self:isProtected()
or type(expiry) == 'number' and expiry < os.time()
then
return makeCategoryLink(self._cfg.msg['tracking-category-incorrect'])
end
end
function Protection:makeTemplateCategoryisTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
if return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink(msg['tracking-category-expiry']) end if self:isIncorrect() then return ret[#ret + 1] = makeCategoryLink(msg['tracking-category-incorrect']) end if self._cfg.:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink(msg['tracking-category-template'])
end
return table.concat(ret)
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeProtectionCategory() ret[#ret + 1] = protectionObj:makeExpiryCategory() ret[#ret + 1] = protectionObj:makeErrorCategory() ret[#ret + 1] = protectionObj:makeTemplateCategorymakeCategoryLinks()
end
Anonymous user