From c3a40b7d42276f152d8f4f6a7a3ad4eca3c6d7a8 Mon Sep 17 00:00:00 2001
From: MW
Date: Sat, 26 May 2007 14:34:57 +0000
Subject: Die WebFrontEnd, Die Grid class!
---
OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs | 228 +--------------------
1 file changed, 3 insertions(+), 225 deletions(-)
(limited to 'OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs')
diff --git a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 2299fa4..1f508ce 100644
--- a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -19,238 +19,16 @@ namespace OpenSim.CAPS
private string NewAccountForm;
private string LoginForm;
private string passWord = "Admin";
- private World m_world;
- private LoginServer _userServer;
- private InventoryCache _inventoryCache;
- public AdminWebFront(string password, World world, InventoryCache inventoryCache, LoginServer userserver)
+
+ public AdminWebFront(string password)
{
- _inventoryCache = inventoryCache;
- _userServer = userserver;
- m_world = world;
passWord = password;
- LoadAdminPage();
}
public void LoadMethods( BaseHttpServer server )
{
- server.AddRestHandler("GET", "/Admin", GetAdminPage);
- server.AddRestHandler("GET", "/Admin/Welcome", GetWelcomePage);
- server.AddRestHandler("GET", "/Admin/Accounts", GetAccountsPage );
- server.AddRestHandler("GET", "/Admin/Clients", GetConnectedClientsPage);
- server.AddRestHandler("GET", "/Admin/Entities", GetEntitiesPage);
- server.AddRestHandler("GET", "/Admin/Scripts", GetScriptsPage);
- server.AddRestHandler("GET", "/Admin/AddTestScript", AddTestScript );
- server.AddRestHandler("GET", "/ClientInventory", GetClientsInventory);
-
- server.AddRestHandler("POST", "/Admin/NewAccount", PostNewAccount );
- server.AddRestHandler("POST", "/Admin/Login", PostLogin );
- }
-
- private string GetWelcomePage(string request, string path, string param)
- {
- string responseString;
- responseString = "Welcome to the OpenSim Admin Page";
- responseString += "
" + LoginForm;
- return responseString;
- }
-
- private string PostLogin(string requestBody, string path, string param)
- {
- string responseString;
-// Console.WriteLine(requestBody);
- if (requestBody == passWord)
- {
- responseString = "
Login Successful
"; - } - else - { - responseString = "Password Error
"; - responseString += "Please Login with the correct password
"; - responseString += "New Account created
"; - } - else - { - responseString = "Admin password is incorrect, please login with the correct password
"; - responseString += "Listing connected Clients
"; - OpenSim.world.Avatar TempAv; - foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys) - { - if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar") - { - TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID]; - responseString += "Client: "; - responseString += TempAv.firstname + " , " + TempAv.lastname + " , " + UUID + " , " + TempAv.ControllingClient.SessionID + " , " + TempAv.ControllingClient.CircuitCode + " , " + TempAv.ControllingClient.userEP.ToString(); - responseString += "
"; - } - } - return responseString; - } - - private string AddTestScript(string request, string path, string param) - { - int index = path.LastIndexOf('/'); - - string lluidStr = path.Substring(index+1); - - LLUUID id; - - if( LLUUID.TryParse( lluidStr, out id ) ) - { - // This is just here for concept purposes... Remove! - m_world.AddScript( m_world.Entities[id], new FollowRandomAvatar()); - return String.Format("Added new script to object [{0}]", id); - } - else - { - return String.Format("Couldn't parse [{0}]", lluidStr ); - } - } - - private string GetScriptsPage(string request, string path, string param) - { - return String.Empty; - } - - private string GetEntitiesPage(string request, string path, string param) - { - string responseString; - responseString = "Listing current entities
Listing Inventory
"; - - line = path.Split(delimiter); - if (line.Length > 2) - { - if (line[1] == "ClientInventory") - { - AgentInventory inven = this._inventoryCache.GetAgentsInventory(new libsecondlife.LLUUID(line[2])); - responseString += "Client: " + inven.AgentID.ToStringHyphenated() +"
"; - if (inven != null) - { - foreach (InventoryItem item in inven.InventoryItems.Values) - { - responseString += "InventoryItem: "; - responseString += item.Name +" , "+ item.ItemID +" , "+ item.Type +" , "+ item.FolderID +" , "+ item.AssetID +" , "+ item.Description ; - responseString += "
"; - } - } - } - } - return responseString; - } - - private string GetCachedAssets(string request, string path, string param) - { - return ""; - } - - private string GetAccountsPage(string request, string path, string param) - { - string responseString; - responseString = "Account management
"; - responseString += "Create New Account
"; - responseString += NewAccountForm; - return responseString; - } - - private string GetAdminPage(string request, string path, string param) - { - return AdminPage; - } - - private void LoadAdminPage() - { - try - { - StreamReader SR; - - SR = File.OpenText("testadmin.htm"); - AdminPage = SR.ReadToEnd(); - SR.Close(); - - SR = File.OpenText("newaccountform.htm"); - NewAccountForm = SR.ReadToEnd(); - SR.Close(); - - SR = File.OpenText("login.htm"); - LoginForm = SR.ReadToEnd(); - SR.Close(); - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - } - - } - } } -- cgit v1.1