Prepare fixtures
This commit is contained in:
parent
797e5ea192
commit
9c94356263
6021 changed files with 722805 additions and 22 deletions
208
kf_sources/XWebAdmin/Classes/ListItem.uc
Normal file
208
kf_sources/XWebAdmin/Classes/ListItem.uc
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
class ListItem extends Object;
|
||||
|
||||
var ListItem Next;
|
||||
var ListItem Prev;
|
||||
|
||||
var String Tag; // sorted element
|
||||
var String Data; // saved data
|
||||
var bool bJustMoved; // if the map was just moved, keep it selected
|
||||
|
||||
function AddElement(ListItem NewElement)
|
||||
{
|
||||
local ListItem TempItem;
|
||||
|
||||
for (TempItem = self; TempItem.Next != None; TempItem = TempItem.Next);
|
||||
|
||||
TempItem.Next = NewElement;
|
||||
NewElement.Prev = TempItem;
|
||||
NewElement.Next = None;
|
||||
}
|
||||
|
||||
function AddSortedElement(out ListItem FirstElement, ListItem NewElement)
|
||||
{
|
||||
local ListItem TempItem;
|
||||
|
||||
// find item which new should be inserted after
|
||||
TempItem = FirstElement;
|
||||
while (TempItem != None)
|
||||
{
|
||||
// if current is less or equal than new, but is at the end
|
||||
if (Caps(TempItem.Tag) <= Caps(NewElement.Tag) && TempItem.Next == None)
|
||||
{
|
||||
TempItem.Next = NewElement;
|
||||
NewElement.Prev = TempItem;
|
||||
NewElement.Next = None;
|
||||
break;
|
||||
} // else if current is greater than new
|
||||
else if (Caps(TempItem.Tag) > Caps(NewElement.Tag))
|
||||
{ // if current.prev == none, then make it the new first element
|
||||
if (TempItem.Prev == None)
|
||||
FirstElement = NewElement;
|
||||
else
|
||||
TempItem.Prev.Next = NewElement;
|
||||
|
||||
NewElement.Prev = TempItem.Prev;
|
||||
NewElement.Next = TempItem;
|
||||
TempItem.Prev = NewElement;
|
||||
break;
|
||||
}
|
||||
TempItem = TempItem.Next;
|
||||
}
|
||||
}
|
||||
|
||||
function ListItem FindItem(String SearchData)
|
||||
{
|
||||
local ListItem TempItem;
|
||||
|
||||
for (TempItem = self; TempItem != None; TempItem = TempItem.Next)
|
||||
{
|
||||
if (TempItem.Data ~= SearchData)
|
||||
return TempItem;
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
function ListItem DeleteElement(out ListItem First, optional String SearchData)
|
||||
{
|
||||
local ListItem TempItem;
|
||||
for (TempItem = self; TempItem != None; TempItem = TempItem.Next)
|
||||
{
|
||||
if (TempItem.Data ~= SearchData || SearchData == "") {
|
||||
// if no prev, assume this is the first element
|
||||
if (TempItem == First || TempItem.Prev == None) {
|
||||
First = TempItem.Next;
|
||||
if (First != None)
|
||||
First.Prev = None;
|
||||
}
|
||||
else { // close the links around TempItem
|
||||
if (TempItem.Prev != None)
|
||||
TempItem.Prev.Next = TempItem.Next;
|
||||
if (TempItem.Next != None)
|
||||
TempItem.Next.Prev = TempItem.Prev;
|
||||
}
|
||||
|
||||
TempItem.Prev = None;
|
||||
TempItem.Next = None;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TempItem;
|
||||
}
|
||||
|
||||
function MoveElementUp(out ListItem First, ListItem MoveItem, out int Count)
|
||||
{
|
||||
local ListItem TempItem;
|
||||
local int TempCount;
|
||||
|
||||
if (MoveItem != None) {
|
||||
for (TempCount = Count; TempCount > 0 && MoveItem.Prev != None; TempCount--) {
|
||||
TempItem = MoveItem.Prev;
|
||||
MoveItem.Prev = TempItem.Prev;
|
||||
if (MoveItem.Prev != None)
|
||||
MoveItem.Prev.Next = MoveItem;
|
||||
TempItem.Next = MoveItem.Next;
|
||||
if (TempItem.Next != None)
|
||||
TempItem.Next.Prev = TempItem;
|
||||
MoveItem.Next = TempItem;
|
||||
TempItem.Prev = MoveItem;
|
||||
|
||||
if (TempItem == First)
|
||||
First = MoveItem;
|
||||
}
|
||||
Count = Count - TempCount;
|
||||
}
|
||||
}
|
||||
|
||||
function MoveElementDown(out ListItem First, ListItem MoveItem, out int Count)
|
||||
{
|
||||
local ListItem TempItem;
|
||||
local int TempCount;
|
||||
|
||||
if (MoveItem != None) {
|
||||
for (TempCount = Count; TempCount > 0 && MoveItem.Next != None; TempCount--) {
|
||||
TempItem = MoveItem.Next;
|
||||
MoveItem.Next = TempItem.Next;
|
||||
if (MoveItem.Next != None)
|
||||
MoveItem.Next.Prev = MoveItem;
|
||||
TempItem.Prev = MoveItem.Prev;
|
||||
if (TempItem.Prev != None)
|
||||
TempItem.Prev.Next = TempItem;
|
||||
MoveItem.Prev = TempItem;
|
||||
TempItem.Next = MoveItem;
|
||||
|
||||
if (MoveItem == First)
|
||||
First = TempItem;
|
||||
}
|
||||
Count = Count - TempCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function RunTest()
|
||||
{
|
||||
local ListItem Test, TempItem;
|
||||
|
||||
Log("Test: Init 'B'");
|
||||
Test = new(None) class'ListItem';
|
||||
Test.Tag = "B";
|
||||
Test.Data = "B";
|
||||
Log(" => Test="$Test);
|
||||
|
||||
TempItem = new(None) class'ListItem';
|
||||
TempItem.Tag = "A";
|
||||
TempItem.Data = "A";
|
||||
Log("Test: AddSort 'A'");
|
||||
Test.AddSortedElement(Test, TempItem);
|
||||
Log(" => Test="$Test);
|
||||
for (TempItem = Test; TempItem != None; TempItem = TempItem.Next)
|
||||
Log(" => Tag="$TempItem.Tag$" Prev="$TempItem.Prev$" Next="$TempItem.Next);
|
||||
|
||||
TempItem = new(None) class'ListItem';
|
||||
TempItem.Tag = "D";
|
||||
TempItem.Data = "D";
|
||||
Log("Test: AddSort 'D'");
|
||||
Test.AddSortedElement(Test, TempItem);
|
||||
Log(" => Test="$Test);
|
||||
for (TempItem = Test; TempItem != None; TempItem = TempItem.Next)
|
||||
Log(" => Tag="$TempItem.Tag$" Prev="$TempItem.Prev$" Next="$TempItem.Next);
|
||||
|
||||
TempItem = new(None) class'ListItem';
|
||||
TempItem.Tag = "C";
|
||||
TempItem.Data = "C";
|
||||
Log("Test: AddSort 'C'");
|
||||
Test.AddSortedElement(Test, TempItem);
|
||||
Log(" => Test="$Test);
|
||||
for (TempItem = Test; TempItem != None; TempItem = TempItem.Next)
|
||||
Log(" => Tag="$TempItem.Tag$" Prev="$TempItem.Prev$" Next="$TempItem.Next);
|
||||
|
||||
Log("");
|
||||
|
||||
Log("Test: Delete 'C'");
|
||||
Test.DeleteElement(Test, "C");
|
||||
Log(" => Test="$Test);
|
||||
for (TempItem = Test; TempItem != None; TempItem = TempItem.Next)
|
||||
Log(" => Tag="$TempItem.Tag$" Prev="$TempItem.Prev$" Next="$TempItem.Next);
|
||||
|
||||
Log("Test: Delete 'D'");
|
||||
Test.DeleteElement(Test, "D");
|
||||
Log(" => Test="$Test);
|
||||
for (TempItem = Test; TempItem != None; TempItem = TempItem.Next)
|
||||
Log(" => Tag="$TempItem.Tag$" Prev="$TempItem.Prev$" Next="$TempItem.Next);
|
||||
|
||||
Log("Test: Delete 'A'");
|
||||
Test.DeleteElement(Test, "A");
|
||||
Log(" => Test="$Test);
|
||||
for (TempItem = Test; TempItem != None; TempItem = TempItem.Next)
|
||||
Log(" => Tag="$TempItem.Tag$" Prev="$TempItem.Prev$" Next="$TempItem.Next);
|
||||
|
||||
Log("Test: Delete 'B'");
|
||||
Test.DeleteElement(Test, "B");
|
||||
Log(" => Test="$Test);
|
||||
for (TempItem = Test; TempItem != None; TempItem = TempItem.Next)
|
||||
Log(" => Tag="$TempItem.Tag$" Prev="$TempItem.Prev$" Next="$TempItem.Next);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
}
|
||||
141
kf_sources/XWebAdmin/Classes/ObjectArray.uc
Normal file
141
kf_sources/XWebAdmin/Classes/ObjectArray.uc
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
// ====================================================================
|
||||
// Class: xWebAdmin.ObjectArray
|
||||
// Parent: Core.Object
|
||||
//
|
||||
// <Enter a description here>
|
||||
// ====================================================================
|
||||
|
||||
class ObjectArray extends Object;
|
||||
|
||||
struct ArrayItem
|
||||
{
|
||||
var object item;
|
||||
var string tag;
|
||||
};
|
||||
|
||||
var protected array<ArrayItem> AllItems;
|
||||
var protected bool ReverseSort;
|
||||
|
||||
// ObjectArray members must always be unique
|
||||
function Add(object item, string tag)
|
||||
{
|
||||
InsertAt(AllItems.Length, item, tag);
|
||||
}
|
||||
|
||||
protected function SetAt(int pos, object item, string tag)
|
||||
{
|
||||
// Increase array if necessary
|
||||
if (AllItems.Length <= pos)
|
||||
AllItems.Length = (pos+1);
|
||||
|
||||
AllItems[pos].item = item;
|
||||
AllItems[pos].tag = tag;
|
||||
}
|
||||
|
||||
protected function InsertAt(int pos, object item, string tag)
|
||||
{
|
||||
// See if need to insert or increase length
|
||||
if (pos < AllItems.Length)
|
||||
AllItems.Insert(pos, 1);
|
||||
else
|
||||
AllItems.Length = (pos+1);
|
||||
|
||||
AllItems[pos].item = item;
|
||||
AllItems[pos].tag = tag;
|
||||
}
|
||||
|
||||
// User Prepare if you know the number of items that will be inserted
|
||||
function SetSize(int NewSize)
|
||||
{
|
||||
// HACK: This is to pre-allocate the space in the FArray
|
||||
// It should prevent a bunch of Realloc()
|
||||
AllItems.Length = NewSize;
|
||||
AllItems.Length = 0;
|
||||
}
|
||||
|
||||
function Reset()
|
||||
{
|
||||
AllItems.Length = 0;
|
||||
}
|
||||
|
||||
function int Count()
|
||||
{
|
||||
return AllItems.Length;
|
||||
}
|
||||
|
||||
function int FindItemId(object item)
|
||||
{
|
||||
local int i;
|
||||
|
||||
for (i=0; i<i; i++)
|
||||
if (AllItems[i].item == item)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function int FindTagId(string tag)
|
||||
{
|
||||
local int i;
|
||||
|
||||
for (i=0; i<i; i++)
|
||||
if (AllItems[i].tag == tag)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function bool Remove(int index)
|
||||
{
|
||||
if (index < 0 || index >= AllItems.Length)
|
||||
return false;
|
||||
|
||||
AllItems.Remove(index, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
function object GetItem(int index) { return AllItems[index].item; }
|
||||
function string GetTag(int index) { return AllItems[index].tag; }
|
||||
|
||||
function int CopyTo(ObjectArray arr, string Tag)
|
||||
{
|
||||
local int i;
|
||||
|
||||
i = FindTagId(Tag);
|
||||
if (i >= 0)
|
||||
arr.Add(AllItems[i].item, AllItems[i].tag);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
function int CopyItemTo(ObjectArray arr, object item)
|
||||
{
|
||||
local int i;
|
||||
|
||||
i = FindItemId(item);
|
||||
if (i >= 0)
|
||||
arr.Add(AllItems[i].item, AllItems[i].tag);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
// 0 = Sort lowest to highest (A first, Z last)
|
||||
// 1 = Reverse sort (Z first, A last)
|
||||
singular function SetSortOrder(bool Order)
|
||||
{
|
||||
ReverseSort = Order;
|
||||
}
|
||||
|
||||
singular function ToggleSort()
|
||||
{
|
||||
ReverseSort = !ReverseSort;
|
||||
}
|
||||
|
||||
function bool IsBefore(string test, string tag)
|
||||
{
|
||||
return ((!ReverseSort && Caps(test) < Caps(tag)) || (ReverseSort && Caps(test) > Caps(tag)));
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
}
|
||||
16
kf_sources/XWebAdmin/Classes/ROOstSkin.uc
Normal file
16
kf_sources/XWebAdmin/Classes/ROOstSkin.uc
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class ROOstSkin extends WebSkin;
|
||||
|
||||
function Init(UTServerAdmin WebAdmin)
|
||||
{
|
||||
WebAdmin.SkinPath = "";
|
||||
WebAdmin.SiteBG = DefaultBGColor;
|
||||
WebAdmin.SiteCSSFile = SkinCSS;
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
DisplayName="Standard Killing Floor"
|
||||
}
|
||||
119
kf_sources/XWebAdmin/Classes/SortedObjectArray.uc
Normal file
119
kf_sources/XWebAdmin/Classes/SortedObjectArray.uc
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
// ====================================================================
|
||||
// Class: xWebAdmin.SortedObjectArray
|
||||
// Parent: xWebAdmin.ObjectArray
|
||||
//
|
||||
// Sorted list - sorts by tag
|
||||
// ====================================================================
|
||||
|
||||
class SortedObjectArray extends ObjectArray;
|
||||
|
||||
var const bool debug;
|
||||
|
||||
function Add(object item, string tag)
|
||||
{
|
||||
local int pos;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
for (pos = 0; pos < AllItems.Length; pos++)
|
||||
log(" Member"@pos@AllItems[pos].Tag);
|
||||
}
|
||||
|
||||
pos = FindTagId(tag);
|
||||
|
||||
if (pos < 0)
|
||||
InsertAt(-pos-1, item, tag);
|
||||
else
|
||||
InsertAt(pos, item, tag);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
log("~~Inserting new member at"@pos@tag);
|
||||
for (pos = 0; pos < AllItems.Length; pos++)
|
||||
log(" Member"@pos@AllItems[pos].Tag);
|
||||
}
|
||||
}
|
||||
|
||||
function int FindTagId(string Tag)
|
||||
{
|
||||
local int sz, min, max, pos;
|
||||
|
||||
sz = AllItems.Length - 1;
|
||||
if (sz < 0 || IsBefore(Tag, AllItems[0].tag))
|
||||
{
|
||||
if (debug)
|
||||
log(tag@"was before first member, so returning -1");
|
||||
return -1;
|
||||
}
|
||||
if (Tag ~= AllItems[0].Tag)
|
||||
return 0;
|
||||
|
||||
if (Tag ~= AllItems[sz].Tag)
|
||||
return sz;
|
||||
|
||||
if (sz == 1)
|
||||
return -3;
|
||||
// Add tag to end of list
|
||||
if (!IsBefore(Tag,AllItems[sz].tag))
|
||||
{
|
||||
if (debug)
|
||||
log(tag@"was after last member, so returning"@(-(sz+1))-1);
|
||||
return (-(sz+1))-1;
|
||||
}
|
||||
|
||||
// Find the position of insertion
|
||||
max = sz;
|
||||
pos = sz;
|
||||
do {
|
||||
if (tag ~= AllItems[pos].tag)
|
||||
return pos;
|
||||
if (IsBefore(Tag,AllItems[pos].tag))
|
||||
max = pos;
|
||||
else min = pos;
|
||||
|
||||
if (debug)
|
||||
log("Min:"$Min@"Max:"$Max@"Pos:"$((Min + Max)/2));
|
||||
|
||||
pos = (min + max)/2;
|
||||
} until (max-min < 2);
|
||||
|
||||
// Min = 1 and Max = 2, return 1
|
||||
if (pos == 0)
|
||||
{
|
||||
if (debug)
|
||||
log(tag@"wanted to be added at 0, so adding at 1 instead");
|
||||
return 1;
|
||||
}
|
||||
if (debug)
|
||||
log(tag@"will be inserted at position"@-pos-2);
|
||||
return -pos-2;
|
||||
}
|
||||
|
||||
/*
|
||||
singular function ToggleSort()
|
||||
{
|
||||
ReverseSort = !ReverseSort;
|
||||
log("ToggleSort. ReverseSort is now:"$ReverseSort);
|
||||
}
|
||||
|
||||
*/
|
||||
function bool IsBefore(string test, string tag)
|
||||
{
|
||||
local bool b;
|
||||
if (debug)
|
||||
{
|
||||
b = ((!ReverseSort && test < tag) || (ReverseSort && test > tag));
|
||||
log("IsBefore");
|
||||
log(" ReverseSort:"$ReverseSort);
|
||||
log(" "$Test@"is before"@Tag$":"@b);
|
||||
log("");
|
||||
return ((!ReverseSort && test < tag) || (ReverseSort && test > tag));
|
||||
}
|
||||
|
||||
return Super.IsBefore(test,tag);
|
||||
}
|
||||
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
}
|
||||
62
kf_sources/XWebAdmin/Classes/SortedStringArray.uc
Normal file
62
kf_sources/XWebAdmin/Classes/SortedStringArray.uc
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// ====================================================================
|
||||
// Class: XAdmin.SortedStringArray
|
||||
// Parent: XAdmin.StringArray
|
||||
//
|
||||
// Sorted list - sorts based on tag
|
||||
// ====================================================================
|
||||
|
||||
class SortedStringArray extends StringArray;
|
||||
|
||||
function int Add(coerce string item, coerce string tag, optional bool bUnique)
|
||||
{
|
||||
local int pos;
|
||||
|
||||
pos = FindTagId(tag);
|
||||
|
||||
if (pos < 0)
|
||||
return InsertAt(-pos-1, item, tag);
|
||||
else if (bUnique)
|
||||
return pos;
|
||||
|
||||
return InsertAt(pos, item, tag);
|
||||
}
|
||||
|
||||
function int FindTagId(coerce string Tag)
|
||||
{
|
||||
local int Last, Min, Max, Pos;
|
||||
|
||||
Last = AllItems.Length - 1;
|
||||
if ( Last < 0 || IsBefore(Tag,AllItems[0].Tag) )
|
||||
return -1;
|
||||
|
||||
if (Tag ~= AllItems[0].Tag)
|
||||
return 0;
|
||||
|
||||
if (Tag ~= AllItems[Last].Tag)
|
||||
return Last;
|
||||
|
||||
// if (Last == 0)
|
||||
// return -2;
|
||||
|
||||
// Add tag to end of list
|
||||
if (!IsBefore(Tag,AllItems[Last].tag))
|
||||
return (-(Last+1))-1;
|
||||
|
||||
// Find the position of insertion
|
||||
max = Last;
|
||||
pos = Last;
|
||||
do {
|
||||
if (tag ~= AllItems[pos].tag)
|
||||
return pos;
|
||||
if (IsBefore(Tag,AllItems[pos].tag))
|
||||
max = pos;
|
||||
else min = pos;
|
||||
|
||||
pos = (min + max)/2;
|
||||
} until (max-min < 2);
|
||||
if (pos == 0)
|
||||
return -2;
|
||||
|
||||
return -pos-2;
|
||||
}
|
||||
|
||||
220
kf_sources/XWebAdmin/Classes/StringArray.uc
Normal file
220
kf_sources/XWebAdmin/Classes/StringArray.uc
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
// ====================================================================
|
||||
// Class: XAdmin.StringArray
|
||||
// Parent: Core.Object
|
||||
//
|
||||
// <Enter a description here>
|
||||
// ====================================================================
|
||||
|
||||
class StringArray extends Object;
|
||||
|
||||
struct ArrayItem
|
||||
{
|
||||
var string item;
|
||||
var string tag;
|
||||
};
|
||||
|
||||
var protected array<ArrayItem> AllItems;
|
||||
var protected bool ReverseSort;
|
||||
|
||||
function int Add(coerce string item, coerce string tag, optional bool bUnique)
|
||||
{
|
||||
local int pos;
|
||||
|
||||
if (bUnique)
|
||||
{
|
||||
pos = FindTagId(tag);
|
||||
if (pos >= 0)
|
||||
return pos;
|
||||
}
|
||||
return InsertAt(AllItems.Length, item, tag);
|
||||
}
|
||||
|
||||
protected function int SetAt(int pos, coerce string item, coerce string tag)
|
||||
{
|
||||
// Increase array if necessary
|
||||
if (AllItems.Length <= pos)
|
||||
AllItems.Length = (pos+1);
|
||||
|
||||
AllItems[pos].item = item;
|
||||
AllItems[pos].tag = tag;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
protected function int InsertAt(int pos, coerce string item, coerce string tag)
|
||||
{
|
||||
// See if need to insert or increase length
|
||||
if (pos < AllItems.Length)
|
||||
AllItems.Insert(pos, 1);
|
||||
else
|
||||
AllItems.Length = (pos+1);
|
||||
|
||||
AllItems[pos].item = item;
|
||||
AllItems[pos].tag = tag;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
// User Prepare if you know the number of items that will be inserted
|
||||
function SetSize(int NewSize)
|
||||
{
|
||||
// HACK: This is to pre-allocate the space in the FArray
|
||||
// It should prevent a bunch of Realloc()
|
||||
AllItems.Length = NewSize;
|
||||
AllItems.Length = 0;
|
||||
}
|
||||
|
||||
function Reset()
|
||||
{
|
||||
AllItems.Length = 0;
|
||||
}
|
||||
|
||||
function int Count()
|
||||
{
|
||||
return AllItems.Length;
|
||||
}
|
||||
|
||||
function int FindItemId(coerce string item, optional bool bLog)
|
||||
{
|
||||
local int i;
|
||||
|
||||
for (i=0; i<AllItems.Length; i++)
|
||||
if (AllItems[i].item ~= item)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function int FindTagId(coerce string tag)
|
||||
{
|
||||
local int i;
|
||||
|
||||
for (i=0; i<AllItems.Length; i++)
|
||||
if (AllItems[i].tag ~= tag)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function bool Remove(int index)
|
||||
{
|
||||
if (index < 0 || index >= AllItems.Length)
|
||||
return false;
|
||||
|
||||
AllItems.Remove(index, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
function string GetItem(int index) { return AllItems[index].item; }
|
||||
function string GetTag(int index) { return AllItems[index].tag; }
|
||||
|
||||
function int CopyFrom(StringArray arr, coerce string Tag)
|
||||
{
|
||||
local int id;
|
||||
|
||||
id = arr.FindTagId(Tag);
|
||||
if (id >= 0 && id < arr.Count())
|
||||
id = Add(arr.GetItem(id), arr.GetTag(id));
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
function int MoveFrom(StringArray arr, coerce string Tag)
|
||||
{
|
||||
return MoveFromId(arr, arr.FindTagId(Tag));
|
||||
}
|
||||
|
||||
function int MoveFromId(StringArray arr, int id)
|
||||
{
|
||||
local int newid;
|
||||
|
||||
if (id >= 0 && id < arr.Count())
|
||||
{
|
||||
newid = Add(arr.GetItem(id), arr.GetTag(id));
|
||||
arr.Remove(id);
|
||||
return newid;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function int CopyFromId(StringArray arr, int id)
|
||||
{
|
||||
if (id >= 0 && id < arr.Count())
|
||||
return Add(arr.GetItem(id), arr.GetTag(id));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function ShiftStrict(int id, out int Count)
|
||||
{
|
||||
if (Count == 0 || id<0 || id >= AllItems.Length)
|
||||
return;
|
||||
|
||||
if (Count < 0)
|
||||
{
|
||||
// Move items toward 0
|
||||
if (id + Count < 0)
|
||||
Count = -id;
|
||||
InsertAt(id + Count, AllItems[id].item, AllItems[id].Tag);
|
||||
Remove(id+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((id + Count + 1) >= AllItems.Length)
|
||||
Count = AllItems.Length - id - 1;
|
||||
|
||||
InsertAt(id + Count + 1, AllItems[id].item, AllItems[id].Tag);
|
||||
Remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
// 0 = Sort lowest to highest (A first, Z last)
|
||||
// 1 = Reverse sort (Z first, A last)
|
||||
// Thread safe
|
||||
singular function SetSortOrder(bool Order)
|
||||
{
|
||||
ReverseSort = Order;
|
||||
}
|
||||
|
||||
singular function ToggleSort()
|
||||
{
|
||||
ReverseSort = !ReverseSort;
|
||||
}
|
||||
|
||||
function bool IsBefore(string test, string tag)
|
||||
{
|
||||
local bool bResult;
|
||||
|
||||
bResult = Strcmp(Test,Tag,,True) < 0;
|
||||
if ( ReverseSort )
|
||||
return !bResult;
|
||||
else return bResult;
|
||||
}
|
||||
|
||||
/*
|
||||
function int CopyTo(ObjectArray arr, string Tag)
|
||||
{
|
||||
local int i;
|
||||
|
||||
i = FindTagId(Tag);
|
||||
if (i >= 0 && id < arr.Count())
|
||||
arr.Add(AllItems[i].item, AllItems[i].tag);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
function int CopyItemTo(ObjectArray arr, string item)
|
||||
{
|
||||
local int i;
|
||||
|
||||
i = FindItemId(item);
|
||||
if (i >= 0 && id < arr.Count())
|
||||
arr.Add(AllItems[i].item, AllItems[i].tag);
|
||||
|
||||
return i;
|
||||
}
|
||||
*/
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
}
|
||||
2
kf_sources/XWebAdmin/Classes/UTImageServer.uc
Normal file
2
kf_sources/XWebAdmin/Classes/UTImageServer.uc
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
class UTImageServer extends ImageServer;
|
||||
|
||||
1369
kf_sources/XWebAdmin/Classes/UTServerAdmin.uc
Normal file
1369
kf_sources/XWebAdmin/Classes/UTServerAdmin.uc
Normal file
File diff suppressed because it is too large
Load diff
203
kf_sources/XWebAdmin/Classes/UTServerAdminSpectator.uc
Normal file
203
kf_sources/XWebAdmin/Classes/UTServerAdminSpectator.uc
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
class UTServerAdminSpectator extends MessagingSpectator
|
||||
config;
|
||||
|
||||
struct PlayerMessage
|
||||
{
|
||||
var PlayerReplicationInfo PRI;
|
||||
var String Text;
|
||||
var Name Type;
|
||||
var PlayerMessage Next; // pointer to next message
|
||||
};
|
||||
|
||||
var array<string> Messages;
|
||||
|
||||
var byte NextMsg, LastMsg;
|
||||
var config byte ReceivedMsgMax;
|
||||
|
||||
var config bool bClientMessages;
|
||||
var config bool bTeamMessages;
|
||||
var config bool bVoiceMessages;
|
||||
var config bool bLocalizedMessages;
|
||||
var UTServerAdmin Server;
|
||||
|
||||
function bool SetPause( BOOL bPause )
|
||||
{
|
||||
log("Webadmin spectator executing SetPause:"$bPause);
|
||||
return Super.SetPause(bPause);
|
||||
}
|
||||
|
||||
/* Pause()
|
||||
Command to try to pause the game.
|
||||
*/
|
||||
function ServerPause()
|
||||
{
|
||||
log("Webadmin spectator executing pause command!");
|
||||
Super.Pause();
|
||||
}
|
||||
|
||||
event Destroyed()
|
||||
{
|
||||
Server.Spectator = None;
|
||||
Super.Destroyed();
|
||||
}
|
||||
|
||||
event PreBeginPlay()
|
||||
{
|
||||
Super.PreBeginPlay();
|
||||
NextMsg = 0;
|
||||
LastMsg = 0;
|
||||
if (ReceivedMsgMax < 10)
|
||||
ReceivedMsgMax = 10;
|
||||
|
||||
Messages.Length = ReceivedMsgMax;
|
||||
}
|
||||
|
||||
function int LastMessage()
|
||||
{
|
||||
return LastMsg;
|
||||
}
|
||||
|
||||
function string NextMessage(out int msg)
|
||||
{
|
||||
local string str;
|
||||
|
||||
if (msg == NextMsg)
|
||||
return "";
|
||||
|
||||
str = Messages[msg];
|
||||
msg++;
|
||||
|
||||
if (msg >= ReceivedMsgMax)
|
||||
msg = 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// Implemented Rotating
|
||||
function AddMessage(PlayerReplicationInfo PRI, String S, name Type)
|
||||
{
|
||||
// Add the message to the array
|
||||
Messages[NextMsg] = FormatMessage(PRI, S, Type);
|
||||
NextMsg++;
|
||||
|
||||
if (NextMsg >= ReceivedMsgMax)
|
||||
NextMsg = 0;
|
||||
|
||||
if (NextMsg == LastMsg)
|
||||
LastMsg++;
|
||||
|
||||
if (LastMsg >= ReceivedMsgMax)
|
||||
LastMsg = 0;
|
||||
}
|
||||
|
||||
function Dump()
|
||||
{
|
||||
Log("----Begin Dump----");
|
||||
if (PlayerReplicationInfo == None)
|
||||
Log("NO PLAYER REPLICATION INFO");
|
||||
if (Pawn == None)
|
||||
Log("NO PAWN");
|
||||
Log("NextMsg:"@NextMsg);
|
||||
Log("LastMsg:"@LastMsg);
|
||||
Log("ReceivedMsgMax:"@ReceivedMsgMax);
|
||||
Log("Msg[0]"@Messages[0]);
|
||||
Log("Msg[1]"@Messages[1]);
|
||||
Log("Msg[2]"@Messages[2]);
|
||||
Log("Msg[3]"@Messages[3]);
|
||||
Log("Msg[4]"@Messages[4]);
|
||||
Log("Msg[5]"@Messages[5]);
|
||||
}
|
||||
|
||||
function String FormatMessage(PlayerReplicationInfo PRI, String Text, name Type)
|
||||
{
|
||||
local String Message;
|
||||
|
||||
// format Say and TeamSay messages
|
||||
if (PRI != None) {
|
||||
if (Type == 'Say' && PRI == PlayerReplicationInfo)
|
||||
Message = Text;
|
||||
else if (Type == 'Say')
|
||||
Message = PRI.PlayerName$": "$Text;
|
||||
else if (Type == 'TeamSay')
|
||||
Message = "["$PRI.PlayerName$"]: "$Text;
|
||||
else
|
||||
Message = "("$Type$") "$Text;
|
||||
}
|
||||
else if (Type == 'Console')
|
||||
Message = "WebAdmin:"@Text;
|
||||
else
|
||||
Message = "("$Type$") "$Text;
|
||||
|
||||
return Message;
|
||||
}
|
||||
|
||||
event ClientMessage( coerce string S, optional Name Type )
|
||||
{
|
||||
//Log("Admin Received a ClientMessage");
|
||||
if (bClientMessages)
|
||||
AddMessage(None, S, Type);
|
||||
}
|
||||
|
||||
function TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type)
|
||||
{
|
||||
//Log("Admin Received a TeamMessage");
|
||||
if (bTeamMessages)
|
||||
AddMessage(PRI, S, Type);
|
||||
}
|
||||
|
||||
// if _RO_
|
||||
function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID, optional Pawn soundSender, optional vector senderLocation)
|
||||
// else
|
||||
// function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
|
||||
// end if _RO_
|
||||
{
|
||||
//Log("Admin Received a ClientVoiceMessage");
|
||||
// do nothing?
|
||||
}
|
||||
|
||||
function ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
|
||||
{
|
||||
//Log("Admin Received a LocalizedMessage");
|
||||
// do nothing?
|
||||
}
|
||||
|
||||
// A couple of functions that should not do anything
|
||||
function ClientGameEnded() {}
|
||||
|
||||
// Report end game in log
|
||||
function GameHasEnded()
|
||||
{
|
||||
AddMessage(None, "GAME HAS ENDED", 'Console');
|
||||
}
|
||||
|
||||
exec function DumpMaplists( string GameType )
|
||||
{
|
||||
local int i;
|
||||
local int GameIndex;
|
||||
local StringArray ExcludeMaps, IncludeMaps;
|
||||
|
||||
if ( GameType == "" )
|
||||
GameType = string(Level.Game.Class);
|
||||
|
||||
GameIndex = Level.Game.MaplistHandler.GetGameIndex(GameType);
|
||||
ExcludeMaps = Server.ReloadExcludeMaps(GameType);
|
||||
IncludeMaps = Server.ReloadIncludeMaps(ExcludeMaps, GameIndex, Level.Game.MaplistHandler.GetActiveList(GameIndex));
|
||||
|
||||
for ( i = 0; i < ExcludeMaps.Count(); i++ )
|
||||
{
|
||||
log(" ExcludeMaps["$i$"]: Item '"$ExcludeMaps.GetItem(i)$"' Tag '"$ExcludeMaps.GetTag(i)$"'");
|
||||
}
|
||||
|
||||
for ( i = 0; i < IncludeMaps.Count(); i++ )
|
||||
{
|
||||
log(" IncludeMaps["$i$"]: Item '"$IncludeMaps.GetItem(i)$"' Tag '"$IncludeMaps.GetTag(i)$"'");
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
ReceivedMsgMax=32
|
||||
bClientMessages=True
|
||||
bTeamMessages=True
|
||||
bLocalizedMessages=True
|
||||
}
|
||||
43
kf_sources/XWebAdmin/Classes/WebSkin.uc
Normal file
43
kf_sources/XWebAdmin/Classes/WebSkin.uc
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class WebSkin extends Object
|
||||
abstract
|
||||
notplaceable;
|
||||
|
||||
var string SubPath;
|
||||
var localized string DisplayName; // Name to use in skin select box
|
||||
var string SkinCSS; // CSS file associated with this skin
|
||||
var string DefaultBGColor; // Color for webadmin backgrounds
|
||||
|
||||
// Array containing any pages you'd like to handle a query for
|
||||
var array<string> SpecialQuery;
|
||||
|
||||
function Init(UTServerAdmin WebAdmin)
|
||||
{
|
||||
WebAdmin.SkinPath = "/" $ SubPath;
|
||||
WebAdmin.SiteBG = DefaultBGColor;
|
||||
WebAdmin.SiteCSSFile = SkinCSS;
|
||||
}
|
||||
|
||||
// Add additional values to WebResponse object
|
||||
// Return true to cancel normal handling of query
|
||||
// Return false to allow UTServerAdmin to continue processing query
|
||||
function bool HandleSpecialQuery(WebRequest Request, WebResponse Response) { return false; }
|
||||
|
||||
// Hook for overriding VariableMap values before tokens in .htm or .inc files are replaced with values
|
||||
// Return false to allow query processing to continue
|
||||
function string HandleWebInclude(WebResponse Response, string filename) { return ""; }
|
||||
function bool HandleHTM(WebResponse Response, string filename) { return false; }
|
||||
function bool HandleMessagePage(WebResponse Response, string Title, string Message) { return false; }
|
||||
function bool HandleFrameMessage(WebResponse Response, string Message, bool bIsError) { return false; }
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
DefaultBGColor="#411b17"
|
||||
DisplayName="SomeSkin"
|
||||
SkinCSS="ROOst.css"
|
||||
}
|
||||
|
||||
|
||||
|
||||
21
kf_sources/XWebAdmin/Classes/index.html
Normal file
21
kf_sources/XWebAdmin/Classes/index.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<html>
|
||||
<head><title>Index of /kf_sources/XWebAdmin/Classes/</title></head>
|
||||
<body>
|
||||
<h1>Index of /kf_sources/XWebAdmin/Classes/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="ListItem.uc">ListItem.uc</a> 06-Oct-2019 10:27 5767
|
||||
<a href="ObjectArray.uc">ObjectArray.uc</a> 06-Oct-2019 10:27 2760
|
||||
<a href="ROOstSkin.uc">ROOstSkin.uc</a> 06-Oct-2019 10:27 373
|
||||
<a href="SortedObjectArray.uc">SortedObjectArray.uc</a> 06-Oct-2019 10:27 2494
|
||||
<a href="SortedStringArray.uc">SortedStringArray.uc</a> 06-Oct-2019 10:27 1341
|
||||
<a href="StringArray.uc">StringArray.uc</a> 06-Oct-2019 10:27 4243
|
||||
<a href="UTImageServer.uc">UTImageServer.uc</a> 06-Oct-2019 10:27 44
|
||||
<a href="UTServerAdmin.uc">UTServerAdmin.uc</a> 06-Oct-2019 10:27 40786
|
||||
<a href="UTServerAdminSpectator.uc">UTServerAdminSpectator.uc</a> 06-Oct-2019 10:27 4748
|
||||
<a href="WebSkin.uc">WebSkin.uc</a> 06-Oct-2019 10:27 1566
|
||||
<a href="xWebAdminCommandLet.uc">xWebAdminCommandLet.uc</a> 06-Oct-2019 10:27 731
|
||||
<a href="xWebQueryAdmins.uc">xWebQueryAdmins.uc</a> 06-Oct-2019 10:27 34349
|
||||
<a href="xWebQueryCurrent.uc">xWebQueryCurrent.uc</a> 06-Oct-2019 10:27 36167
|
||||
<a href="xWebQueryDefaults.uc">xWebQueryDefaults.uc</a> 06-Oct-2019 10:27 27832
|
||||
<a href="xWebQueryHandler.uc">xWebQueryHandler.uc</a> 06-Oct-2019 10:27 736
|
||||
</pre><hr></body>
|
||||
</html>
|
||||
25
kf_sources/XWebAdmin/Classes/xWebAdminCommandLet.uc
Normal file
25
kf_sources/XWebAdmin/Classes/xWebAdminCommandLet.uc
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// ====================================================================
|
||||
// Class: xWebAdmin.xWebAdminCommandLet
|
||||
// Parent: Core.Commandlet
|
||||
//
|
||||
// <Enter a description here>
|
||||
// ====================================================================
|
||||
|
||||
class xWebAdminCommandLet extends Commandlet;
|
||||
|
||||
event int Main( string Parms )
|
||||
{
|
||||
// local class<xWebQueryHandler> Tmp;
|
||||
// local int i;
|
||||
// for (i = 0; i < class'XWebAdmin.UTServerAdmin'.default.QueryHandlerClasses.Length;i++)
|
||||
// {
|
||||
// Tmp = class<xWebQueryhandler>(DynamicLoadObject(class'xWebAdmin.UTServerAdmin'.default.QueryHandlerClasses[i],class'Class'));
|
||||
// if (Tmp != None)
|
||||
// Tmp.static.StaticSaveConfig();
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
}
|
||||
1103
kf_sources/XWebAdmin/Classes/xWebQueryAdmins.uc
Normal file
1103
kf_sources/XWebAdmin/Classes/xWebQueryAdmins.uc
Normal file
File diff suppressed because it is too large
Load diff
1134
kf_sources/XWebAdmin/Classes/xWebQueryCurrent.uc
Normal file
1134
kf_sources/XWebAdmin/Classes/xWebQueryCurrent.uc
Normal file
File diff suppressed because it is too large
Load diff
863
kf_sources/XWebAdmin/Classes/xWebQueryDefaults.uc
Normal file
863
kf_sources/XWebAdmin/Classes/xWebQueryDefaults.uc
Normal file
|
|
@ -0,0 +1,863 @@
|
|||
//==============================================================================
|
||||
// WebAdmin handler for modifying default game settings
|
||||
//
|
||||
// Written by Michael Comeau
|
||||
// Revised by Ron Prestenback
|
||||
// © 2003,2004 Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class xWebQueryDefaults extends xWebQueryHandler
|
||||
config;
|
||||
|
||||
var config string DefaultsIndexPage; // Defaults Menu Page
|
||||
var config string DefaultsMapsPage;
|
||||
var config string DefaultsRulesPage;
|
||||
var config string DefaultsIPPolicyPage; // Special Case of Multi-part list page
|
||||
var config string DefaultsRestartPage;
|
||||
var config string DefaultsVotingGameConfigPage;
|
||||
|
||||
// Custom Skin Support
|
||||
var config string DefaultsRowPage;
|
||||
|
||||
var localized string DefaultsMapsLink;
|
||||
var localized string DefaultsIPPolicyLink;
|
||||
var localized string DefaultsRestartLink;
|
||||
var localized string IDBan;
|
||||
var localized string DefaultsVotingGameConfigLink;
|
||||
|
||||
// Error messages
|
||||
var localized string ActiveMapNotFound;
|
||||
var localized string InactiveMapNotFound;
|
||||
var localized string CannotModify;
|
||||
|
||||
var localized string NoteMapsPage;
|
||||
var localized string NoteRulesPage;
|
||||
var localized string NotePolicyPage;
|
||||
var localized string NoteVotingGameConfigPage;
|
||||
|
||||
// ifdef _KF_
|
||||
var localized string NoteSandboxPage;
|
||||
var localized string NoteGamePage;
|
||||
// endif _KF_
|
||||
|
||||
function bool Init()
|
||||
{
|
||||
local int i;
|
||||
|
||||
if (GamePI == None)
|
||||
SetGamePI("");
|
||||
|
||||
for (i = 0; i < GamePI.Settings.Length; i++)
|
||||
if (GamePI.Settings[i].ExtraPriv != "" && InStr(NeededPrivs, GamePI.Settings[i].ExtraPriv) == -1)
|
||||
NeededPrivs = NeededPrivs $ "|" $ GamePI.Settings[i].ExtraPriv;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function bool Query(WebRequest Request, WebResponse Response)
|
||||
{
|
||||
if (!CanPerform(NeededPrivs))
|
||||
return false;
|
||||
|
||||
MapTitle(Response);
|
||||
|
||||
switch (Mid(Request.URI, 1))
|
||||
{
|
||||
case DefaultPage: QueryDefaults(Request, Response); return true; // Done : General
|
||||
case DefaultsIndexPage: QueryDefaultsMenu(Request, Response); return true;// Done : General
|
||||
case DefaultsMapsPage: if (!MapIsChanging()) QueryDefaultsMaps(Request, Response); return true;
|
||||
case DefaultsRulesPage: if (!MapIsChanging()) QueryDefaultsRules(Request, Response); return true;
|
||||
case DefaultsIPPolicyPage: if (!MapIsChanging()) QueryDefaultsIPPolicy(Request, Response); return true;
|
||||
case DefaultsRestartPage: if (!MapIsChanging()) QueryRestartPage(Request, Response); return true;
|
||||
case DefaultsVotingGameConfigPage: if (!MapIsChanging()) QueryVotingGameConfig(Request, Response); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
function QueryDefaults(WebRequest Request, WebResponse Response)
|
||||
{
|
||||
local String GameType, PageStr, Filter;
|
||||
|
||||
// if no gametype specified use the first one in the list
|
||||
GameType = Request.GetVariable("GameType", String(Level.Game.Class));
|
||||
|
||||
// if no page specified, use the first one
|
||||
PageStr = Request.GetVariable("Page", DefaultsMapsPage);
|
||||
Filter = Eval(Request.GetVariable("Filter") != "", "&Filter="$ Request.GetVariable("Filter"), "");
|
||||
|
||||
Response.Subst("IndexURI", DefaultsIndexPage $ "?GameType=" $ GameType $ "&Page=" $ PageStr $ Filter);
|
||||
Response.Subst("MainURI", PageStr $ "?GameType=" $GameType $ Filter);
|
||||
|
||||
ShowFrame(Response, DefaultPage);
|
||||
}
|
||||
|
||||
function QueryDefaultsMenu(WebRequest Request, WebResponse Response)
|
||||
{
|
||||
local string GameType, Page, TempStr, Content;
|
||||
local int i;
|
||||
|
||||
GameType = SetGamePI(Request.GetVariable("GameType", string(Level.Game.Class)));
|
||||
Page = Request.GetVariable("Page");
|
||||
|
||||
// set currently active page
|
||||
if (CanPerform("Mt"))
|
||||
{
|
||||
if (Request.GetVariable("GameTypeSet", "") != "")
|
||||
{
|
||||
TempStr = Request.GetVariable("GameTypeSelect", GameType);
|
||||
if (!(TempStr ~= GameType))
|
||||
GameType = TempStr;
|
||||
}
|
||||
|
||||
Response.Subst("GameTypeButton", SubmitButton("GameTypeSet", Update));
|
||||
Response.Subst("GameTypeSelect", Select("GameType", GenerateGameTypeOptions(GameType)));
|
||||
}
|
||||
else
|
||||
Response.Subst("GameTypeSelect", Level.Game.Default.GameName);
|
||||
|
||||
// set background colors
|
||||
Response.Subst("DefaultBG", DefaultBG); // for unused tabs
|
||||
|
||||
// Set URIs
|
||||
Content = MakeMenuRow(Response, GameType $ "&Page=" $ DefaultsMapsPage, DefaultsMapsLink);
|
||||
for (i = 0; i<GamePI.Groups.Length; i++)
|
||||
Content = Content $ MakeMenuRow(Response, GameType $ "&Page=" $ DefaultsRulesPage $ "&Filter=" $ GamePI.Groups[i], GamePI.Groups[i]);
|
||||
|
||||
Content $= MakeMenuRow(Response, GameType $ "&Page=" $ DefaultsIPPolicyPage, DefaultsIPPolicyLink);
|
||||
Content $= MakeMenuRow(Response, GameType $ "&Page=" $ DefaultsVotingGameConfigPage, DefaultsVotingGameConfigLink);
|
||||
Content $= "<br>" $ MakeMenuRow(Response, GameType $ "&Page=" $ DefaultsRestartPage, DefaultsRestartLink);
|
||||
|
||||
Response.Subst("Content", Content);
|
||||
Response.Subst("Filter", Request.GetVariable("Filter", ""));
|
||||
Response.Subst("Page", Page);
|
||||
Response.Subst("PostAction", DefaultPage);
|
||||
ShowPage(Response, DefaultsIndexPage);
|
||||
}
|
||||
|
||||
// TODO: add highlight code
|
||||
function string MakeMenuRow(WebResponse Response, string URI, string Title)
|
||||
{
|
||||
Response.Subst("URI", DefaultPage $ "?GameType=" $ URI);
|
||||
Response.Subst("URIText", Title);
|
||||
return WebInclude("defaults_menu_row");
|
||||
}
|
||||
|
||||
function QueryDefaultsMaps(WebRequest Request, WebResponse Response)
|
||||
{
|
||||
local String GameType, ListName, Tmp, MapName, MapURL;
|
||||
|
||||
// Strings containing generated html (possibly move to .inc?)
|
||||
local string CustomMapSelect;
|
||||
local StringArray ExcludeMaps, IncludeMaps, MovedMaps;
|
||||
local int i, Count, MoveCount, id, CurrentList, Index;
|
||||
local array<string> Arr;
|
||||
local bool bForceSave;
|
||||
|
||||
//Don't always force the Map List to Save
|
||||
bForceSave = false;
|
||||
|
||||
if (CanPerform("Ml"))
|
||||
{
|
||||
Request.Dump();
|
||||
|
||||
GameType = Request.GetVariable("GameType"); // provided by index page
|
||||
Index = Level.Game.MaplistHandler.GetGameIndex(GameType);
|
||||
// Get index of maplist from select
|
||||
Tmp = Request.GetVariable("MapListNum");
|
||||
|
||||
// Maybe viewing a non-active list
|
||||
if (Tmp != "")
|
||||
CurrentList = int(Tmp);
|
||||
else CurrentList = Level.Game.MaplistHandler.GetActiveList(Index);
|
||||
ListName = Level.Game.MaplistHandler.GetMapListTitle(Index, CurrentList);
|
||||
|
||||
// Available maplists
|
||||
ExcludeMaps = ReloadExcludeMaps(GameType);
|
||||
IncludeMaps = ReloadIncludeMaps(ExcludeMaps, Index, CurrentList);
|
||||
MovedMaps = New(None) class'SortedStringArray';
|
||||
|
||||
Tmp = Request.GetVariable("MoveMap","");
|
||||
|
||||
// If name in textbox isn't the same as the name of the active list,
|
||||
// and we're moving maps, should track of name until we either save or cancel
|
||||
if (Tmp != "")
|
||||
{
|
||||
ListName = Request.GetVariable("ListName", ListName);
|
||||
switch (Tmp)
|
||||
{
|
||||
case " > ":
|
||||
case ">":
|
||||
Count = Request.GetVariableCount("ExcludeMapsSelect");
|
||||
for (i = Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (ExcludeMaps.Count() > 0)
|
||||
{
|
||||
MapURL = Request.GetVariableNumber("ExcludeMapsSelect", i);
|
||||
MapName = class'MaplistRecord'.static.GetBaseMapName(MapURL);
|
||||
|
||||
id = IncludeMaps.MoveFrom(ExcludeMaps, MapName);
|
||||
if (id >= 0)
|
||||
{
|
||||
MovedMaps.CopyFromId(IncludeMaps, id);
|
||||
Level.Game.MaplistHandler.AddMap(Index, CurrentList, MapName $ MapURL);
|
||||
}
|
||||
else
|
||||
Log(InactiveMapNotFound$Request.GetVariableNumber("ExcludeMapsSelect", i),'WebAdmin');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case " < ":
|
||||
case "<":
|
||||
if (Request.GetVariableCount("IncludeMapsSelect") > 0)
|
||||
{
|
||||
Count = Request.GetVariableCount("IncludeMapsSelect");
|
||||
for (i = Count-1; i >= 0; i--)
|
||||
{
|
||||
MapURL = Request.GetVariableNumber("IncludeMapsSelect", i);
|
||||
MapName = class'MaplistRecord'.static.GetBaseMapName(MapURL);
|
||||
if (IncludeMaps.Count() > 0)
|
||||
{
|
||||
id = ExcludeMaps.MoveFrom(IncludeMaps, MapName);
|
||||
if (id >= 0)
|
||||
{
|
||||
MovedMaps.CopyFromId(ExcludeMaps, id);
|
||||
Level.Game.MaplistHandler.RemoveMap(Index, CurrentList, MapName $ MapURL);
|
||||
}
|
||||
else
|
||||
Log(ActiveMapNotFound $ Request.GetVariableNumber("IncludeMapsSelect", i),'WebAdmin');
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ">>":
|
||||
while (ExcludeMaps.Count() > 0)
|
||||
{
|
||||
id = IncludeMaps.MoveFromId(ExcludeMaps, ExcludeMaps.Count()-1);
|
||||
if (id >= 0)
|
||||
{
|
||||
MovedMaps.CopyFromId(IncludeMaps, id);
|
||||
Level.Game.MaplistHandler.AddMap(Index, CurrentList, IncludeMaps.GetItem(id));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "<<":
|
||||
while (IncludeMaps.Count() > 0)
|
||||
{
|
||||
id = ExcludeMaps.MoveFromId(IncludeMaps, IncludeMaps.Count()-1);
|
||||
if (id >= 0)
|
||||
{
|
||||
MovedMaps.CopyFromId(ExcludeMaps, id);
|
||||
Level.Game.MaplistHandler.ClearList(Index, CurrentList);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "Up":
|
||||
MoveCount = int(Abs(float(Request.GetVariable("MoveMapCount"))));
|
||||
Count = Request.GetVariableCount("IncludeMapsSelect");
|
||||
for (i = 0; i<Count; i++)
|
||||
{
|
||||
//if _RO_
|
||||
MapURL = Request.GetVariableNumber("IncludeMapsSelect", i);
|
||||
//end _RO_
|
||||
MovedMaps.CopyFrom(IncludeMaps, class'MaplistRecord'.static.GetBaseMapName(MapURL));
|
||||
}
|
||||
|
||||
MoveCount = -MoveCount;
|
||||
for (i = 0; i<IncludeMaps.Count(); i++)
|
||||
{
|
||||
if (MovedMaps.FindTagId(IncludeMaps.GetTag(i)) >= 0)
|
||||
{
|
||||
Level.Game.MaplistHandler.ShiftMap(Index, CurrentList, IncludeMaps.GetItem(i), MoveCount);
|
||||
IncludeMaps.ShiftStrict(i, MoveCount);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "Down":
|
||||
MoveCount = int(Abs(float(Request.GetVariable("MoveMapCount"))));
|
||||
Count = Request.GetVariableCount("IncludeMapsSelect");
|
||||
for (i = 0; i<Count; i++)
|
||||
{
|
||||
//if _RO_
|
||||
MapURL = Request.GetVariableNumber("IncludeMapsSelect", i);
|
||||
//end _RO_
|
||||
MovedMaps.CopyFrom(IncludeMaps, class'MaplistRecord'.static.GetBaseMapName(MapURL));
|
||||
}
|
||||
|
||||
for (i = IncludeMaps.Count()-1; i >= 0; i--)
|
||||
{
|
||||
if (MovedMaps.FindTagId(IncludeMaps.GetTag(i)) >= 0)
|
||||
{
|
||||
Level.Game.MaplistHandler.ShiftMap(Index, CurrentList, IncludeMaps.GetItem(i), MoveCount);
|
||||
IncludeMaps.ShiftStrict(i, MoveCount);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Request.GetVariable("Save") != "" || bForceSave)
|
||||
{
|
||||
ListName = Request.GetVariable("ListName", ListName);
|
||||
UpdateCustomMapList(Index, CurrentList, ListName);
|
||||
}
|
||||
|
||||
else if (Request.GetVariable("New") != "")
|
||||
{
|
||||
Arr.Length = 0;
|
||||
for (i = 0; i < IncludeMaps.Count(); i++)
|
||||
Arr[Arr.Length] = IncludeMaps.GetTag(i);
|
||||
Level.Game.MaplistHandler.ResetList(Index, CurrentList);
|
||||
CurrentList = Level.Game.MaplistHandler.AddList(GameType, Request.GetVariable("ListName", ListName), Arr);
|
||||
ExcludeMaps = ReloadExcludeMaps(GameType);
|
||||
IncludeMaps = ReloadIncludeMaps(ExcludeMaps, Index, CurrentList);
|
||||
}
|
||||
|
||||
else if (Request.GetVariable("Use") != "")
|
||||
{
|
||||
ListName = Request.GetVariable("ListName", ListName);
|
||||
UpdateCustomMaplist(Index, CurrentList, ListName);
|
||||
Level.Game.MaplistHandler.ApplyMapList(Index, CurrentList);
|
||||
}
|
||||
|
||||
else if (Request.GetVariable("Delete") != "")
|
||||
{
|
||||
CurrentList = Level.Game.MaplistHandler.RemoveList(Index, CurrentList);
|
||||
ListName = Level.Game.MaplistHandler.GetMapListTitle(Index, CurrentList);
|
||||
ExcludeMaps = ReloadExcludeMaps(GameType);
|
||||
IncludeMaps = ReloadIncludeMaps(ExcludeMaps, Index, CurrentList);
|
||||
}
|
||||
|
||||
CustomMapSelect = GenerateMapListOptions(GameType, CurrentList);
|
||||
// Fill response values
|
||||
Response.Subst("GameType", GameType);
|
||||
Response.Subst("Session", "Session");
|
||||
Response.Subst("MapListName", ListName);
|
||||
Response.Subst("MapListOptions", CustomMapSelect);
|
||||
Response.Subst("ExcludeMapsOptions", GenerateMapListSelect(ExcludeMaps, MovedMaps));
|
||||
Response.Subst("IncludeMapsOptions", GenerateMapListSelect(IncludeMaps, MovedMaps));
|
||||
|
||||
Response.Subst("Section", DefaultsMapsLink);
|
||||
Response.Subst("PostAction", DefaultsMapsPage);
|
||||
Response.Subst("PageHelp", NoteMapsPage);
|
||||
|
||||
Response.Dump();
|
||||
|
||||
ShowPage(Response, DefaultsMapsPage);
|
||||
}
|
||||
else
|
||||
AccessDenied(Response);
|
||||
}
|
||||
|
||||
function QueryDefaultsRules(WebRequest Request, WebResponse Response)
|
||||
{
|
||||
local int i, j;
|
||||
local bool bMarked, bSave;
|
||||
local String GameType, Content, Data, Op, Mark, Filter, SecLevel, TempStr;
|
||||
local array<string> Options;
|
||||
|
||||
if (!CanPerform("Ms"))
|
||||
{
|
||||
AccessDenied(Response);
|
||||
return;
|
||||
}
|
||||
|
||||
GameType = SetGamePI(Request.GetVariable("GameType"));
|
||||
Filter = Request.GetVariable("Filter");
|
||||
|
||||
bSave = Request.GetVariable("Save", "") != "";
|
||||
|
||||
Content = "";
|
||||
Mark = WebInclude("defaults_mark");
|
||||
Response.Subst("Section", Filter);
|
||||
Response.Subst("Filter", Filter);
|
||||
for (i = 0; i<GamePI.Settings.Length; i++)
|
||||
{
|
||||
if (GamePI.Settings[i].Grouping == Filter && GamePI.Settings[i].SecLevel <= CurAdmin.MaxSecLevel() && (GamePI.Settings[i].ExtraPriv == "" || CanPerform(GamePI.Settings[i].ExtraPriv)))
|
||||
{
|
||||
// FIXME - update webadmin to correctly handle new playinfo types
|
||||
if ( GamePI.Settings[i].ArrayDim != -1 || GamePI.Settings[i].bStruct || GamePI.Settings[i].ThisProp.IsA('UArrayProperty') )
|
||||
continue;
|
||||
|
||||
// ifdef _KF_
|
||||
if ( GamePI.Settings[i].RenderType == PIT_Custom )
|
||||
continue;
|
||||
// endif
|
||||
|
||||
Options.Length = 0;
|
||||
TempStr = HtmlDecode(Request.GetVariable(GamePI.Settings[i].SettingName, ""));
|
||||
if (bSave)
|
||||
GamePI.StoreSetting(i, TempStr, GamePI.Settings[i].Data);
|
||||
|
||||
bMarked = bMarked || GamePI.Settings[i].bGlobal;
|
||||
Response.Subst("Mark", Eval(bMarked, Mark, ""));
|
||||
Response.Subst("HintText",HtmlEncode(GamePI.Settings[i].Description));
|
||||
Response.Subst("DisplayText", HtmlEncode(GamePI.Settings[i].DisplayName));
|
||||
SecLevel = Eval(CurAdmin.bMasterAdmin, string(GamePI.Settings[i].SecLevel), "");
|
||||
Response.Subst("SecLevel", " " $ SecLevel);
|
||||
|
||||
switch ( GamePI.Settings[i].RenderType )
|
||||
{
|
||||
case PIT_Custom:
|
||||
case PIT_Text:
|
||||
Data = "8";
|
||||
if (GamePI.Settings[i].Data != "")
|
||||
{
|
||||
if ( Divide(GamePI.Settings[i].Data, ";", Data, Op) )
|
||||
GamePI.SplitStringToArray(Options, Op, ":");
|
||||
else Data = GamePI.Settings[i].Data;
|
||||
}
|
||||
|
||||
j = Min( int(Data), 40 ); // TODO: not nice to hard code it like this
|
||||
|
||||
Op = "";
|
||||
if (Options.Length > 1)
|
||||
Op = " ("$Options[0]$" - "$Options[1]$")";
|
||||
|
||||
Response.Subst("Content", Textbox(GamePI.Settings[i].SettingName, j, int(Data), HtmlEncode(GamePI.Settings[i].Value)) $ Op);
|
||||
Response.Subst("FormObject", WebInclude(NowrapLeft));
|
||||
break;
|
||||
|
||||
case PIT_Check:
|
||||
if (bSave && GamePI.Settings[i].Value == "")
|
||||
GamePI.StoreSetting(i, false);
|
||||
|
||||
Response.Subst("Content", Checkbox(GamePI.Settings[i].SettingName, GamePI.Settings[i].Value ~= string(true), GamePI.Settings[i].Data != ""));
|
||||
Response.Subst("FormObject", WebInclude(NowrapLeft));
|
||||
break;
|
||||
|
||||
case PIT_Select:
|
||||
Data = "";
|
||||
// Build a set of options from PID.Data
|
||||
GamePI.SplitStringToArray(Options, GamePI.Settings[i].Data, ";");
|
||||
for (j = 0; (j+1)<Options.Length; j += 2)
|
||||
{
|
||||
Data $= ("<option value='"$Options[j]$"'");
|
||||
If (GamePI.Settings[i].Value == Options[j])
|
||||
Data @= "selected";
|
||||
Data $= (">"$HtmlEncode(Options[j+1])$"</option>");
|
||||
}
|
||||
|
||||
Response.Subst("Content", Select(GamePI.Settings[i].SettingName, Data));
|
||||
Response.Subst("FormObject", WebInclude(NowrapLeft));
|
||||
break;
|
||||
}
|
||||
|
||||
Content $= WebInclude(DefaultsRowPage);
|
||||
}
|
||||
}
|
||||
GamePI.SaveSettings();
|
||||
|
||||
if (Content == "")
|
||||
Content = CannotModify;
|
||||
|
||||
Response.Subst("TableContent", Content);
|
||||
Response.Subst("PostAction", DefaultsRulesPage);
|
||||
Response.Subst("GameType", GameType);
|
||||
Response.Subst("SubmitValue", Accept);
|
||||
|
||||
// ifdef _KF_
|
||||
if ( Filter == "Sandbox" )
|
||||
{
|
||||
Response.Subst("PageHelp", NoteSandboxPage);
|
||||
}
|
||||
else if ( Filter == "Game" )
|
||||
{
|
||||
Response.Subst("PageHelp", NoteGamePage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// endif _KF_
|
||||
Response.Subst("PageHelp", NoteRulesPage);
|
||||
}
|
||||
|
||||
ShowPage(Response, DefaultsRulesPage);
|
||||
}
|
||||
|
||||
function QueryDefaultsIPPolicy(WebRequest Request, WebResponse Response)
|
||||
{
|
||||
local int i, j;
|
||||
local bool bIpBan;
|
||||
local string policies, tmpN, tmpV;
|
||||
local string PolicyType;
|
||||
|
||||
if (CanPerform("Xi"))
|
||||
{
|
||||
Response.Subst("Section", DefaultsIPPolicyLink);
|
||||
if (Request.GetVariable("Update") != "")
|
||||
{
|
||||
i = int(Request.GetVariable("IpNo", "-1"));
|
||||
//if _RO_
|
||||
tmpN = Request.GetVariable("IPMask");
|
||||
if (ValidMask(tmpN))
|
||||
{
|
||||
if(i > -1)
|
||||
{
|
||||
//else
|
||||
//if(i > -1 && ValidMask(Request.GetVariable("IPMask")))
|
||||
//{
|
||||
//end _RO_
|
||||
if (i >= Level.Game.AccessControl.IPPolicies.Length)
|
||||
{
|
||||
i = Level.Game.AccessControl.IPPolicies.Length;
|
||||
Level.Game.AccessControl.IPPolicies.Length = i+1;
|
||||
}
|
||||
Level.Game.AccessControl.IPPolicies[i] = Request.GetVariable("AcceptDeny")$";"$Request.GetVariable("IPMask");
|
||||
Level.Game.AccessControl.SaveConfig();
|
||||
}
|
||||
}
|
||||
//if _RO_
|
||||
else if (Level.Game.AccessControl.CheckID(tmpN) == 0)
|
||||
{
|
||||
i = Level.Game.AccessControl.BannedIDs.Length;
|
||||
Level.Game.AccessControl.BannedIDs.Length = i+1;
|
||||
Level.Game.AccessControl.BannedIDs[i] = tmpN @ "WebAdminBan";
|
||||
Level.Game.AccessControl.SaveConfig();
|
||||
}
|
||||
//end _RO_
|
||||
}
|
||||
|
||||
if(Request.GetVariable("Delete") != "")
|
||||
{
|
||||
i = int(Request.GetVariable("IdNo", "-1"));
|
||||
if (i == -1)
|
||||
{
|
||||
bIpBan = True;
|
||||
i = int(Request.GetVariable("IpNo", "-1"));
|
||||
}
|
||||
|
||||
if (i > -1)
|
||||
{
|
||||
if ( bIpBan && i < Level.Game.AccessControl.IPPolicies.Length )
|
||||
{
|
||||
Level.Game.AccessControl.IPPolicies.Remove(i,1);
|
||||
Level.Game.AccessControl.SaveConfig();
|
||||
}
|
||||
|
||||
if ( !bIpBan && i < Level.Game.AccessControl.BannedIDs.Length )
|
||||
{
|
||||
Level.Game.AccessControl.BannedIDs.Remove(i,1);
|
||||
Level.Game.AccessControl.SaveConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Policies = "";
|
||||
if (Level.Game.AccessControl.bBanById)
|
||||
{
|
||||
for (i = 0; i < Level.Game.AccessControl.BannedIds.Length; i++)
|
||||
{
|
||||
j = InStr(Level.Game.AccessControl.BannedIDs[i], " ");
|
||||
tmpN = Mid(Level.Game.AccessControl.BannedIDs[i], j + 1);
|
||||
tmpV = Left(Level.Game.AccessControl.BannedIDs[i], j);
|
||||
|
||||
Response.Subst("PolicyType", IDBan);
|
||||
Response.Subst("PolicyCell", tmpN $ ":" @ tmpV $ " ");
|
||||
Response.Subst("PostAction", DefaultsIPPolicyPage $ "?IDNo="$string(i));
|
||||
Response.Subst("UpdateButton", "");
|
||||
Policies = Policies $ WebInclude(DefaultsIPPolicyPage $ "_row");
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<Level.Game.AccessControl.IPPolicies.Length; i++)
|
||||
{
|
||||
Divide( Level.Game.AccessControl.IPPolicies[i], ";", tmpN, tmpV );
|
||||
|
||||
PolicyType = RadioButton("AcceptDeny", "ACCEPT", tmpN ~= "ACCEPT") @ Accept $ "<br>";
|
||||
PolicyType = PolicyType $ RadioButton("AcceptDeny", "DENY", tmpN ~= "DENY") @ Deny;
|
||||
|
||||
Response.Subst("PolicyType", PolicyType);
|
||||
Response.Subst("PolicyCell", Textbox("IPMask", 15, 25, tmpV) $ " ");
|
||||
Response.Subst("PostAction", DefaultsIPPolicyPage $ "?IpNo="$string(i));
|
||||
Response.Subst("UpdateButton", SubmitButton("Update", Update));
|
||||
Policies = Policies $ WebInclude(DefaultsIPPolicyPage $ "_row");
|
||||
}
|
||||
|
||||
Response.Subst("Policies", policies);
|
||||
Response.Subst("PostAction", DefaultsIPPolicyPage$"?IpNo="$string(i));
|
||||
Response.Subst("PageHelp", NotePolicyPage);
|
||||
ShowPage(Response, DefaultsIPPolicyPage);
|
||||
}
|
||||
else
|
||||
AccessDenied(Response);
|
||||
}
|
||||
|
||||
function QueryVotingGameConfig(WebRequest Request, WebResponse Response)
|
||||
{
|
||||
local int i, j, k, x, columns, count, GameConfigIndex;
|
||||
local string PageText, GameConfigData, ColumnTitle, Value;
|
||||
local array<string> Parts;
|
||||
local array<string> MutatorList;
|
||||
|
||||
if (CanPerform("Ms"))
|
||||
{
|
||||
Response.Subst("Section", DefaultsVotingGameConfigLink);
|
||||
|
||||
PageText = "";
|
||||
// make headers
|
||||
i=0;
|
||||
while( Level.Game.VotingHandler.GetConfigArrayColumnTitle("GameConfig",i) != "" )
|
||||
{
|
||||
PageText = PageText $ "<th nowrap>" $ Level.Game.VotingHandler.GetConfigArrayColumnTitle("GameConfig",i) $ "</th>";
|
||||
i++;
|
||||
}
|
||||
columns = i;
|
||||
Response.Subst("ColumnTitles", PageText);
|
||||
|
||||
GameConfigIndex = int(Request.GetVariable("GameConfigIndex", "-1"));
|
||||
|
||||
if (Request.GetVariable("Update") != "")
|
||||
{
|
||||
if( GameConfigIndex > -1 )
|
||||
{
|
||||
for( j=0; j < columns; j++ )
|
||||
{
|
||||
ColumnTitle = Level.Game.VotingHandler.GetConfigArrayColumnTitle("GameConfig",j);
|
||||
Value = "";
|
||||
|
||||
if ( j == 4 ) // Mutators - retrieve all selected mutators
|
||||
{
|
||||
count = Request.GetVariableCount(ColumnTitle);
|
||||
for ( k = 0; k < count; k++ )
|
||||
{
|
||||
if( Request.GetVariableNumber(ColumnTitle, k) ~= "NONE" )
|
||||
{
|
||||
Value = "NONE"; // dont allow any other mutators if none
|
||||
break;
|
||||
}
|
||||
if ( Value != "" )
|
||||
Value $= ",";
|
||||
Value $= Request.GetVariableNumber(ColumnTitle, k);
|
||||
}
|
||||
}
|
||||
else Value = Request.GetVariable(ColumnTitle);
|
||||
|
||||
Level.Game.VotingHandler.UpdateConfigArrayItem("GameConfig", GameConfigIndex, j, Value);
|
||||
}
|
||||
Level.Game.VotingHandler.SaveConfig();
|
||||
GameConfigIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if(Request.GetVariable("Delete") != "")
|
||||
{
|
||||
if (GameConfigIndex > -1)
|
||||
{
|
||||
Level.Game.VotingHandler.DeleteConfigArrayItem("GameConfig", GameConfigIndex);
|
||||
Level.Game.VotingHandler.SaveConfig();
|
||||
GameConfigIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if(Request.GetVariable("New") != "")
|
||||
{
|
||||
Level.Game.VotingHandler.AddConfigArrayItem("GameConfig");
|
||||
Level.Game.VotingHandler.SaveConfig();
|
||||
}
|
||||
|
||||
PageText = "";
|
||||
for( i=0; i<Level.Game.VotingHandler.GetConfigArrayItemCount("GameConfig"); i++)
|
||||
{
|
||||
PageText $= "<tr><form method=\"post\" action=\"" $ DefaultsVotingGameConfigPage $ "?GameConfigIndex="$string(i) $ "\">";
|
||||
for( j=0; j < columns; j++)
|
||||
{
|
||||
PageText $= "<td valign=\"top\">";
|
||||
GameConfigData = Level.Game.VotingHandler.GetConfigArrayData("GameConfig", i, j);
|
||||
Split(GameConfigData, ";", Parts); // split "type;maxlength;value"
|
||||
// 0 1 2
|
||||
|
||||
if( i == GameConfigIndex )
|
||||
{
|
||||
switch( Caps(Parts[0]) ) // type
|
||||
{
|
||||
case "TEXT":
|
||||
//TextBox(string TextName, coerce string Size, coerce string MaxLength, optional string DefaultValue)
|
||||
PageText $= Textbox(Level.Game.VotingHandler.GetConfigArrayColumnTitle("GameConfig",j),
|
||||
15,
|
||||
int(Parts[1]),
|
||||
Parts[2]);
|
||||
break;
|
||||
case "GAMETYPE":
|
||||
PageText $= Select(Level.Game.VotingHandler.GetConfigArrayColumnTitle("GameConfig",j),
|
||||
GenerateGameTypeOptions(Parts[2]));
|
||||
break;
|
||||
case "MUTATORS":
|
||||
PageText $= "<select name=\"" $ Level.Game.VotingHandler.GetConfigArrayColumnTitle("GameConfig",j) $
|
||||
"\" size=5 multiple>" $ GenerateMutatorOptions(Parts[2]) $ "</select>";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( Caps(Parts[0]) ) // type
|
||||
{
|
||||
case "TEXT":
|
||||
PageText $= Parts[2];
|
||||
break;
|
||||
|
||||
case "GAMETYPE":
|
||||
// translate game class name to friendly name
|
||||
for(k=0; k < AllGames.Length; k++)
|
||||
{
|
||||
if( Parts[2] ~= AllGames[k].ClassName )
|
||||
{
|
||||
PageText $= AllGames[k].GameName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "MUTATORS":
|
||||
// translate mutator class names to friendly names for display
|
||||
Split( Parts[2], ",", MutatorList);
|
||||
for(x=0; x < MutatorList.Length; x++)
|
||||
{
|
||||
for(k=0; k < AllMutators.Length; k++)
|
||||
{
|
||||
if( MutatorList[x] ~= AllMutators[k].ClassName )
|
||||
{
|
||||
PageText $= AllMutators[k].FriendlyName;
|
||||
if( x < MutatorList.Length - 1 )
|
||||
PageText $= ",";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
PageText $= "</td>";
|
||||
}
|
||||
PageText $= "<td>";
|
||||
if( i == GameConfigIndex )
|
||||
{
|
||||
PageText $= SubmitButton("Update", Update);
|
||||
PageText $= SubmitButton("Delete", DeleteText);
|
||||
}
|
||||
else
|
||||
PageText $= SubmitButton("Edit",Edit);
|
||||
PageText $= "</td></form></tr>";
|
||||
}
|
||||
PageText $= "<tr><td colspan=" $ columns + 1 $ "><form method=\"post\" action=\"" $ DefaultsVotingGameConfigPage $ "?GameConfigIndex=-1"$string(i) $ "\">";
|
||||
PageText $= SubmitButton("New", NewText);
|
||||
PageText $= "</form></td></tr>";
|
||||
|
||||
Response.Subst("GameConfigs", PageText);
|
||||
Response.Subst("PageHelp", NoteVotingGameConfigPage);
|
||||
ShowPage(Response, DefaultsVotingGameConfigPage);
|
||||
}
|
||||
else
|
||||
AccessDenied(Response);
|
||||
}
|
||||
|
||||
// evo ---
|
||||
function bool ValidMask(string mask)
|
||||
{
|
||||
local int i;
|
||||
local string Octets[4];
|
||||
local string tmp;
|
||||
|
||||
// First check each octet to make sure it's a byte
|
||||
while (mask != "")
|
||||
{
|
||||
if (Left(mask,1) == ".")
|
||||
{
|
||||
if (!ValidOctet(tmp))
|
||||
return false;
|
||||
|
||||
Octets[i++] = tmp;
|
||||
Mask = Mid(Mask,1);
|
||||
tmp = "";
|
||||
}
|
||||
|
||||
EatStr(tmp, Mask, 1);
|
||||
}
|
||||
|
||||
if (!ValidOctet(tmp))
|
||||
return false;
|
||||
|
||||
Octets[i++] = tmp;
|
||||
|
||||
// Check to make sure we only have 4 valid bytes
|
||||
if (i > 4) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function bool ValidOctet(string tmp)
|
||||
{
|
||||
local int i;
|
||||
|
||||
if (tmp == "") return false;
|
||||
if (ValidMaskOctet(tmp)) return true;
|
||||
|
||||
i = int(tmp);
|
||||
if (i == 0 && tmp != "0") return false;
|
||||
if (i < 0 || i > 255) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function bool ValidMaskOctet(string tmp)
|
||||
{
|
||||
local string s;
|
||||
|
||||
if (tmp == "" || len(tmp) > 3 || right(tmp,1) != "*")
|
||||
return false;
|
||||
|
||||
while (tmp != "")
|
||||
{
|
||||
s = left(tmp,1);
|
||||
if (s == "*")
|
||||
break;
|
||||
|
||||
if (s < "0" || s > "9")
|
||||
return false;
|
||||
|
||||
tmp = mid(tmp,1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// --- evo
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
NeededPrivs="G|M|X|Gt|Ml|Ms|Xi|Xb"
|
||||
DefaultsIndexPage="defaults_menu"
|
||||
DefaultsMapsPage="defaults_maps"
|
||||
DefaultsRulesPage="defaults_rules"
|
||||
DefaultsIPPolicyPage="defaults_ippolicy"
|
||||
DefaultsRestartPage="defaults_restart"
|
||||
DefaultsRowPage="defaults_row"
|
||||
DefaultsVotingGameConfigPage="defaults_votinggameconfig"
|
||||
|
||||
ActiveMapNotFound="Active map not found: "
|
||||
InactiveMapNotFound="Inactive map not found: "
|
||||
CannotModify="** You cannot modify any settings in this section **"
|
||||
IDBan="(Global Ban)"
|
||||
|
||||
DefaultsMapsLink="Maps"
|
||||
DefaultsRestartLink="Restart Level"
|
||||
DefaultsIPPolicyLink="Access Policies"
|
||||
DefaultsVotingGameConfigLink="Voting GameConfig"
|
||||
NoteMapsPage="To save any changes to a custom maplist, click the Save button. To apply the selected maplist to the server's map rotation, click the 'Use' button."
|
||||
NoteRulesPage="Configurable game parameters can be changed from this page. Some parameters may affect more than one gametype."
|
||||
NotePolicyPage="Any banned players will automatically be added to this listing. You will only be able to add manual bans for IP addresses."
|
||||
NoteVotingGameConfigPage="The game configurations for map voting can be modified from this page."
|
||||
DefaultPage="defaultsframe"
|
||||
Title="Defaults"
|
||||
|
||||
// ifdef _KF_
|
||||
NoteSandboxPage="Settings on this page are only applied when GameLength is set to Custom. Setting GameLength to Custom, however, will turn off Perk progression."
|
||||
NoteGamePage="<b>WARNING: Setting GameLength to Custom will turn off Perk progression.</b> In order to use Sandbox settings, however, GameLength must be Custom."
|
||||
// endif _KF_
|
||||
}
|
||||
22
kf_sources/XWebAdmin/Classes/xWebQueryHandler.uc
Normal file
22
kf_sources/XWebAdmin/Classes/xWebQueryHandler.uc
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// ====================================================================
|
||||
// Class: XWebAdmin.xWebQueryHandler
|
||||
// Parent: Engine.xAdminBase
|
||||
//
|
||||
// <Enter a description here>
|
||||
// ====================================================================
|
||||
|
||||
class xWebQueryHandler extends xAdminBase
|
||||
Within UTServerAdmin;
|
||||
|
||||
var string DefaultPage;
|
||||
var string Title;
|
||||
var string NeededPrivs;
|
||||
|
||||
function bool Init() {return true;}
|
||||
function bool PreQuery(WebRequest Request, WebResponse Response) { return true; }
|
||||
function bool Query(WebRequest Request, WebResponse Response) { return false; }
|
||||
function bool PostQuery(WebRequest Request, WebResponse Response) { return true; }
|
||||
|
||||
// Called at end of match
|
||||
function Cleanup();
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue