الفرق بين المراجعتين لصفحة: «وحدة:Protection banner»

من كوبتيكبيديا
اذهب إلى التنقلاذهب الى البحث
ط
تم استيراد 236 مراجعة من en:Module:Protection_banner
Gerges
Gerges (نقاش | مساهمات) (مراجعة واحدة)
ط
كوبتيكبيديا>Dr-Taher
كوبتيكبيديا>Dr-Taher (تم استيراد 236 مراجعة من en:Module:Protection_banner)
ط
سطر ١٦٩: سطر ١٦٩:
end
end
return setmetatable(obj, Protection)
return setmetatable(obj, Protection)
end
function Protection:isUserScript()
-- Whether the page is a user JavaScript or CSS page.
local title = self.title
return title.namespace == 2 and (
title.contentModel == 'javascript' or title.contentModel == 'css'
)
end
end


سطر ١٨٢: سطر ١٧٤:
return self.level ~= '*'
return self.level ~= '*'
end
end
function Protection:shouldShowLock()
-- Whether we should output a banner/padlock
return self:isProtected() and not self:isUserScript()
end
-- Whether this page needs a protection category.
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock


function Protection:isTemporary()
function Protection:isTemporary()
سطر ١٩٦: سطر ١٨٠:


function Protection:makeProtectionCategory()
function Protection:makeProtectionCategory()
if not self:shouldHaveProtectionCategory() then
local cfg = self._cfg
local title = self.title
-- Exit if the page is not protected.
if not self:isProtected() then
return ''
return ''
end
end
local cfg = self._cfg
local title = self.title
-- 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:shouldHaveProtectionCategory()
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(
سطر ٤٠١: سطر ٣٨٦:
if not self._params then
if not self._params then
local parameterFuncs = {}
local parameterFuncs = {}
 
--مضافة
local male = (self._protectionObj.title.namespace == 6
or self._protectionObj.title.namespace == 10
or self._protectionObj.title.namespace == 14)
and 2
or 1
parameterFuncs.CURRENTVERSION    = self._makeCurrentVersionParameter
parameterFuncs.CURRENTVERSION    = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST        = self._makeEditRequestParameter
parameterFuncs.EDITREQUEST        = self._makeEditRequestParameter
سطر ٤١٠: سطر ٤٠٠:
parameterFuncs.INTROFRAGMENT      = self._makeIntroFragmentParameter
parameterFuncs.INTROFRAGMENT      = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE          = self._makePagetypeParameter
parameterFuncs.PAGETYPE          = self._makePagetypeParameter
--مضافة
parameterFuncs.THIS            = self._makeThisParameter
parameterFuncs.PROTECTED          = self._makeProtectedParameter
parameterFuncs.PROTECTIONBLURB    = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONBLURB    = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE    = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONDATE    = self._makeProtectionDateParameter
سطر ٥٦١: سطر ٥٥٤:
or pagetypes.default
or pagetypes.default
or error('no default pagetype defined', 8)
or error('no default pagetype defined', 8)
end
-- مضافة لأجل تانيث وتذكير اسم الإشارة
function Blurb:_MaleParameter()
return (self._protectionObj.title.namespace == 6
or self._protectionObj.title.namespace == 10
or self._protectionObj.title.namespace == 14)
and 2
or 1
end
function Blurb:_makeThisParameter()
mw.log(self:_MaleParameter())
return self._cfg.this[self:_MaleParameter()]
end
function Blurb:_makeProtectedParameter()
return self._cfg.protected[self:_MaleParameter()]
end
end


سطر ٦٥٢: سطر ٦٦٣:


function Blurb:_makeVandalTemplateParameter()
function Blurb:_makeVandalTemplateParameter()
return mw.getCurrentFrame():expandTemplate{
return require('Module:Vandal-m')._main{
title="vandal-m",
self._args.user or self._protectionObj.title.baseText
args={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 not yesno(args.catonly) and (protectionObj.action == 'edit' or
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:shouldShowLock() then
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)
مستخدم مجهول

قائمة التصفح