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
Balise : Révoqué
Hiob (discussion | contributions)
m Révocation de 3 modifications réalisées par Ayd (discussion) et restauration de la dernière version réalisée par Hiob
Balises : Révocation Révoqué
Ligne 1 : Ligne 1 :
-- Module:Infobox/Configs/Organisation
local config = {
-- Configuration du modèle {{Infobox Organisation}}
    -- Titre de la page (avec fallback sur {{PAGENAME}})
    titre = function(args)
        return args.nom or mw.title.getCurrentTitle().text
    end,


local config = {}
    -- Configuration de l'icône (Font Awesome)
    icone = {
        type = 'fas',  -- Types possibles : 'fas', 'fab', 'far', 'fal', 'fad'
        nom = 'landmark',
        -- Couleur optionnelle (CSS valide)
        couleur = args.couleuricone or '#2c3e50'
    },


-- ==========================
    -- Gestion de l'image (avec légende et taille)
-- 🏷️ Titre de la page
    image = function(args)
-- ==========================
        if args.image then
config.titre = function(args)
            return {
    return args.nom or mw.title.getCurrentTitle().text
                nom = args.image,
end
                taille = args.tailleimage or "250px",
                legende = args.legende,
                position = args.positionimage or "right"  -- 'left', 'center', 'right'
            }
        end
        return nil
    end,


-- ==========================
    -- Types d'organisation (avec catégories automatiques)
-- 🏛️ Icône principale (Font Awesome)
    typeField = {
-- ==========================
        required = true,  -- Champ obligatoire
config.icone = {
        allowedValues = {
    type = 'fas',
            ['faction'] = {
    nom = 'landmark',
                display = 'Faction',
    couleur = '#2c3e50'
                category = 'Faction',
}
                icone = { type = 'fas', nom = 'flag' }
 
            },
-- ==========================
            ['tribu'] = {
-- 🖼️ Image principale
                display = 'Tribu',
-- ==========================
                category = 'Tribu',
config.image = function(args)
                icone = { type = 'fas', nom = 'users' }
    if args.image then
            },
        return {
            ['ordre'] = {
             nom = args.image,
                display = 'Ordre',
             taille = args.tailleimage or "250px",
                category = 'Ordre',
            legende = args.legende,
                icone = { type = 'fas', nom = 'scroll' }
            position = args.positionimage or "right" -- 'left', 'center', 'right'
            },
         }
            ['guilde'] = {
    end
                display = 'Guilde',
     return nil
                category = 'Guilde',
end
                icone = { type = 'fas', nom = 'handshake' }
             },
             ['administration'] = {
                display = 'Administration',
                category = 'Administration',
                icone = { type = 'fas', nom = 'gavel' }
            }
         },
        default = 'faction',  -- Valeur par défaut si non spécifié
        errorMessage = 'Type non valide. Types autorisés : faction, tribu, ordre, guilde, administration.'
     },


-- ==========================
    -- Sections de la fiche (avec gestion des coordonnées groupées)
-- 🧭 Type d'organisation
    sections = {
-- ==========================
        {
config.typeField = {
            titre = 'Informations générales',
    required = true,
            id = 'infos-generales',  -- ID HTML pour les ancres
    allowedValues = {
            champs = {
        ['faction'] = {
                { cle = 'type', label = 'Type', type = 'select' },  -- Champ de type "select"
            display = 'Faction',
                { cle = 'fondation', label = 'Fondation', type = 'date' },
            category = 'Faction',
                { cle = 'dissolution', label = 'Dissolution', type = 'date' },
            icone = { type = 'fas', nom = 'flag' }
                { cle = 'fondateurs', label = 'Fondateur(s)', type = 'text' },
                { cle = 'symbole', label = 'Symbole', type = 'image' },
                { cle = 'statut', label = 'Statut', type = 'text' },
                -- Coordonnées (seront affichées groupées dans la section "Localisation")
                { 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 }
            }
         },
         },
         ['tribu'] = {
         {
             display = 'Tribu',
            titre = 'Organisation interne',
             category = 'Tribu',
             id = 'organisation',
            icone = { type = 'fas', nom = 'users' }
             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' }
            }
         },
         },
         ['ordre'] = {
         {
             display = 'Ordre',
             titre = 'Géographie',
             category = 'Ordre',
             id = 'geographie',
             icone = { type = 'fas', nom = 'scroll' }
             champs = {
                { cle = 'territoire', label = 'Territoire d’influence', type = 'text' },
                { cle = 'siege', label = 'Siège', type = 'text' }
            }
         },
         },
         ['guilde'] = {
         {
             display = 'Guilde',
             titre = 'Localisation',
             category = 'Guilde',
             id = 'localisation',
             icone = { type = 'fas', nom = 'handshake' }
             champs = {
        },
                { cle = 'monde', label = 'Monde', type = 'text' },
        ['administration'] = {
                { cle = 'localisation', label = 'Localisation', type = 'text' },
            display = 'Administration',
                -- Champs techniques pour la carte (masqués par défaut)
            category = 'Administration',
                { cle = 'worldname', label = 'Monde technique', type = 'text', hidden = true },
            icone = { type = 'fas', nom = 'gavel' }
                { cle = 'mapname', label = 'Type de carte', type = 'text', hidden = true },
                { cle = 'zoom', label = 'Niveau de zoom', type = 'number', hidden = true }
            },
            -- Fonction pour afficher les coordonnées groupées
            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
         }
         }
     },
     },
    default = 'faction',
    errorMessage = 'Type non valide. Types autorisés : faction, tribu, ordre, guilde, administration.'
}


