Aller au contenu

Module:Infobox/Organisation

Cette page fait l’objet d’une mesure de semi-protection étendue.
Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 21 mars 2023 à 10:28 et modifiée en dernier par Edelsmann (discuter | contributions) (Siège : Remplacement du code au sein de labelformat qui produisait des "1"s indésirables (à remplacer par une table ?). "de facto" et "de jure" en italique.). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.

 Documentation[voir] [modifier] [historique] [purger]

Cette page définit un module d'infobox. Elle utilise des fonctions définies sur Module:Infobox/Fonctions/Organisation. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Organisation2.


--[[ 
Avant de mettre en production une nouvelle version avez-vous :
- testé avec la version bac à sable ?
- modifié la documentation ?
]]

local generic = require "Module:Infobox/Fonctions"
local localdata = require "Module:Infobox/Localdata"
local organisation = require "Module:Infobox/Fonctions/Organisation"
local wd = require "Module:Wikidata"

local chartes = {
	-- {titre charte, élément wikidata, couleur titre, couleur texte, pictogramme}
    {'agence fédérale des États-Unis', 'Q20857065', '#3c3b6e', '#FFF', 'musee'},
    {'bibliothèque', 'Q7075', '4C6099', '#FFF', 'universite'},
    {'dicastère', 'Q1225300', '#FFE8BF', '#000', 'eveque'},
    {'école', 'Q3914', '4d6699', 'ffffff', 'universite'},
    {'institut de recherche', 'Q31855', '#8089b7', '#FFF', 'universite'},
    {'institution spécialisée des Nations unies', 'Q15925165', '#4B92DB', '#FFF', 'nations-unies'},
    {'organe de l\'Union européenne', 'Q4936585', '#003399', '#FFF', 'union-europeenne'},
    {'musée', 'Q33506', 'A0A0FF', '#000', 'musee'},
    {'organisme sans but lucratif', 'Q163740', '6e77ef', '#FFF', 'association'},
    {'parti politique', 'Q7278', '#E1E1E1', '#000', 'defaut'},
    {'société nationale du Mouvement international de la Croix-Rouge et du Croissant-Rouge', 'Q1968122', '#CC0000', '#FFF', 'medecine'},
    {'société savante', 'Q955824', '#FFDEAD', '#000', 'universite'},
    {'syndicat', 'Q681615', '#D20012', '#FFF', 'association'},
}

local function setformat()
	local instanceof = wd.getIds(localdata.item, {property = 'P31'})

	if not instanceof then
		return  {'Q', '', '#323996', '#FFF', 'defaut'}
	end
	instanceof = wd.addVals(instanceof, {property = 'P279'}, 2)
	for i, j in pairs(instanceof) do
		for k, l in pairs(chartes) do
			if l[2] == j then
				return l
			end
		end
	end
	return {'Q', '', '#323996', '#FFF', 'defaut'}
end

local function setcharte()
	local charte = localdata['charte']
	if charte then
		for i, j in pairs(chartes) do
			if j[1] == charte then
				return j
			end
		end
	end
	return setformat()
end

local infoboxformat = setcharte()

local defaultquery = {property = {'P101', 'P366', 'P361', 'P279'}}

