الفرق بين المراجعتين لصفحة: «وحدة:Protection banner»
اذهب إلى التنقل
اذهب إلى البحث
(add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.) |
ط (مراجعة واحدة) |
||
سطر ١٦٩: | سطر ١٦٩: | ||
end | end | ||
return setmetatable(obj, Protection) | return setmetatable(obj, Protection) | ||
end | end | ||
سطر ١٨٢: | سطر ١٧٤: | ||
return self.level ~= '*' | return self.level ~= '*' | ||
end | end | ||
function Protection:isTemporary() | function Protection:isTemporary() | ||
سطر ١٩٦: | سطر ١٨٠: | ||
function Protection:makeProtectionCategory() | function Protection:makeProtectionCategory() | ||
if not self: | local cfg = self._cfg | ||
local title = self.title | |||
-- Exit if the page is not protected. | |||
if not self:isProtected() then | |||
return '' | return '' | ||
end | end | ||
-- Get the expiry key fragment. | -- Get the expiry key fragment. | ||
سطر ٢١٦: | سطر ٢٠١: | ||
namespaceFragment = 'talk' | namespaceFragment = 'talk' | ||
end | end | ||
-- Define the order that key fragments are tested in. This is done with an | -- Define the order that key fragments are tested in. This is done with an | ||
-- array of tables containing the value to be tested, along with its | -- array of tables containing the value to be tested, along with its | ||
سطر ٣٢٤: | سطر ٣٠٩: | ||
function Protection:isIncorrect() | function Protection:isIncorrect() | ||
local expiry = self.expiry | local expiry = self.expiry | ||
return not self: | return not self:isProtected() | ||
or type(expiry) == 'number' and expiry < os.time() | or type(expiry) == 'number' and expiry < os.time() | ||
end | end | ||
سطر ٣٣٩: | سطر ٣٢٤: | ||
function Protection:makeCategoryLinks() | function Protection:makeCategoryLinks() | ||
local msg = self._cfg.msg | local msg = self._cfg.msg | ||
local ret = {self:makeProtectionCategory()} | local ret = { self:makeProtectionCategory() } | ||
if self:isIncorrect() then | if self:isIncorrect() then | ||
ret[#ret + 1] = makeCategoryLink( | ret[#ret + 1] = makeCategoryLink( | ||
سطر ٦٥٢: | سطر ٦٣٧: | ||
function Blurb:_makeVandalTemplateParameter() | function Blurb:_makeVandalTemplateParameter() | ||
return | return require('Module:Vandal-m')._main{ | ||
self._args.user or self._protectionObj.title.baseText | |||
} | } | ||
end | end | ||
سطر ٨٤٣: | سطر ٨٢٧: | ||
-- protection from some other action, then don't bother displaying anything | -- protection from some other action, then don't bother displaying anything | ||
-- for the other action (except categories). | -- for the other action (except categories). | ||
if | if protectionObj.action == 'edit' or | ||
args.demolevel or | args.demolevel or | ||
not getReachableNodes( | not getReachableNodes( | ||
cfg.hierarchy, | cfg.hierarchy, | ||
protectionObj.level | protectionObj.level | ||
)[effectiveProtectionLevel('edit', protectionObj.title)] | )[effectiveProtectionLevel('edit', protectionObj.title)] | ||
then | then | ||
-- Initialise the blurb object | -- Initialise the blurb object | ||
سطر ٨٥٤: | سطر ٨٣٨: | ||
-- Render the banner | -- Render the banner | ||
if protectionObj: | if protectionObj:isProtected() then | ||
ret[#ret + 1] = tostring( | ret[#ret + 1] = tostring( | ||
(yesno(args.small) and Padlock or Banner) | (yesno(args.small) and Padlock or Banner) |