Anonymous user
Module:Protection banner: Difference between revisions
don't use Module:Middleclass
(add category sort keys) |
(don't use Module:Middleclass) |
||
Line 4:
-- Initialise necessary modules.
require('Module:No globals')
local newFileLink = require('Module:File link').new
local effectiveProtectionLevel = require('Module:Effective protection level')._main
Line 71 ⟶ 70:
--------------------------------------------------------------------------------
local Protection =
Protection.__index = Protection
Protection.supportedActions = {
Line 88:
}
function Protection
-- Set action
if not args.action then
elseif
else
error(string.format(
Line 105 ⟶ 106:
-- Set level
if
-- Lump titleblacklisted pages in with template-protected pages,
-- since templateeditors can do both.
elseif not
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
end
Line 119 ⟶ 120:
if args.expiry then
if cfg.indefStrings[args.expiry] then
elseif type(args.expiry) == 'number' then
else
end
end
Line 129 ⟶ 130:
-- Set reason
if args[1] then
if
error('reasons cannot contain the pipe character ("|")', 0)
end
Line 137 ⟶ 138:
-- Set protection date
if args.date then
end
-- Set banner config
do
local configTables = {}
if cfg.banners[
configTables[#configTables + 1] = cfg.banners[
end
if cfg.defaultBanners[
configTables[#configTables + 1] = cfg.defaultBanners[
configTables[#configTables + 1] = cfg.defaultBanners[
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(
for j, t in ipairs(configTables) do
if t[field] then
break
end
Line 161 ⟶ 162:
end
end
return setmetatable(obj, Protection)
end
Line 362 ⟶ 364:
--------------------------------------------------------------------------------
local Blurb =
Blurb.__index = Blurb
Blurb.bannerTextFields = {
Line 372 ⟶ 375:
}
function Blurb
return setmetatable({
▲ self._cfg = cfg
_cfg = cfg,
}, Blurb)
end
Line 679 ⟶ 684:
--------------------------------------------------------------------------------
local BannerTemplate =
BannerTemplate.__index = BannerTemplate
function BannerTemplate
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
else
-- If an image filename isn't specified explicitly in the banner config,
Line 703 ⟶ 710:
-- Fully protected modules and templates get the special red "indef"
-- padlock.
else
-- Deal with regular protection types.
local images =
if images[action] then
if images[action][level] then
elseif images[action].default then
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
Line 742 ⟶ 750:
--------------------------------------------------------------------------------
local Banner =
Banner.__index = Banner
function Banner
return setmetatable(obj, Banner)
end
Line 775 ⟶ 785:
--------------------------------------------------------------------------------
local Padlock =
Padlock.__index = Padlock
function Padlock
local obj = BannerTemplate.
or cfg.padlockPositions.default
or '55px'
return setmetatable(obj, Padlock)
end
Line 821 ⟶ 833:
-- Initialise the protection object and check for errors
local protectionObjCreated, protectionObj = pcall(
Protection.new,
args,
cfg,
Line 842 ⟶ 854:
-- Initialise the blurb object
local blurbObj = Blurb
local ret = {}
Line 850 ⟶ 862:
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
)
end
|