<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AClassengine-template-module-class-page</id>
	<title>MediaWiki:Classengine-template-module-class-page - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AClassengine-template-module-class-page"/>
	<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=MediaWiki:Classengine-template-module-class-page&amp;action=history"/>
	<updated>2026-04-06T05:33:06Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Verzauberte Welten e.V.</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://www.verzauberte-welten.de/index.php?title=MediaWiki:Classengine-template-module-class-page&amp;diff=4444&amp;oldid=prev</id>
		<title>imported&gt;Oetterer am 21. März 2016 um 07:40 Uhr</title>
		<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=MediaWiki:Classengine-template-module-class-page&amp;diff=4444&amp;oldid=prev"/>
		<updated>2016-03-21T07:40:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local FoundationClass = require('Module:Foundationclass')&lt;br /&gt;
local ClassDebug = require('Module:Debug/class')&lt;br /&gt;
&lt;br /&gt;
-- ****************************************************************&lt;br /&gt;
-- *                         inheritance                          *&lt;br /&gt;
-- ****************************************************************&lt;br /&gt;
local $2 = FoundationClass:subclass('$1')&lt;br /&gt;
-- setting class's configuration data&lt;br /&gt;
$2.static.myConfiguration = mw.loadData('Module:$1/config')	-- this means, modules on subpages have a / in their names&lt;br /&gt;
--   being in a static method, use self.myConfiguration&lt;br /&gt;
--   being in a private method, that knows self or in a public method, use self.class.myConfiguration&lt;br /&gt;
&lt;br /&gt;
-- ****************************************************************&lt;br /&gt;
-- *                          properties                          *&lt;br /&gt;
-- ****************************************************************&lt;br /&gt;
&lt;br /&gt;
-- **************** initialization of table for private properties&lt;br /&gt;
local _private = setmetatable({}, {__mode = 'k'})   -- weak table storing all private attributes&lt;br /&gt;
&lt;br /&gt;
-- **************** declaration of public static properties&lt;br /&gt;
-- $2.static.myPropertyModule = require('Module:extern')&lt;br /&gt;
-- $2.static.staticProperty = ' '&lt;br /&gt;
&lt;br /&gt;
-- remember the static classes provided by Foundationclass:&lt;br /&gt;
-- $2.globalConfig&lt;br /&gt;
-- $2.myCargoUtil&lt;br /&gt;
-- $2.mySmwUtil&lt;br /&gt;
-- $2.myTableTools&lt;br /&gt;
-- $2.myYesno&lt;br /&gt;
&lt;br /&gt;
-- **************** declaration of (global) private properties&lt;br /&gt;
-- for properties you should rather use constructor and _private[self]. this only, if you need a private class property&lt;br /&gt;
-- you should, however predeclare private methods here&lt;br /&gt;
local _debug	-- private method declared later&lt;br /&gt;
local _privateMethodAhead	-- declaration ahead, so this private method can be used in the constructor and in other private methods&lt;br /&gt;
&lt;br /&gt;
-- ***************************************************************&lt;br /&gt;
-- *                           methods                           *&lt;br /&gt;
-- ***************************************************************&lt;br /&gt;
 &lt;br /&gt;
-- **************** declaration of static methods&lt;br /&gt;
function $2:initialize(uid, superhandler)&lt;br /&gt;
	local _CFG = self.class.myConfiguration&lt;br /&gt;
	FoundationClass.initialize(self, uid, superhandler)&lt;br /&gt;
	_private[self] = {&lt;br /&gt;
		dbg = ClassDebug:new(tostring(self.class) .. ': id ' .. uid),&lt;br /&gt;
	}&lt;br /&gt;
	_debug(self, 1, ' $2: done initializing object &amp;quot;' .. uid ..'&amp;quot;, from ' .. tostring(self))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- use use self.myConfiguration to access your configuration in a static method&lt;br /&gt;
function $2.static:aStaticMethod(var)&lt;br /&gt;
	_debug(self, 1, 'entering $2.static:aStaticMethod() to do something, from ' .. tostring(self))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function $2.static:mySfDynamicFieldAttribute(fieldname, attribute, value)&lt;br /&gt;
	_debug(self, 1, 'entering $2.static:mySfDynamicFieldAttribute(fieldname, attribute, value), from ' .. tostring(self))&lt;br /&gt;
	_debug(self, 2, ' with parameters &amp;quot;' .. fieldname .. '&amp;quot;, &amp;quot;' .. attribute .. '&amp;quot; and a ' .. type(value) .. ' value')&lt;br /&gt;
	-- function that can process any attribute/value pair just before rendering the semantic forms field&lt;br /&gt;
	-- usually done, to generate a dynamic 'default' value&lt;br /&gt;
	-- keep in mind: you can completely disable a form field, if you return true on attribute &amp;quot;disable&amp;quot;.&lt;br /&gt;
	-- 	however, this causes the parameter to not show at all, neither in the form, nor in processing&lt;br /&gt;
	local val = value&lt;br /&gt;
	if fieldname == 'this' and attribute == 'that' then&lt;br /&gt;
		val = 'whatever ' .. val&lt;br /&gt;
	end&lt;br /&gt;
	return val	-- this value will be used as new value for field's attribute&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- **************** declaration of private methods&lt;br /&gt;
