From d14a24d5caa6a8b8fc3a09fd0be12420d7ce6372 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 30 Mar 2007 10:14:15 +0000 Subject: [PATCH] Started to add a few features to the web front end that should be useful during debugging. First such feature is that you can see a list of any connected clients inventory. --- .../OpenGridServices.UserServer.csproj | 43 ++++++++++------- OpenSim.RegionServer/CAPS/AdminWebFront.cs | 47 +++++++++++++++++-- OpenSim.RegionServer/OpenSimMain.cs | 2 +- OpenSim.sln | 2 +- Servers/BaseHttpServer.cs | 10 ++-- Servers/IRestHandler.cs | 2 +- bin/testadmin.htm | 2 +- 7 files changed, 77 insertions(+), 31 deletions(-) diff --git a/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj b/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj index e82379374f..da38f1052f 100644 --- a/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj +++ b/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {66591469-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenGridServices.UserServer @@ -15,9 +16,11 @@ IE50 false Exe - + + OpenGridServices.UserServer - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,26 +61,23 @@ False False 4 - + + - + System.dll False - + System.Data.dll False - + System.Xml.dll False - - ..\bin\OpenSim.Framework.dll - False - - + ..\bin\libsecondlife.dll False @@ -84,7 +87,11 @@ OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + + + {8ACA2445-0000-0000-0000-000000000000} + OpenSim.Framework @@ -105,4 +112,4 @@ - + \ No newline at end of file diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs index 4995e545bd..72fbdafbaa 100644 --- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs +++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs @@ -5,6 +5,8 @@ using System.IO; using OpenSim.world; using OpenSim.UserServer; using OpenSim.Servers; +using OpenSim.Assets; +using OpenSim.Framework.Inventory; namespace OpenSim.CAPS { @@ -16,9 +18,11 @@ namespace OpenSim.CAPS private string passWord = "Admin"; private World m_world; private LoginServer _userServer; + private InventoryCache _inventoryCache; - public AdminWebFront(string password, World world, LoginServer userserver) + public AdminWebFront(string password, World world, InventoryCache inventoryCache, LoginServer userserver) { + _inventoryCache = inventoryCache; _userServer = userserver; m_world = world; passWord = password; @@ -31,9 +35,10 @@ namespace OpenSim.CAPS server.AddRestHandler("GET", "/Admin/Welcome", GetWelcomePage); server.AddRestHandler("GET", "/Admin/Accounts", GetAccountsPage ); server.AddRestHandler("GET", "/Admin/Clients", GetConnectedClientsPage ); + server.AddRestHandler("GET", "/ClientInventory", GetClientsInventory); server.AddRestHandler("POST", "/Admin/NewAccount", PostNewAccount ); - server.AddRestHandler("POST", "/Admin/Login", PostLogin ); + server.AddRestHandler("POST", "/Admin/Login", PostLogin ); } private string GetWelcomePage(string request, string path) @@ -120,14 +125,48 @@ namespace OpenSim.CAPS if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar") { TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID]; - responseString += "

"; - responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); + responseString += "

Client: "; + responseString += TempAv.firstname + " , " + TempAv.lastname + " , " + UUID + " , " + TempAv.ControllingClient.SessionID + " , " + TempAv.ControllingClient.CircuitCode + " , " + TempAv.ControllingClient.userEP.ToString();//String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); responseString += "

"; } } return responseString; } + private string GetClientsInventory(string request, string path) + { + string[] line; + string delimStr = "/"; + char[] delimiter = delimStr.ToCharArray(); + string responseString; + responseString = "

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 ; //String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", item.Name, item.ItemID, item.Type, item.FolderID, item.AssetID, item.Description); + responseString += "

"; + } + } + } + } + return responseString; + } + + private string GetCachedAssets(string request, string path) + { + return ""; + } + private string GetAccountsPage(string request, string path) { string responseString; diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index 36e1817dab..ffa64b5a43 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs @@ -199,7 +199,7 @@ namespace OpenSim } } - AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, adminLoginServer); + AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); adminWebFront.LoadMethods( HttpServer ); m_console.WriteLine("Main.cs:Startup() - Starting HTTP server"); diff --git a/OpenSim.sln b/OpenSim.sln index b6b12b015c..28237283b6 100644 --- a/OpenSim.sln +++ b/OpenSim.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +# Visual C# Express 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Servers", "Servers\OpenSim.Servers.csproj", "{8BB20F0A-0000-0000-0000-000000000000}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Console", "OpenSim.Framework.Console\OpenSim.Framework.Console.csproj", "{A7CD0630-0000-0000-0000-000000000000}" diff --git a/Servers/BaseHttpServer.cs b/Servers/BaseHttpServer.cs index 174402a97c..2f73f468fb 100644 --- a/Servers/BaseHttpServer.cs +++ b/Servers/BaseHttpServer.cs @@ -4,7 +4,7 @@ using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading; -using OpenSim.CAPS; +//using OpenSim.CAPS; using Nwc.XmlRpc; using System.Collections; @@ -191,11 +191,11 @@ namespace OpenSim.Servers public void Start() { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine("BaseHttpServer.cs: Starting up HTTP Server"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("BaseHttpServer.cs: Starting up HTTP Server"); - m_workerThread = new Thread(new ThreadStart(StartHTTP)); - m_workerThread.IsBackground = true; - m_workerThread.Start(); + m_workerThread = new Thread(new ThreadStart(StartHTTP)); + m_workerThread.IsBackground = true; + m_workerThread.Start(); } private void StartHTTP() diff --git a/Servers/IRestHandler.cs b/Servers/IRestHandler.cs index 46459ffd96..08737cc3b4 100644 --- a/Servers/IRestHandler.cs +++ b/Servers/IRestHandler.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.CAPS +namespace OpenSim.Servers { public delegate string RestMethod( string request, string path ); } diff --git a/bin/testadmin.htm b/bin/testadmin.htm index 4252ffd30e..1e34cf768a 100644 --- a/bin/testadmin.htm +++ b/bin/testadmin.htm @@ -110,7 +110,7 @@ if (http_request.readyState==4) -
+