Module:Protection banner/config: Difference between revisions

    From Nonbinary Wiki
    (use the old banner config style, but with the new parameter name scheme, and make more messages based on sentences rather than on snippets)
     
    (112 intermediate revisions by 25 users not shown)
    Line 1: Line 1:
    -- This module provides configuration data for [[Module:Protection banner]].
    -- This module provides configuration data for [[Module:Protection banner]].


    local cfg = {}
    return {


    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --
    --                                BANNER DATA
    --                                BANNER DATA
    --
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------


    --[[
    --[[
    -- The following banner data fields are available:
    -- Banner data consists of six fields:
    -- text, explanation, tooltip, alt, image, category
    -- * text - the main protection text that appears at the top of protection
    --
    --   banners.
    -- When the module is asked to retrieve one of these data fields, it looks in
    -- * explanation - the text that appears below the main protection text, used
    -- the cfg.bannerData table. It uses five properties in its search:
    --   to explain the details of the protection.
    -- 1. the expiry date
    -- * tooltip - the tooltip text you see when you move the mouse over a small
    -- 2. the namespace
    --   padlock icon.
    -- 3. the protection reason (e.g. "dispute" or "vandalism")
    -- * link - the page that the small padlock icon links to.
    -- 4. the protection level (e.g. "sysop" or "autoconfirmed")
    -- * alt - the alt text for the small padlock icon. This is also used as tooltip
    -- 5. the action (e.g. "edit" or "move")
    --   text for the large protection banners.
    --
    -- * image - the padlock image used in both protection banners and small padlock
    -- For each data field, the module will check to see if the field exists in the
    --   icons.
    -- table with the key corresponding to all five parameters. For example, a
    -- user page semi-protected from vandalism for two weeks would have the key
    -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
    -- changes the first part of the key to "all" and checks the table again. It
    -- keeps checking increasingly generic key combinations until it finds the
    -- field, or until it reaches the key "all-all-all-all-all".
    --
    -- This makes it possible to specify fine-grained distinctions in banner text.
    -- For example, data defined for the key "all-user-vandalism-all-edit" can be
    -- used for user pages that are protected either temporarily or permanently,
    -- and either fully protected or semi-protected, but it won't be used for
    -- articles or for pages protected against sockpuppetry.
    --
    -- Note that the fields don't have to be in the same table. A given banner
    -- might use text from "temp-user-vandalism-autoconfirmed-edit" but a
    -- category from "all-all-vandalism-all-edit".
    --
    --
    -- The module uses a binary matrix to determine the order in which to search.
    -- The module checks in three separate tables to find a value for each field.
    -- This is best demonstrated by a table. In this table, the "0" values
    -- First it checks the banners table, which has values specific to the reason
    -- represent "all", and the "1" values represent the original data (e.g.
    -- for the page being protected. Then the module checks the defaultBanners
    -- "indef" or "file" or "vandalism").
    -- table, which has values specific to each protection level. Finally, the
    --
    -- module checks the masterBanner table, which holds data for protection
    --        expiry    namespace reason   level    action
    -- templates to use if no data has been found in the previous two tables.
    -- order
    -- 1      1        1        1        1        1
    -- 2      0        1        1        1        1
    -- 3      1        0        1        1        1
    -- 4      0        0        1        1        1