경고: 이 문서의 오래된 판을 편집하고 있습니다. 이것을 게시하면, 이 판 이후로 바뀐 모든 편집이 사라집니다. 귀하는 로그인되어 있지 않습니다. 이대로 편집하면 귀하의 IP 주소가 편집 기록에 남게 됩니다.스팸 방지 검사입니다. 이것을 입력하지 마세요!-- This module implements {{pp-meta}} and its daughter templates such as -- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}. -- Initialise necessary modules. local class = require('Module:Middleclass').class local mArguments = require('Module:Arguments') local mFileLink = require('Module:File link') local mProtectionLevel = require('Module:Effective protection level') local yesno = require('Module:Yesno') -------------------------------------------------------------------------------- -- ProtectionStatus class -------------------------------------------------------------------------------- local ProtectionStatus = class('ProtectionStatus') function ProtectionStatus:initialize(args, titleObj) -- Set action do local actions = { create = true, edit = true, move = true, autoreview = true } if args.action and actions[args.action] then self._action = args.action else self._action = 'edit' end end -- Set level do local level = mProtectionLevel._main(self._action, titleObj) if level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. level = 'templateeditor' end self._level = level or '*' end -- Set reason self._reason = args.reason -- Set expiry self._expiry = args.expiry end function ProtectionStatus:getAction() return self._action end function ProtectionStatus:getLevel() return self._level end function ProtectionStatus:getReason() return self._reason end function ProtectionStatus:getExpiry() return self._expiry end -------------------------------------------------------------------------------- -- Config class -------------------------------------------------------------------------------- local Config = class('Config') function Config:initialize() self._cfg = mw.loadData('Module:Protection banner/config') end function Config:getBannerConfig(protectionStatusObj) local cfg = self._cfg local action = protectionStatusObj:getAction() local reason = protectionStatusObj:getReason() if cfg.banners[action][reason] then return cfg.banners[action][reason] else return cfg.defaultBanners[action] end end function Config:getConfigTable(key) local whitelisted = { images = true, categories = true, categoryNamespaces = true, pagetypeNamespaces = true, errorCategories = true } if whitelisted[key] then return self._cfg[key] else return nil end end -------------------------------------------------------------------------------- -- Image class -------------------------------------------------------------------------------- local Image = class('Image') -------------------------------------------------------------------------------- -- Blurb class -------------------------------------------------------------------------------- local Blurb = class('Blurb') function Blurb:initialize(bannerConfig) self._config = bannerConfig end -------------------------------------------------------------------------------- -- BannerTemplate class -------------------------------------------------------------------------------- local BannerTemplate = class('BannerTemplate') function BannerTemplate:initialize() end function BannerTemplate:render() end -------------------------------------------------------------------------------- -- Banner class -------------------------------------------------------------------------------- local Banner = BannerTemplate:subclass('Banner') -------------------------------------------------------------------------------- -- Padlock class -------------------------------------------------------------------------------- local Padlock = BannerTemplate:subclass('Padlock') -------------------------------------------------------------------------------- -- Category class -------------------------------------------------------------------------------- local Category = class('Category') function Category:initialize() end function Category:export() if self._categoryName then return string.format( '[[%s:%s]]', mw.site.namespaces[14].name, self._categoryName ) else return '' end end -------------------------------------------------------------------------------- -- ProtectionCategory class -------------------------------------------------------------------------------- local ProtectionCategory = Category:subclass('ProtectionCategory') -------------------------------------------------------------------------------- -- ErrorCategory class -------------------------------------------------------------------------------- local ErrorCategory = Category:subclass('ErrorCategory') -------------------------------------------------------------------------------- -- ExpiryCategory class -------------------------------------------------------------------------------- local ExpiryCategory = Category:subclass('ExpiryCategory') -------------------------------------------------------------------------------- -- ProtectionBanner class -------------------------------------------------------------------------------- local ProtectionBanner = {} function ProtectionBanner._newBannerTemplate(args) -- Makes a new banner template object. This will be a new instance of -- the most suitable subclass of BannerTemplate, e.g. Banner or Padlock. if yesno(args.small) then return Padlock:new(args) else return Banner:new(args) end end function ProtectionBanner.exportToWiki(frame, titleObj) local args = mArguments.getArgs(frame) return ProtectionBanner.exportToLua(args, titleObj) end function ProtectionBanner.exportToLua(args, title) title = title or mw.title.getCurrentTitle() end return ProtectionBanner 편집 요약 가온 위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-동일조건변경허락 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는 가온 위키:저작권 문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요. 또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다. 저작권이 있는 내용을 허가 없이 저장하지 마세요! 취소 편집 도움말 (새 창에서 열림) 이 문서에서 사용한 틀: 모듈:Protection banner/설명문서 (편집)