Modul:SFfield

This is [[MediaWiki:Tagline]]. Set to <code>display:none</code> by chameleon skin.
Version vom 22. September 2015, 12:25 Uhr von imported>Oetterer
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu:Navigation, Suche
Documentation icon Module documentation[view] [edit] [history] [purge]

This module implements no template . ATM it serves only testing purposes for Module:SFfield/class

Usage

{{#invoke:SFfield|function_name}}

local p = {}
local getArgs = require('Module:Arguments').getArgs
local classSFfield = require('Module:SFfield/class')
local classDebug = require('Module:Debug/class')

function p.printField(frame)
	local name = mw.ustring.lower(frame.args[1] or frame.args.name)
	local field = classSFfield:new(name)
	classSFfield:setDefaultSize(20)
	field:set('input type', 'textarea')
	field:set('hidden')
	field:set('qunique')
	field:set('unique')
	field:set('autogrow', false)
	local field2 = classSFfield:new(name .. '2')
	field2:set('list')
	field2:set('show on select', 'trallalla')
	local field3 = classSFfield:new(name .. '3')
	field3:set('input type', 'dropdown')
	field3:set('show on select', {hallo = 'welt', foo = 'bar'})
	local str = field:render() .. '<br>' .. field2:render() .. '<br>' .. field3:render()
	
	html = mw.html.create('table')
	html:attr('class', 'formtable')
		:node(field:createTr('Field1', 'This is tooltip 1'))
		:newline()
		:node(field2:createTr('Field2', 'This is tooltip 2'))
		:newline()
		:node(field3:createTr('Field3', 'This is tooltip 3'))
		:newline()

	str = str .. '\n' .. classDebug:printLog(3, 'pre') .. '\n'

	return str .. tostring(html)
end

return p