Module:High-use: Difference between revisions

    (Avoid displaying 0%)
    (Categorize like {{used in system}})
    Line 118: Line 118:
    local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
    local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
    local type_param = "style"
    local type_param = "style"
    local epilogue = ''
    if frame.args['system'] and frame.args['system'] ~= '' then
    if frame.args['system'] and frame.args['system'] ~= '' then
    image = "[[File:Ambox important.svg|40px|alt=Warning|link=]]"
    image = "[[File:Ambox important.svg|40px|alt=Warning|link=]]"
    type_param = "content"
    type_param = "content"
    local categorise = frame:getParent().args['nocat'] == '' or require('Module:Yesno')(frame:getParent().args['nocat'])
    if categorise then
    epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}}}')
    end
    elseif (frame.args[1] == "risk" or (count and count >= 100000)) then
    elseif (frame.args[1] == "risk" or (count and count >= 100000)) then
    image = "[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]"
    image = "[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]"
    Line 134: Line 139:
    ["expiry"] = (frame.args["expiry"] or "")
    ["expiry"] = (frame.args["expiry"] or "")
    }
    }
    }
    } .. epilogue
    else
    else
    return require('Module:Message box').main('ombox', {
    return require('Module:Message box').main('ombox', {
    Line 141: Line 146:
    text = p.text(frame, count),
    text = p.text(frame, count),
    expiry = (frame.args["expiry"] or "")
    expiry = (frame.args["expiry"] or "")
    })
    }) .. epilogue
    end
    end
    end
    end


    return p
    return p