-- ==========================
    -- Catégories automatiques (ajoutées à la page)
-- 📑 Sections principales
     categories = function(args)
-- ==========================
         local cats = {}
config.sections = {
         -- Catégorie par type
     {
         if args.type and config.typeField.allowedValues[args.type] then
        titre = 'Informations générales',
            table.insert(cats, config.typeField.allowedValues[args.type].category)
        id = 'infos-generales',
        end
        champs = {
        -- Catégorie par monde (si spécifié)
            { cle = 'type', label = 'Type', type = 'select' },
        if args.monde then
            { cle = 'fondation', label = 'Fondation', type = 'date' },
            table.insert(cats, 'Localisation dans ' .. args.monde)
            { 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
         end
     }
        -- Catégorie "Organisations" par défaut
        table.insert(cats, 'Organisations')
        return cats
     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
return config

Version du 30 octobre 2025 à 11:23

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

local config = {
    -- Titre de la page (avec fallback sur {{PAGENAME}})
    titre = function(args)
        return args.nom or mw.title.getCurrentTitle().text
    end,

    -- Configuration de l'icône (Font Awesome)
    icone = {
        type = 'fas',  -- Types possibles : 'fas', 'fab', 'far', 'fal', 'fad'
        nom = 'landmark',
        -- Couleur optionnelle (CSS valide)
        couleur = args.couleuricone or '#2c3e50'
    },

    -- Gestion de l'image (avec légende et taille)
    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,

    -- Types d'organisation (avec catégories automatiques)
    typeField = {
        required = true,  -- Champ obligatoire
        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',  -- Valeur par défaut si non spécifié
        errorMessage = 'Type non valide. Types autorisés : faction, tribu, ordre, guilde, administration.'
    },

    -- Sections de la fiche (avec gestion des coordonnées groupées)
    sections = {
        {
            titre = 'Informations générales',
            id = 'infos-generales',  -- ID HTML pour les ancres
            champs = {
                { cle = 'type', label = 'Type', type = 'select' },  -- Champ de 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' },
                -- Coordonnées (seront affichées groupées dans la section "Localisation")
                { 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' },
                -- Champs techniques pour la carte (masqués par défaut)
                { 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 }
            },
            -- Fonction pour afficher les coordonnées groupées
            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 (ajoutées à la page)
    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 (si spécifié)
        if args.monde then
            table.insert(cats, 'Localisation dans ' .. args.monde)
        end
        -- Catégorie "Organisations" par défaut
        table.insert(cats, 'Organisations')
        return cats
    end
}

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