aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/CAPS
diff options
context:
space:
mode:
authorlbsa712007-04-03 16:50:17 +0000
committerlbsa712007-04-03 16:50:17 +0000
commitad398971445a3aad5490ad4c3e6b7319f201bb8f (patch)
tree746655b671e158b1e578983d68eeb96976ebdf8f /OpenSim.RegionServer/CAPS
parentLimited (hacked) object linking. Note: once you have linked a set of prims to... (diff)
downloadopensim-SC-ad398971445a3aad5490ad4c3e6b7319f201bb8f.zip
opensim-SC-ad398971445a3aad5490ad4c3e6b7319f201bb8f.tar.gz
opensim-SC-ad398971445a3aad5490ad4c3e6b7319f201bb8f.tar.bz2
opensim-SC-ad398971445a3aad5490ad4c3e6b7319f201bb8f.tar.xz
* Script prototype
Diffstat (limited to 'OpenSim.RegionServer/CAPS')
-rw-r--r--OpenSim.RegionServer/CAPS/AdminWebFront.cs98
1 files changed, 72 insertions, 26 deletions
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 7f00225..43996d0 100644
--- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -7,6 +7,8 @@ using OpenSim.UserServer;
7using OpenSim.Servers; 7using OpenSim.Servers;
8using OpenSim.Assets; 8using OpenSim.Assets;
9using OpenSim.Framework.Inventory; 9using OpenSim.Framework.Inventory;
10using libsecondlife;
11using OpenSim.RegionServer.world.scripting;
10 12
11namespace OpenSim.CAPS 13namespace OpenSim.CAPS
12{ 14{
@@ -34,7 +36,10 @@ namespace OpenSim.CAPS
34 server.AddRestHandler("GET", "/Admin", GetAdminPage); 36 server.AddRestHandler("GET", "/Admin", GetAdminPage);
35 server.AddRestHandler("GET", "/Admin/Welcome", GetWelcomePage); 37 server.AddRestHandler("GET", "/Admin/Welcome", GetWelcomePage);
36 server.AddRestHandler("GET", "/Admin/Accounts", GetAccountsPage ); 38 server.AddRestHandler("GET", "/Admin/Accounts", GetAccountsPage );
37 server.AddRestHandler("GET", "/Admin/Clients", GetConnectedClientsPage ); 39 server.AddRestHandler("GET", "/Admin/Clients", GetConnectedClientsPage);
40 server.AddRestHandler("GET", "/Admin/Entities", GetEntitiesPage);
41 server.AddRestHandler("GET", "/Admin/Scripts", GetScriptsPage);
42 server.AddRestHandler("GET", "/Admin/AddTestScript", AddTestScript );
38 server.AddRestHandler("GET", "/ClientInventory", GetClientsInventory); 43 server.AddRestHandler("GET", "/ClientInventory", GetClientsInventory);
39 44
40 server.AddRestHandler("POST", "/Admin/NewAccount", PostNewAccount ); 45 server.AddRestHandler("POST", "/Admin/NewAccount", PostNewAccount );
@@ -133,6 +138,68 @@ namespace OpenSim.CAPS
133 return responseString; 138 return responseString;
134 } 139 }
135 140
141
142 private class TestScript : Script
143 {
144 int toggle = 0;
145
146 public TestScript()
147 : base(LLUUID.Random())
148 {
149 OnFrame += MyOnFrame;
150 }
151
152 private void MyOnFrame(IScriptContext context)
153 {
154 toggle = 2 - toggle;
155
156 LLVector3 pos = context.GetPos();
157
158 pos.X += (toggle - 1);
159
160 context.MoveTo(pos);
161 }
162 }
163
164 private string AddTestScript(string request, string path)
165 {
166 int index = path.LastIndexOf('/');
167
168 string lluidStr = path.Substring(index+1);
169
170 LLUUID id;
171
172 if( LLUUID.TryParse( lluidStr, out id ) )
173 {
174 // This is just here for concept purposes... Remove!
175 m_world.AddScript( m_world.Entities[id], new TestScript());
176 return String.Format("Added new script to object [{0}]", id);
177 }
178 else
179 {
180 return String.Format("Couldn't parse [{0}]", lluidStr );
181 }
182 }
183
184 private string GetScriptsPage(string request, string path)
185 {
186 return String.Empty;
187 }
188
189 private string GetEntitiesPage(string request, string path)
190 {
191 string responseString;
192 responseString = " <p> Listing current entities</p><ul>";
193
194 foreach (Entity entity in m_world.Entities.Values)
195 {
196 string testScriptLink = "javascript:loadXMLDoc('Admin/AddTestScript/" + entity.uuid.ToString() + "');";
197 responseString += String.Format( "<li>[{0}] \"{1}\" @ {2} <a href=\"{3}\">add test script</a></li>", entity.uuid, entity.getName(), entity.position, testScriptLink );
198 }
199 responseString += "</ul>";
200 return responseString;
201 }
202
136 private string GetClientsInventory(string request, string path) 203 private string GetClientsInventory(string request, string path)
137 { 204 {
138 string[] line; 205 string[] line;
@@ -187,38 +254,17 @@ namespace OpenSim.CAPS
187 try 254 try
188 { 255 {
189 StreamReader SR; 256 StreamReader SR;
190 string lines; 257
191 AdminPage = "";
192 NewAccountForm = "";
193 LoginForm = "";
194 SR = File.OpenText("testadmin.htm"); 258 SR = File.OpenText("testadmin.htm");
195 259 AdminPage = SR.ReadToEnd();
196 while (!SR.EndOfStream)
197 {
198 lines = SR.ReadLine();
199 AdminPage += lines + "\n";
200
201 }
202 SR.Close(); 260 SR.Close();
203 261
204 SR = File.OpenText("newaccountform.htm"); 262 SR = File.OpenText("newaccountform.htm");
205 263 NewAccountForm = SR.ReadToEnd();
206 while (!SR.EndOfStream)
207 {
208 lines = SR.ReadLine();
209 NewAccountForm += lines + "\n";
210
211 }
212 SR.Close(); 264 SR.Close();
213 265
214 SR = File.OpenText("login.htm"); 266 SR = File.OpenText("login.htm");
215 267 LoginForm = SR.ReadToEnd();
216 while (!SR.EndOfStream)
217 {
218 lines = SR.ReadLine();
219 LoginForm += lines + "\n";
220
221 }
222 SR.Close(); 268 SR.Close();
223 } 269 }
224 catch (Exception e) 270 catch (Exception e)