Siirry sisältöön

Moduuli:Fr:Infobox/Phare

Wikiopistosta

local building = require "Module:Fr:Infobox/Fonctions/Bâtiment"
local lighthouse = require "Module:Fr:Infobox/Fonctions"
local localdata = require "Module:Fr:Infobox/Localdata"
local validate = require "Module:ValidateInfobox"

local function getLocalValueWithDefaultUnit(localdata, paramname, testparams )
	local ret=localdata[paramname] 
	if ret == "-" then
		return "-"
	end
	
	if ret == nil then
		return nil
	end
	
	if 	localdata[paramname .. "_ohita_tarkistus"] == "1"  then
		return ret;
	end


	args= {
		["sisältö"] = ret .."",
		tyyppi = testparams["type"] ,
		["sallitut_yksiköt"] = testparams["allowedunits"],
		malline = testparams["templatename"],
		parametri = testparams["paramname"] ,
		["vakioyksikkö"] = testparams["defaultunit"], 
		virheviesti = testparams["errormessage"],
		minimiarvo = testparams["minvalue"] ,
		maksimiarvo = testparams["maxvalue"],
		ohita_tarkistus = testparams["skiptests"]
	}

	frame=mw.getCurrentFrame();
	ret=frame:expandTemplate{ title = 'Tarkista luku', args = args }
	return ret
end

return 
	{
	maincolor = '#A8D2FF',
	parts =
    	{
		--lighthouse.mainimage('Article à illustrer Phare', 'Defaut 2.svg'),
		lighthouse.mainimage({size='x300px'}),
		lighthouse.title('entete map', {}, 'nimi-muu'),
		{type = 'table', title = "Sijainti", rows = {
			building.adminlocation(),
			building.islandlocation(),
			building.geographiclocation(),
			building.onshoreof(),
			building.protectedarea(),
			},
		},
		{type = 'table', title = "Arkkitehtuuri", rows = {
			building.creator(),
			building.dimensions(),
			building.material(),
			building.colour(),
			{type = 'row', label = 'Korkeus merenpinnasta', value = function()  return  getLocalValueWithDefaultUnit(localdata, 'korkeus merenpinnasta',
				{
					paramname='korkeus merenpinnasta', 
					type='desimaaliluku', 
					allowedunits='m', 
					templatename='Majakka WD', 
					defaultunit='m', 
					errormessage='Esimerkkiarvo: 10 m', 
					minvalue=0,
					maxvalue=100,
					skiptests=11
				} ) end, property = 'P2044', showsource=true},
			building.protection(),
			{type = 'row', label = 'RKY-tunniste', value = 'rky-tunniste', wikidata = {property = 'P4009', urlpattern="http://www.rky.fi/read/asp/r_kohde_det.aspx?KOHDE_ID=$1"}},
			{type = 'row', label = 'Osa kohdetta', value = 'osa kohdetta', wikidata = {property = 'P361'}},
			},
		},
		{type = 'table', title = "Historia", rows = {
			building.construction(),
			{type = 'row', label = 'Otettu käyttöön', value = 'otettu käyttöön', wikidata = { property = 'P729'}, blockers='rakennettu', showsource=true},
			{type = 'row', label = 'Sähköistetty', value = 'sähköistetty', wikidata = {property = 'P793', targetvalue = 'Q1076056', showonlyqualifier = 'P585', showsource=true} },
			{type = 'row', label = 'Kauko-ohjattu', value = 'kauko-ohjattu'},
			{type = 'row', label = 'Automatisoitu', value = 'automatisoitu', wikidata = {property = 'P793', targetvalue = 'Q24410992', showonlyqualifier = 'P585', showsource=true}},
			{type = 'row', label = 'Sammutettu', value = 'sammutettu', property = 'P730', showsource=true},
			building.demolition()
			},
		},
		{type = 'table', title = "Varustus", rows = {
			{type = 'row', label = 'Valon korkeus', value = function()  return  getLocalValueWithDefaultUnit(localdata, 'valonkorkeus',
				{
					paramname='valonkorkeus', 
					type='desimaaliluku', 
					allowedunits='m', 
					templatename='Majakka WD', 
					defaultunit='m', 
					errormessage='Esimerkkiarvo: 10 m', 
					minvalue=0,
					maxvalue=200,
					skiptests=""
				} ) end , wikidata = {property = 'P2923', targetunit = 'm', conjtype = ' ou ', rounding = '1', numval = '2', showsource=true} },
			{type = 'row', label = 'Valonlähde', value = 'valonlähde'},
			{type = 'row', label = 'Valoteho', value = 'valoteho', wikidata = { property = 'P3041', showqualifiers = {'P462'}, showsource=true}},
			{type = 'row', label = 'Valonkanto', value = function()  return  getLocalValueWithDefaultUnit(localdata, 'valonkanto',
				{
					paramname='valonkanto', 
					type='desimaaliluku', 
					allowedunits='m,km,mpk', 
					templatename='Majakka WD', 
					defaultunit='km', 
					errormessage='Esimerkkiarvo: 10 km', 
					minvalue=0,
					maxvalue=100,
					skiptests=""
				} ) end, wikidata = {property = 'P2929', targetunit = 'km', conjtype = 'comma', rounding = '1', showqualifiers = {'P462'}, showsource=true} },
			{type = 'row', label = 'Valon ominaisuudet', value = 'valon ominaisuudet', property = 'P1030', showsource=true},
			{type = 'row', label = 'Tutka', value = 'tutka', property = 'P3994', showsource=true},
			},
		},
		{type = 'table', title = "Tunnisteet", rows = {
			{type = 'row', label = 'ARLHS', value = 'ARLHS', wikidata = {property = "P2980", urlpattern="http://wlol.arlhs.com/lighthouse/$1.html"}},
			{type = 'row', label = 'Admiralty', value = 'Admiralty', property = 'P3562'},
			{type = 'row', label = 'Dansk Fyrliste', value = 'Dansk Fyrliste', property = 'P4038'},
			{type = 'row', label = 'Garde côtière canadienne', value = 'GCC', property = 'P3920'},
			{type = 'row', label = 'List of Lights', value = 'List of Lights', wikidata = {property = "P3223", urlpattern="http://listoflights.org/leuchtfeuer/detail?id=$1"}},
			{type = 'row', label = 'Marina militare', value = 'Marina militare', wikidata = {property = "P3863", urlpattern="http://www.marina.difesa.it/cosa-facciamo/fari/Pagine/$1.aspx"}},
			{type = 'row', label = 'MarineTraffic', value = 'MarineTraffic', wikidata = {property = "P3601", urlpattern="http://www.marinetraffic.com/fr/ais/details/lights/$1/"}},
			{type = 'row', label = 'NGA', value = 'NGA', property = 'P3563'},
			{type = 'row', label = 'Norsk fyrliste', value = 'Norsk fyrliste', property = 'P4055'},
			{type = 'row', label = 'USCG', value = 'USCG', property = 'P3723'},
			{type = 'row', label = 'Vitaskrá', value = 'Vitaskrá', property = 'P3993'},
			},
		},
		building.geoloc({marker = 'lighthouse', default_zoom=14}),
		{type = 'table',  rows = {
			building.coordinates({displaytitle="-"}),
			}
		},	
			
				
	}
}