aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/UserStatistics/Prototype_distributor.cs
diff options
context:
space:
mode:
authorRobert Adams2013-01-24 10:44:57 -0800
committerRobert Adams2013-01-24 10:44:57 -0800
commit427ab219b8ecf7f039d03ed3067e183db1434fb2 (patch)
tree520cdf2f0afb00fe8dbb28801d4fbf98902788dd /OpenSim/Region/UserStatistics/Prototype_distributor.cs
parent* Added in the manifold point dept on collision desc. In BulletSim engine Bul... (diff)
downloadopensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.zip
opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.gz
opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.bz2
opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.xz
Add JSONification of WebStats module. Adds a '?json' query parameter
to the fetch URL to return the data in JSON format. Also adds a simple 'sim.html' that uses JavaScript to display the JSON data. Not pretty but an example.
Diffstat (limited to 'OpenSim/Region/UserStatistics/Prototype_distributor.cs')
-rw-r--r--OpenSim/Region/UserStatistics/Prototype_distributor.cs31
1 files changed, 23 insertions, 8 deletions
diff --git a/OpenSim/Region/UserStatistics/Prototype_distributor.cs b/OpenSim/Region/UserStatistics/Prototype_distributor.cs
index 53ae557..6f8b2aa 100644
--- a/OpenSim/Region/UserStatistics/Prototype_distributor.cs
+++ b/OpenSim/Region/UserStatistics/Prototype_distributor.cs
@@ -36,7 +36,18 @@ namespace OpenSim.Region.UserStatistics
36{ 36{
37 public class Prototype_distributor : IStatsController 37 public class Prototype_distributor : IStatsController
38 { 38 {
39 private string prototypejs=string.Empty; 39 private string jsFileName = "prototype.js";
40 private string prototypejs = string.Empty;
41
42 public Prototype_distributor()
43 {
44 jsFileName = "prototype.js";
45 }
46
47 public Prototype_distributor(string jsName)
48 {
49 jsFileName = jsName;
50 }
40 51
41 public string ReportName 52 public string ReportName
42 { 53 {
@@ -45,20 +56,24 @@ namespace OpenSim.Region.UserStatistics
45 public Hashtable ProcessModel(Hashtable pParams) 56 public Hashtable ProcessModel(Hashtable pParams)
46 { 57 {
47 Hashtable pResult = new Hashtable(); 58 Hashtable pResult = new Hashtable();
48 if (prototypejs.Length == 0) 59 pResult["js"] = jsFileName;
60 return pResult;
61 }
62
63 public string RenderView(Hashtable pModelResult)
64 {
65 string fileName = (string)pModelResult["js"];
66 using (StreamReader fs = new StreamReader(new FileStream(Util.dataDir() + "/data/" + fileName, FileMode.Open)))
49 { 67 {
50 StreamReader fs = new StreamReader(new FileStream(Util.dataDir() + "/data/prototype.js", FileMode.Open));
51 prototypejs = fs.ReadToEnd(); 68 prototypejs = fs.ReadToEnd();
52 fs.Close(); 69 fs.Close();
53 fs.Dispose();
54 } 70 }
55 pResult["js"] = prototypejs; 71 return prototypejs;
56 return pResult;
57 } 72 }
58 73
59 public string RenderView(Hashtable pModelResult) 74 public string RenderJson(Hashtable pModelResult)
60 { 75 {
61 return pModelResult["js"].ToString(); 76 return "{}";
62 } 77 }
63 78
64 } 79 }