Class ExtWebApp extends Object implements(IQueryHandler); var WebAdmin webadmin; var string ExtWebURL; var int EditPageIndex; var ExtWebAdmin_UI ExtAdminUI; var ServerExtMut MyMutator; function cleanup() { webadmin = None; MyMutator = None; if( ExtAdminUI!=None ) { ExtAdminUI.Cleanup(); ExtAdminUI = None; } } function init(WebAdmin webapp) { webadmin = webapp; } function registerMenuItems(WebAdminMenu menu) { menu.addMenu(ExtWebURL, "ExtServer Mod", self, "Modify settings of Extended Server Mod.", -44); } function bool handleQuery(WebAdminQuery q) { switch (q.request.URI) { case ExtWebURL: handleExtMod(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 bSkipTrail ) { local string S; S = ""$InfoStr$":"; if( !bSkipTrail ) S $= ""; q.response.SendText(S); } final function AddConfigCheckbox( WebAdminQuery q, string InfoStr, bool bCur, string ResponseVar, string Tooltip ) { local string S; S = bCur ? " checked" : ""; S = ""$InfoStr$":"; q.response.SendText(S); } final function AddConfigTextbox( WebAdminQuery q, string InfoStr, string CurVal, int Rows, string ResponseVar, string Tooltip ) { local string S; S = ""$InfoStr$":"; S $= ""; q.response.SendText(S); } function handleExtMod(WebAdminQuery q) { local int i,j,z; local string S; local delegate GetV; local delegate SetV; local bool bEditArray; if( ExtAdminUI==None ) { ExtAdminUI = new (None) class'ExtWebAdmin_UI'; MyMutator.InitWebAdmin(ExtAdminUI); } // First check if user is trying to get to another page. S = q.request.getVariable("GoToPage"); if( S!="" ) { if( S=="Main Menu" ) EditPageIndex = -1; else EditPageIndex = ExtAdminUI.ConfigList.Find('PageName',S); } if( EditPageIndex<0 || EditPageIndex>=ExtAdminUI.ConfigList.Length ) { // Show main links page. SendHeader(q,"Ext Server Links page"); q.response.SendText(""); for( i=0; i"); q.response.SendText("
Links
"); } else { S = q.request.getVariable("edit"$EditPageIndex); bEditArray = false; if( S=="Submit" ) { // Read setting values. for( i=0; i=0; --j ) { if( q.request.getVariable("DEL"$j)=="1" ) SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j,"#DELETE"); else { S = q.request.getVariable("PR"$j,"New Line"); if( S!="New Line" ) SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j,S); } } } } // Show settings page SendHeader(q,ExtAdminUI.ConfigList[EditPageIndex].PageName$" ("$PathName(ExtAdminUI.ConfigList[EditPageIndex].ObjClass)$")"); q.response.SendText("
"); if( bEditArray ) { q.response.SendText("
"); GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue; z = int(GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,-1)); for( j=0; j<=z; ++j ) { if( j"); else q.response.SendText(""); break; case 2: // string AddConfigEditbox(q,"["$j$"]",S,80,"PR"$j,"",true); if( j"); else q.response.SendText(""); break; } } q.response.SendText(""); } else { q.response.SendText("
Edit Array "$ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName$"Delete Line
"); for( i=0; i"); } else { GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue; S = GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,0); switch( ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType ) { case 0: // Int AddConfigEditbox(q,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName,S,8,"PR"$i,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc); break; case 1: // Bool AddConfigCheckbox(q,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName,bool(S),"PR"$i,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc); break; case 2: // String AddConfigEditbox(q,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName,S,80,"PR"$i,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc); break; case 3: // Text field AddConfigTextbox(q,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName,S,25,"PR"$i,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc); break; } } } // Submit button q.response.SendText(""); } // Return to main menu button. q.response.SendText(""); q.response.SendText("
Settings
"$ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName$"["$j$"]:
"); } SendFooter(q); } function bool producesXhtml() { return true; } function bool unhandledQuery(WebAdminQuery q); function decoratePage(WebAdminQuery q); defaultproperties { ExtWebURL="/settings/ExtServerMod" EditPageIndex=-1 }