Modul:Protection banner: Unterschied zwischen den Versionen
use new cfg format
(some cleanup) |
(use new cfg format) |
||
| Zeile 98: | Zeile 98: | ||
-- Set expiry | -- Set expiry | ||
if args.expiry then | if args.expiry then | ||
if configObj | if configObj.indefStrings[args.expiry] then | ||
self.expiry = 'indef' | self.expiry = 'indef' | ||
elseif type(args.expiry) == 'number' then | elseif type(args.expiry) == 'number' then | ||
| Zeile 121: | Zeile 121: | ||
do | do | ||
self.bannerConfig = {} | self.bannerConfig = {} | ||
local cfg = configObj | local cfg = configObj | ||
local configTables = {} | local configTables = {} | ||
if cfg.banners[self.action] then | if cfg.banners[self.action] then | ||
| Zeile 167: | Zeile 167: | ||
do | do | ||
local namespace = titleObj.namespace | local namespace = titleObj.namespace | ||
local categoryNamespaces = configObj | 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 | ||
| Zeile 202: | Zeile 202: | ||
local configOrder = {} | local configOrder = {} | ||
do | do | ||
local reasonsWithNamespacePriority = configObj | 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 | ||
| Zeile 271: | Zeile 271: | ||
-- pos field in the property table. | -- pos field in the property table. | ||
--]] | --]] | ||
local cats = configObj | local cats = configObj.protectionCategories | ||
local cat | local cat | ||
for i = 1, 2^noActive do | for i = 1, 2^noActive do | ||
| Zeile 300: | Zeile 300: | ||
function Protection:makeExpiryCategory() | function Protection:makeExpiryCategory() | ||
local reasonsWithoutExpiryCheck = self._configObj | local reasonsWithoutExpiryCheck = self._configObj.reasonsWithoutExpiryCheck | ||
local expiryCheckActions = self._configObj | local expiryCheckActions = self._configObj.expiryCheckActions | ||
local cat | local cat | ||
| Zeile 554: | Zeile 554: | ||
function Blurb:_makeImageLinkParameter() | function Blurb:_makeImageLinkParameter() | ||
local imageLinks = self._configObj | 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 | ||
| Zeile 587: | Zeile 587: | ||
function Blurb:_makePagetypeParameter() | function Blurb:_makePagetypeParameter() | ||
local pagetypes = self._configObj | 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') | ||
| Zeile 593: | Zeile 593: | ||
function Blurb:_makeProtectionBlurbParameter() | function Blurb:_makeProtectionBlurbParameter() | ||
local protectionBlurbs = self._configObj | 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 | ||
| Zeile 619: | Zeile 619: | ||
function Blurb:_makeProtectionLevelParameter() | function Blurb:_makeProtectionLevelParameter() | ||
local protectionLevels = self._configObj | 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 | ||
| Zeile 767: | Zeile 767: | ||
-- Deal with regular protection types. | -- Deal with regular protection types. | ||
local images = self._configObj | local images = self._configObj.images | ||
if images[action] then | if images[action] then | ||
if images[action][level] then | if images[action][level] then | ||