Class xVoteWebApp extends Object implements(IQueryHandler);
var WebAdmin webadmin;
var string MapVoterURL;
var int EditSettingLine;
function cleanup()
{
webadmin = None;
}
function init(WebAdmin webapp)
{
webadmin = webapp;
}
function registerMenuItems(WebAdminMenu menu)
{
menu.addMenu(MapVoterURL, "X - Mapvote", self, "Modify settings of mapvote.", -88);
}
function bool handleQuery(WebAdminQuery q)
{
switch (q.request.URI)
{
case MapVoterURL:
handleMapVotes(q);
return true;
}
return false;
}
final function IncludeFile(WebAdminQuery q, string file)
{
local string S;
if(webadmin.HTMLSubDirectory!="")
{
S = webadmin.Path $ "/" $ webadmin.HTMLSubDirectory $ "/" $ file;
if (q.response.FileExists(S))
{
q.response.IncludeUHTM(S);
return;
}
}
q.response.IncludeUHTM(webadmin.Path $ "/" $ file);
}
final function SendHeader(WebAdminQuery q, string Title)
{
local IQueryHandler handler;
q.response.Subst("page.title", Title);
q.response.Subst("page.description", "");
foreach webadmin.handlers(handler)
{
handler.decoratePage(q);
}
q.response.Subst("messages", webadmin.renderMessages(q));
if (q.session.getString("privilege.log") != "")
{
q.response.Subst("privilege.log", webadmin.renderPrivilegeLog(q));
}
IncludeFile(q,"header.inc");
q.response.SendText("
"$Title$"
");
}
final function SendFooter(WebAdminQuery q)
{
IncludeFile(q,"navigation.inc");
IncludeFile(q,"footer.inc");
q.response.ClearSubst();
}
final function AddConfigEditbox(WebAdminQuery q, string InfoStr, string CurVal, int MaxLen, string ResponseVar, string Tooltip, optional bool bNoTR)
{
local string S;
S = "
"$InfoStr$":
";
if(!bNoTR)
S = "
"$S$"
";
q.response.SendText(S);
}
final function AddInLineEditbox(WebAdminQuery q, string CurVal, int MaxLen, string ResponseVar, string Tooltip)
{
q.response.SendText("
");
AddConfigEditbox(q,"Mapvote time",string(class'xVotingHandler'.Default.VoteTime),8,"VT","Time in seconds people have to cast mapvote");
AddConfigEditbox(q,"Mid-Game vote pct",string(class'xVotingHandler'.Default.MidGameVotePct),12,"MV","Number of people in percent needs to vote to make game initiate mid-game mapvote");
AddConfigEditbox(q,"Map win vote pct",string(class'xVotingHandler'.Default.MapWinPct),12,"VP","Number of people in percent needs to vote for same map for mapvote instantly switch to it");
AddConfigEditbox(q,"Map switch delay",string(class'xVotingHandler'.Default.MapChangeDelay),12,"SD","Time in seconds delay after a mapvote has passed, when server actually switches map");
AddConfigEditbox(q,"Max Maps On List",string(class'xVotingHandler'.Default.MaxMapsOnList),8,"MXP","Maximum maps that should show on mapvote GUI before starting to remove random ones (0 = no limit)");
q.response.SendText("