Class:Location: Unterschied zwischen den Versionen
Noémi (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Noémi (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| (10 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 9: | Zeile 9: | ||
|global_delimiter=, | |global_delimiter=, | ||
|global_edit_timestamp={{REVISIONTIMESTAMP}} | |global_edit_timestamp={{REVISIONTIMESTAMP}} | ||
|global_autocreate_module= | |global_autocreate_module=1455295484 | ||
|global_autocreate_template= | |global_autocreate_template=1455295484 | ||
|global_autocreate_form= | |global_autocreate_form=1455295484 | ||
|global_autocreate_category= | |global_autocreate_category=1455295484 | ||
|global_autocreate_property= | |global_autocreate_property=1455295484 | ||
|form_enable=Yes | |form_enable=Yes | ||
|form_name=Schauplatz | |form_name=Schauplatz | ||
| Zeile 29: | Zeile 29: | ||
|form_textareaAttributes_autogrow=true | |form_textareaAttributes_autogrow=true | ||
|form_textareaAttributes_editor=wikieditor | |form_textareaAttributes_editor=wikieditor | ||
|form_customization=tab_maindata = { 'name', 'image', 'type', 'incity', 'localization', 'address', 'coordinates', 'residents', 'operator', 'description', }, | |||
|template_name=Location | |template_name=Location | ||
|template_templateDocumentationSeeAlso=City, | |template_templateDocumentationSeeAlso=City, | ||
| Zeile 51: | Zeile 52: | ||
|property=Yes | |property=Yes | ||
|property_name=Has display title | |property_name=Has display title | ||
|property_type=Text | |||
|severity=mandatory | |||
|sf=No | |||
}}{{Classgenerator/parameter | |||
|name=title | |||
|cardinality=single | |||
|description=Der Name für den Kartenmarker | |||
|label=Name | |||
|property=Yes | |||
|property_name=Is titled | |||
|property_type=Text | |property_type=Text | ||
|severity=mandatory | |severity=mandatory | ||
| Zeile 60: | Zeile 71: | ||
|label=Bild | |label=Bild | ||
|property=Yes | |property=Yes | ||
|property_name= | |property_name=uses image | ||
|property_type=Page | |property_type=Page | ||
|severity=suggested | |severity=suggested | ||
| Zeile 72: | Zeile 83: | ||
|name=type | |name=type | ||
|cardinality=single | |cardinality=single | ||
|description=Welchem | |description=Welchem Hauptzweck dient der Schauplatz? Elysium, Gildehaus, etc. Wenn unbekannt, einfach "Sonstiges" auswählen. | ||
PS: Ein Vampir hat üblicherweise keinen Wohnort, sondern eine Zuflucht. Ersteres ist anderen Wesenheiten vorbehalten. Z.B. Menschen. | PS: Ein Vampir hat üblicherweise keinen Wohnort, sondern eine Zuflucht. Ersteres ist anderen Wesenheiten vorbehalten. Z.B. Menschen. | ||
|label=Typ | |label=Typ | ||
| Zeile 91: | Zeile 102: | ||
|label=Stadt | |label=Stadt | ||
|property=Yes | |property=Yes | ||
|property_name= | |property_name=Is located in city | ||
|property_type=Page | |property_type=Page | ||
|severity=suggested | |severity=suggested | ||
| Zeile 99: | Zeile 110: | ||
|existing_values_only=false | |existing_values_only=false | ||
|values_from_category=Städte | |values_from_category=Städte | ||
}}{{Classgenerator/parameter | |||
|name=localization | |||
|cardinality=single | |||
|description=Möchtest du den Schauplatz lieber über eine Adresse oder über Kartenkoordinaten verorten? Letzteres ist genauer, ersteres wesenlich besser für Nutzer zu lesen. | |||
|label=Verortung | |||
|property=No | |||
|severity=mandatory | |||
|sf=Yes | |||
|td_type=line | |||
|values=Adresse, Koordinaten, | |||
|input_type=radiobutton | |||
|default=Adresse | |||
|show_on_select=Adresse=address, Koordinaten=coordinates, | |||
}}{{Classgenerator/parameter | }}{{Classgenerator/parameter | ||
|name=address | |name=address | ||
| Zeile 104: | Zeile 128: | ||
|description=Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt. | |description=Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt. | ||
Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt. | Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt. | ||
Lieber ist uns aber die Angabe einer Adresse. Ist besser lesbar! :) | |||
|label=Adresse | |label=Adresse | ||
|property=Yes | |property=Yes | ||
|property_name=has address | |property_name=has address | ||
|property_type=Text | |property_type=Text | ||
|severity= | |severity=mandatory | ||
|sf=Yes | |sf=Yes | ||
|td_type=line | |td_type=line | ||
| Zeile 121: | Zeile 146: | ||
|property_name=Has geo coordinates | |property_name=Has geo coordinates | ||
|property_type=Text | |property_type=Text | ||
|severity= | |severity=mandatory | ||
|sf=Yes | |sf=Yes | ||
|td_type=line | |td_type=line | ||
| Zeile 127: | Zeile 152: | ||
|center=40.7412551,-73.9940724 | |center=40.7412551,-73.9940724 | ||
|geoservice=googlemaps | |geoservice=googlemaps | ||
|height= | |height=300 | ||
|width= | |width=400 | ||
|zoom=13 | |zoom=13 | ||
}}{{Classgenerator/parameter | }}{{Classgenerator/parameter | ||
| Zeile 144: | Zeile 169: | ||
|placeholder=Personen | |placeholder=Personen | ||
|existing_values_only=false | |existing_values_only=false | ||
|values_from_category= | |mapping_property=Has display title | ||
|values_from_category=Personen | |||
}}{{Classgenerator/parameter | }}{{Classgenerator/parameter | ||
|name=operator | |name=operator | ||
| Zeile 158: | Zeile 184: | ||
|input_type=combobox | |input_type=combobox | ||
|existing_values_only=false | |existing_values_only=false | ||
|values_from_category= | |mapping_property=Has display title | ||
|values_from_category=Personen | |||
}}{{Classgenerator/parameter | }}{{Classgenerator/parameter | ||
|name=description | |name=description | ||
| Zeile 173: | Zeile 200: | ||
|editor=wikieditor | |editor=wikieditor | ||
|rows=10 | |rows=10 | ||
}}{{Classgenerator/parameter | |||
|name=additional_map_marker | |||
|cardinality=single | |||
|description=Neben der Hauptmarkierung die automatisch für den Schauplatz gesetzt werden, können hier noch weitere Kartenmarkierungen gesetzt werden. | |||
|label=Kartenmarkierungen | |||
|property=No | |||
|severity=suggested | |||
|sf=Holds template | |||
|td_type=string | |||
}} | }} | ||
}} | }} | ||
Aktuelle Version vom 16. Februar 2016, 19:50 Uhr
| Class | |
|---|---|
| Title | Location |
| Änderungsdatum | 16.02.2016 19:50:14 |
| Store available | smw |
| Smw class | Location |
| Namespace | MAIN |
| Beschreibt ein Ort im Spiel. Hier können alle namhaften Örtlichkeiten, die keine Städte sind, aufgeführt werden. | |
| Pages | |
| Module | Module:Location |
| Class | Module:Location/class |
| Config | Module:Location/config |
| Template | Template:Location |
| Form | Form:Schauplatz |
| Category | Category:Schauplätze |
| Gardening | Category:Locations with erroneous data |
| Identity | |
| name | Name |
| image | Bild |
| type | Typ |
| incity | Stadt |
| localization | Verortung |
| address | Adresse |
| coordinates | Koordinaten |
| residents | Ansässig |
| operator | Verantwortlich |
| description | Beschreibung |
| additional_map_marker | Kartenmarkierungen |
| displaytitle | Anzeigename |
| title | Name |
| Properties | |
| Text | Bears_the_name |
| Text | Has_address |
| Text | Has_display_title |
| Text | Has_geo_coordinates |
| Text | Has_mainfunction |
| Page | Has_resident |
| Text | Has_short_description |
| Text | Is_identified_by_classengine_through |
| Page | Is_located_in_city |
| Text | Is_member_of_class |
| Page | Is_operated_by |
| Text | Is_titled |
| Page | Uses_image |
Beschreibt ein Ort im Spiel. Hier können alle namhaften Örtlichkeiten, die keine Städte sind, aufgeführt werden.
Class identity
| Parameter | Label | Severity | Cardinality | Description |
|---|---|---|---|---|
| name | Name | mandatory | single | Der Name, die Bezeichnung des Ortes. So präzise aber kurz wie möglich, bitte. |
| image | Bild | suggested | single | Ein Bild für den Schauplatz. Dient der besseren Identifizierung und Assozierung. |
| type | Typ | mandatory | single | Welchem Hauptzweck dient der Schauplatz? Elysium, Gildehaus, etc. Wenn unbekannt, einfach "Sonstiges" auswählen.
PS: Ein Vampir hat üblicherweise keinen Wohnort, sondern eine Zuflucht. Ersteres ist anderen Wesenheiten vorbehalten. Z.B. Menschen. |
| incity | Stadt | suggested | single | Die Stadt, in der der Schauplatz verortet ist. |
| localization | Verortung | mandatory | single | Möchtest du den Schauplatz lieber über eine Adresse oder über Kartenkoordinaten verorten? Letzteres ist genauer, ersteres wesenlich besser für Nutzer zu lesen. |
| address | Adresse | mandatory | single | Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt.
Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt. Lieber ist uns aber die Angabe einer Adresse. Ist besser lesbar! :) |
| coordinates | Koordinaten | mandatory | single | Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt.
Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt. |
| residents | Ansässig | mandatory | list | Namen der Bewohner, Ansässigen, hier tätigen oder häufig hier anzutreffenden Personen. |
| operator | Verantwortlich | suggested | single | Sofern vorhanden, hier den für den Ort Verantwortlichen eintragen (Hüter des Elysiums, Regent, Ladenbesitzer) |
| description | Beschreibung | suggested | single | Eine (kurze) Beschreibung des Schauplatzes mit allen wichtigen Informationen. Im Text kann auf andere Seiten wikitypisch verlinkt werden. |
| additional_map_marker | Kartenmarkierungen | suggested | single | Neben der Hauptmarkierung die automatisch für den Schauplatz gesetzt werden, können hier noch weitere Kartenmarkierungen gesetzt werden. |
| displaytitle | Anzeigename | mandatory | single | Der Name, der als Linktext für die Kapitelseite verwendet wird |
| title | Name | mandatory | single | Der Name für den Kartenmarker |
Data Storage
Semantic properties used in this class: |
|---|
|
Page status
This status may be inaccurate, if you just created pages. In that case, run jobs and clear cache of this page.
| Module:Location | |
|---|---|
| Module:Location/doc | |
| Module:Location/class | |
| Module:Location/class/doc | |
| Module:Location/config | |
| Module:Location/config/doc | |
| Template:Location | |
| Template:Location/doc | |
| Form:Schauplatz | |
| Category:Schauplätze | |
| Category:Locations with erroneous data | |
| Property pages for your smw store | |
| Property:Bears_the_name | |
| Property:Has_address | |
| Property:Has_display_title | |
| Property:Has_geo_coordinates | |
| Property:Has_mainfunction | |
| Property:Has_resident | |
| Property:Has_short_description | |
| Property:Is_identified_by_classengine_through | |
| Property:Is_located_in_city | |
| Property:Is_member_of_class | |
| Property:Is_operated_by | |
| Property:Is_titled | |
| Property:Uses_image | |
Page autocreation
All pages present!
Note: Creation of module pages is impossible due to an incompatibility issue.
Page contents
Contents of Module:Location [EDIT] |
|---|
local p = {}
local Class = require('Module:Location/class')
local getArgs = require('Module:Arguments').getArgs
function p.categorize(frame)
return tostring(Class:categorize())
end
function p.categoryPage(frame)
return tostring(Class:categoryPage())
end
function p.explainDataStore(frame)
return tostring(Class:explainDataStore())
end
function p.gardeningCategoryPage(frame)
return tostring(Class:gardeningCategoryPage())
end
function p.sfGenerateForm(frame)
return tostring(Class:sfGenerateForm())
end
function p.sfGenerateFormEntry(frame)
return tostring(Class:sfGenerateFormEntry())
end
function p.sfGenerateFormLink(frame)
return tostring(Class:sfGenerateFormLink())
end
function p.templateDocumentation(frame)
return tostring(Class:templateDocumentation())
end
function p.main(frame)
local args = getArgs(frame)
local me = Class:new(mw.title.getCurrentTitle().prefixedText)
me:initFromArgs(args)
me:storeData()
me:addInfobox()
me:addPageBody()
return me:render()
end
return p
|
Contents of Module:Location/doc [EDIT] |
|---|
{{documentation subpage}}
{{module rating|protected}}{{lua|Module:Arguments|Module:Location/class}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
This module implements template {{tl|Location}}.
== Usage ==
{{pre|
{{tli|Location|''main''}}
}}
It also provides some additional "gateways" to some of [[Module:Location/class]]'s static methods:
{{pre|
{{tli|Location|''categorize''}}
{{tli|Location|''categoryPage''}}
{{tli|Location|''explainDataStore''}}
{{tli|Location|''gardeningCategoryPage''}}
{{tli|Location|''sfGenerateForm''}}
{{tli|Location|''sfGenerateFormEntry''}}
{{tli|Location|''sfGenerateFormLink''}}
{{tli|Location|''templateDocumentation''}}
}}
{{#invoke:Location|categorize}}<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Note: The class engine sets the category "CamNet modules" automatically in function categorize -->
<!-- Categories go here if you wish an additional category to that set in {{module rating}} above automatically. -->
}}</includeonly><h2>Maintenanace notes</h2>
This page was created by [[Module:Classgenerator]] and belongs to [[Class:Location]].
|
Contents of Module:Location/class [EDIT] |
|---|
local FoundationClass = require('Module:Foundationclass')
local ClassDebug = require('Module:Debug/class')
-- ****************************************************************
-- * inheritance *
-- ****************************************************************
local ClassLocation = FoundationClass:subclass('Location')
-- setting class's configuration data
ClassLocation.static.myConfiguration = mw.loadData('Module:Location/config') -- this means, modules on subpages have a / in their names
-- being in a static method, use self.myConfiguration
-- being in a private method, that knows self or in a public method, use self.class.myConfiguration
-- ****************************************************************
-- * properties *
-- ****************************************************************
-- **************** initialization of table for private properties
local _private = setmetatable({}, {__mode = 'k'}) -- weak table storing all private attributes
-- **************** declaration of public static properties
-- ClassLocation.static.myPropertyModule = require('Module:extern')
-- ClassLocation.static.staticProperty = ' '
-- remember the static classes provided by Foundationclass:
-- ClassLocation.globalConfig
-- ClassLocation.myCargoUtil
-- ClassLocation.mySmwUtil
-- ClassLocation.myTableTools
-- ClassLocation.myYesno
-- **************** declaration of (global) private properties
-- for properties you should rather use constructor and _private[self]. this only, if you need a private class property
-- you should, however predeclare private methods here
local _debug -- private method declared later
local _privateMethodAhead -- declaration ahead, so this private method can be used in the constructor and in other private methods
-- ***************************************************************
-- * methods *
-- ***************************************************************
-- **************** declaration of static methods
function ClassLocation:initialize(uid, superhandler)
local _CFG = self.class.myConfiguration
FoundationClass.initialize(self, uid, superhandler)
_private[self] = {
dbg = ClassDebug:new(tostring(self.class) .. ': id ' .. uid),
}
_debug(self, 1, ' ClassLocation: done initializing object "' .. uid ..'", from ' .. tostring(self))
end
-- use use self.myConfiguration to access your configuration in a static method
function ClassLocation.static:aStaticMethod(var)
_debug(self, 1, 'entering ClassLocation.static:aStaticMethod() to do something, from ' .. tostring(self))
end
function ClassLocation.static:mySfDynamicFieldAttribute(fieldname, attribute, value)
_debug(self, 1, 'entering ClassLocation.static:mySfDynamicFieldAttribute(fieldname, attribute, value), from ' .. tostring(self))
_debug(self, 2, ' with parameters "' .. fieldname .. '", "' .. attribute .. '" and a ' .. type(value) .. ' value')
-- function that can process any attribute/value pair just before rendering the semantic forms field
-- usually done, to generate a dynamic 'default' value
-- keep in mind: you can completely disable a form field, if you return true on attribute "disable".
-- however, this causes the parameter to not show at all, neither in the form, nor in processing
local val = value
if fieldname == 'this' and attribute == 'that' then
val = 'whatever ' .. val
end
return val -- this value will be used as new value for field's attribute
end
-- **************** declaration of private methods
-- use self.class.myConfiguration to access your configuration in a public or a private method that is called by a public method
_debug = function (self, level, text)
if _private[self] and _private[self].dbg then
local debugLevel = FoundationClass.globalConfig.debugLevel or self.class.myConfiguration.global.debugLevel
if debugLevel and level <= debugLevel then
_private[self].dbg:log(level, text)
end
else
local debugLevel = FoundationClass.globalConfig.debugLevel or self.myConfiguration.global.debugLevel
if debugLevel and level <= debugLevel then
ClassDebug:log(level, text, tostring(self) .. '.static')
end
end
end
local _privateMethod = function (self)
_debug(self, 1, 'entering private _privateMethod() to do something, from ' .. tostring(self))
end
-- **************** declaration of public methods
-- use self.class.myConfiguration to access your configuration in a public method
function ClassLocation:addInfobox()
_debug(self, 1, 'entering ClassLocation:addInfobox(), from ' .. tostring(self))
if self:goodToGo() then
local _CFG = self.class.myConfiguration
local coreData = self:getCoreData()
local ib_args = {
bodyclass = 'infobox_name',
aboveclass = 'objtitle titletext',
headerclass = 'headertext',
labelstyle = 'width: 30%;',
datastyle = 'width: 70%;',
title = self:getUid(),
above = _CFG.global.entityTitle,
subheader = nil,
label1 = _CFG.parameter.name.label,
data1 = coreData.name and coreData.name or nil,
header1 = nil,
}
self:addOutput(require('Module:Infobox').infobox(ib_args))
return true
end
return false
end
function ClassLocation:addPageBody()
_debug(self, 1, 'entering ClassLocation:addPageBody(), from ' .. tostring(self))
_debug(self, 2, ' rendering errors and warnings and adding them to output')
local frame = mw.getCurrentFrame()
self:addOutput(self:renderErrors())
self:addOutput(self:renderWarnings())
if self:goodToGo() then
self:addOutput('No output yet')
return true
end
return false
end
function ClassLocation:myArgumentProcessing(coreData)
_debug(self, 1, 'entering ClassLocation:myArgumentProcessing(args) to process coreData, from ' .. tostring(self))
-- function that performs some individual transformation args --> coreData
-- 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()
-- hint: for conversion bool values, this is useful: FoundationClass.myYesno
local coreData = coreData
return coreData -- this is your new coreData.
end
function ClassLocation:myDataAdjustments(data)
_debug(self, 1, 'entering ClassLocation:myDataAdjustments(data) to convert data from data store into data suitable for argument processing, from ' .. tostring(self))
-- function that performs some individual transformation datastore data into argument data
-- keep in mind, when using smw data store, that data is indexed by parameter names, not properties
-- hint: for conversion bool values, this is useful: FoundationClass.myYesno
local data = data
return data -- this is your new data table, being passed on to initFromArgs and subsequently to plausibility testing
end
function ClassLocation:myPlausibilityTest(args)
_debug(self, 1, 'entering ClassLocation:myPlausibilityTest(args) to test arguments, from ' .. tostring(self))
-- function that performs the individual plausibility tests
-- note: before you access a field args.fieldname you should check for existance
-- use self:addError(text); this also puts the page in its class's gardening category
return false -- return value will be ignored. but if you add any error, the object's initialization will fail with the error
end
function ClassLocation:myStashAdjustments(stash, storeType)
_debug(self, 1, 'entering ClassLocation:myStashAdjustments(stash) to do some minor adjustments on data before storing, from ' .. tostring(self))
-- 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 {}
-- storeType is the actual method of storage for this call. either 'cargo', or 'smw'
-- hint: for conversion bool values, this is useful: FoundationClass.myYesno
local stash = stash
return stash -- this is your new stash. this will be stored. it has format (fieldname: value)
end
function ClassLocation:method()
_debug(self, 1, 'entering ClassLocation:method() to do something, from ' .. tostring(self))
return true
end
return ClassLocation
|
Contents of Module:Location/class/doc [EDIT] |
|---|
{{documentation subpage}}
{{module rating|protected}}{{lua|Module:Debug/class|Module:Foundationclass|Module:Location/config}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
This is a Class Module. It implements a class in Lua using [[Module:Middleclass]] and the template class [[Module:Foundationclass]]. This class provides methods for PURPOSE.
== Usage ==
{{code|lang=lua|code=
local name = args[1] or args.name or mw.title.getCurrentTitle().rootText
local Class = require('Module:Location/class')
local me = Class:new(mw.title.getCurrentTitle().prefixedText)
me:initFromArgs(args)
me:storeData()
me:addInfobox()
me:addPageBody()
return me:render()
}}
{{#invoke:Location|explainDataStore}}
== Methods ==
=== Constructor ===
==== new(uid, superhandler) ====
Creates a new Object for the class.
;uid
:variable, optional
:used to identify the object
;superhandler
:object of childclass of Foundationclass, optional
:supply the superhandler, if you instanciate this object within another object. the instanciated object will pass errors and warnings to the superhandler and forgo adding the object category
;return
:object, of the class
=== public methods ===
==== addInfobox() ====
If no errors and data is present, adds an infobox to the object's output.
{{small|
;return
:boolean, whether adding was successful or not
}}
==== addPageBody() ====
Adds a page body (all content besides the infobox) to the object's output: Errors and Warnings, sample configuration, statistics, ... Of course, only if there is data.
{{small|
;return
:boolean, whether adding was successful or not
}}
==== myArgumentProcessing(coreData) ====
Performs the individual argument processing in [[#initFromArgs(args)|initFromArgs(args)]] right before inititializing it.
{{small|
;coreData
:table, mandatory
:the core data of the object. the one to process individually before initialization
;return
:table, the new core data array to be used
}}
==== myDataAdjustments(data) ====
Performs a transformation form data (coming from the datastore) into data used for argument processing. This is called by [[#initFromData(data)|initFromData(data)]] (for smw: after property to parameter conversion)
and is directly passed to [[#initFromArgs(args)|initFromArgs(args)]] and subsequently plausibility test.
{{small|
;data
:table, mandatory
:a data table coming directly from the data store
;return
:table, the new data table suiteable for argument processing
}}
==== myPlausibilityTest(args) ====
Performs the individual plausibility tests in [[#initFromArgs(args)|initFromArgs(args)]] before entering the initialization part.
NOTE: The return value will be ignored. If this finds errors, it must add them to the list of errors via [[#addError(errortext)|addError(errortext)]].
{{small|
;args
:table, mandatory
:arguments passed to the template to be checked
;return
:boolean, whether the object is plausible or not.
}}
==== myStashAdjustments(stash, storeType) ====
Performs the adjusts the stash in [[#storeData()|storeData()]] right before storing it.
{{small|
;stash
:table, mandatory
:the array of data to be saved (in the form fieldname: value)
;storeType
:string, mandatory
:type of storage method used with the current call (either 'cargo' or 'swm'). In case you use both stores and your stash adjustment differs with each of this methods
;return
:boolean, the new stash
}}
=== static methods ===
==== ClassLocation:mySfDynamicFieldAttribute(fieldname, attribute, value) ====
For some semantic form fields there are attribute values, that are not static, thus can not be provided at forehand in the [[#Configuration Data|configuration file]]. This method does the trick to adapt them at runtime shortly before the field is rendered.
Essentially: the method checks, if it has a special rule for the pair fieldname:attribute and if so, calculates the new value. if not, the old value is returned. Note, that you can completely disable a form field with this when you
return false on attribute "disable".
{{small|
;fieldname
:string, mandatory
:the form field's name, needed to match current paring to an existing special treatment rule
;attribute
:string, mandatory
:the form field's attribute, needed to match current paring to an existing special treatment rule
;value
:variable, mandatory
:the value, that is already provided in the [[#Configuration Data|configuration file]]. this will be adapted by the method, if there is a special rule for the pair fieldname:attribute.
;return
:string, the value to be used forthwith (which can be the old one or a freshly calculated)
}}
=== private methods ===
==== _debug(self, level, text) ====
Adds output to the internal debug log.
{{small|
;self
:object, me
;level
:int; mandatory
:debug level for the message
;text
:string; mandatory
:debug message text
;return
:void
}}
== Properties ==
=== static ===
See also [[#Static Properties|Static Properties]]
;ClassLocation.myConfiguration
:this is your configuration. It is devided in several section, each a
:table, holds configuration data found in Module:Location/config
::'''WARNING:''' This is a read only table and besides functions ''pairs()'' and ''ipairs()'' nothing else will work on it, especially not the functions of the table library!
<ul>
* form, table, holds data used to create the form. here are some of them:
** formButtons, table, which buttons should be printed at the bottom
** fieldOrder, table, in which order the form fields should appear (note: only fields listed here will be added to the form)
* global, table, holds some global configuration data
* parameter, table, holds all data about all parameter used in the module (be they form only, data store only or normal). The table has the form ''paramname = { table of paramdata }''. The tables for the parameter have data as follows:
** cardinality, string, mandatory, one of singe or list
** cargo_type, string, optional, if the parameter is to be stored in cargo, add the field type here (one of Page, Text, Integer, Float, Date, Datetime, Boolean (which should be provided as 1 or 0), Coordinates, Wikitext, File, String, URL, or Email)
** description, string, mandatory, a description of this parameter
** label, string, mandatory, the label used in the form and the template documentation
** property_name, string, optional, if the parameter is to be stored in smw, add the property name here
** property_type, string, optional, if the parameter is to be stored in smw, add the property type here (defaults to page)
** severity, string, optional, if provided one of mandatory, suggested
** sf, table, optional, used to add more attributes to the semantic forms field. ref [[Module:SFfield/config]] for all possible attributes. Note that the table is of type attribute_name : value. Value can be of type string, integer, boolean, and (in case of 'show on select') a table. Please note, that the attribute name cannot contain a " " (space). Use the underscore instead.
** td_default, string, optional, if you want a default value to be indicated in the template data section on the documentation page, add it here
** td_type, string, optional, if the parameter should be present in the template documentation page, fill this field. all possible values are listed [https://www.mediawiki.org/wiki/Extension:TemplateData#Format here]
** values, table, optional, if you want the possible values to be restricted to a specific set, fill this table
* template, table, holds some data used only in the template
</ul>
;ClassLocation.publicStaticProperty
:type, explanation
;_privateStaticProperty
:type, explanation
=== private ===
Note: all private properties are stored in table ''_private[self]''. _private is a static array that is indexed by ''self'', so the table ''_private[self]'' holds all properties for instance ''self''.
;dbg
:object, my instance of [[Module:Debug/class]] for debugging purposes. only present afer first call of [[#_debug(self, level, text)|_debug(self, level, text)]]
== Configuration Data ==
This class holds its control data in [[Module:{{ROOTPAGENAME}}/config]].
== Inheritance ==
'''Note:''' You still reference those either by self:publicMethod() or ClassLocation:staticMethod() and ClassLocation.staticProperty respectively!
=== Methods ===
{{MediaWiki:Classengine-content-documentation-methods}}
=== Static Properties ===
{{MediaWiki:Classengine-content-documentation-properties}}
{{#invoke:Location|categorize}}<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Note: the class engine sets the categories "CamNet modules" and "Lua class modules" automatically in categorize -->
<!-- Categories go here if you wish an additional category to that set in {{module rating}} above automatically. -->
}}</includeonly><h2>Maintenanace notes</h2>
This page was created by [[Module:Classgenerator]] and belongs to [[Class:Location]].
|
Contents of Module:Location/config [EDIT] |
|---|
-- This is the configuration for ClassLocation. It has been autocreated by Module:Classgenerator.
-- It is strongly suggested, you use the form to make alterations and copy the new configuration an this page!
local superglobal = mw.loadData('Module:Foundationclass/globalconfig')
local global = {
debugLevel = false,
entityTitle = 'Location',
description = 'Beschreibt ein Ort im Spiel. Hier können alle namhaften Örtlichkeiten, die keine Städte sind, aufgeführt werden.',
category = 'Schauplätze',
gardeningCategory = 'Locations with erroneous data',
namespace = nil,
cargoTable = nil,
smwUseStorage = true,
smwIsSubobject = false,
restrictedTo = nil,
delimiter = ',',
}
local form = {
enable = true,
name = 'Schauplatz',
teaserText = 'Bitte gib den Namen des zu erstellenden Schauplatzes ein. Sollte bereits eine entsprechende Seite existieren, wirst du darauf weitergeleitet und kannst sie bearbeiten.',
typeCreateLink = 'forminput',
createInfotext = 'Bitte den Namen des Schauplatzes angeben ',
createInputPlaceholder = nil,
createInputQueryString = nil,
createLinkPageName = nil,
createLinkQueryString = nil,
createLinkType = nil,
labelCreate = 'Schauplatz erstellen',
labelEdit = 'Schauplatz bearbeiten',
headerText = 'Beschreibt ein Ort im Spiel. Hier können alle namhaften Örtlichkeiten, die keine Städte sind, aufgeführt werden.',
notification = nil,
sectionList = nil,
allowsFreeText = true,
freeTextPreload = nil,
buttons = { 'save', 'preview', 'changes', 'cancel', },
fieldSize = 80,
textareaAttributes = { -- the defaults for your textarea fields
cols = 80,
rows = 4,
autogrow = true,
editor = 'wikieditor',
},
fieldOrder = { 'name', 'image', 'type', 'incity', 'localization', 'address', 'coordinates', 'residents', 'operator', 'description', 'additional_map_marker', },
tab_maindata = { 'name', 'image', 'type', 'incity', 'localization', 'address', 'coordinates', 'residents', 'operator', 'description', },
}
local template = {
name = 'Location',
templateDocumentationSeeAlso = { 'City', },
}
local parameter = {
name = {
cardinality = 'single',
description = 'Der Name, die Bezeichnung des Ortes. So präzise aber kurz wie möglich, bitte.',
label = 'Name',
property_name = 'Bears_the_name',
property_type = 'Text',
severity = 'mandatory',
sf = {
input_type = 'text',
placeholder = 'Bezeichnung',
},
td_type = 'line',
},
displaytitle = {
cardinality = 'single',
description = 'Der Name, der als Linktext für die Kapitelseite verwendet wird',
label = 'Anzeigename',
property_name = 'Has_display_title',
property_type = 'Text',
severity = 'mandatory',
},
title = {
cardinality = 'single',
description = 'Der Name für den Kartenmarker',
label = 'Name',
property_name = 'Is_titled',
property_type = 'Text',
severity = 'mandatory',
},
image = {
cardinality = 'single',
description = 'Ein Bild für den Schauplatz. Dient der besseren Identifizierung und Assozierung.',
label = 'Bild',
property_name = 'Uses_image',
property_type = 'Page',
severity = 'suggested',
sf = {
image_preview = true,
input_type = 'text with autocomplete',
uploadable = true,
values_from_category = 'Schauplatzbilder',
},
td_type = 'wiki-file-name',
},
type = {
cardinality = 'single',
description = 'Welchem Hauptzweck dient der Schauplatz? Elysium, Gildehaus, etc. Wenn unbekannt, einfach "Sonstiges" auswählen.\n' ..
'PS: Ein Vampir hat üblicherweise keinen Wohnort, sondern eine Zuflucht. Ersteres ist anderen Wesenheiten vorbehalten. Z.B. Menschen.',
label = 'Typ',
property_name = 'Has_mainfunction',
property_type = 'Text',
severity = 'mandatory',
sf = {
existing_values_only = true,
input_type = 'combobox',
placeholder = 'Bitte auswählen!',
},
td_type = 'line',
values = { 'Zuflucht', 'Elysium', 'Gildehaus', 'Wohnort', 'Besonderer Ort', 'Mundaner Ort', 'Sonstiges', },
},
incity = {
cardinality = 'single',
description = 'Die Stadt, in der der Schauplatz verortet ist.',
label = 'Stadt',
property_name = 'Is_located_in_city',
property_type = 'Page',
severity = 'suggested',
sf = {
existing_values_only = false,
input_type = 'combobox',
values_from_category = 'Städte',
},
td_type = 'line',
},
localization = {
cardinality = 'single',
description = 'Möchtest du den Schauplatz lieber über eine Adresse oder über Kartenkoordinaten verorten? Letzteres ist genauer, ersteres wesenlich besser für Nutzer zu lesen.',
label = 'Verortung',
severity = 'mandatory',
sf = {
default = 'Adresse',
input_type = 'radiobutton',
show_on_select = { Koordinaten = { 'coordinates', }, Adresse = { 'address', }, },
},
td_type = 'line',
values = { 'Adresse', 'Koordinaten', },
},
address = {
cardinality = 'single',
description = 'Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt.\n' ..
'Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt.\n' ..
'Lieber ist uns aber die Angabe einer Adresse. Ist besser lesbar! :)',
label = 'Adresse',
property_name = 'Has_address',
property_type = 'Text',
severity = 'mandatory',
sf = {
input_type = 'text',
},
td_type = 'line',
},
coordinates = {
cardinality = 'single',
description = 'Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt.\n' ..
'Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt.',
label = 'Koordinaten',
property_name = 'Has_geo_coordinates',
property_type = 'Text',
severity = 'mandatory',
sf = {
center = '40.7412551,-73.9940724',
geoservice = 'googlemaps',
height = 300,
input_type = 'googlemaps',
width = 400,
zoom = 13,
},
td_type = 'line',
},
residents = {
cardinality = 'list',
description = 'Namen der Bewohner, Ansässigen, hier tätigen oder häufig hier anzutreffenden Personen.',
label = 'Ansässig',
property_name = 'Has_resident',
property_type = 'Page',
severity = 'mandatory',
sf = {
existing_values_only = false,
input_type = 'tokens',
mapping_property = 'Has display title',
placeholder = 'Personen',
values_from_category = 'Personen',
},
td_type = 'line',
},
operator = {
cardinality = 'single',
description = 'Sofern vorhanden, hier den für den Ort Verantwortlichen eintragen (Hüter des Elysiums, Regent, Ladenbesitzer)',
label = 'Verantwortlich',
property_name = 'Is_operated_by',
property_type = 'Page',
severity = 'suggested',
sf = {
existing_values_only = false,
input_type = 'combobox',
mapping_property = 'Has display title',
values_from_category = 'Personen',
},
td_type = 'wiki-page-name',
},
description = {
cardinality = 'single',
description = 'Eine (kurze) Beschreibung des Schauplatzes mit allen wichtigen Informationen. Im Text kann auf andere Seiten wikitypisch verlinkt werden.',
label = 'Beschreibung',
property_name = 'Has_short_description',
property_type = 'Text',
severity = 'suggested',
sf = {
editor = 'wikieditor',
input_type = 'textarea',
rows = 10,
},
td_type = 'string',
},
additional_map_marker = {
cardinality = 'single',
description = 'Neben der Hauptmarkierung die automatisch für den Schauplatz gesetzt werden, können hier noch weitere Kartenmarkierungen gesetzt werden.',
label = 'Kartenmarkierungen',
severity = 'suggested',
sf = {
holds_template = true,
},
td_type = 'string',
},
}
return {
form = form,
global = global,
parameter = parameter,
template = template,
}
|
Contents of Module:Location/config/doc [EDIT] |
|---|
{{documentation subpage}}
{{module rating|protected}}{{lua|Module:Foundationclass/globalconfig}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
This module provides data for [[Module:Location/class]]
== Usage ==
{{code|lang=lua|code=local cfg = mw.loadData('Module:Location/config')}}
{{#invoke:Location|categorize}}<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Note: The class engine sets the categories "CamNet modules" and "Lua class modules" automatically in function categorize -->
<!-- Categories go here if you wish an additional category to that set in {{module rating}} above automatically. -->
}}</includeonly><h2>Maintenanace notes</h2>
This page was created by [[Module:Classgenerator]] and belongs to [[Class:Location]].
{{ombox| type=content | text = It is strongly advised, to not edit this page but to use [https://{{SERVERNAME}}{{SCRIPTPATH}}/Special:FormEdit/Classgenerator/Class%3ALocation the Classgenerator form] instead! After that, use your new configuration to replace the contents of this page.}} |
Contents of Template:Location [EDIT] |
|---|
{{#invoke:Location|main|{{BASEPAGENAME}}}}<noinclude>
{{documentation}}
</noinclude> |
Contents of Template:Location/doc [EDIT] |
|---|
{{Documentation subpage}}
<!-- Categories go at the bottom of this page. -->
{{#invoke:Location|templateDocumentation}}
{{#invoke:Location|categorize}}<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Note: The class engine sets the category "CamNet templates" automatically in function categorize -->
<!-- ADD CATEGORIES AFTER THIS LINE -->
}}</includeonly><h2>Maintenanace notes</h2>
This page was created by [[Module:Classgenerator]] and belongs to [[Class:Location]].
|
Contents of Form:Schauplatz [EDIT] |
|---|
<noinclude>{{#invoke:Location|sfGenerateFormEntry}}{{#invoke:Location|categorize}}</noinclude>
<includeonly>{{#invoke:Location|sfGenerateForm}}</includeonly>
<!-- Note: The class engine sets category "CamNet forms" automatically in function categorize --> |
Contents of Category:Schauplätze [EDIT] |
|---|
{{#invoke:Location|categoryPage}}{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet" automatically in function categorize --> |
Contents of Category:Locations with erroneous data [EDIT] |
|---|
{{#invoke:Location|gardeningCategoryPage}}{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet entities with erroneous input" automatically in function categorize --> |
All property pages
Contents of Property:Bears_the_name [EDIT] |
|---|
== Description ==
<div class="description-box">Der Name, die Bezeichnung des Ortes. So präzise aber kurz wie möglich, bitte.</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Has_address [EDIT] |
|---|
== Description ==
<div class="description-box">Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt.
Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt.
Lieber ist uns aber die Angabe einer Adresse. Ist besser lesbar! :)</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Has_display_title [EDIT] |
|---|
== Description ==
<div class="description-box">Der Name, der als Linktext für die Kapitelseite verwendet wird</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Has_geo_coordinates [EDIT] |
|---|
== Description ==
<div class="description-box">Bitte die Adresse oder Koordinaten für den Schauplatz angeben. Er wird entsprechend auf der Karte angezeigt.
Wird beides angegeben, wird die Eingabe für Koordinaten bevorzugt.</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Has_mainfunction [EDIT] |
|---|
== Description == <div class="description-box">Welchem Hauptzweck dient der Schauplatz? Elysium, Gildehaus, etc. Wenn unbekannt, einfach "Sonstiges" auswählen. PS: Ein Vampir hat üblicherweise keinen Wohnort, sondern eine Zuflucht. Ersteres ist anderen Wesenheiten vorbehalten. Z.B. Menschen.</div> == Type == * This is an attribute of the datatype [[Has type::Text]]. == Allowed values == The allowed values are: * [[Allows value::Zuflucht]] * [[Allows value::Elysium]] * [[Allows value::Gildehaus]] * [[Allows value::Wohnort]] * [[Allows value::Besonderer Ort]] * [[Allows value::Mundaner Ort]] * [[Allows value::Sonstiges]] {{#invoke:Location|categorize}} <!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Has_resident [EDIT] |
|---|
== Description ==
<div class="description-box">Namen der Bewohner, Ansässigen, hier tätigen oder häufig hier anzutreffenden Personen.</div>
== Type ==
* This is an attribute of the datatype [[Has type::Page]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Has_short_description [EDIT] |
|---|
== Description ==
<div class="description-box">Eine (kurze) Beschreibung des Schauplatzes mit allen wichtigen Informationen. Im Text kann auf andere Seiten wikitypisch verlinkt werden.</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Is_identified_by_classengine_through [EDIT] |
|---|
== Description ==
<div class="description-box">Automatisch hinzugefügt! Wird verwendet, um individuelle Objekte innerhalb der Klasse zu identifizieren.</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Is_located_in_city [EDIT] |
|---|
== Description ==
<div class="description-box">Die Stadt, in der der Schauplatz verortet ist.</div>
== Type ==
* This is an attribute of the datatype [[Has type::Page]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Is_member_of_class [EDIT] |
|---|
== Description ==
<div class="description-box">Automatisch hinzugefügt! Wird verwendet, um Mitglieder dieser Klasse zu finden (funktioniert auch, ohne dass eine Kategorie definiert wird und auch fur subobjects)</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Is_operated_by [EDIT] |
|---|
== Description ==
<div class="description-box">Sofern vorhanden, hier den für den Ort Verantwortlichen eintragen (Hüter des Elysiums, Regent, Ladenbesitzer)</div>
== Type ==
* This is an attribute of the datatype [[Has type::Page]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Is_titled [EDIT] |
|---|
== Description ==
<div class="description-box">Der Name für den Kartenmarker</div>
== Type ==
* This is an attribute of the datatype [[Has type::Text]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |
Contents of Property:Uses_image [EDIT] |
|---|
== Description ==
<div class="description-box">Ein Bild für den Schauplatz. Dient der besseren Identifizierung und Assozierung.</div>
== Type ==
* This is an attribute of the datatype [[Has type::Page]].
== Allowed values ==
No restriction given
{{#invoke:Location|categorize}}
<!-- Note: The class engine sets category "CamNet properties" automatically in function categorize --> |