Module:SubpageNavbox

local util_cargo = require('Module:CargoUtil')

local h = {} function h.orgNavboxArgs(team) return { title = 'OrgNavbox', events = { showAll = true }, args = { team, suffix = 'Yes' }, } end

function h.clpnArgs(team, tabstype) return { title = 'CurrentLeagueParticipantNavbox', events = { showAll = true }, args = { team, suffix = 'Yes' }, pagetype = tabstype } end

function h.getTeamFromPlayer(title) local query = { tables = 'Players', fields = 'Team', where = string.format('_pageName="%s"', title) }	return util_cargo.getOneResult(query) end

local p = {} function p.navbox(tabstype, title) if tabstype ~= 'Player' and tabstype ~= 'Team' then return nil end local team = (tabstype == 'Team') and title or h.getTeamFromPlayer(title) local clpnavbox = h.clpnArgs(team, tabstype) local orgnavbox = h.orgNavboxArgs(team) local navboxes = { clpnavbox, orgnavbox } return navboxes end return p