|
|
(One intermediate revision by the same user not shown) |
Line 138: |
Line 138: |
| root | | root |
| :wikitext(p._getModuleWikitext(args, env)) | | :wikitext(p._getModuleWikitext(args, env)) |
| :wikitext(p.protectionTemplate(env))
| |
| :wikitext(p.sandboxNotice(args, env)) | | :wikitext(p.sandboxNotice(args, env)) |
| :tag('div') | | :tag('div') |
Line 425: |
Line 424: |
| end | | end |
|
| |
|
| function p.protectionTemplate(env)
| |
| -- Generates the padlock icon in the top right.
| |
| -- @env - environment table containing title objects, etc., generated with p.getEnvironment
| |
| -- Messages:
| |
| -- 'protection-template' --> 'pp-template'
| |
| -- 'protection-template-args' --> {docusage = 'yes'}
| |
| local protectionLevels = env.protectionLevels
| |
| if not protectionLevels then
| |
| return nil
| |
| end
| |
| local editProt = protectionLevels.edit and protectionLevels.edit[1]
| |
| local moveProt = protectionLevels.move and protectionLevels.move[1]
| |
| if editProt then
| |
| -- The page is edit-protected.
| |
| return require('Module:Protection banner')._main{
| |
| message('protection-reason-edit'), small = true
| |
| }
| |
| elseif moveProt and moveProt ~= 'autoconfirmed' then
| |
| -- The page is move-protected but not edit-protected. Exclude move
| |
| -- protection with the level "autoconfirmed", as this is equivalent to
| |
| -- no move protection at all.
| |
| return require('Module:Protection banner')._main{
| |
| action = 'move', small = true
| |
| }
| |
| else
| |
| return nil
| |
| end
| |
| end
| |
|
| |
|
| ---------------------------------------------------------------------------- | | ---------------------------------------------------------------------------- |