Modul:Foundationclass/config

Permanently protected module
IMT HilfeWiki - das Wiki
Documentation icon Module documentation

This module provides data for Module:Foundationclass.

Usage[Quelltext bearbeiten]

local cfg = mw.loadData( 'Module:Foundationclass/config' )

local superglobal = mw.loadData( 'Module:Foundationclass/globalconfig' )

local form = {
	enable = true, -- Do you want to create a form for this class? Note: When you don't want to have a form _page_, but need this to be a part of another form (as a holds-template form), set this to true!
	name = '',	-- The name of the form, i.e. the form will be placed an page [[Form:Formname]]. If you don't need an actual form page, leave this empty (e.g. if this is a prot of another form as holds-template or such).
	teaserText = '',	-- This is the text displayed on the form:name page (before you see the actual form))
	typeCreateLink = 'none',	-- This field lets you choose, what kind of object create link is provided to the user on the form page: is there none, a formlink, or a forminput field? possible values are: 'none' (default), 'forminput', 'formlink'
	createInfotext = '', -- This is the short text that appears right above the input field. Short being the important part. Please limit yourself to a short sentence.
	createInputPlaceholder = '',	-- Placeholder text that is shwon in the form create input field
	createInputQueryString = '',	-- You can use this option to pass information to the form; this information generally takes the form of ''templateName[fieldName]=value''. It should look like a typical URL query string; an example would be "query string=namespace=User&User[Is_employee]=yes".
	createLinkPageName = '',	-- With this, you can have the name of the page created by the form to be set automatically. You can use any of the parameters ''<template-name[field-name]>'' or ''<unique number>''. The latter takes options start=x, unique, random, and a number (length of id string, default 6).
		-- IMPORTANT: If you want to use the one step process with a createLinkPageName, you have to add the output if your class's sfGenerateFormInfoTag() in comments to your form page!!!
			-- this is a workaround for a semantic forms bug. see https://phabricator.wikimedia.org/T123230 for more information
	createLinkQueryString = '',	-- You can use this option to pass information to the form; this information generally takes the form of ''templateName[fieldName]=value''. It should look like a typical URL query string; an example would be "query string=namespace=User&User[Is_employee]=yes".
	createLinkType = 'plain', -- This field lets you choose, what kind of form link is used to link to the form page: is it a plain link or a button (with parameter submission via get or post), possible values are nil, 'plain', 'button', 'post button'
	labelCreate = '',	-- label for create entity
	labelEdit = '',	-- label for edit entity
	headerText = '',	-- this is the text displayed above the form
	notification = '',	-- this notification will be displayed above your form
	sectionList = {},	-- if you want to have hl2 sections of text after the datafields and before the freetext, name them here. Use strings for names of section headlines
	allowsFreeText = false,	-- will the form have a free text field?
	freeTextPreload = nil,	-- when this is set your free text will have a preload=<freeTextPreload> statement. of course only when allowsFreeText is set to true
	buttons = {'save', 'preview', 'changes', 'cancel'},	-- which buttons should appera below the form
	fieldSize = 80,	-- what is the default size= for the form fields
	textareaAttributes = {	-- the defaults for your textarea fields
		cols = 80,
		rows = 4,
		autogrow = true,
		editor = 'wikieditor',	-- other values would be false or 'none'...
	},
	fieldOrder = {
		-- the order in which the form fields appear. NOTE: a parameter not in this list, will not appear in the form!!
		-- YOU HAVE TO FILL THIS TABLE! Put in here all parameters, that are used in the form, even if you have your own sfGenerateForm() implemented using a different table.
		-- Reason: This is also be used in plausibility tests
		'',
	},
}

local global = {
	cargoTable = '',	-- if you use dataStore cargo, name the table here. if you do not name a table, no persistant cargo data will be stored for that class
	category = '',	-- the mediawiki category, the entity is placed into
	delimiter = ',',	-- see to it, that the delimiter is not a character, that will be encoded by mw.text.encode. CargoUtil.store encodes the data for security reasons
	description = '',	-- a short description of the entity. will be displayed on the template documentation page for example
	entityTitle = '',	-- generic title for the entity
	gardeningCategory = superglobal.gardeningCategory,	-- the category, objects with erroneous/inplausible data will be put into
	namespace = '',	-- if you put this entity on a special namespace, name it here. NOTE: You have to be precise. This is case sensitive. But omit the colon.
	smwIsSubobject = false, -- when using datastore smw: is this stored as subobject (and not as normal data)?
	smwUseStorage = true,	-- if you use dataStore smw, set this to true if you actually want persistant smw data to be stored for that class
}

local parameter = {
	-- this is your list of parameters. you put all data here, that you would like to handle
	--	* parameters of your form (and thus your template)
	--		* when you fill td_type, your parameter will be shown on the template documentation page
	--		* when you add the parameter name to form.fieldOrder, it will be added to the form and processed in plausibility tests
	--	* add also data, that you only want to store (omit these from form.fieldOrder and leave the sf table, probably best, to leave td_type unset, too).
	--  * hint: if you need a row in your table as information, add pseudo parameter w/o entry in fieldOrder, w/o sf table, w/o td_type, and w/o cargo/property entries
	name = {
		cardinality = 'single|list',
		cargo_hidden = false, -- takes no value. If set, the field is not listed in either Special:ViewTable or Special:Drilldown, although it is still queriable.
		cargo_size = nil, -- for fields of type "Text", sets the size of this field, i.e. the number of characters; default is 300
		cargo_type = '',
		description = '',
		label = '',
		property_name = '',	-- please use underscores (_) instead of spaces
		property_type = '', -- possible values are: Annotation URI, Boolean, Code, Date, Email, Number, Page (default), Quantity, Telephone Number, Temperature, Text, URL
		severity = 'mandatory|suggested',
		sf = {
			--	note: this list is incomplete. see [[Module:SFfield/config]] for a complete list of supported attributes
			--	note also: mandatory, list, property and values are derived form fields "above" this table
			--  IMPORTANT: If you want this to be a regular form parameter, you have to add this table. even, if you leave it empty.
			--  also: keep in mind that a parameter appears in the form only if you add its name to form.fieldOrder above
			cargo_field = '',
			cargo_table = '',
			class = '',
			default = '',
			default_filename = '',
			existing_values_only = true,
			hidden = true,
			image_preview = true,
			input_type = '',
			mapping_cargo_field = '',
			mapping_cargo_table = '',
			mapping_template = '',
			max_values = 0,
			maxlength = 0,
			placeholder = '',
			restricted = '',	-- e.g.: restricted = superglobal.restrictionRole,
			show_on_select = {}, -- takes either a string (in case of input type checkbox) or a table. table must be of format "selected value" : "field shown"
			size = 0,
			unique = true,
			unique_for_category = true,
			unique_for_namespace = true,
			uploadable = true,
			values_dependent_on = '',
			values_from_category = '',
			values_from_namespace = '',
		},
		td_default = '',
		td_type = '',
		values = {},
	},
}

local template = {
	name = 'nameOfYourTemplate',	-- the name of your template. e.g.: your template can be found on the page [[Template:nameOfYourTemplate]]
	templateDocumentationSeeAlso = {'List', 'of', 'similar', 'or', 'related', 'templates'}	-- used in the see also-section of your template documentation
}

return {
	form = form,
	global = global,
	parameter = parameter,
	template = template,
}
Cookies helfen uns bei der Bereitstellung des IMT HilfeWikis. Bei der Nutzung vom IMT HilfeWiki werden die in der Datenschutzerklärung beschriebenen Cookies gespeichert.