return {
	maincolor = infoboxformat[3],
	secondcolor = infoboxformat[3],
	thirdcolor = infoboxformat[4],
 	parts =
    	{
			generic.title(infoboxformat[5]),
			generic.logo(),
			generic.blason(),
			generic.flag(),
			generic.locationmap(),
			generic.mainimage{cat = 'Article à illustrer Organisation', wikidata = {property = {"P2716", "P18", "P5252"}}},
			{type = 'table',
				rows = 	{
				{type = 'row', value = {'devise', 'slogan', 'association_slogan'}, wikidata = {property = 'P1451', showlang = true, isinlang = {'fr', 'en', 'la'}, conjtype = 'new line'}, style = { ['text-align'] = 'center', ['font-size'] = '0.9em', ['font-weight'] = 'normal', ['font-style'] = 'italic' }},
				}
			},			
			{type = 'table', title = localdata['histoire'] or wd.formatStatements{entity = id, property = 'P2184', withlink = 'frwiki'} or 'Histoire',
				rows = 	{
				{type = 'row', label = 'Fondation', value = {'création', 'fondation', 'date_de_fondation'}, wikidata = {property = {'P571', 'P740'}, showqualifiers = {'P518', 'P1810', 'P4649', 'P5168', 'P8338'}, conjtype = 'new line'}},
				{type = 'row', label = 'Dissolution', value = 'dissolution', wikidata = {property = 'P576'}},
				{type = 'row', label = 'Origine', value = {'origine'}},
				{type = 'row', label = 'Prédécesseur', plurallabel = 'Prédécesseurs', value = {'remplace', 'a remplacé', 'prédécesseur'}, wikidata = {property = {'P1365', 'P155', 'P1398'}, removedupes = true}},
				{type = 'row', label = 'Successeur', plurallabel = 'Successeurs', value = {'remplacé par', 'successeur'}, wikidata = {property = {'P1366', 'P156', 'P167'}, removedupes = true}},
				{type = 'row', label = 'Scission de', value = {'scission de'}},
				{type = 'row', label = 'Fusion de', value = {'fusion de'}},
				{type = 'row', label = 'Scission dans', value = {'scission dans'}},
				{type = 'row', label = 'Fusionné dans', value = {'fusionné dans'}},
				}
			},
			{type = 'table', title='Cadre',
				rows = 	{
				{type = 'row', label = 'Sigle', plurallabel = 'Sigles', value = {'sigle', 'acronyme'}, wikidata = {property = {'P1813'}, showlang = true, isinlang = {'fr', 'en'}}},
				{type = 'row', label = 'Surnom', plurallabel = 'Surnoms', value = {'surnom'}, wikidata = {property = {'P1449'}, showlang = true, isinlang = {'fr', 'en'}}},
				{type = 'row', label = 'Code', plurallabel = 'Codes', value = 'code', wikidata = {property = 'P4550', atdate = "today"}},
				{type = 'row', label = 'Zone d\'activité', value = {'couverture', 'région', 'zone opérationnelle', 'zone d\'influence'}, wikidata = {property = 'P2541', speciallabels = {Q13780930 = '[[Monde (univers)|Monde entier]]', Q46 = '[[Europe]]'}}},
				{type = 'row', label = 'Type', value = {'type', 'association_type'}, wikidata = {property = 'P31', removedupes = true, showqualifiers = {'P642', 'P459', 'P1013', 'P5102'}, qualifconjtype = 'comma', defaultlink = '-', defaultlinkquery = defaultquery, excludevalues = {'Q43229','Q41176','Q45400320'}}}, --non affichées : "organisation" (trop vague), "bâtiment" (hors sujet), "éditeur en accès libre" (secondaire, présent sur un grand nombre d'institutions scientifiques)
				{type = 'row', label = '[[Forme juridique]]', value = 'forme juridique', wikidata = {property = 'P1454', showqualifiers = 'P4649', defaultlink = '-', defaultlinkquery = defaultquery, rank = 'valid', showdate = true, sorttype = 'chronological', conjtype = 'new line'}},
				{type = 'row', label = 'Structure', value = 'structure'},
				{type = 'row', label = '[[Objet social]]', plurallabel = '[[Objet social|Objets sociaux]]', value = {'objet social', 'objets sociaux'}, wikidata = {property = 'P6346'}},
				{type = 'row', label = 'Domaine d\'activité', plurallabel = 'Domaines d\'activité', value = {'discipline', 'disciplines', 'domaine', 'domaines', 'secteur'}, wikidata = {property = {'P101', 'P452', 'P2650'}, defaultlink = '-', defaultlinkquery = defaultquery, excludevalues={'Q112166212','Q107607934','Q29584118'}}}, --on exclut les regroupements statistiques pas informatifs
				{type = 'row', label = '[[Mouvement culturel|Mouvement]]', value = {'mouvement'}, wikidata = {property = 'P135'}},
				{type = 'row', label = 'Financement', value = 'financement', wikidata = {property = 'P2770', speciallabels = {Q193219 = '[[subvention]]s', Q1124860 = '[[dons]]'}, conjtype = "and"}},
				{type = 'row', label = 'Objectif', plurallabel = 'Objectifs', value = {'but', 'objectif', 'objectifs'}, wikidata = {property = 'P3712'}},
				{type = 'row', label = 'Méthode', plurallabel = 'Méthodes', value = {'méthode', 'methode'}},
				{type = 'row', label = 'Campus', value = 'campus'},
				{type = 'row', label = function() return localdata['titre siège'] or 'Siège' end, value = {'siège', 'siège social', 'adresse', 'localisation', 'ville', 'siege'}, wikidata = {property = 'P159', defaultlink = '-', defaultlinkquery = {property = {'P669', 'P131', 'P466'}}, showdate = true , showqualifiers = {'P670', 'P969', 'P669', 'P281', 'P131', 'P17', 'P5102'}, conjtype = 'new line', qualifconjtype = 'comma', labelformat = function(id) local label = wd.getLabel(id) if label and mw.ustring.match(label, '%de') then label = label:gsub('(%d)(e)', '%1<sup>e</sup>') return label elseif label and mw.ustring.match(label, '(de%s[jJ]ure)') then label = label:gsub('de jure', '<i>de jure</i>') return label elseif label and mw.ustring.match(label, '(de%s[fF]acto)') then label = label:gsub('(de%s[fF]acto)', '<i>de facto</i>') return label else return label end end}},
				generic.country(),
				generic.coordinates(),
				{type = 'row', label = 'Langue', plurallabel = 'Langues', value = {'langue', 'langues', 'langue officielle', 'langues officielles'}, wikidata = {property = 'P37', showqualifiers = 'P4626'}},
				{type = 'row', label = '[[Langue de travail]]', plurallabel = '[[Langue de travail|Langues de travail]]', value = {'langue de travail', 'langues de travail'}, wikidata = {property = 'P2936', showqualifiers = 'P4626'}},
				}
			},
			{type = 'table', title='Organisation',
				rows = 	{
				organisation.membres(id),
				organisation.custom(),
				-- Entités liées
				{type = 'row', label = 'Organisation mère', plurallabel = 'Organisations mères', value = {'organisation mère', 'société mère', 'organisme'}, wikidata = {property = 'P749', showdate = true, sorttype = 'chronological', showqualifiers = {'P1001'}, conjtype = 'new line'}},
				{type = 'row', label = 'Branche', plurallabel = 'Branches', value = 'branche', wikidata = {property = 'P199'}},
				{type = 'row', label = 'Partenaire', value = 'partenaire'},
				{type = 'row', label = 'Dépend de', value = 'dépend de'},
				{type = 'row', label = 'Affiliation', value = {'affiliation', 'affiliation_europeenne', 'affiliation_internationale', 'rattachement'}, wikidata = {property = {'P1416'}, showdate = true, defaultlinkquery = {property = {'P749', 'P127', 'P112'}}, qualifdefaultlinkquery = defaultquery, showqualifiers = {'P2868', 'P1416', 'P3831'}}},
				{type = 'row', label = 'Sponsor', plurallabel = 'Sponsors', value = 'sponsor', wikidata = {property = 'P859', defaultlinkquery = {property = {'P749', 'P127', 'P112'}}}},
				-- Orientation politique
				{type = 'row', label = 'Idéologie', value = {'idéologie', 'orientation politique', 'politique', 'pol'}, wikidata = {property = 'P1142'}},
				{type = 'row', label = '[[Échiquier politique|Positionnement]]', value = {'positionnement', 'positionnement politique'}, wikidata = {property = 'P1387'}},
				{type = 'row', label = '[[Coalition politique]]', plurallabels = '[[Coalition politique|Coalitions politiques]]', value = {'coalition', 'coalition politique'}, wikidata = {property = 'P5832'}},
				{type = 'row', label = '[[Groupe parlementaire]]', value = {'groupe parlementaire', 'parlement'}, wikidata = {property = 'P4100'}},
				-- Situation financière 
				{type = 'row', label = 'Budget', value = 'budget', wikidata = {property = 'P2769', showdate = true, sorttype = 'chronological', showunit = 'true'}},
				{type = 'row', label = 'Chiffre d\'affaires', value = 'chiffre d\'affaires', wikidata = {property = 'P2139', showdate = true, sorttype = 'chronological', showunit = 'long'}},
				{type = 'row', label = 'Résultat net', value = 'résultat net', wikidata = {property = 'P2295', showdate = true, sorttype = 'chronological', showunit = 'true'}},
				{type = 'row', label = 'Dépenses', value = {'dépenses', 'dépenses annuelles', 'dépenses totales'}, wikidata = {property = 'P2402', showdate = true, sorttype = 'chronological', showunit = 'true'}},
				{type = 'row', label = 'Capitalisation boursière', value = 'capitalisation', wikidata = {property = 'P2226', showdate = true, sorttype = 'chronological', showunit = 'true'}},
				{type = 'row', label = 'Cotation', plurallabel = 'Cotations', value = 'cotation', wikidata = {property = 'P414', showqualifiers = 'P249', conjtype = 'new line'}},
				{type = 'row', label = 'Notation', value = 'notation'},
				-- Divers
				{type = 'row', label = 'Récompense', plurallabel = 'Récompenses', value = 'récompense', wikidata = {property = 'P166', showdate = true, sorttype = 'chronological', conjtype = 'new line', defaultlink = '-', defaultlinkquery = {property = 'P1027'}}},
				{type = 'row', label = 'Produit', plurallabel = 'Produits', value = 'produit', wikidata = {property = 'P1056'}},
				{type = 'row', label = '[[Représentativité syndicale en France|Représentativité]]', value = {'representativite', 'représentativité'}},
				{type = 'row', label = 'Publication', plurallabel = 'Publications', value = {'organe de presse', 'publication', 'publications'}, wikidata = {property = 'P2813', showdate = true, sorttype = 'chronological', conjtype = 'new line', defaultlink = '-', defaultlinkquery = {property = 'P123', 'P1433'}, labelformat = function(id) local label = wd.getLabel(id) if label then return '<i>' .. label .. '</i>' end end}},
				generic.website(),
                                {type = "mixed", label = "Portail open data", value = "portail open data", wikidata = {property = "P8402"}},
                                {type = "mixed", label = "Portail de données", value = "portail de données", wikidata = {property = "P1325", displayformat = "weblink"}},
				{type = "mixed", label = "[[Statut juridique|Statuts]]", value = "statuts", wikidata = {property = "P6378", displayformat = "weblink", text = "En ligne"}},
				}
			},
			organisation.ids(),
			generic.geoloc({default_zoom=13}),
		}
	}