Anonymous user
Module:Protection banner: Difference between revisions
output the categories, and don't display the banner if the page is not protected
(add expiry category code) |
(output the categories, and don't display the banner if the page is not protected) |
||
Line 705:
local Category = class('Category')
function Category:initialize(configObj, protectionStatusObj
self._configObj = configObj
self._protectionStatusObj = protectionStatusObj
end
Line 740 ⟶ 739:
local protectionStatusObj = self._protectionStatusObj
local titleObj = self._titleObj
-- Get the level and exit if the page is not protected.
local level = protectionStatusObj:getLevel()▼
if level == '*' then
return ''
end
-- Get the expiry.
Line 763 ⟶ 768:
local reason = protectionStatusObj:getReason()
local action = protectionStatusObj:getAction()
▲ local level = protectionStatusObj:getLevel()
--[[
Line 883 ⟶ 887:
if cat then
Category.setName(self, cat)
return Category.
else
error(
Line 915 ⟶ 919:
local cat = configObj:getMessage('tracking-category-expiry')
Category.setName(self, cat)
return Category.
end
end
Line 935 ⟶ 939:
if level == '*' or type(expiry) == 'number' and expiry < os.time() then
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))
return Category.
end
end
Line 967 ⟶ 971:
-- Render the banner
if protectionObj:getLevel() ~= '*' then
do▼
-- Get the banner object
local isPadlock = yesno(args.small)
Line 1,006 ⟶ 1,010:
-- Render the categories
▲ do
local objects = {
ProtectionCategory:new(configObj, protectionObj, titleObj),
ExpiryCategory:new(configObj, protectionObj),
ErrorCategory:new(configObj, protectionObj)
}
for _, obj in ipairs(objects) do
ret[#ret + 1] = obj:render()
end
end
return table.concat(ret)
|