Zum Inhalt springen

Modul:Protection banner: Unterschied zwischen den Versionen

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)
Zeile 705: Zeile 705:
local Category = class('Category')
local Category = class('Category')


function Category:initialize(configObj, protectionStatusObj, titleObj)
function Category:initialize(configObj, protectionStatusObj)
self._configObj = configObj
self._configObj = configObj
self._protectionStatusObj = protectionStatusObj
self._protectionStatusObj = protectionStatusObj
self._titleObj = titleObj
end
end


Zeile 740: Zeile 739:
local protectionStatusObj = self._protectionStatusObj
local protectionStatusObj = self._protectionStatusObj
local titleObj = self._titleObj
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.
-- Get the expiry.
Zeile 763: Zeile 768:
local reason = protectionStatusObj:getReason()
local reason = protectionStatusObj:getReason()
local action = protectionStatusObj:getAction()
local action = protectionStatusObj:getAction()
local level = protectionStatusObj:getLevel()
   
   
--[[
--[[
Zeile 883: Zeile 887:
if cat then
if cat then
Category.setName(self, cat)
Category.setName(self, cat)
return Category.export(self)
return Category.render(self)
else
else
error(
error(
Zeile 915: Zeile 919:
local cat = configObj:getMessage('tracking-category-expiry')
local cat = configObj:getMessage('tracking-category-expiry')
Category.setName(self, cat)
Category.setName(self, cat)
return Category.export(self)
return Category.render(self)
end
end
end
end
Zeile 935: Zeile 939:
if level == '*' or type(expiry) == 'number' and expiry < os.time() then
if level == '*' or type(expiry) == 'number' and expiry < os.time() then
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))
return Category.export(self)
return Category.render(self)
end
end
end
end
Zeile 967: Zeile 971:


-- Render the banner
-- Render the banner
do
if protectionObj:getLevel() ~= '*' then
-- Get the banner object
-- Get the banner object
local isPadlock = yesno(args.small)
local isPadlock = yesno(args.small)
Zeile 1.006: Zeile 1.010:
-- Render the categories
-- 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)
return table.concat(ret)
Anonymer Benutzer