Aller au contenu

Module:Infobox/Mize

Depi Wikipedya, ansiklopedi lib

La documentation pour ce module peut être créée à Module:Infobox/Mize/doc

local building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local localdata = require "Module:Infobox/Localdata"
local wd = require "Module:Wikidata"

local buildingitem = localdata.item -- assuming same item for building and organization, but should not be the case, so checks the following:
local buildingcandidates = wd.stringTable{entity = localdata.item, property = 'P276', displayformat = 'raw', excludespecial = true}
if buildingcandidates then
	if (#buildingcandidates == 1) and (buildingcandidates ~= buildingitem) and wd.isInstance('Q41176', buildingcandidates[1], 2) or wd.isInstance('Q1497364', buildingcandidates[1], 1) then
		buildingitem =  buildingcandidates[1]
	end
end

local function architects(item)
	local architects = wd.getClaims{entity = item, property = 'P84'}
	if (not architects) then
		return nil
	end
	if #architects > 3 then
		return wd.formatAndCat{property = 'P84', entity = item, value = 'Divès'}, 2
	end
	return wd.formatAndCat{entity = item, property = 'P84', claims = architects, conjtype = 'comma'}, #architects
end


return 
	{
	maincolor = 'C8D8FF',
	parts =
    	{
			general.title('musee'),
			general.logo(),
			building.mainimage('Atik pou ilistre mize'),
			{type = 'table', title = 'Enfòmasyon jeneral', rows = {
				{type = "row", label = "Non lokal", plurallabel = "Non lokal", value = "non lokal", wikidata = {property = "P1705", showlang = true} },
				{type = 'row', label = 'Tip', value = 'tip', wikidata = {property = 'P31', excludevalues = {'Q33506', 'Q24699794', 'Q18411786', 'Q35989030', 'Q45400320'}}},
				building.opening(),
				building.closure(),
				building.operator(),
				{type = 'row', label = 'Dirijan', plurallabel = 'Dirijan', value = {'konsèvatè', 'dirijan'}, wikidata = {property = 'P1037', showqualifiers = {'P794'}, showdate = true, precision = 'year', stilltrue = true, expl = true}}, -- TODO : forme féminine
				{type = 'row', label = 'Prezidan', plurallabel = 'Prezidan', blockers = {'dirijan', 'konsèvatè'}, value = 'président', wikidata = {property = 'P488', showdate = true, precision = 'year', stilltrue = true}},-- TODO : forme féminine
				{type = 'row', label = 'Sifas', value = 'sipèfisi', wikidata = {property = 'P2046', targetunit = 'square meter'}},
				{type = 'row', label = 'Vizitè pa ane', value = 'vizitè', wikidata = {property = 'P1174', sorttype = 'inverted', numval = 1, showdate = true}},
				building.website('sit'),
				}
			 },
			{type = 'table', title = 'Koleksyon', rows = {
				{type = 'row', label = 'Koleksyon', value = 'koleksyon'}, --  liste des grandes collections du musée ;
				{type = 'row', label = 'Jan', value = 'jan koleksyon'},
				{type = 'row', label = 'Pwovenans', value = 'pwovenans koleksyon'},
				{type = 'row', label = 'Epòk', value = 'epòk koleksyon'},
				{type = 'row', label = localdata['libele kantite objè'] or "Kantite objè", value = {"kantite objè", "zèv"}},
				{type = 'row', label = localdata['libele objè ekspoze'] or "Objets ekspozisyon", value = "objè ekspoze"},
				{type = 'row', label = 'Label', value = 'label'}
				}
			 },			 				 
			{type = 'table', title = 'Batiman', rows = {

				-- pourrait utiliser les fonction de Module:Infobox/Fonctions/Bâtiment si elles étaient adaptées pour utiliser un autre item que l'item principal de l'infobox
				{type = 'row', label = 'Atik dedye', value = {'moniman', 'atik batiman'}, wikidata =
						function()
						if buildingitem and (buildingitem.id ~= localdata.item.id) and wd.siteLink(buildingitem) then
							str = wd.formatEntity(buildingitem)
							return wd.addLinkBack(str, item, 'P276')
						end
						end
				},
				{type = 'row', label = 'Konstriksyon', value = 'konstriksyon', wikidata = function() return wd.keyDate('Q385378', buildingitem) end},
				{type = 'row', label = 'Achitèk', plurallabel = 'Achitèk', value = 'achitèk', wikidata = function() return architects(buildingitem) end},
				{type = 'row', label = 'Pwoteksyon', value = 'pwoteksyon', wikidata = function() return require('Module:Classement').formattedList(buildingitem) end}, 
				}
			 },
			{type = 'table', title = 'Sit', rows = {
				{type = 'row', value = 'Sit'} -- alternative à "site" pour les institutions multi-implantations
				}
			},
			{type = 'table', title = 'Lokalizasyon', rows = {
				building.adminlocation(),
				building.mountainrange(),
				building.protectedarea(),
				building.coordinates(),
				}
			 },
			general.geoloc({marker = 'museum', default_zoom=13, markercolor = '#7CA2FF'}),
	}
}