<?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-11-07T14:20:21Z</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(&amp;#039;Module:Foundationclass&amp;#039;)&lt;br /&gt;
local ClassDebug = require(&amp;#039;Module:Debug/class&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
-- ****************************************************************&lt;br /&gt;
-- *                         inheritance                          *&lt;br /&gt;
-- ****************************************************************&lt;br /&gt;
local $2 = FoundationClass:subclass(&amp;#039;$1&amp;#039;)&lt;br /&gt;
-- setting class&amp;#039;s configuration data&lt;br /&gt;
$2.static.myConfiguration = mw.loadData(&amp;#039;Module:$1/config&amp;#039;)	-- 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 = &amp;#039;k&amp;#039;})   -- weak table storing all private attributes&lt;br /&gt;
&lt;br /&gt;
-- **************** declaration of public static properties&lt;br /&gt;
-- $2.static.myPropertyModule = require(&amp;#039;Module:extern&amp;#039;)&lt;br /&gt;
-- $2.static.staticProperty = &amp;#039; &amp;#039;&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) .. &amp;#039;: id &amp;#039; .. uid),&lt;br /&gt;
	}&lt;br /&gt;
	_debug(self, 1, &amp;#039; $2: done initializing object &amp;quot;&amp;#039; .. uid ..&amp;#039;&amp;quot;, from &amp;#039; .. 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, &amp;#039;entering $2.static:aStaticMethod() to do something, from &amp;#039; .. 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, &amp;#039;entering $2.static:mySfDynamicFieldAttribute(fieldname, attribute, value), from &amp;#039; .. tostring(self))&lt;br /&gt;
	_debug(self, 2, &amp;#039; with parameters &amp;quot;&amp;#039; .. fieldname .. &amp;#039;&amp;quot;, &amp;quot;&amp;#039; .. attribute .. &amp;#039;&amp;quot; and a &amp;#039; .. type(value) .. &amp;#039; value&amp;#039;)&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 &amp;#039;default&amp;#039; 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 == &amp;#039;this&amp;#039; and attribute == &amp;#039;that&amp;#039; then&lt;br /&gt;
		val = &amp;#039;whatever &amp;#039; .. val&lt;br /&gt;
	end&lt;br /&gt;
	return val	-- this value will be used as new value for field&amp;#039;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) .. &amp;#039;.static&amp;#039;)&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, &amp;#039;entering private _privateMethod() to do something, from &amp;#039; .. 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, &amp;#039;entering $2:addInfobox(), from &amp;#039; .. 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 = &amp;#039;infobox_name&amp;#039;,&lt;br /&gt;
			aboveclass = &amp;#039;objtitle titletext&amp;#039;,&lt;br /&gt;
			headerclass = &amp;#039;headertext&amp;#039;,&lt;br /&gt;
			labelstyle = &amp;#039;width: 30%;&amp;#039;,&lt;br /&gt;
			datastyle = &amp;#039;width: 70%;&amp;#039;,&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(&amp;#039;Module:Infobox&amp;#039;).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, &amp;#039;entering $2:addPageBody(), from &amp;#039; .. tostring(self))&lt;br /&gt;
	_debug(self, 2, &amp;#039; rendering errors and warnings and adding them to output&amp;#039;)&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(&amp;#039;No output yet&amp;#039;)&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, &amp;#039;entering $2:myArgumentProcessing(args) to process coreData, from &amp;#039; .. 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, &amp;#039;entering $2:myDataAdjustments(data) to convert data from data store into data suitable for argument processing, from &amp;#039; .. 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, &amp;#039;entering $2:myPlausibilityTest(args) to test arguments, from &amp;#039; .. 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&amp;#039;s gardening category&lt;br /&gt;
	return false	-- return value will be ignored. but if you add any error, the object&amp;#039;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, &amp;#039;entering $2:myStashAdjustments(stash) to do some minor adjustments on data before storing, from &amp;#039; .. 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 &amp;#039;cargo&amp;#039;, or &amp;#039;smw&amp;#039;&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, &amp;#039;entering $2:method() to do something, from &amp;#039; .. 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>