|
|
| (29 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) |
| Zeile 1: |
Zeile 1: |
| p = {} | | local p = {} |
| | |
| local com = require("Modul:Common") | | local com = require("Modul:Common") |
| local dev = require("Modul:Development")
| |
| local str = require("Modul:String")
| |
| local wik = require("Modul:Wiki")
| |
| local mez = require("Modul:Mehrzahl")
| |
| local geo = require("Modul:Geo") | | local geo = require("Modul:Geo") |
| local que = require("Modul:Queries")
| |
| local lfd = require("Modul:LinkFormDatum")
| |
|
| |
|
| local attr_text_anzeige = { | | local fab_common = require("Modul:Faktenbox/Common") |
| ["AbweichendeNamensform"] = "Abw. Namen",
| | local fab_zeilen = require("Modul:Faktenbox/Zeilen") |
| ["AngebotVegetarisch"] = "Vegetarische Speisen",
| | local fab_tabs = require("Modul:Faktenbox/Tabs") |
| ["Ausfuehrung"] = "Ausführung",
| | local fab_tabs_karte = require("Modul:Faktenbox/Tabs/Karte") |
| ["BestandArchivFuerthWiki"] = "Bestand Archiv FürthWiki",
| | local fab_tabs_adressen = require("Modul:Faktenbox/Tabs/Adressen") |
| ["BietetKartenzahlung"] = "Kartenzahlung möglich",
| |
| ["DenkmalstatusBesteht"] = "Denkmalstatus besteht",
| |
| ["GastroBetreiber"] = "Betreiber",
| |
| ["GastroGenre"] = "Genre",
| |
| ["Gewässerquelle"] = "Quelle bzw. Eintritt ins Stadtgebiet",
| |
| ["Gewässermündung"] = "Mündung bzw. Austritt aus Stadtgebiet",
| |
| ["GewässerRegimetyp"] = "Wasserführung",
| |
| ["Gewässerstatus"] = "Status/Lage",
| |
| ["Gewässerstellung"] = "Stellung",
| |
| ["Gewässerursprung"] = "Ursprung",
| |
| ["HatAußenplätze"] = "Außenplätze vorhanden",
| |
| ["HatFassbier"] = "Fassbier-Ausschank",
| |
| ["HatNebenraum"] = "Nebenraum vorhanden",
| |
| ["ISBNnr"] = "ISBN-Nr.",
| |
| ["IstBarrierefrei"] = "Barrierefrei",
| |
| ["Nachfolger"] = "nachher dort",
| |
| ["StatistischerBezirk"] = "Statistischer Bezirk",
| |
| ["StatistischerDistrikt"] = "Statistischer Distrikt",
| |
| ["TeilDesAreals"] = "Teil des Areals",
| |
| ["TeilDesEnsembles"] = "Teil des Ensembles",
| |
| ["TeilDesGebäudeKomplexes"] = "Teil des Gebäude-Komplexes",
| |
| ["Vorgänger"] = "vorher dort"
| |
| }
| |
|
| |
|
| function p.Faktenbox(frame) | | function p.Faktenbox(frame) |
| Zeile 46: |
Zeile 18: |
| -- Basis-Faktenbox-Daten (Klasse/Kategorie/Formular) | | -- Basis-Faktenbox-Daten (Klasse/Kategorie/Formular) |
| -- Kein(e) Klasse/Kategorie/Formular! | | -- Kein(e) Klasse/Kategorie/Formular! |
| local fbdata = p.fbdata(frame) | | local fbdata = fab_common.fbdata_(frame) |
|
| |
|
| -- Tabs einsammeln und zusammenfügen | | -- Tabs einsammeln und zusammenfügen |
| local box = | | local box = |
| "<div class = factbox><tabs>" .. | | "<div class = factbox><tabs>" .. |
| p.bildTab(fbdata) .. | | fab_tabs.bildTab_(fbdata) .. |
| p.kartenTab(fbdata) .. | | fab_tabs_karte.kartenTab_(fbdata) .. |
| p.datenUniversalDatenTab(fbdata) .. | | fab_tabs.universalDatenTab_(fbdata) .. |
| "</tabs></div>" | | "</tabs></div>" |
|
| |
|
| -- Sonstige gemeinsame Dinge anfügen (Klasse, Formular, Kategorien, Wartung, ...) | | -- Sonstige gemeinsame Dinge anfügen (Klasse, Formular, Kategorien, Wartung, ...) |
| box = box .. p.common(fbdata, false) | | box = box .. fab_common.common_(fbdata, false) |
| mw.log("box = " .. box) | | mw.log("box = " .. box) |
|
| |
|
| Zeile 67: |
Zeile 39: |
| end | | end |
|
| |
|
| function p.datenUniversalDatenTab(fbdata)
| | -- wrapper für functions von Modul:Faktenbox/Tabs |
| -- mw.log("datenUniversalTab(fbdata)") | | function p.universalDatenTab(...) return fab_tabs.universalDatenTab_(...) end |
| -- mw.logObject(fbdata)
| | function p.bildTab(...) return fab_tabs.bildTab_(...) end |
| -- Konsolenzeile zum Debuggen (Achtung! Bug in Fehlerbereinigungskonsole! Kann nur 1x ausgeführt werden!):
| | function p.kartenTab(...) return fab_tabs_karte.kartenTab_(...) end |
| -- fab=require("Modul:Faktenbox/Work"); fbdata=p.fbdata{pargs={lat="Bla", Objekt="Häusle", Test="BlaBla"}}; print(p.datenTab(fbdata))
| | function p.getKartenArgs(...) return fab_tabs_karte.getKartenArgs_(...) end |
| local t = ""
| | function p.benennungenTab(...) return fab_tabs.benennungenTab_(...) end |
| local no_show_attr = {
| | function p.adressenTab(...) return fab_tabs_adressen.adressenTab_(...) end |
| ["Bild"] = true,
| | function p.tab(...) return fab_tabs.tab_(...) end |
| ["lat"] = true, ["lon"] = true, ["location"] = true,["locationlist"] = true, ["geojson"] = true,
| |
| ["zoom"] = true, ["popuptitle"] = true, ["popuptext"] = true
| |
| }
| |
| | |
| -- Zusammenbau
| |
| t = t .. "<dl class = 'dataTable'>"
| |
| for a, _ in pairs(fbdata.pargs) do
| |
| if not com.isTrue(no_show_attr[a]) then
| |
| t = t .. p.zeile{attr_name = a, fbdata = fbdata, delimiter = ";"}
| |
| end
| |
| end
| |
| t = t .. "</dl>"
| |
| t = t .. p.faktenboxSemantikBrowsen(fbdata)
| |
| | |
| -- Tab draus machen
| |
| t = p.tab(t, "Daten")
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.bildTab(fbdata, seite) | |
| -- mw.log("bild(fbdata, " .. (seite or "nil") .. ")")
| |
| -- mw.logObject(fbdata.pargs)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.bildTab{pargs={Bild="Erloeserkirche.jpg"}}
| |
| local t = ""
| |
| local beschreibung = que.getValues("Datei:" .. (fbdata.pargs["Bild"] or ""), "Beschreibung")
| |
| local beschreibung = beschreibung[1] or ""
| |
| if not com.isEmpty(fbdata.pargs["Bild"]) and wik.pageexists("Bild:" .. fbdata.pargs["Bild"]) then
| |
| t = t .. '{| class = "factbox_imagetable" border = "0" cellpadding = "0" cellspacing = "0" width = "100%"\n'
| |
| t = t .. '|-\n'
| |
| t = t .. '|[[Bild::Datei:' .. fbdata.pargs["Bild"] .. '|768px|link=' .. (seite or '') .. ']]\n' | |
| if beschreibung ~= "" then
| |
| t = t .. '|-\n'
| |
| t = t .. '|' .. beschreibung .. '\n'
| |
| end
| |
| t = t .. '|}'
| |
| end
| |
| -- Tab draus machen
| |
| t = p.tab(t, "Bild")
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.kartenTab(fbdata)
| |
| -- mw.log("kartenTab(fbdata)")
| |
| -- mw.logObject(fbdata)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- fab=require("Modul:Faktenbox/Work"); fbdata=p.fbdata{pargs={["location"]="Erlanger Straße 11, Fürth, Bayern, Deutschland",Debug="ja"}}; print(p.kartenTab(fbdata))
| |
| -- fab=require("Modul:Faktenbox/Work"); fbdata=p.fbdata{pargs={["Gebäude"]="Erlanger Straße 11;Erlanger Straße 12",Debug="ja"}}; print(p.kartenTab(fbdata))
| |
| t = ""
| |
| if string.find(fbdata.pagename, ";") ~= nil then
| |
| t = "Semikolon im Artikel-/Seitennamen für korrekte Kartendarstellung nicht erlaubt!"
| |
| else
| |
| local args = {
| |
| lat = fbdata.pargs["lat"] or "", location = fbdata.pargs["location"] or "",
| |
| lon = fbdata.pargs["lon"] or "", locationlist = fbdata.pargs["locationlist"] or "",
| |
| geojson = fbdata.pargs["geojson"] or "", zoom = fbdata.pargs["zoom"] or "18", -- 18 ist default-zoom
| |
| Debug = fbdata.pargs["Debug"] or "",
| |
| width = "", height = "", -- passt sich beides automatisch an die Box an
| |
| box = "nein", form = "ja" -- keine eigene Box; Seite hat Formular
| |
| }
| |
| -- Wenn kein geojson-Formular-Wert vorgegeben, prüfen,
| |
| -- ob sich hinter der Artikelseite eine gleichnamige GeoJson-Karte versteckt oder
| |
| -- über Formular-Wert GeoJsonKarte eine Karte aktiviert ist
| |
| if args.geojson == "" then
| |
| if wik.pageexists("GeoJson:" .. fbdata.pagename) or com.isTrue(fbdata.pargs["GeoJsonKarte"]) then
| |
| args.geojson = fbdata.pagename
| |
| end
| |
| end
| |
| -- Verwende Geolokation des Gebäudes, sofern vorhanden und wenn keine location oder locationlist übergeben
| |
| if args.location == "" and args.locationlist == "" then
| |
| local gebaeude = str.splitAndStrip(fbdata.pargs["Gebäude"] or "", ";")
| |
| if #gebaeude > 0 then -- Gebäude angegeben?
| |
| args.locationlist = ""
| |
| local first = true
| |
| for _, g in ipairs(gebaeude) do -- alle Gebäude durchiterieren
| |
| local seite = que.getValues(g, "Seite", true)
| |
| if seite[1] ~= fbdata.pagename then -- Weiterleitung auf sich selbst rausfiltern
| |
| local geolokation = que.getValues(g, "Geolokation", true)
| |
| for _, l in ipairs(geolokation) do -- alle Geolokationen eines Gebäudes durchiterieren
| |
| if first then
| |
| first = false
| |
| else
| |
| args.locationlist = args.locationlist .. ";"
| |
| end
| |
| args.locationlist = args.locationlist .. l
| |
| end
| |
| end
| |
| end
| |
| end
| |
| end
| |
| -- Karte-Vorlage einbinden
| |
| -- mw.logObject(args)
| |
| if (args.lat ~= "" and args.lon ~= "") or args.location ~= "" or args.locationlist ~= "" or args.geojson ~= "" then
| |
| t = fbdata.frame:expandTemplate{title = "Karte", args = args} | |
| end
| |
| end
| |
| -- Tab draus machen
| |
| t = p.tab(t, "Karte")
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end | |
| | |
| function p.benennungenTab(fbdata) | |
| -- mw.log("benennungenTab()")
| |
| -- mw.logObject(fbdata)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.benennungenTab({fullpagename="Engelhardtsteg"})
| |
| -- =p.benennungenTab({fullpagename="Jakob-Henle-Straße"})
| |
| -- =p.benennungenTab({fullpagename="Eichhornstraße"})
| |
| -- =p.benennungenTab({fullpagename="Georg-Brandstätter-Straße"})
| |
| local t = ""
| |
| | |
| -- DB-Abfrage
| |
| local query = "[[-Has subobject::".. fbdata.fullpagename .. "]][[SubObjektTyp::Benennung]]|?Benennung|?Benennungsdatum|?BenanntNach|?Bemerkung|limit=100"
| |
| local ask_result = mw.smw.ask(query)
| |
| -- mw.logObject(ask_result)
| |
| | |
| -- Zeilen zusammenbauen
| |
| local first = true
| |
| if ask_result ~= nil then
| |
| for i, z in ipairs(ask_result) do -- Ergebniszeile durchiterieren
| |
| if not com.isEmpty(z.Benennung) or not com.isEmpty(z.BenanntNach) then
| |
| if first then
| |
| t = t .. "<nowiki></nowiki>\n" -- nötig, warum auch immer, damit erster Listeeintrag richtig gerendert wird
| |
| first = false
| |
| end
| |
| t = t .. "* "
| |
| if z.Benennung ~= nil then
| |
| t = t .. "[[" .. z.Benennung .. "]]"
| |
| end
| |
| if z.Benennung ~= nil and z.BenanntNach ~= nil then
| |
| t = t .. ", "
| |
| end
| |
| if z.BenanntNach ~= nil then
| |
| t = t .. "benannt nach " .. z.BenanntNach | |
| end
| |
| if z.Benennungsdatum ~= nil then
| |
| t = t .. ", " .. z.Benennungsdatum
| |
| end
| |
| if z.Bemerkung ~= nil then
| |
| t = t .. " (" .. z.Bemerkung .. ")"
| |
| end
| |
| t = t .. "\n"
| |
| end
| |
| end
| |
| end
| |
| | |
| -- Tab draus machen
| |
| t = p.tab(t, "Benennungen")
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.adressenTab(fbdata)
| |
| local t = fbdata.frame:expandTemplate{title = 'CommonTabs/Adressen'}
| |
| t = p.tab(t, "Adressen")
| |
| return t
| |
| end
| |
| | |
| function p.zeileKategorieSeite(fbdata, kindex)
| |
| -- mw.log("zeileKategorieSeite(fbdata, " .. (kindex or 1) .. ")")
| |
| -- mw.logObject(fbdata)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.zeileKategorieSeite({fullpagename="fpn",kategorie={"kat1","kat2"},klasse={"kla1","kla2"}}, 2)
| |
| local t = ""
| |
| t = t .. "<dt>[[:Kategorie:" .. fbdata.kategorie[kindex or 1] .. "|" .. fbdata.klasse[kindex or 1] .. "]]</dt><dd>[[Seite::" .. fbdata.fullpagename .. "]]</dd>"
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end | |
| | |
| function p.zeileStrasseHnr(fbdata) | |
| -- mw.log("zeileStrasseHnr(fbdata)")
| |
| -- mw.logObject(fbdata.strasse_hnr)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.zeileStrasseHnr{strasse_hnr={strasse={{name="Erlanger Straße",hausnummer={"11", "13"}},{name="XY Straße",hausnummer={}}},anzahlGebaeude=3}}
| |
| local t = ""
| |
| for is, sh in ipairs(fbdata.strasse_hnr.strasse) do -- Straßen/Hausnummer-Kombis durchiterieren
| |
| t = t .. "<dt>"
| |
| if is > 1 then
| |
| t = t .. is .. ". " -- Numerierungsanzeige "2., "3." usw.
| |
| else
| |
| is = "" -- keine 1, aber 2, 3, ... für weitere Verwendung
| |
| end
| |
| t = t .. "[[Attribut:Straße" .. is .. "|Straße]]"
| |
| if #sh.hausnummer > 0 then
| |
| t = t .. " / " .. "[[Attribut:Hausnummer" .. is .. "|Hausnummer]]" -- nur wenn Hausnummern vorhanden
| |
| end
| |
| t = t .. "</dt><dd>[[Straße" .. is .. "::" .. sh.name .. "]]"
| |
| for ih, h in ipairs(sh.hausnummer) do -- Hausnummern durchiterieren
| |
| local strasse_hnr_ = sh.name .. " " .. h
| |
| if ih > 1 then
| |
| t = t .. "," -- Kommas davor ab 2. Hausnummer
| |
| end
| |
| if wik.pageexists(strasse_hnr_) then -- Link, wenn Seite vorhanden
| |
| t = t .. " [[" .. strasse_hnr_ .. "|" .. h .. "]]"
| |
| else
| |
| t = t .. " " .. h | |
| end
| |
| t = t .. "{{#set:Hausnummer" .. is .. "=" .. h .. "|StraßeHnr=" .. strasse_hnr_ .. "}}"
| |
| end
| |
| t = t .. "</dd>"
| |
| end
| |
| t = t .. "{{#set:AnzahlGebäude=" .. fbdata.strasse_hnr.anzahlGebaeude .. "}}"
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.zeileAktenNr(fbdata)
| |
| -- mw.log("zeileAktenNr(fbdata)")
| |
| -- mw.logObject(fbdata.pargs)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.zeileAktenNr{pargs={AktenNr="D-5-63-000-1464"}}
| |
| local t = ""
| |
| local aktennr = str.splitAndStrip(fbdata.pargs["AktenNr"] or "", ";")
| |
| if #aktennr > 0 then
| |
| t = t .. "<dt>" .. "[[Attribut:AktenNr|Akten-Nr.]]</dt><dd>"
| |
| for i, a in ipairs(aktennr) do
| |
| if i > 1 then
| |
| t = t .. ",<br>"
| |
| end
| |
| t = t .. "{{#queryformlink:form=Abfrage Denkmalschutz|link text=[[AktenNr::" .. a .. "]]|query string=Abfrage Denkmalschutz[AktenNr]=" .. a .. "&_run}}"
| |
| local p = que.getPages("[[:+]][[AktenNr::" .. a .. "]]", true) | |
| t = t .. " (" .. #p .. ")" -- Anzahl der Artikel mit dieser Akten-Nr. in Klammern
| |
| end
| |
| t = t .. "</dd>"
| |
| end
| |
| -- mw.log("t=" .. t)
| |
| return t
| |
| end | |
| | |
| function p.zeileGeokoordinate(fbdata) | |
| -- mw.log("zeileGeokoordinate()")
| |
| -- mw.logObject(fbdata)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- fbdata=p.fbdata{pargs={}}; fbdata.fullpagename="Isaak-Loewi-Straße 1, 3, 5, 7, 9, Liesl-Kießling-Straße 16"; print(p.zeileGeokoordinate(fbdata))
| |
| local t = ""
| |
| local geokoordinate = que.getValues(fbdata.fullpagename, "Geokoordinate", true)
| |
| if #geokoordinate > 0 then
| |
| local attr_text = "Geokoordinate"
| |
| if #geokoordinate > 1 then
| |
| attr_text = attr_text .. "n"
| |
| end
| |
| t = t .. "<dt>[[Attribut:Geokoordinate|" .. attr_text .. "]]</dt><dd>"
| |
| for i, g in ipairs(geokoordinate) do
| |
| if i > 1 then
| |
| t = t .. ",<br>"
| |
| end
| |
| t = t .. geo.osmLink(fbdata.frame, g) | |
| end
| |
| t = t .. "</dd>"
| |
| end
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.zeileDatum(args)
| |
| -- mw.log("zeileDatum(args)")
| |
| -- mw.logObject(args)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.zeileDatum{attr_date="Weihedatum",date="1959/11/15",attr_day="Weihetag",attr_year="Weihejahr"}
| |
| local t = ""
| |
| local date = str.strip(args.date or "")
| |
| if date ~= "" then
| |
| t = t .. "<dt>" .. "[[Attribut:" .. args.attr_date .. "|" .. (args.attr_text or args.attr_date) .. "]]</dt><dd>" | |
| t = t .. lfd.linkFormDate(date, args.attr_date, args.attr_day, args.attr_year)
| |
| t = t .. "</dd>"
| |
| end
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.zeile(args) | |
| -- mw.log("zeile(args)")
| |
| -- mw.logObject(args)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.zeile{attr_name="Vorgänger",attr_text="t",fbdata={pargs={["Vorgänger"]="; v11 , V12 ; v13 (a(b))"}},attr_val="; v1 ; v2, v3 (a(b))",val_prefix="pre",val_postfix="post",exclude_bracket_values=true,val_is_list=true, delimiter=","}
| |
| local t = ""
| |
| -- Attribut-Name/Wert aufbereiten (splitten, in table umwandeln)
| |
| local attr_name = args.attr_name
| |
| local attr_val = args.attr_val or args.fbdata.pargs[attr_name] or {}
| |
| if type(attr_val) ~= "table" then -- Liste in table umwandeln/zerteilen
| |
| if args.delimiter ~= nil then
| |
| attr_val = str.splitAndStrip(attr_val, args.delimiter or ";") | |
| elseif attr_val ~= "" then
| |
| attr_val = { attr_val }
| |
| else
| |
| attr_val = {}
| |
| end
| |
| end
| |
| -- Zeile zusammenbauen
| |
| if #attr_val > 0 then
| |
| -- Attribut-Text ermitteln und in Zeile übernehmen
| |
| local attr_text = args.attr_text or attr_text_anzeige[attr_name] or attr_name
| |
| if #attr_val > 1 then
| |
| attr_text = mez.mehrzahl(attr_text) -- Mehrzahl
| |
| end
| |
| t = t .. "<dt>" .. "[[Attribut:" .. attr_name .. "|" .. attr_text .. "]]</dt>"
| |
| -- Attribut-Werte in Zeile übernehmen
| |
| t = t .. "<dd>"
| |
| if args.val_prefix ~= nil then
| |
| t = t .. args.val_prefix .. " " -- Prefix
| |
| end
| |
| for idx, val in ipairs(attr_val) do -- Werte-Liste
| |
| if idx > 1 then
| |
| t = t .. ", " -- Listen-Kommata
| |
| end
| |
| local val_bracket = ""
| |
| if com.isTrue(args.exclude_bracket_values) then -- Klammer-Text separieren (kein Attribut-Wert)
| |
| local first_bracket = string.find(val, "%(")
| |
| local last_bracket = string.find(val, "%)", -1)
| |
| if first_bracket ~= nil and last_bracket ~= nil and first_bracket > 1 then
| |
| val_bracket = " " .. string.sub(val, first_bracket, last_bracket)
| |
| val = str.strip(string.sub(val, 1, first_bracket - 1))
| |
| end
| |
| end | |
| if mw.smw.getPropertyType(attr_name) == "_wpg" then -- Seiten-Attribute Spezialbehandlung
| |
| t = t .. p.setPageAttr(attr_name, val)
| |
| else
| |
| t = t .. "[[" .. attr_name .. "::" .. val .. "]]"
| |
| end
| |
| t = t .. val_bracket
| |
| end
| |
| if args.val_postfix ~= nil then
| |
| t = t .. " " .. args.val_postfix -- Postfix
| |
| end
| |
| t = t .. "</dd>"
| |
| end
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.faktenboxSemantikBrowsen(fbdata) | |
| -- mw.log("faktenboxSemantikBrowsen(fbdata)")
| |
| -- mw.logObject(fbdata)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.faktenboxSemantikBrowsen{pargs={Bild="Erloeserkirche.jpg"}}
| |
| local t = ""
| |
| t = t .. "<dl class = 'dataTable'>"
| |
| t = t .. "<dt>[[Bild:IconSearch.svg|16px|semantisches Browsen|link=[[Spezial:Durchsuchen/" .. fbdata.fullpagename .. "]]]]</dt>"
| |
| t = t .. "<dd>[[Spezial:Durchsuchen/" .. fbdata.fullpagename .. "|Semantisches Browsen]]</dd>"
| |
| t = t .. "</dl>"
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.common(fbdata, positionscheck)
| |
| -- mw.log("common(fbdata)")
| |
| -- mw.logObject(fbdata)
| |
| -- Konsolenzeile zum Debuggen:
| |
| -- =p.common{formular="Gebäude/Work",klasse={"Gebäude","Kirche"},kategorie={"Gebäude","Kirchen"},strasse_hnr={suspekt=true},positionscheck=true,pargs={Bild="Angie Oeckl.JPG",Ehemals="Ja",DenkmalstatusBesteht="Ja",Stadtteil="Ronhof; Nordstadt ",location="bla"},pagename="Test/Test;Test"}
| |
| local t = ""
| |
| -- Klasse
| |
| if fbdata.klasse ~= nil then
| |
| t = t .. "{{#set:KlassenName=" .. fbdata.klasse[1] .. "}}"
| |
| end
| |
| -- Formular
| |
| if fbdata.formular ~= nil then
| |
| t = t .. "{{#default_form:" .. fbdata.formular .. "}}"
| |
| end
| |
| -- Kategorien
| |
| local ehemals_text = ""
| |
| if com.isTrue(fbdata.pargs["Ehemals"]) then
| |
| ehemals_text = " (ehemals)"
| |
| end
| |
| if fbdata.kategorie ~= nil then
| |
| for _, k in ipairs(fbdata.kategorie) do
| |
| t = t .. "[[Kategorie:" .. k .. ehemals_text .. "]]"
| |
| end
| |
| end
| |
| if com.isTrue(fbdata.pargs["DenkmalstatusBesteht"]) then
| |
| t = t .. "[[Kategorie:Denkmalliste]]"
| |
| end
| |
| local stadtteil = str.splitAndStrip(fbdata.pargs["Stadtteil"] or "", ";")
| |
| for _, s in ipairs(stadtteil) do
| |
| s = str.strip(tostring(s or ""))
| |
| t = t .. "[[Kategorie:" .. s .. "]]"
| |
| end
| |
| -- Wartungs-Kategorien
| |
| if com.isEmpty(fbdata.pargs["Bild"]) then
| |
| if fbdata.kategorie ~= nil then
| |
| t = t .. "[[Kategorie:" .. fbdata.kategorie[1] .. " ohne Bild]]"
| |
| else
| |
| t = t .. "[[Kategorie:Ohne Bild]]"
| |
| end
| |
| elseif not wik.pageexists("Bild:" .. fbdata.pargs["Bild"]) then
| |
| t = t .. "[[Kategorie:Bild nicht gefunden]]"
| |
| end
| |
| if string.find(fbdata.pagename, ";") ~= nil then
| |
| t = t .. "[[Kategorie:Hat Semikolon]]"
| |
| end
| |
| if string.find(fbdata.pagename, "/") ~= nil then
| |
| t = t .. "[[Kategorie:Hat Slash]]"
| |
| end
| |
| if not com.isEmpty(fbdata.strasse_hnr) then
| |
| if fbdata.strasse_hnr.suspekt then
| |
| t = t .. "[[Kategorie:Gebäude mit verdächtiger Straße-Hausnummer-Kombination]]"
| |
| end | |
| end
| |
| if fbdata.positionscheck and (fbdata.pargs["lat"] or "") == "" and (fbdata.pargs["lon"] or "") == "" and
| |
| (fbdata.pargs["location"] or "") == "" and not wik.pageexists("GeoJson:" .. (fbdata.pargs["geojson"] or fbdata.pagename)) and
| |
| fbdata.kategorie ~= nil then
| |
| t = t .. "[[Kategorie:" .. fbdata.kategorie[1] .. ehemals_text .. " ohne Position]]"
| |
| end
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end
| |
| | |
| function p.tab(t, name) | |
| -- mw.log("tab(t)")
| |
| -- mw.logObject(t)
| |
| t = str.strip(t)
| |
| if t ~= "" then
| |
| t = "<tab name = ".. name .. ">" .. t .. "</tab>"
| |
| end
| |
| -- mw.log("t = " .. t)
| |
| return t
| |
| end | |
|
| |
|
| function p.fbdata(frame) | | -- wrapper für functions von Modul:Faktenbox/Zeilen |
| -- mw.log("fbdata(frame)")
| | function p.zeileKategorieSeite(...) return fab_zeilen.zeileKategorieSeite_(...) end |
| -- mw.logObject(frame)
| | function p.zeileStrasseHnr(...) return fab_zeilen.zeileStrasseHnr_(...) end |
| -- Konsolenzeile zum Debuggen:
| | function p.zeileAktenNr(...) return fab_zeilen.zeileAktenNr_(...) end |
| -- =p.fbdata{pargs={a=1}}
| | function p.zeileGeoDaten(...) return fab_zeilen.zeileGeoDaten_(...) end |
| local fbdata = {}
| | function p.zeileDatum(...) return fab_zeilen.zeileDatum_(...) end |
| fbdata.frame, fbdata.pargs = dev.GetFrameAndParentArgs(frame)
| | function p.zeileSemantikBrowsenAbfrage(...) return fab_zeilen.zeileSemantikBrowsenAbfrage_(...) end |
| wik.setPagenames(fbdata)
| | function p.zeile(...) return fab_zeilen.zeile_(...) end |
| -- mw.logObject(fbdata)
| |
| return fbdata
| |
| end | |
|
| |
|
| function p.setPageAttr(name, val)
| | -- wrapper für functions von Modul:Faktenbox/Common |
| local t = ""
| | function p.common(...) return fab_common.common_(...) end |
| if string.find(val, "%[") ~= nil or string.find(val, "<") ~= nil then -- problemtische Wikitext/HTML-Inhalte regulär setzen
| | function p.fbdata(...) return fab_common.fbdata_(...) end |
| t = "[[" .. name .. "::" .. val .. "]]" -- und damit bewusst Verarbeitungsfehler provozieren
| |
| elseif wik.pageexists(val) then -- eine vorhandene Seite regulär setzen
| |
| t = "[[" .. name .. "::" .. val .. "]]"
| |
| else
| |
| val_pre_bracket, val_without_bracket, val_post_bracket = str.bracketSplitAndStrip(val) -- nach Klammern suchen und aufteilen
| |
| if not wik.pageexists(val_without_bracket) then -- Seite auch ohne Klammern nicht vorhanden?
| |
| t = val .. "{{#set:" .. name .. "=" .. val .. "}}" -- ==> kein Link, sondern nur Attribut versteckt setzen
| |
| else
| |
| if val_pre_bracket ~= "" then -- Klammer-Text vor eigentlicher Seite
| |
| t = t .. val_pre_bracket .. " "
| |
| end
| |
| t = t .. "[[" .. name .. "::" .. val_without_bracket .. "]]" -- das eigentliche Attribut-Setzen
| |
| if val_post_bracket ~= "" then -- Klammer-Text nach eigentlicher Seite
| |
| t = t .. " " .. val_post_bracket
| |
| end
| |
| end
| |
| end
| |
| return t
| |
| end | |
|
| |
|
| return p | | return p |