Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UWebAdmin.MapListPage


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
//=============================================================================
// MapListPage. Maplist config page.
//=============================================================================
class MapListPage expands WebPageContent;

var string DoMapList; // Filled in by SubWebManager.

Static function string LoadUpClassContent( SubWebManager Other, WebConnection Receiver )
{
	local class<MapList> MPLC;
	local string S,PreF,FML,AML,ML;
	local int i,j,c;
	local bool bRes;

	if( Default.DoMapList=="" )
		Return "<-- Missing maplist code -->";
	i = InStr(Default.DoMapList,".");
	PreF = Left(Default.DoMapList,i);
	S = Mid(Default.DoMapList,i+1);
	MPLC = Class<MapList>(DynamicLoadObject(S,Class'Class',True));
	if( MPLC==None )
		Return "<-- Bad maplist class specified"@Default.DoMapList@"-->";
	S = "<!-- Maplist auto-gen code --><CENTER>Select maps you wish to add or remove from the maplist, then press Submit (using Ctrl key you can select multiple maps).<BR>"$Other.NewLineChar;
	S = S$"<form method=\"post\" action=\"MapList_"$Default.DoMapList$"?"$Default.Class$"\">"$Other.NewLineChar;

	c = Array_Size(MPLC.Default.MapsArray);
	For( i=0; i<c; i++ )
	{
		if( MPLC.Default.MapsArray[i]!="" )
		{
			if( !(Right(MPLC.Default.MapsArray[i],4)~=".unr") )
				MPLC.Default.MapsArray[i] = MPLC.Default.MapsArray[i]$".unr";
			AML = AML$"<option value=\""$MPLC.Default.MapsArray[i]$"\">"$MPLC.Default.MapsArray[i]$"</option>";
		}
	}
	foreach Other.AllFiles("unr",PreF,ML)
	{
		bRes = False;
		For( j=0; j<c; j++ )
		{
			if( Len(MPLC.Default.MapsArray[j])!=0 && MPLC.Default.MapsArray[j]~=ML )
			{
				bRes = True;
				Break;
			}
		}
		if( bRes )
			Continue;
		FML = FML$"<option value=\""$ML$"\">"$ML$"</option>";
	}
	S = S$"<TABLE BORDER=0><TR><TH>Maps not in cycle:</TH><TH>Maps in cycle:</TH></TR>"$Other.NewLineChar;
	S = S$"<TR><TD><select name=\"INC\" size=\"10\" multiple=\"multiple\">"$Other.NewLineChar;
	S = S$FML$Other.NewLineChar$"</select></TD>"$Other.NewLineChar;

	S = S$"<TD><select name=\"EXC\" size=\"10\" multiple=\"multiple\">"$Other.NewLineChar;
	S = S$AML$Other.NewLineChar$"</select></TD></TR></TABLE>"$Other.NewLineChar;
	S = S$"<p><input class=\"button\" type=\"submit\" name=\"edit\" value=\"Submit\"></form></CENTER><!-- End of maplist code -->"$Other.NewLineChar;
	Return S;
}

Static function ProcessReceivedData( string Data, SubWebManager Other, WebConnection Receiver )
{
	local int i,j,c;
	local bool bLoopsDone;
	local class<MapList> MPLC;
	local string S,Pr;

	i = InStr(Default.DoMapList,".");
	MPLC = Class<MapList>(DynamicLoadObject(Mid(Default.DoMapList,i+1),Class'Class',True));
	if( MPLC==None )
		Return;
	c = Array_Size(MPLC.Default.MapsArray);
	While( !bLoopsDone )
	{
		i = InStr(Data,"&");
		if( i==-1 )
		{
			bLoopsDone = True;
			S = Data;
		}
		else
		{
			S = Left(Data,i);
			Data = Mid(Data,i+1);
		}
		i = InStr(S,"=");
		if( i==-1 )
			Continue;
		Pr = Left(S,i);
		S = Mid(S,i+1);
		S = Other.DataToStr(S);
		Switch(Pr)
		{
			Case "INC":
				MPLC.Default.MapsArray[c++] = S;
				Break;
			Case "EXC":
				for( j=0; j<c; j++ )
				{
					if( MPLC.Default.MapsArray[j]~=S )
					{
						Array_Remove(MPLC.Default.MapsArray,j);
						c--;
						break;
					}
				}
				Break;
		}
	}
	MPLC.Static.StaticSaveConfig();
}

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: zo 11-11-2012 21:10:30.000 - Creation time: zo 11-11-2012 21:14:19.209 - Created with UnCodeX