Jump to content

Module:Protection banner: Difference between revisions

use new cfg format
(some cleanup)
(use new cfg format)
Line 98: Line 98:
-- Set expiry
-- Set expiry
if args.expiry then
if args.expiry then
if configObj.cfg.indefStrings[args.expiry] then
if configObj.indefStrings[args.expiry] then
self.expiry = 'indef'
self.expiry = 'indef'
elseif type(args.expiry) == 'number' then
elseif type(args.expiry) == 'number' then
Line 121: Line 121:
do
do
self.bannerConfig = {}
self.bannerConfig = {}
local cfg = configObj.cfg
local cfg = configObj
local configTables = {}
local configTables = {}
if cfg.banners[self.action] then
if cfg.banners[self.action] then
Line 167: Line 167:
do
do
local namespace = titleObj.namespace
local namespace = titleObj.namespace
local categoryNamespaces = configObj.cfg.categoryNamespaceKeys
local categoryNamespaces = configObj.categoryNamespaceKeys
nskey = categoryNamespaces[namespace]
nskey = categoryNamespaces[namespace]
if not nskey and namespace % 2 == 1 then
if not nskey and namespace % 2 == 1 then
Line 202: Line 202:
local configOrder = {}
local configOrder = {}
do
do
local reasonsWithNamespacePriority = configObj.cfg.reasonsWithNamespacePriority
local reasonsWithNamespacePriority = configObj.reasonsWithNamespacePriority
local namespaceFirst = reason and reasonsWithNamespacePriority[reason] or false
local namespaceFirst = reason and reasonsWithNamespacePriority[reason] or false
for propertiesKey, t in pairs(properties) do
for propertiesKey, t in pairs(properties) do
Line 271: Line 271:
-- pos field in the property table.
-- pos field in the property table.
--]]
--]]
local cats = configObj.cfg.protectionCategories
local cats = configObj.protectionCategories
local cat
local cat
for i = 1, 2^noActive do
for i = 1, 2^noActive do
Line 300: Line 300:


function Protection:makeExpiryCategory()
function Protection:makeExpiryCategory()
local reasonsWithoutExpiryCheck = self._configObj.cfg.reasonsWithoutExpiryCheck
local reasonsWithoutExpiryCheck = self._configObj.reasonsWithoutExpiryCheck
local expiryCheckActions = self._configObj.cfg.expiryCheckActions
local expiryCheckActions = self._configObj.expiryCheckActions
local cat
local cat
Line 554: Line 554:


function Blurb:_makeImageLinkParameter()
function Blurb:_makeImageLinkParameter()
local imageLinks = self._configObj.cfg.imageLinks
local imageLinks = self._configObj.imageLinks
local action = self._protectionObj.action
local action = self._protectionObj.action
local level = self._protectionObj.level
local level = self._protectionObj.level
Line 587: Line 587:


function Blurb:_makePagetypeParameter()
function Blurb:_makePagetypeParameter()
local pagetypes = self._configObj.cfg.pagetypes
local pagetypes = self._configObj.pagetypes
local namespace = self._titleObj.namespace
local namespace = self._titleObj.namespace
return pagetypes[namespace] or pagetypes.default or error('no default pagetype defined')
return pagetypes[namespace] or pagetypes.default or error('no default pagetype defined')
Line 593: Line 593:


function Blurb:_makeProtectionBlurbParameter()
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._configObj.cfg.protectionBlurbs
local protectionBlurbs = self._configObj.protectionBlurbs
local action = self._protectionObj.action
local action = self._protectionObj.action
local level = self._protectionObj.level
local level = self._protectionObj.level
Line 619: Line 619:


function Blurb:_makeProtectionLevelParameter()
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._configObj.cfg.protectionLevels
local protectionLevels = self._configObj.protectionLevels
local action = self._protectionObj.action
local action = self._protectionObj.action
local level = self._protectionObj.level
local level = self._protectionObj.level
Line 767: Line 767:


-- Deal with regular protection types.
-- Deal with regular protection types.
local images = self._configObj.cfg.images
local images = self._configObj.images
if images[action] then
if images[action] then
if images[action][level] then
if images[action][level] then
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.