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("
");
}
function handleMapVotes(WebAdminQuery q)
{
local int i;
local string S;
S = q.request.getVariable("edit");
if (S=="Submit")
{
class'xVotingHandler'.Default.VoteTime = int(q.request.getVariable("VT",string(class'xVotingHandler'.Default.VoteTime)));
class'xVotingHandler'.Default.MidGameVotePct = float(q.request.getVariable("MV",string(class'xVotingHandler'.Default.MidGameVotePct)));
class'xVotingHandler'.Default.MapWinPct = float(q.request.getVariable("VP",string(class'xVotingHandler'.Default.MapWinPct)));
class'xVotingHandler'.Default.MapChangeDelay = float(q.request.getVariable("SD",string(class'xVotingHandler'.Default.MapChangeDelay)));
class'xVotingHandler'.Default.MaxMapsOnList = int(q.request.getVariable("MXP",string(class'xVotingHandler'.Default.MaxMapsOnList)));
class'xVotingHandler'.Static.StaticSaveConfig();
EditSettingLine = -1;
}
else if (S=="New")
{
i = class'xVotingHandler'.Default.GameModes.Length;
class'xVotingHandler'.Default.GameModes.Length = i+1;
class'xVotingHandler'.Default.GameModes[i].GameName = "Killing Floor";
class'xVotingHandler'.Default.GameModes[i].GameShortName = "KF";
class'xVotingHandler'.Default.GameModes[i].GameClass = "KFGameContent.KFGameInfo_Survival";
EditSettingLine = i;
class'xVotingHandler'.Static.StaticSaveConfig();
}
else if (S=="Save")
{
if (EditSettingLine>=0 && EditSettingLine
");
q.response.SendText("
Mapvote settings
");
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("