
Verwendung
Das Submodul ist eine Testversion des Moduls Quickbar Ort und nicht für den Produktivbetrieb geeignet. Es dient der Weiterentwicklung des Moduls Quickbar Ort, damit sich Änderungen nicht auf alle Artikel auswirken, die das Modul benutzen.
![]() | Derzeit arbeitet kein Benutzer an diesem Testmodul. Du kannst es für deine Zwecke benutzen. |
Neu- und Weiterentwicklung des Moduls für die {{Quickbar Ort}}.
Testobjekte
Diese Testseite: Inklusive Provinzabfrage. Zeile sollte nicht dargestellt werden, aber die Fehlerkategorie Artikel ohne Objekt auf Wikidata vergeben werden.
Quickbar Ort/Test | |
Einwohnerzahl | |
---|---|
Höhe |
{{#invoke:Quickbar Ort/Test|qb_ort
}}
Europa: Inklusive Provinzabfrage. Zeile sollte nicht dargestellt werden, aber die Fehlerkategorie Artikel ohne Verwaltungseinheit auf Wikidata vergeben werden.
Europa | |
Einwohnerzahl | 744.831.142 (2024) |
---|---|
Höhe |
{{#invoke:Quickbar Ort/Test|qb_ort
|id= Q46
|Namen = Europa
}}
Deutschland: Inklusive Provinzabfrage. Objekt ist ein Staat: Zeile sollte nicht dargestellt werden, aber die Fehlerkategorie Wikidata:Provinzsuche endet bei einem Staat vergeben werden.
Deutschland | |
Einwohnerzahl | 84.358.845 (2022) |
---|---|
Höhe | |
Social Media | , |
![]() ![]() Deutschland |
{{#invoke:Quickbar Ort/Test|qb_ort
|id= Q183
|Namen = Deutschland
}}
Brandenburg: Inklusive Provinzabfrage. Objekt selbst eine Provinz: Zeile sollte nicht dargestellt werden, aber die Fehlerkategorie Wikidata:Provinzsuche endet bei einem Staat vergeben werden.
Brandenburg | |
Einwohnerzahl | 2.449.193 (2013) |
---|---|
Höhe | 0 m |
Social Media | |
![]() ![]() Brandenburg |
{{#invoke:Quickbar Ort/Test|qb_ort
|id= Q1208
|Namen = Brandenburg
}}
Berlin | |
Staat | Deutschland |
---|---|
Einwohnerzahl | 3.782.202 (2023) |
Höhe | 34 m |
Social Media | |
![]() ![]() Berlin |
Berlin: Inklusive Provinzabfrage. Der Ort liegt in keiner Provinz, sondern stellt eine eigene Verwaltungseinheit dar. Damit ist die Angabe des Staates als "Provinz" in der Quickbar die gültige Alternative. Die Fehlerkategorie Wikidata:Provinzsuche endet bei einem Staat sollte nicht vergeben werden. {{#invoke:Quickbar Ort/Test|qb_ort
|id= Q64
|Namen= Berlin
|StaatOK= ja
}}
Kota Kinabalu:
Kota Kinabalu | |
Bundesstaat | Sabah |
---|---|
Einwohnerzahl | 452.058 |
Höhe | 5 m |
Tourist-Info | +60 (0)88 212 121, +60 (0)88 232 121 |
www.sabahtourism.com | |
![]() ![]() Kota Kinabalu |
{{#invoke:Quickbar Ort/Test|qb_ort
|id=Q137271
|Namen= Kota Kinabalu
}}
Kota Kinabalu: (lokale Daten + Test IATA ohne typ „Flughafen“)
Kota Kinabalu | |
Bundesstaat | Sarawak |
---|---|
Einwohnerzahl | 452.058 |
Höhe | 2m |
Tourist-Info | +66 (0)12 345 67 |
www.wikivoyage.org | |
![]() ![]() Kota Kinabalu |
{{#invoke:Quickbar Ort/Test|qb_ort
|id=Q137271
|Namen= Kota Kinabalu
|BILD= [[Bild:Kota Kinabalu City Centre 0001.jpg|300px|Stadtzentrum]]
|Provinz= [[Sarawak]]
|Einwohner= 452.058
|Höhe= 2m
|touriinfotel= +66 12 34567
|touriinfoweb= [http://www.wikivoyage.org www.wikivoyage.org]
|iata= ABC
}}
Kota Kinabalu: (alles abschalten)
Kota Kinabalu | |
![]() ![]() Kota Kinabalu |
{{#invoke:Quickbar Ort/Test|qb_ort
|id=Q137271
|Namen= Kota Kinabalu
|BILD= no
|Provinz= nein
|Einwohner= false
|Höhe= n
|touriinfotel= no
|touriinfoweb= nein
}}
Pirna
Pirna | |
Bundesland | Sachsen |
---|---|
Einwohnerzahl | 39.303 (2023) |
Höhe | 118 m |
Tourist-Info | +49 (0)3501 55 64 46 |
TouristService Pirna | |
Social Media | |
![]() ![]() Pirna |
{{#invoke:Quickbar Ort/Test|qb_ort
|id=Q6477
|TouriInfoWeb= [https://www.pirna.de/pirna-erleben/tourismus/ TouristService Pirna]
|TouriInfoTel= +49 (0)3501 556446]
}}
Bergamo: (spezielle Location Map in der Modul:Quickbar Ort/Locmaps)
Bergamo | |
Region | Lombardei |
---|---|
Einwohnerzahl | 119.534 (2023) |
Höhe | 249 m |
Social Media | |
![]() ![]() Bergamo |
{{#invoke:Quickbar Ort/Test|qb_ort
|id=Q628
}}
Chania: (spezielle Location Map in der Modul:Quickbar Ort/Locmaps)
Chania | |
Präfektur | Chania |
---|---|
Einwohnerzahl | 54.559 (2021) |
Höhe | 13 m |
![]() ![]() Chania |
{{#invoke:Quickbar Ort/Test|qb_ort
|id=Q182299
}}
- Die obige Dokumentation wurde aus der Seite Modul:Quickbar Ort/Test/Doku eingefügt. (bearbeiten | Versionsgeschichte) Die Kategorien für dieses Modul sollten in der Dokumentation eingetragen werden. Die Interwiki-Links sollten auf Wikidata eingepflegt werden.
- Liste der Unterseiten
--[=[ Quickbar Notruf 2023-10-04 ]=] local yesno = require( 'Modul:Yesno' ) local pnumber = require( 'Module:GetNumber' ) local pstring = require( 'Module:GetString' ) local p856 = require( 'Module:GetP856' ) local images = require( 'Module:GetImage' ) local province = require( 'Module:GetProvince' ) -- returns nil, if both values are equal, otherwise the value -- similar to the SQL function nullif() local function nilIf ( value, equalValue ) if ( value == nil ) then return nil elseif ( tostring ( value ) == tostring ( equalValue ) ) then return nil else return value end end -- returns the first value that is not nil -- similar to the SQL function coalesce() local function coalesce ( value1, value2, value3 ) return value1 or value2 or value3 end local function checkMapObject ( id ) local region = require ( 'Modul:Location map data ' .. id ) if ( region ~= nil ) and ( region.data ~= nil ) then region.data['id'] = id return region else return nil end end local qbOrt = {} function qbOrt.qb_ort ( frame ) -- copying and lowering the given parameters local templateArgs = {} for key,value in pairs ( frame.args ) do templateArgs[string.lower(key)] = value end for key,value in pairs ( frame:getParent().args ) do templateArgs[string.lower(key)] = value end -- variables for the whole quickbar content and the categories local display = '' local categories = '' -- province information are used twice -- variables for saving information local provinceName = '' local provinceCode = '' -- contains some site.infos -- needed as fallback for the parameter "Namen" and the location map local page = {} page = mw.title.getCurrentTitle() -- getting or determining (if needed) the wikidata-ID if templateArgs.id == '' then templateArgs.id = nil end local qbID = nilIf ( nilIf ( templateArgs.id, 'self' ), '' ) or mw.wikibase.getEntityIdForCurrentPage() or '' -- getting object name -- uses WD sitelink and the page name as fallback local destinationName if qbID ~= '' then destinationName = coalesce ( mw.wikibase.getSitelink( qbID, 'dewikivoyage' ), page.text, 'Ort') else destinationName = coalesce ( page.text, 'Ort') end -- determining the country -- (not urgently needed, but if someone wants to develop country- specific quickbars) -- getting from Wikidata, if not provided -- if you want to save processing time, you should provide it -- e.g. in country specific infobox tables local qbIso3166 = templateArgs["iso-3166"] or '' local qbIso3166Class = '' if qbIso3166 == '' then if qbID ~= '' then local wdCountry = mw.wikibase.getBestStatements( qbID, 'P17' ) local wdIso3166 = {} if #wdCountry > 0 then -- there where empty values if wdCountry[1].mainsnak.datavalue ~= nil then wdIso3166 = mw.wikibase.getBestStatements( wdCountry[1].mainsnak.datavalue.value["id"], 'P297' ) if #wdIso3166 > 0 then if wdIso3166[1].mainsnak.snaktype == 'value' then qbIso3166 = string.lower(wdIso3166[1].mainsnak.datavalue.value) qbIso3166Class = ' voy-qb-' .. qbIso3166 else qbIso3166Class = '' end else qbIso3166Class = '' end else qbIso3166Class = '' end end end else qbIso3166Class = ' voy-qb-' .. qbIso3166 end -- DEBUG: showing the parameters -- it was just for development -- display = display .. '<br />Parameter:<br />' .. mw.dumpObject(templateArgs) -- starting the quickbar table display = display .. '<table cellspacing="0" class="voy-qb voy-qb-right voy-qb-ort' .. qbIso3166Class .. '">' -- the main image -- taken from Wikidata, if not provided display = display .. images.GetImage().getMainImageQuickbar ( qbID, coalesce ( templateArgs["bild"], '' ) ) -- heading -- is mandatory, even if you do not provide it, its shown (with the sitename) -- initialising with given heading local qbNamen = coalesce ( templateArgs["namen"], '' ) -- if no heading is provided, get the sitename if qbNamen == '' then qbNamen = destinationName end -- creating the row with the heading local trHeader = mw.html.create ( 'tr' ) trHeader:addClass( 'voy-qb-item' ) trHeader:tag('td') :attr('colspan', 2 ) :addClass('voy-qb-header' ) :wikitext(qbNamen) -- adding it to the quickbar display = display .. tostring ( trHeader ) -- general information: -- an entry is only added when the parameter is used -- if the parameter is empty, the information is fetched from Wikidata -- if the parameter is not empty, the local information is used, but mostly compared Wikidata, and maintenance categories are used -- the parameter with the value "no" deactivates the entry -- province local displayString = '' displayString, provinceCode = province.GetProvince().getProvinceQuickbar ( qbID, coalesce ( templateArgs["provinz"], '' ), coalesce ( templateArgs["provinzlabel"], '' ), coalesce ( templateArgs["staatok"], 'no' ) ) display = display .. displayString -- population display = display .. pnumber.GetNumber().getNumbersWithDateQuickbar ( qbID, 'P1082', coalesce ( templateArgs["einwohner"], '' ) ) -- altitude display = display .. pnumber.GetNumber().getNumbersWithUnitQuickbar ( qbID, 'P2044', nil, 0, coalesce ( templateArgs["höhe"], '' ) ) -- tourist info -- it has two parameters: phone number and webseite -- they can used both or single -- Wikidata-ID of the tourist info local wdTouristInfo = {} local touristInfoID = '' -- tourist info: phone number -- it contains the wiki markup of the whole row local touristInfoPhone = '' local touristInfoWeb = '' -- table row for the entries local trTouristInfo = '' -- displaying only, if its not switched off if ( yesno ( coalesce ( templateArgs["touriinfotel"], '' ), true ) ) then -- trying to find it on Wikidata, if empty if coalesce ( templateArgs["touriinfotel"], '' ) == '' and qbID ~= '' then wdTouristInfo = mw.wikibase.getBestStatements( qbID, 'P2872' ) if #wdTouristInfo > 0 then touristInfoID = wdTouristInfo[1].mainsnak.datavalue.value["id"] end -- Found it on Wikidata? > showing the phone number if touristInfoID ~= '' then touristInfoPhone = pstring.GetString().getStringsQuickbar ( touristInfoID, 'P1329', nil, nil, 'Tourist-Info' ) end -- if provided locally then just showing it elseif coalesce ( templateArgs["touriinfotel"], '' ) ~= '' then -- formatting and linking local cm = require( 'Module:CountryData' ) local lp = require( 'Module:LinkPhone' ) local lpArgs = { phone = templateArgs["touriinfotel"], format = true, isFax = false, isTollfree = false } lpArgs.cc, lpArgs.size = cm.getCountryCode() templateArgs["touriinfotel"] = lp.linkPhoneNumbers( lpArgs ) -- displaying the given info trTouristInfo = mw.html.create ( 'tr' ) trTouristInfo:addClass('voy-qb-item voy-qb-tourist-info' ) :tag('th') :addClass('voy-qb-item-key') :wikitext('Tourist-Info') trTouristInfo:tag('td') :addClass( 'voy-qb-item-value1' ) :wikitext( templateArgs["touriinfotel"] ) touristInfoPhone = tostring ( trTouristInfo ) end -- showing the entry display = display .. touristInfoPhone end -- displaying only, if its not switched off if ( yesno ( coalesce ( templateArgs["touriinfoweb"], '' ), true ) ) then -- if there is a row for the phone number, then no label in the second row local trLabel if touristInfoPhone == '' then trLabel = 'Tourist-Info' else trLabel = '' end -- trying to find it on Wikidata, if empty if coalesce ( templateArgs["touriinfoweb"], '' ) == '' and qbID ~= '' then -- is the WikidataID known already (from above)? if touristInfoID == '' then wdTouristInfo = mw.wikibase.getBestStatements( qbID, 'P2872' ) if #wdTouristInfo > 0 then touristInfoID = wdTouristInfo[1].mainsnak.datavalue.value["id"] end end -- Found it on Wikidata? > showing the phone number if touristInfoID ~= '' then touristInfoWeb = p856.GetP856().getUrlAsLinkWithHostQuickbar ( touristInfoID, nil, trLabel ) end -- if provided just showing it elseif coalesce ( templateArgs["touriinfoweb"], '' ) ~= '' then -- displaying the given info trTouristInfo = mw.html.create ( 'tr' ) trTouristInfo:addClass('voy-qb-item voy-qb-tourist-information' ) :tag('th') :addClass('voy-qb-item-key') :wikitext(trLabel) trTouristInfo:tag('td') :addClass( 'voy-qb-item-value1' ) :wikitext( templateArgs["touriinfoweb"] ) touristInfoWeb = tostring ( trTouristInfo ) end -- showing the entry display = display .. touristInfoWeb end -- adding social media display = display .. pstring.GetString().getSocialMediaQuickbar ( qbID ) -- location map -- the location map is always shown, but you can switch it off if yesno ( coalesce ( templateArgs["karte"], '' ), true ) then -- reading latitude and longitude from Wikidata local breite local laenge breite, laenge = pnumber.GetNumber().getCoordinate( qbID ) -- got coordinates? then creating the map if breite ~= 0 and laenge ~= 0 then -- loading the configuration fopr the location maps local cfgLocmaps = mw.loadData('Modul:Quickbar Ort/Locmaps') provinceCode = string.lower ( coalesce ( provinceCode, '' ) ) -- determining the locmap, starting with the country code local locmapCode = qbIso3166 -- some countries alays use province maps (see Modul:Quickbar_Ort/Locmaps) if cfgLocmaps.LocMapLevel[qbIso3166] ~= nil and provinceCode ~= '' then locmapCode = provinceCode end -- some province maps differ from the 3166 Code if cfgLocmaps.LocMapNoProvince[provinceCode] ~= nil and provinceCode ~= '' then locmapCode = cfgLocmaps.LocMapNoProvince[provinceCode] end -- some province maps are individually wanted although normally the country map is used if cfgLocmaps.ForceProvinceMap[provinceCode] ~= nil and provinceCode ~= '' then locmapCode = cfgLocmaps.ForceProvinceMap[provinceCode] end -- is a map-code given manually in the QB? then if nilIf ( templateArgs["karte"], '' ) ~= nil then locmapCode = templateArgs["karte"] end locmapCode = string.lower ( locmapCode ) -- creating the location map if locmapCode ~= '' then local locMap = require('Modul:Location map') local success, mData = pcall(checkMapObject, locmapCode) -- location map available? if success then -- collecting all parameters local locMapArgs = { args = { map = locmapCode, lat = breite, long = laenge, maptype = 'quickbar', label = '<b>' .. mw.text.trim(mw.ustring.gsub(destinationName, '%s%(.*%)', '' )) .. '</b>' } } -- creating the row and adding to the quickbar local trLocMap = mw.html.create ( 'tr' ) trLocMap:addClass( 'voy-qb-locmap' ) trLocMap:tag('td') :attr('colspan', 2 ) :wikitext(locMap.locationMap(locMapArgs)) display = display .. tostring ( trLocMap ) else categories = categories .. '[[Kategorie:Provinz ohne Location map]]' end end -- if locmapCode ~= '' end -- if breite ~= 0 and laenge ~= 0 end -- if yesno ( coalesce ( templateArgs["karte"], '' ), true ) -- finishing the HTML table display = display .. '</table>' return display .. categories end return qbOrt