Difference between revisions 51766 and 51767 on wikimaniawiki

-- This module implements {{documentation}}.

----------------------------------------------------------------------------
-- Configuration
----------------------------------------------------------------------------

-- Here you can set the values of the parameters and messages used in this module, so that it
-- can be easily ported to other wikis.
(contracted; show full)
cfg.mainDivClasses = 'template-documentation iezoomfix' -- The CSS classes added to the main HTML "div" tag.
cfg.sandboxSubpage = 'sandbox' -- The name of the template subpage typically used for sandboxes.
cfg.sandboxNoticeTemplate = 'template sandbox notice' -- The name of the template to display at the top of sandbox pages.
cfg.sandboxNoticeLivepageParam = 1 -- The parameter of the sandbox notice template to send the cfg.livepageArg to.

cfg.protectionTemplate = 'pp-template' -- The name of the template that displays the protection icon (a padlock on enwiki).
cfg.protectionTemplateArgs = {docusage = 'yes'} -- Any arguments to send to the protection template.

-- Display settings
-- The following settings configure the values displayed by the module.

cfg.sandboxLinkDisplay = 'sandbox'

----------------------------------------------------------------------------
(contracted; show full)			.css('clear', 'both')
			.done()
		.wikitext(frame:expandTemplate{title = sandboxNoticeTemplate, args = {[cfg.sandboxNoticeLivepageParam] = args[cfg.livepageArg]}})
	return tostring(notice)
end

function p.protectionTemplate()
	
iflocal protectionTemplate = cfg.protectionTemplate
	if not (protectionTemplate and currentTitle.namespace == 10) then -- W
		-- Don't display the protection template if we are not in the template namespace.
		return nil
	end
	local frame = mw.getCurrentFrame()


			local function getProtectionLevel(protectionType)
				-- Gets the protection level for the current page.
				local level = frame:callParserFunction('PROTECTIONLEVEL', protectionType)
				if level ~= '' then
					return level
				else
					return nil -- The parser function returns the blank string if there is no match.
				end
			end


			if getProtectionLevel('move') == 'sysop' or getProtectionLevel('edit') then
				-- The page is full-move protected, or full, template, or semi-protected.
				return frame:expandTemplate{title = 'pp-tprotectionTemplate', args = {docusage = 'yes'}}
		endcfg.protectionTemplateArgs}
	end
	return nil
end

p.startBox = makeInvokeFunc('_startBox')

function p._startBox(args)
(contracted; show full)	if subpage == cfg.sandboxSubpage or subpage == 'testcases' then
		return currentTitle.baseText
	else
		return currentTitle.text
	end
end

return p