Modul:Klasse/Work
Aus FürthWiki
Die Dokumentation für dieses Modul kann unter Modul:Klasse/Work/Doku erstellt werden
local p = {}
local com = require("Module:Common")
local str = require("Module:String")
local atr = require("Module:Attribut")
function p.Faktenbox( frame )
local args = frame:getParent().args
local t = p.daten( frame, args )
-- Use preprocess to render the factbox and all contens at once
return frame:preprocess(t)
end
function p.daten(frame, args)
local title = mw.title.getCurrentTitle().text
local t = '<table class="wikitable">'..
'<th>[[FürthWiki:Semantik]]</th>'..
'<th colspan="3">'..'[[KlassenName::'..title..']]</th>'
t=t..'<tr>'..
'<td>[[Attribut:Bild|Bild dieser Klasse]]</td>'
if not com.isEmpty(args.Bild) then
t=t..'<td colspan="3"><div class="ImageLink">[[Datei:'..
args.Bild..'|48px]]</div></td>'
mw.smw.set{["Bild"] = "Datei:" .. args.Bild}
end
t=t..'</tr><tr>'..
'<td>[[Attribut:KlassenVorlage|Vorlage]]</td>'
t=t..'<td colspan="3">[[KlassenVorlage::Vorlage:'..title..']]</td>'
t=t..'</tr><tr>'..
'<td>[[Attribut:KlassenModul|Modul]]</td>'
t=t..'<td colspan="3">[[KlassenModul::Modul:'..title..']]</td>'
t=t..'</tr><tr>'..
'<td>[[Attribut:KlassenKategorie|Kategorie]]</td>'
if not com.isEmpty(args.KlassenKategorie) then
t=t..'<td colspan="3">[[KlassenKategorie::Kategorie:'..args.KlassenKategorie..']]</td>'
end
t=t..'</tr><tr>'..
'<td>[[Attribut:KlassenFormular|Formular]]</td>'
t=t..'<td colspan="3">[[KlassenFormular::Formular:'..title..']]</td>'
t=t..'</tr><tr>'..
'<td>[[Attribut:Suchformular|Suchformular]]</td>'
if not com.isEmpty(args.KlassenKategorie) then
t=t..'<td colspan="2">[[Suchformular::Abfrage_'..args.KlassenKategorie..']]</td>'..
'<td>[[Formular:Abfrage_'..args.KlassenKategorie..']]</td>'
end
t=t..'</tr><tr>'..
'<td>[[Attribut:Suchvorlage|Suchvorlage]]</td>'
if not com.isEmpty(args.KlassenKategorie) then
t=t..'<td colspan="2">[[Suchvorlage::Abfrage_'..args.KlassenKategorie..']]</td>'..
'<td>[[Spezial:Abfrage_ausführen/Abfrage_'..args.KlassenKategorie..']]</td>'
end
t=t..'</tr><tr>'..
'<td>[[Attribut:AttributListe|AttributListe]]</td>'
if not com.isEmpty(args.AttributListe) then
t=t..'<td colspan="3">[[AttributListe::'..args.AttributListe..']]</td>'
end
t=t..'<tr>'..
'<td>[[Bild:IconSearch.svg|16px|semantisches Browsen|link=Spezial:Durchsuchen/{{NAMESPACE}}:{{PAGENAME}}]]</td>'..
'<td colspan="3">[[Spezial:Durchsuchen/{{NAMESPACE}}:{{PAGENAME}}|semantisches Browsen]]</td>'..
'</tr>'
t=t..'</table>'
return t
end
function p.getAttrData(klasse)
local attr_data = {}
local query = {"[[Klasse:" .. klasse .. "]]",
"?AttributListe"}
query = mw.smw.ask(query)
if query ~= nil then
local attributliste = query[1]["AttributListe"]
attributliste = str.splitAndStrip(attributliste, ";")
if #attributliste > 0 then
attr_data.list = {}
for i, a in ipairs(attributliste) do
attr_data.list[i] = atr.getAttrAttributes(a, klasse)
attr_data.list[i]["Attribut"] = a
end
end
end
return attr_data
end
return p