30 using System.Reflection;
32 using System.Collections.Generic;
33 using System.Threading;
35 using OpenMetaverse.StructuredData;
38 using OpenSim.Region.Framework;
39 using OpenSim.Region.Framework.Scenes;
40 using OpenSim.Region.Framework.Interfaces;
41 using OpenSim.Framework;
43 using OpenSim.Framework.Servers;
44 using OpenSim.Framework.Servers.HttpServer;
53 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"SpecialUI")]
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 private const string VIEWER_SUPPORT_DIR =
"ViewerSupport";
59 private Scene m_scene;
61 private bool m_Enabled;
62 private int m_UserLevel;
66 get {
return "SpecialUIModule"; }
69 public Type ReplaceableInterface
76 IConfig moduleConfig = config.Configs[
"SpecialUIModule"];
77 if (moduleConfig != null)
79 m_Enabled = moduleConfig.GetBoolean(
"enabled",
false);
82 m_UserLevel = moduleConfig.GetInt(
"UserLevel", 0);
83 m_log.Info(
"[SPECIAL UI]: SpecialUIModule enabled");
109 if (featuresModule != null)
110 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
118 private void OnSimulatorFeaturesRequest(UUID agentID, ref
OSDMap features)
120 m_log.DebugFormat(
"[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
121 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel)
125 using (StreamReader s =
new StreamReader(Path.Combine(VIEWER_SUPPORT_DIR,
"panel_toolbar.xml")))
127 if (features.ContainsKey(
"OpenSimExtras"))
128 extrasMap = (
OSDMap)features[
"OpenSimExtras"];
132 features[
"OpenSimExtras"] = extrasMap;
135 specialUI[
"toolbar"] = OSDMap.FromString(s.ReadToEnd());
136 extrasMap[
"special-ui"] = specialUI;
138 m_log.DebugFormat(
"[SPECIAL UI]: Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);
140 if (Directory.Exists(Path.Combine(VIEWER_SUPPORT_DIR,
"Floaters")))
144 foreach (String name
in Directory.GetFiles(Path.Combine(VIEWER_SUPPORT_DIR,
"Floaters"),
"*.xml"))
146 using (StreamReader s =
new StreamReader(name))
148 string simple_name = Path.GetFileNameWithoutExtension(name);
150 floaters[simple_name] = OSDMap.FromString(s.ReadToEnd());
154 specialUI[
"floaters"] = floaters;
155 m_log.DebugFormat(
"[SPECIAL UI]: Sending {0} floaters", n);
159 m_log.DebugFormat(
"[SPECIAL UI]: NOT Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);
OpenSim.Framework.Constants.TeleportFlags TeleportFlags
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
OpenMetaverse.StructuredData.OSDMap OSDMap
Add remove or retrieve Simulator Features that will be given to a viewer via the SimulatorFeatures ca...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
OpenMetaverse.StructuredData.OSDMap OSDMap
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
Interactive OpenSim region server
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
OpenSim.Framework.Constants.TeleportFlags TeleportFlags