Module:EnCours

De Adadov.net wiki
Documentation icon Documentation Module[voir] [éditer] [historique] [purger]

Ce module implémente {{Modèle:EnCours}}

local documentation = require('Module:Documentation').main
local categoryHandler = require('Module:Category handler').main
 
local p = {}

local function getType()
	local title = tostring(mw.title.getCurrentTitle())
	if string.match(title, "doc") then
		type = "doc"
	else
		type = "std"
	end
 
	p.type = type
 
	return type
end	

function p.showType()
	local type = p.getType()
	print(type)
	return type
end
 
function p.showTitle()
	print(tostring(mw.title.getCurrentTitle()))
end

function p.html(frame) 
	local img = "[[Image:WorkInProgress.png|70px]]"
	local auteurName, auteur = ""
	local lastedit = "'' Dernière édition : '''"..frame.args.lastedit.."''' ''"
	
	if frame.args.auteur then
		auteurName = frame.args.auteur
	end

	if auteurName == "" then 
		auteur = "'' Auteur / Editeur : '''Inconnu''' ''"
	else
		if frame:getParent().args.nolink then
			auteur = "'' Auteur / Editeur : '''"..auteurName.."''' ''"
		else
			auteur = "'' Auteur / Editeur : '''[[Utilisateur:"..auteurName.."|"..auteurName.."]]''' ''"
		end
	end


	local textInfo = [[Le présent article est actuellement en cours de rédaction ou de modification.<br />
	Adressez-vous à la personne en charge pour toute proposition ou modification.]]

	local root = mw.html.create()
	root
		:tag('div')
			:addClass('wgTemplateWarning')
			:addClass('redacEnCours')
			:tag('table')
				:attr('align', 'center')
				:tag('caption')
					:cssText('color:red;font-weight:bold;')
					:wikitext('Article en cours de rédaction ou de modification&nbsp;!')
					:done()
				:tag('tr')
					:tag('td')
						:wikitext(img)
						:done()
					:done()
				:tag('tr')
					:tag('td')
						:wikitext(textInfo)
						:done()
					:done()
				:tag('tr')
				:addClass('enCoursInfos')
					:tag('td')
						:attr('align', 'right')
						:wikitext(auteur)
						:done()
					:done()
				:tag('tr')
				:addClass('enCoursInfos')
					:tag('td')
						:attr('align', 'right')
						:wikitext(lastedit)
						:done()
					:done()

    local category = categoryHandler{
        all = '[[Category:Rédaction en cours]]',
        nocat = frame:getParent().args.nocat
    }
    category = category or ''

	return tostring(root)..category
end

return p