Module:Protection banner: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(hacky code for image rendering)
(move the image name function to its proper place and rename it)
Line 133: Line 133:
create = 'Padlock-skyblue.svg'
create = 'Padlock-skyblue.svg'
}
}

function banner:renderImage()
local image
if self.reason == 'office' or self.reason == 'reset' then
image = cfg.images.office
elseif self.title.namespace == 10 or self.title.namespace == 828 then
-- We are in the template or module namespaces.
if self.protectionLevel == 'templateeditor' then
image = cfg.images.template
elseif self.protectionLevel == 'sysop' then
image = cfg.images.indef
end
elseif self.action == 'create' then
image = cfg.images.create
elseif self.action == 'move'
and (
self.protectionLevel == 'templateeditor'
or self.protectionLevel == 'sysop'
)
then
image = cfg.images.move
elseif self.action == 'edit' then
if self.protectionLevel == 'sysop' then
image = cfg.images.full
elseif self.protectionLevel == 'autoconfirmed' then
image = cfg.images.semi
end
elseif self.action == 'autoreview' then
if self.protectionLevel == 'autoconfirmed' then
image = cfg.images.pc1
elseif self.protectionLevel == 'reviewer' then
image = cfg.images.pc2
end
else
image = 'Transparent.gif'
end
return image
end


cfg.categories = {
cfg.categories = {
Line 327: Line 289:


return obj
return obj
end

function banner:fetchImageName()
local image
if self.reason == 'office' or self.reason == 'reset' then
image = cfg.images.office
elseif self.title.namespace == 10 or self.title.namespace == 828 then
-- We are in the template or module namespaces.
if self.protectionLevel == 'templateeditor' then
image = cfg.images.template
elseif self.protectionLevel == 'sysop' then
image = cfg.images.indef
end
elseif self.action == 'create' then
image = cfg.images.create
elseif self.action == 'move'
and (
self.protectionLevel == 'templateeditor'
or self.protectionLevel == 'sysop'
)
then
image = cfg.images.move
elseif self.action == 'edit' then
if self.protectionLevel == 'sysop' then
image = cfg.images.full
elseif self.protectionLevel == 'autoconfirmed' then
image = cfg.images.semi
end
elseif self.action == 'autoreview' then
if self.protectionLevel == 'autoconfirmed' then
image = cfg.images.pc1
elseif self.protectionLevel == 'reviewer' then
image = cfg.images.pc2
end
else
image = 'Transparent.gif'
end
return image
end
end