Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.

« Module:Infobox/Configs/Organisation » : différence entre les versions

De Nefald
Aucun résumé des modifications
Aucun résumé des modifications
Balise : Révocation manuelle
 
(6 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
local config = {
-- Module:Infobox/Configs/Organisation
    titre = function(args)
-- Configuration du modèle {{Infobox Organisation}}
        return args.nom or '{{PAGENAME}}'
 
    end,
local config = {}
 
 
    -- Icône avec type et nom
-- ==========================
    icone = {
-- 🏷️ Titre de la page
        type = 'fas', -- ou 'fab', 'far', 'fal', 'fad'
-- ==========================
        nom = 'landmark'
config.titre = function(args)
    },
    return args.nom or mw.title.getCurrentTitle().text
   
end
    image = function(args)
 
        if args.image then
-- ==========================
            return {
-- 🏛️ Icône principale (Font Awesome)
                nom = args.image,
-- ==========================
                taille = args.tailleimage or "250px",
config.icone = {
                legende = args.legende
    type = 'fas',
             }
    nom = 'landmark',
        end
    couleur = '#2c3e50'
        return nil
}
    end,
 
   
-- ==========================
        typeField = {
-- 🖼️ Image principale
        required = false, --
-- ==========================
        allowedValues = {
config.image = function(args)
            ['faction'] = {
    if args.image then
                display = 'Faction',
        return {
                category = 'Faction'
            nom = args.image,
             },
            taille = args.tailleimage or "250px",
            ['tribu'] = {
            legende = args.legende,
                display = 'Tribu',  
             position = args.positionimage or "right" -- 'left', 'center', 'right'
                category = 'Tribu'
        }
             },
    end
['ordre'] = {
    return nil
                display = 'Ordre',  
end
                category = 'Ordre'
 
             },
-- ==========================
['guilde'] = {
-- 🧭 Type d'organisation
                display = 'Guilde',  
-- ==========================
                category = 'Guilde'
config.typeField = {
             },
    required = true,
['administration'] = {
    allowedValues = {
                display = 'Administration',  
        ['faction'] = {
                category = 'Administration'
            display = 'Faction',
            }
            category = 'Faction',
             icone = { type = 'fas', nom = 'flag' }
        },
        ['tribu'] = {
            display = 'Tribu',
            category = 'Tribu',
             icone = { type = 'fas', nom = 'users' }
        },
        ['ordre'] = {
            display = 'Ordre',
            category = 'Ordre',
             icone = { type = 'fas', nom = 'scroll' }
        },
        ['guilde'] = {
            display = 'Guilde',
            category = 'Guilde',
             icone = { type = 'fas', nom = 'handshake' }
         },
         },
         errorMessage = 'Type non reconnu. Types autorisés : Tribu, Faction, Ordre, Guilde , Administration'
         ['administration'] = {
            display = 'Administration',
            category = 'Administration',
            icone = { type = 'fas', nom = 'gavel' }
        }
     },
     },
    default = 'faction',
    errorMessage = 'Type non valide. Types autorisés : faction, tribu, ordre, guilde, administration.'
}


    sections = {
-- ==========================
        {
-- 📑 Sections principales
            titre = 'Informations Générales',
-- ==========================
            champs = {
config.sections = {
                { cle = 'type', label = 'Type' },
    {
                { cle = 'fondation', label = 'Fondation' },
        titre = 'Informations générales',
                { cle = 'dissolution', label = 'Dissolution' },
        id = 'infos-generales',
                { cle = 'fondateurs', label = 'Fondateur(s)' },
        champs = {
                { cle = 'symbole', label = 'Symbole' },
            { cle = 'type', label = 'Type', type = 'select' },
                { cle = 'statut', label = 'Statut' },
            { cle = 'fondation', label = 'Fondation', type = 'date' },
                { cle = 'x', label = 'Coordonnée X' }, -- Ces champs seront remplacés automatiquement
            { cle = 'dissolution', label = 'Dissolution', type = 'date' },
                { cle = 'y', label = 'Coordonnée Y' }, -- par l'affichage "Coordonnées" groupé
            { cle = 'fondateurs', label = 'Fondateur(s)', type = 'text' },
                { cle = 'z', label = 'Coordonnée Z' }
            { cle = 'symbole', label = 'Symbole', type = 'image' },
             }
            { cle = 'statut', label = 'Statut', type = 'text' },
            { cle = 'x', label = 'Coordonnée X', type = 'number', hidden = true },
            { cle = 'y', label = 'Coordonnée Y', type = 'number', hidden = true },
            { cle = 'z', label = 'Coordonnée Z', type = 'number', hidden = true }
        }
    },
    {
        titre = 'Organisation interne',
        id = 'organisation',
        champs = {
            { cle = 'dirigeant', label = 'Dirigeant', type = 'text' },
            { cle = 'effectifs', label = 'Effectifs', type = 'number' },
             { cle = 'activite', label = 'Activité', type = 'text' },
            { cle = 'culte', label = 'Culte', type = 'text' }
        }
    },
    {
        titre = 'Géographie',
        id = 'geographie',
        champs = {
            { cle = 'territoire', label = 'Territoire d’influence', type = 'text' },
            { cle = 'siege', label = 'Siège', type = 'text' }
        }
    },
    {
        titre = 'Localisation',
        id = 'localisation',
        champs = {
            { cle = 'monde', label = 'Monde', type = 'text' },
            { cle = 'localisation', label = 'Localisation', type = 'text' },
            { cle = 'worldname', label = 'Monde technique', type = 'text', hidden = true },
            { cle = 'mapname', label = 'Type de carte', type = 'text', hidden = true },
            { cle = 'zoom', label = 'Niveau de zoom', type = 'number', hidden = true }
         },
         },
         {
         displayCoordonnees = function(args)
            titre = 'Organisation Interne',
             if args.x and args.y and args.z then
             champs = {
                 return string.format(
                 { cle = 'dirigeant', label = 'Dirigeant' },
                    'Coordonnées : **%s**, **%s**, **%s** %s',
                { cle = 'effectifs', label = 'Effectifs' },
                    args.x,
                { cle = 'activite', label = 'Activité' },
                    args.y,
                { cle = 'culte', label = 'Culte' }
                    args.z,
            }
                    (args.monde and ('(' .. args.monde .. ')') or '')
        },
                 )
        {
            end
            titre = 'Géographie',
             return nil
            champs = {
         end
                { cle = 'territoire', label = 'Territoire d’influence' },
                 { cle = 'siege', label = 'Siège' },
                { cle = 'localisation', label = 'Localisation' }
             }
         }
     }
     }
}
}
-- ==========================
-- 🗂️ Catégories automatiques
-- ==========================
config.categories = function(args)
    local cats = {}
    -- Catégorie par type
    if args.type and config.typeField.allowedValues[args.type] then
        table.insert(cats, config.typeField.allowedValues[args.type].category)
    end
    -- Catégorie par monde
    if args.monde then
        table.insert(cats, 'Localisation dans ' .. args.monde)
    end
    -- Catégorie générique
    table.insert(cats, 'Organisations')
    return cats
end
-- ==========================
-- 🧪 Fonction de test rapide
-- ==========================
function config.test()
    return "✅ Module Infobox/Configs/Organisation chargé correctement"
end


return config
return config

Dernière version du 30 octobre 2025 à 11:41

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

-- Module:Infobox/Configs/Organisation
-- Configuration du modèle {{Infobox Organisation}}

local config = {}

-- ==========================
-- 🏷️ Titre de la page
-- ==========================
config.titre = function(args)
    return args.nom or mw.title.getCurrentTitle().text
end

-- ==========================
-- 🏛️ Icône principale (Font Awesome)
-- ==========================
config.icone = {
    type = 'fas',
    nom = 'landmark',
    couleur = '#2c3e50'
}

-- ==========================
-- 🖼️ Image principale
-- ==========================
config.image = function(args)
    if args.image then
        return {
            nom = args.image,
            taille = args.tailleimage or "250px",
            legende = args.legende,
            position = args.positionimage or "right" -- 'left', 'center', 'right'
        }
    end
    return nil
end

-- ==========================
-- 🧭 Type d'organisation
-- ==========================
config.typeField = {
    required = true,
    allowedValues = {
        ['faction'] = {
            display = 'Faction',
            category = 'Faction',
            icone = { type = 'fas', nom = 'flag' }
        },
        ['tribu'] = {
            display = 'Tribu',
            category = 'Tribu',
            icone = { type = 'fas', nom = 'users' }
        },
        ['ordre'] = {
            display = 'Ordre',
            category = 'Ordre',
            icone = { type = 'fas', nom = 'scroll' }
        },
        ['guilde'] = {
            display = 'Guilde',
            category = 'Guilde',
            icone = { type = 'fas', nom = 'handshake' }
        },
        ['administration'] = {
            display = 'Administration',
            category = 'Administration',
            icone = { type = 'fas', nom = 'gavel' }
        }
    },
    default = 'faction',
    errorMessage = 'Type non valide. Types autorisés : faction, tribu, ordre, guilde, administration.'
}

-- ==========================
-- 📑 Sections principales
-- ==========================
config.sections = {
    {
        titre = 'Informations générales',
        id = 'infos-generales',
        champs = {
            { cle = 'type', label = 'Type', type = 'select' },
            { cle = 'fondation', label = 'Fondation', type = 'date' },
            { cle = 'dissolution', label = 'Dissolution', type = 'date' },
            { cle = 'fondateurs', label = 'Fondateur(s)', type = 'text' },
            { cle = 'symbole', label = 'Symbole', type = 'image' },
            { cle = 'statut', label = 'Statut', type = 'text' },
            { cle = 'x', label = 'Coordonnée X', type = 'number', hidden = true },
            { cle = 'y', label = 'Coordonnée Y', type = 'number', hidden = true },
            { cle = 'z', label = 'Coordonnée Z', type = 'number', hidden = true }
        }
    },
    {
        titre = 'Organisation interne',
        id = 'organisation',
        champs = {
            { cle = 'dirigeant', label = 'Dirigeant', type = 'text' },
            { cle = 'effectifs', label = 'Effectifs', type = 'number' },
            { cle = 'activite', label = 'Activité', type = 'text' },
            { cle = 'culte', label = 'Culte', type = 'text' }
        }
    },
    {
        titre = 'Géographie',
        id = 'geographie',
        champs = {
            { cle = 'territoire', label = 'Territoire d’influence', type = 'text' },
            { cle = 'siege', label = 'Siège', type = 'text' }
        }
    },
    {
        titre = 'Localisation',
        id = 'localisation',
        champs = {
            { cle = 'monde', label = 'Monde', type = 'text' },
            { cle = 'localisation', label = 'Localisation', type = 'text' },
            { cle = 'worldname', label = 'Monde technique', type = 'text', hidden = true },
            { cle = 'mapname', label = 'Type de carte', type = 'text', hidden = true },
            { cle = 'zoom', label = 'Niveau de zoom', type = 'number', hidden = true }
        },
        displayCoordonnees = function(args)
            if args.x and args.y and args.z then
                return string.format(
                    'Coordonnées : **%s**, **%s**, **%s** %s',
                    args.x,
                    args.y,
                    args.z,
                    (args.monde and ('(' .. args.monde .. ')') or '')
                )
            end
            return nil
        end
    }
}

-- ==========================
-- 🗂️ Catégories automatiques
-- ==========================
config.categories = function(args)
    local cats = {}

    -- Catégorie par type
    if args.type and config.typeField.allowedValues[args.type] then
        table.insert(cats, config.typeField.allowedValues[args.type].category)
    end

    -- Catégorie par monde
    if args.monde then
        table.insert(cats, 'Localisation dans ' .. args.monde)
    end

    -- Catégorie générique
    table.insert(cats, 'Organisations')

    return cats
end

-- ==========================
-- 🧪 Fonction de test rapide
-- ==========================
function config.test()
    return "✅ Module Infobox/Configs/Organisation chargé correctement"
end

return config
Les témoins (''cookies'') nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de témoins.