-- use self.class.myConfiguration to access your configuration in a public or a private method that is called by a public method&lt;br /&gt;
_debug = function (self, level, text)&lt;br /&gt;
	if _private[self] and _private[self].dbg then&lt;br /&gt;
		local debugLevel = FoundationClass.globalConfig.debugLevel or self.class.myConfiguration.global.debugLevel&lt;br /&gt;
		if debugLevel and level &amp;lt;= debugLevel then&lt;br /&gt;
			_private[self].dbg:log(level, text)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local debugLevel = FoundationClass.globalConfig.debugLevel or self.myConfiguration.global.debugLevel&lt;br /&gt;
		if debugLevel and level &amp;lt;= debugLevel then&lt;br /&gt;
			ClassDebug:log(level, text, tostring(self) .. '.static')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local _privateMethod = function (self)&lt;br /&gt;
	_debug(self, 1, 'entering private _privateMethod() to do something, from ' .. tostring(self))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- **************** declaration of public methods&lt;br /&gt;
-- use self.class.myConfiguration to access your configuration in a public method&lt;br /&gt;
function $2:addInfobox()&lt;br /&gt;
	_debug(self, 1, 'entering $2:addInfobox(), from ' .. tostring(self))&lt;br /&gt;
	if self:goodToGo() then&lt;br /&gt;
		local _CFG = self.class.myConfiguration&lt;br /&gt;
		local coreData = self:getCoreData()&lt;br /&gt;
		local ib_args = {&lt;br /&gt;
			bodyclass = 'infobox_name',&lt;br /&gt;
			aboveclass = 'objtitle titletext',&lt;br /&gt;
			headerclass = 'headertext',&lt;br /&gt;
			labelstyle = 'width: 30%;',&lt;br /&gt;
			datastyle = 'width: 70%;',&lt;br /&gt;
			title = self:getUid(),&lt;br /&gt;
			subheader = nil,&lt;br /&gt;
			label1 = _CFG.parameter.name.label,&lt;br /&gt;
			data1 = coreData.name and coreData.name or nil,&lt;br /&gt;
			header1 = nil,&lt;br /&gt;
		}&lt;br /&gt;
		self:addOutput(require('Module:Infobox').infobox(ib_args))&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function $2:addPageBody()&lt;br /&gt;
	_debug(self, 1, 'entering $2:addPageBody(), from ' .. tostring(self))&lt;br /&gt;
	_debug(self, 2, ' rendering errors and warnings and adding them to output')&lt;br /&gt;
	local frame = mw.getCurrentFrame()&lt;br /&gt;
	self:addOutput(self:renderErrors())&lt;br /&gt;
	self:addOutput(self:renderWarnings())&lt;br /&gt;
	if self:goodToGo() then&lt;br /&gt;
		self:addOutput('No output yet')&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function $2:myArgumentProcessing(coreData)&lt;br /&gt;
	_debug(self, 1, 'entering $2:myArgumentProcessing(args) to process coreData, from ' .. tostring(self))&lt;br /&gt;
	-- function that performs some individual transformation args --&amp;gt; coreData&lt;br /&gt;
	-- remember: you can add warnings to your output with self:addWarning(warning). the page, however, will not be put in any gardening category. for that, use self:addError()&lt;br /&gt;
	-- hint: for conversion bool values, this is useful: FoundationClass.myYesno&lt;br /&gt;
	local coreData = coreData&lt;br /&gt;
	return coreData	-- this is your new coreData.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function $2:myDataAdjustments(data)&lt;br /&gt;
	_debug(self, 1, 'entering $2:myDataAdjustments(data) to convert data from data store into data suitable for argument processing, from ' .. tostring(self))&lt;br /&gt;
	-- function that performs some individual transformation datastore data into argument data&lt;br /&gt;
	-- keep in mind, when using smw data store, that data is indexed by parameter names, not properties&lt;br /&gt;
	-- hint: for conversion bool values, this is useful: FoundationClass.myYesno&lt;br /&gt;
	local data = data&lt;br /&gt;
	return data	-- this is your new data table, being passed on to initFromArgs and subsequently to plausibility testing&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function $2:myPlausibilityTest(args)&lt;br /&gt;
	_debug(self, 1, 'entering $2:myPlausibilityTest(args) to test arguments, from ' .. tostring(self))&lt;br /&gt;
	-- function that performs the individual plausibility tests&lt;br /&gt;
	-- note: before you access a field args.fieldname you should check for existance&lt;br /&gt;
	-- use self:addError(text); this also puts the page in its class's gardening category&lt;br /&gt;
	return false	-- return value will be ignored. but if you add any error, the object's initialization will fail with the error&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function $2:myStashAdjustments(stash, storeType)&lt;br /&gt;
	_debug(self, 1, 'entering $2:myStashAdjustments(stash) to do some minor adjustments on data before storing, from ' .. tostring(self))&lt;br /&gt;
	-- function that alters the stash before storing the data. if necessary, you can complate skip storing this stash, if you return false or the empty table {}&lt;br /&gt;
	-- storeType is the actual method of storage for this call. either 'cargo', or 'smw'&lt;br /&gt;
	-- hint: for conversion bool values, this is useful: FoundationClass.myYesno&lt;br /&gt;
	local stash = stash&lt;br /&gt;
	return stash	-- this is your new stash. this will be stored. it has format (fieldname: value)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function $2:method()&lt;br /&gt;
	_debug(self, 1, 'entering $2:method() to do something, from ' .. tostring(self))&lt;br /&gt;
	return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return $2&lt;/div&gt;</summary>
		<author><name>imported&gt;Oetterer</name></author>
	</entry>
</feed>