Beispiel #1
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object>();

            if (httpRequest.Query.ContainsKey("regionid"))
            {
                var regionService = webInterface.Registry.RequestModuleInterface <IGridService>();
                var region        = regionService.GetRegionByUUID(null, UUID.Parse(httpRequest.Query["regionid"].ToString()));

                IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector>();
                EstateSettings   estate          = null;

                if (estateConnector != null)
                {
                    estate = estateConnector.GetRegionEstateSettings(region.RegionID);
                }

                if (estate != null)
                {
                    vars.Add("OwnerUUID", estate.EstateOwner);
                    var estateOwnerAccount = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                                             GetUserAccount(null, estate.EstateOwner);
                    vars.Add("OwnerName", estateOwnerAccount == null ? "No account found" : estateOwnerAccount.Name);
                }
                else
                {
                    vars.Add("OwnerUUID", "Unknown");
                    vars.Add("OwnerName", "Unknown");
                }

                vars.Add("RegionName", region.RegionName);
                vars.Add("RegionLocX", region.RegionLocX / Constants.RegionSize);
                vars.Add("RegionLocY", region.RegionLocY / Constants.RegionSize);
                vars.Add("RegionSizeX", region.RegionSizeX);
                vars.Add("RegionSizeY", region.RegionSizeY);
                vars.Add("RegionType", region.RegionType);
                vars.Add("RegionTerrain", region.RegionTerrain);
                vars.Add("RegionMaturity", Utilities.GetRegionMaturity(region.Access));

                bool regionIsOnline = (region.Flags & (int)RegionFlags.RegionOnline) == (int)RegionFlags.RegionOnline;
                vars.Add("RegionOnline",
                         regionIsOnline
                    ? translator.GetTranslatedString("Online")
                    : translator.GetTranslatedString("Offline"));

                IAgentInfoService   agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService>();
                IUserAccountService userService      = webInterface.Registry.RequestModuleInterface <IUserAccountService>();

                if (agentInfoService != null)
                {
                    List <UserInfo> usersInRegion = agentInfoService.GetUserInfos(region.RegionID);
                    vars.Add("NumberOfUsersInRegion", usersInRegion != null ? usersInRegion.Count : 0);
                    List <Dictionary <string, object> > users = new List <Dictionary <string, object> >();

                    if (userService != null)
                    {
                        foreach (var client in usersInRegion)
                        {
                            UserAccount account = userService.GetUserAccount(null, (UUID)client.UserID);

                            if (account == null)
                            {
                                continue;
                            }

                            Dictionary <string, object> user = new Dictionary <string, object>();
                            user.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
                            user.Add("UserUUID", client.UserID);
                            user.Add("UserName", account.Name);
                            users.Add(user);
                        }
                    }

                    vars.Add("UsersInRegion", users);
                }
                else
                {
                    vars.Add("NumberOfUsersInRegion", 0);
                    vars.Add("UsersInRegion", new List <Dictionary <string, object> >());
                }

                IDirectoryServiceConnector directoryConnector = Framework.Utilities.DataManager.RequestPlugin <IDirectoryServiceConnector>();

                if (directoryConnector != null)
                {
                    List <LandData> parcelData = directoryConnector.GetParcelsByRegion(0, 10, region.RegionID, UUID.Zero, ParcelFlags.None, ParcelCategory.Any);

                    if (parcelData != null)
                    {
                        vars.Add("NumberOfParcelsInRegion", parcelData.Count);
                    }
                    else
                    {
                        vars.Add("NumberOfParcelsInRegion", 0);
                    }
                }

                IWebHttpTextureService webTextureService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService>();
                var regionMapURL = "../images/icons/no_terrain.jpg";

                if (webTextureService != null && region.TerrainMapImage != UUID.Zero)
                {
                    regionMapURL = webTextureService.GetTextureURL(region.TerrainMapImage);
                }

                vars.Add("RegionImageURL", regionMapURL);

                // worldview
                IConfig worldViewConfig  = webInterface.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs["WorldViewModule"];
                bool    worldViewEnabled = false;

                if (worldViewConfig != null)
                {
                    worldViewEnabled = worldViewConfig.GetBoolean("Enabled", true);
                }

                if (webTextureService != null && worldViewEnabled && regionIsOnline)
                {
                    vars.Add("RegionWorldViewURL", webTextureService.GetRegionWorldViewURL(region.RegionID));
                }
                else
                {
                    vars.Add("RegionWorldViewURL", regionMapURL);
                }

                // Menu Region
                vars.Add("MenuRegionTitle", translator.GetTranslatedString("MenuRegionTitle"));
                vars.Add("TooltipsMenuRegion", translator.GetTranslatedString("TooltipsMenuRegion"));
                vars.Add("MenuParcelTitle", translator.GetTranslatedString("MenuParcelTitle"));
                vars.Add("TooltipsMenuParcel", translator.GetTranslatedString("TooltipsMenuParcel"));
                vars.Add("MenuOwnerTitle", translator.GetTranslatedString("MenuOwnerTitle"));
                vars.Add("TooltipsMenuOwner", translator.GetTranslatedString("TooltipsMenuOwner"));

                vars.Add("RegionInformationText", translator.GetTranslatedString("RegionInformationText"));
                vars.Add("OwnerNameText", translator.GetTranslatedString("OwnerNameText"));
                vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText"));
                vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText"));
                vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
                vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText"));
                vars.Add("RegionMaturityText", translator.GetTranslatedString("RegionMaturityText"));
                vars.Add("RegionTerrainText", translator.GetTranslatedString("RegionTerrainText"));
                vars.Add("RegionInfoText", translator.GetTranslatedString("RegionInfoText"));
                vars.Add("RegionOnlineText", translator.GetTranslatedString("RegionOnlineText"));
                vars.Add("NumberOfUsersInRegionText", translator.GetTranslatedString("NumberOfUsersInRegionText"));
                vars.Add("ParcelsInRegionText", translator.GetTranslatedString("ParcelsInRegionText"));
                vars.Add("MainServerURL", webInterface.GridURL);
            }

            return(vars);
        }
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object>();

            if (httpRequest.Query.ContainsKey("regionid"))
            {
                var regionService = webInterface.Registry.RequestModuleInterface <IGridService> ();
                var region        = regionService.GetRegionByUUID(null, UUID.Parse(httpRequest.Query["regionid"].ToString()));

                IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector>();
                EstateSettings   estate          = estateConnector.GetEstateSettings(region.RegionID);

                vars.Add("RegionName", region.RegionName);
                vars.Add("OwnerUUID", estate.EstateOwner);
                var estateOwnerAccount = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                                         GetUserAccount(null, estate.EstateOwner);
                vars.Add("OwnerName", estateOwnerAccount == null ? "No account found" : estateOwnerAccount.Name);
                vars.Add("RegionLocX", region.RegionLocX / Constants.RegionSize);
                vars.Add("RegionLocY", region.RegionLocY / Constants.RegionSize);
                vars.Add("RegionSizeX", region.RegionSizeX);
                vars.Add("RegionSizeY", region.RegionSizeY);
                vars.Add("RegionType", region.RegionType);
                vars.Add("RegionTerrain", region.RegionTerrain);
                vars.Add("RegionOnline",
                         (region.Flags & (int)RegionFlags.RegionOnline) ==
                         (int)RegionFlags.RegionOnline
                    ? translator.GetTranslatedString("Online")
                    : translator.GetTranslatedString("Offline"));

                IDirectoryServiceConnector directoryConnector =
                    Framework.Utilities.DataManager.RequestPlugin <IDirectoryServiceConnector>();
                if (directoryConnector != null)
                {
                    List <LandData> data = directoryConnector.GetParcelsByRegion(0, 10, region.RegionID, UUID.Zero,
                                                                                 ParcelFlags.None, ParcelCategory.Any);
                    List <Dictionary <string, object> > parcels = new List <Dictionary <string, object> >();
                    string url = "../images/icons/no_parcel.jpg";

                    foreach (var p in data)
                    {
                        Dictionary <string, object> parcel = new Dictionary <string, object>();
                        parcel.Add("ParcelNameText", translator.GetTranslatedString("ParcelNameText"));
                        parcel.Add("ParcelOwnerText", translator.GetTranslatedString("ParcelOwnerText"));
                        parcel.Add("ParcelUUID", p.GlobalID);
                        parcel.Add("ParcelName", p.Name);
                        parcel.Add("ParcelOwnerUUID", p.OwnerID);
                        parcel.Add("ParcelSnapshotURL", url);
                        IUserAccountService accountService =
                            webInterface.Registry.RequestModuleInterface <IUserAccountService>();
                        if (accountService != null)
                        {
                            var account = accountService.GetUserAccount(null, p.OwnerID);
                            if (account == null)
                            {
                                parcel.Add("ParcelOwnerName", translator.GetTranslatedString("NoAccountFound"));
                            }
                            else
                            {
                                parcel.Add("ParcelOwnerName", account.Name);
                            }
                        }
                        parcels.Add(parcel);
                    }
                    vars.Add("ParcelInRegion", parcels);
                    vars.Add("NumberOfParcelsInRegion", parcels.Count);
                }
                IWebHttpTextureService webTextureService = webInterface.Registry.
                                                           RequestModuleInterface <IWebHttpTextureService>();
                if (webTextureService != null && region.TerrainMapImage != UUID.Zero)
                {
                    vars.Add("RegionImageURL", webTextureService.GetTextureURL(region.TerrainMapImage));
                }
                else
                {
                    vars.Add("RegionImageURL", "../images/icons/no_terrain.jpg");
                }
                vars.Add("RegionInformationText", translator.GetTranslatedString("RegionInformationText"));
                vars.Add("OwnerNameText", translator.GetTranslatedString("OwnerNameText"));
                vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText"));
                vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText"));
                vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
                vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText"));
                vars.Add("RegionTerrainText", translator.GetTranslatedString("RegionTerrainText"));
                vars.Add("RegionInfoText", translator.GetTranslatedString("RegionInfoText"));
                vars.Add("RegionOnlineText", translator.GetTranslatedString("RegionOnlineText"));
                vars.Add("NumberOfUsersInRegionText", translator.GetTranslatedString("NumberOfUsersInRegionText"));
                vars.Add("ParcelsInRegionText", translator.GetTranslatedString("ParcelsInRegionText"));
                vars.Add("MainServerURL", webInterface.GridURL);
            }

            return(vars);
        }
Beispiel #3
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            // under development
            //response = "<h3>Sorry! This feature is not available yet<</h3><br /> Redirecting to main page" +
            //    "<script language=\"javascript\">" +
            //    "setTimeout(function() {window.location.href = \"index.html\";}, 3000);" +
            //    "</script>";
            //return null;

            response = null;
            var vars = new Dictionary <string, object> ();

            if (httpRequest.Query.ContainsKey("regionid"))
            {
                var regionService = webInterface.Registry.RequestModuleInterface <IGridService> ();
                var region        = regionService.GetRegionByUUID(null, UUID.Parse(httpRequest.Query ["regionid"].ToString()));

                IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> ();
                var    ownerUUID = UUID.Zero;
                string ownerName = "Unknown";
                if (estateConnector != null)
                {
                    EstateSettings estate = estateConnector.GetRegionEstateSettings(region.RegionID);
                    if (estate != null)
                    {
                        ownerUUID = estate.EstateOwner;
                        UserAccount estateOwnerAccount = null;
                        var         accountService     = webInterface.Registry.RequestModuleInterface <IUserAccountService> ();
                        if (accountService != null)
                        {
                            estateOwnerAccount = accountService.GetUserAccount(null, estate.EstateOwner);
                        }
                        ownerName = estateOwnerAccount == null ? "No account found" : estateOwnerAccount.Name;
                    }
                }
                else
                {
                    ownerUUID = UUID.Zero;
                    ownerName = "Unknown";
                }

                vars.Add("OwnerUUID", ownerUUID);
                vars.Add("OwnerName", ownerName);
                vars.Add("RegionName", region.RegionName);
                vars.Add("RegionLocX", region.RegionLocX / Constants.RegionSize);
                vars.Add("RegionLocY", region.RegionLocY / Constants.RegionSize);
                vars.Add("RegionSizeX", region.RegionSizeX);
                vars.Add("RegionSizeY", region.RegionSizeY);
                vars.Add("RegionType", region.RegionType);
                vars.Add("RegionTerrain", region.RegionTerrain);
                vars.Add("RegionOnline",
                         (region.Flags & (int)RegionFlags.RegionOnline) ==
                         (int)RegionFlags.RegionOnline
                    ? translator.GetTranslatedString("Online")
                    : translator.GetTranslatedString("Offline"));

                IDirectoryServiceConnector directoryConnector =
                    Framework.Utilities.DataManager.RequestPlugin <IDirectoryServiceConnector> ();
                if (directoryConnector != null)
                {
                    IUserAccountService accountService =
                        webInterface.Registry.RequestModuleInterface <IUserAccountService> ();
                    List <LandData> data = directoryConnector.GetParcelsByRegion(0, 10, region.RegionID, UUID.Zero,
                                                                                 ParcelFlags.None, ParcelCategory.Any);
                    List <Dictionary <string, object> > parcels = new List <Dictionary <string, object> > ();
                    string url = "../images/icons/no_parcel.jpg";

                    if (data != null)
                    {
                        foreach (var p in data)
                        {
                            Dictionary <string, object> parcel = new Dictionary <string, object> ();
                            parcel.Add("ParcelNameText", translator.GetTranslatedString("ParcelNameText"));
                            parcel.Add("ParcelOwnerText", translator.GetTranslatedString("ParcelOwnerText"));
                            parcel.Add("ParcelUUID", p.GlobalID);
                            parcel.Add("ParcelName", p.Name);
                            parcel.Add("ParcelOwnerUUID", p.OwnerID);
                            parcel.Add("ParcelSnapshotURL", url);
                            if (accountService != null)
                            {
                                var account = accountService.GetUserAccount(null, p.OwnerID);
                                if (account != null)
                                {
                                    parcel.Add("ParcelOwnerName", account.Name);
                                }
                                else
                                {
                                    parcel.Add("ParcelOwnerName", translator.GetTranslatedString("NoAccountFound"));
                                }
                            }
                            parcels.Add(parcel);
                        }
                    }
                    vars.Add("ParcelInRegion", parcels);
                    vars.Add("NumberOfParcelsInRegion", parcels.Count);
                }
                IWebHttpTextureService webTextureService = webInterface.Registry.
                                                           RequestModuleInterface <IWebHttpTextureService> ();
                if (webTextureService != null && region.TerrainMapImage != UUID.Zero)
                {
                    vars.Add("RegionImageURL", webTextureService.GetTextureURL(region.TerrainMapImage));
                }
                else
                {
                    vars.Add("RegionImageURL", "../images/icons/no_terrain.jpg");
                }

                /*   // Regionprofile Menus
                 * vars.Add("MenuRegionTitle", translator.GetTranslatedString("MenuRegionTitle"));
                 * vars.Add("TooltipsMenuRegion", translator.GetTranslatedString("TooltipsMenuRegion"));
                 * vars.Add("MenuParcelTitle", translator.GetTranslatedString("MenuParcelTitle"));
                 * vars.Add("TooltipsMenuParcel", translator.GetTranslatedString("TooltipsMenuParcel"));
                 * vars.Add("MenuOwnerTitle", translator.GetTranslatedString("MenuOwnerTitle"));
                 * vars.Add("TooltipsMenuOwner", translator.GetTranslatedString("TooltipsMenuOwner"));
                 */
                vars.Add("RegionInformationText", translator.GetTranslatedString("RegionInformationText"));
                vars.Add("OwnerNameText", translator.GetTranslatedString("OwnerNameText"));
                vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText"));
                vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText"));
                vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
                vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText"));
                vars.Add("RegionTerrainText", translator.GetTranslatedString("RegionTerrainText"));
                vars.Add("RegionInfoText", translator.GetTranslatedString("RegionInfoText"));
                vars.Add("RegionOnlineText", translator.GetTranslatedString("RegionOnlineText"));
                vars.Add("NumberOfUsersInRegionText", translator.GetTranslatedString("NumberOfUsersInRegionText"));
                vars.Add("ParcelsInRegionText", translator.GetTranslatedString("ParcelsInRegionText"));
                vars.Add("MainServerURL", webInterface.GridURL);
            }

            return(vars);
        }
Beispiel #4
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object> ();

            if (httpRequest.Query.ContainsKey("regionid"))
            {
                IAgentInfoService   agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService> ();
                IUserAccountService userService      = webInterface.Registry.RequestModuleInterface <IUserAccountService> ();

                var regionService = webInterface.Registry.RequestModuleInterface <IGridService> ();
                var region        = regionService.GetRegionByUUID(null, UUID.Parse(httpRequest.Query ["regionid"].ToString()));

                IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> ();
                var ownerUUID = UUID.Zero;
                var ownerName = "Unknown";
                if (estateConnector != null)
                {
                    EstateSettings estate = estateConnector.GetRegionEstateSettings(region.RegionID);
                    if (estate != null)
                    {
                        ownerUUID = estate.EstateOwner;
                        UserAccount estateOwnerAcct = new UserAccount();
                        if (userService != null)
                        {
                            estateOwnerAcct = userService.GetUserAccount(null, estate.EstateOwner);
                        }
                        ownerName = estateOwnerAcct.Valid ? estateOwnerAcct.Name : "No account found";
                    }
                }
                vars.Add("OwnerUUID", ownerUUID);
                vars.Add("OwnerName", ownerName);

                vars.Add("RegionName", region.RegionName);
                vars.Add("RegionLocX", region.RegionLocX / Constants.RegionSize);
                vars.Add("RegionLocY", region.RegionLocY / Constants.RegionSize);
                vars.Add("RegionSizeX", region.RegionSizeX);
                vars.Add("RegionSizeY", region.RegionSizeY);
                vars.Add("RegionType", region.RegionType);
                vars.Add("RegionTerrain", region.RegionTerrain);
                vars.Add("RegionOnline",
                         (region.Flags & (int)RegionFlags.RegionOnline) ==
                         (int)RegionFlags.RegionOnline
                             ? translator.GetTranslatedString("Online")
                             : translator.GetTranslatedString("Offline"));

                if (agentInfoService != null)
                {
                    List <UserInfo> usersInRegion = agentInfoService.GetUserInfos(region.RegionID);
                    if (usersInRegion.Count == 0)
                    {
                        vars.Add("NumberOfUsersInRegion", 0);
                        vars.Add("UsersInRegion", new List <Dictionary <string, object> > ());
                    }
                    else
                    {
                        vars.Add("NumberOfUsersInRegion", usersInRegion.Count);
                        List <Dictionary <string, object> > users = new List <Dictionary <string, object> > ();
                        foreach (var client in usersInRegion)
                        {
                            if (userService != null)
                            {
                                UserAccount userAcct = userService.GetUserAccount(null, client.UserID);
                                if (userAcct.Valid)
                                {
                                    Dictionary <string, object> user = new Dictionary <string, object> ();
                                    user.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
                                    user.Add("UserUUID", client.UserID);
                                    user.Add("UserName", userAcct.Name);
                                    users.Add(user);
                                }
                            }
                        }
                        vars.Add("UsersInRegion", users);
                    }
                }
                else
                {
                    vars.Add("NumberOfUsersInRegion", 0);
                    vars.Add("UsersInRegion", new List <Dictionary <string, object> > ());
                }
                IDirectoryServiceConnector directoryConnector =
                    Framework.Utilities.DataManager.RequestPlugin <IDirectoryServiceConnector> ();

                if (directoryConnector != null)
                {
                    List <LandData> data = directoryConnector.GetParcelsByRegion(0, 10, region.RegionID, UUID.Zero,
                                                                                 ParcelFlags.None, ParcelCategory.Any);
                    List <Dictionary <string, object> > parcels = new List <Dictionary <string, object> > ();
                    if (data != null)
                    {
                        foreach (var p in data)
                        {
                            Dictionary <string, object> parcel = new Dictionary <string, object> ();
                            parcel.Add("ParcelNameText", translator.GetTranslatedString("ParcelNameText"));
                            parcel.Add("ParcelOwnerText", translator.GetTranslatedString("ParcelOwnerText"));
                            parcel.Add("ParcelUUID", p.GlobalID);
                            parcel.Add("ParcelName", p.Name);
                            parcel.Add("ParcelOwnerUUID", p.OwnerID);
                            if (userService != null)
                            {
                                var parcelownerAcct = userService.GetUserAccount(null, p.OwnerID);
                                if (parcelownerAcct.Valid)
                                {
                                    parcel.Add("ParcelOwnerName", parcelownerAcct.Name);
                                }
                                else
                                {
                                    parcel.Add("ParcelOwnerName", translator.GetTranslatedString("NoAccountFound"));
                                }
                            }
                            parcels.Add(parcel);
                        }
                    }
                    vars.Add("ParcelInRegion", parcels);
                    vars.Add("NumberOfParcelsInRegion", parcels.Count);
                }
                IWebHttpTextureService webTextureService = webInterface.Registry.
                                                           RequestModuleInterface <IWebHttpTextureService> ();
                if (webTextureService != null && region.TerrainMapImage != UUID.Zero)
                {
                    vars.Add("RegionImageURL", webTextureService.GetTextureURL(region.TerrainMapImage));
                }
                else
                {
                    vars.Add("RegionImageURL", "images/icons/no_picture.jpg");
                }

                // Menu Region
                vars.Add("MenuRegionTitle", translator.GetTranslatedString("MenuRegionTitle"));
                vars.Add("MenuParcelTitle", translator.GetTranslatedString("MenuParcelTitle"));
                vars.Add("MenuOwnerTitle", translator.GetTranslatedString("MenuOwnerTitle"));

                vars.Add("RegionInformationText", translator.GetTranslatedString("RegionInformationText"));
                vars.Add("OwnerNameText", translator.GetTranslatedString("OwnerNameText"));
                vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText"));
                vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText"));
                vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
                vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText"));
                vars.Add("RegionTerrainText", translator.GetTranslatedString("RegionTerrainText"));
                vars.Add("RegionInfoText", translator.GetTranslatedString("RegionInfoText"));
                vars.Add("RegionOnlineText", translator.GetTranslatedString("RegionOnlineText"));
                vars.Add("NumberOfUsersInRegionText", translator.GetTranslatedString("NumberOfUsersInRegionText"));
                vars.Add("ParcelsInRegionText", translator.GetTranslatedString("ParcelsInRegionText"));

                // Style Switcher
                vars.Add("styles1", translator.GetTranslatedString("styles1"));
                vars.Add("styles2", translator.GetTranslatedString("styles2"));
                vars.Add("styles3", translator.GetTranslatedString("styles3"));
                vars.Add("styles4", translator.GetTranslatedString("styles4"));
                vars.Add("styles5", translator.GetTranslatedString("styles5"));

                vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText"));
                vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText"));
                vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText"));

                // Language Switcher
                vars.Add("en", translator.GetTranslatedString("en"));
                vars.Add("fr", translator.GetTranslatedString("fr"));
                vars.Add("de", translator.GetTranslatedString("de"));
                vars.Add("it", translator.GetTranslatedString("it"));
                vars.Add("es", translator.GetTranslatedString("es"));
                vars.Add("nl", translator.GetTranslatedString("nl"));

                var settings = webInterface.GetWebUISettings();
                vars.Add("ShowLanguageTranslatorBar", !settings.HideLanguageTranslatorBar);
                vars.Add("ShowStyleBar", !settings.HideStyleBar);
            }

            return(vars);
        }
Beispiel #5
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator)
        {
            var vars = new Dictionary <string, object>();

            if (httpRequest.Query.ContainsKey("regionid"))
            {
                GridRegion region = webInterface.Registry.RequestModuleInterface <IGridService>().GetRegionByUUID(null,
                                                                                                                  UUID.Parse(httpRequest.Query["regionid"].ToString()));

                IEstateConnector estateConnector = Aurora.DataManager.DataManager.RequestPlugin <IEstateConnector>();
                EstateSettings   estate          = estateConnector.GetEstateSettings(region.RegionID);

                vars.Add("RegionName", region.RegionName);
                vars.Add("OwnerUUID", estate.EstateOwner);
                vars.Add("OwnerName", webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                         GetUserAccount(null, estate.EstateOwner).Name);
                vars.Add("RegionLocX", region.RegionLocX / Constants.RegionSize);
                vars.Add("RegionLocY", region.RegionLocY / Constants.RegionSize);
                vars.Add("RegionSizeX", region.RegionSizeX);
                vars.Add("RegionSizeY", region.RegionSizeY);
                vars.Add("RegionType", region.RegionType);
                vars.Add("RegionOnline", (region.Flags & (int)Aurora.Framework.RegionFlags.RegionOnline) == (int)Aurora.Framework.RegionFlags.RegionOnline ?
                         translator.GetTranslatedString("Online") : translator.GetTranslatedString("Offline"));

                ICapsService       capsService = webInterface.Registry.RequestModuleInterface <ICapsService>();
                IRegionCapsService regionCaps  = capsService != null?capsService.GetCapsForRegion(region.RegionHandle) : null;

                if (regionCaps != null)
                {
                    vars.Add("NumberOfUsersInRegion", regionCaps.GetClients().Count);
                    List <Dictionary <string, object> > users = new List <Dictionary <string, object> >();
                    foreach (var client in regionCaps.GetClients())
                    {
                        Dictionary <string, object> user = new Dictionary <string, object>();
                        user.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
                        user.Add("UserUUID", client.AgentID);
                        user.Add("UserName", client.ClientCaps.AccountInfo.Name);
                        users.Add(user);
                    }
                    vars.Add("UsersInRegion", users);
                }
                else
                {
                    vars.Add("NumberOfUsersInRegion", 0);
                    vars.Add("UsersInRegion", new List <Dictionary <string, object> >());
                }
                IDirectoryServiceConnector directoryConnector = Aurora.DataManager.DataManager.RequestPlugin <IDirectoryServiceConnector>();
                if (directoryConnector != null)
                {
                    List <LandData> data = directoryConnector.GetParcelsByRegion(0, 10, region.RegionID, UUID.Zero, ParcelFlags.None, ParcelCategory.Any);
                    List <Dictionary <string, object> > parcels = new List <Dictionary <string, object> >();
                    foreach (var p in data)
                    {
                        Dictionary <string, object> parcel = new Dictionary <string, object>();
                        parcel.Add("ParcelNameText", translator.GetTranslatedString("ParcelNameText"));
                        parcel.Add("ParcelOwnerText", translator.GetTranslatedString("ParcelOwnerText"));
                        parcel.Add("ParcelUUID", p.InfoUUID);
                        parcel.Add("ParcelName", p.Name);
                        parcel.Add("ParcelOwnerUUID", p.OwnerID);
                        IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService>();
                        if (accountService != null)
                        {
                            var account = accountService.GetUserAccount(null, p.OwnerID);
                            if (account == null)
                            {
                                parcel.Add("ParcelOwnerName", translator.GetTranslatedString("NoAccountFound"));
                            }
                            else
                            {
                                parcel.Add("ParcelOwnerName", account.Name);
                            }
                        }
                        parcels.Add(parcel);
                    }
                    vars.Add("ParcelInRegion", parcels);
                    vars.Add("NumberOfParcelsInRegion", parcels.Count);
                }
                IWebHttpTextureService webTextureService = webInterface.Registry.
                                                           RequestModuleInterface <IWebHttpTextureService>();
                if (webTextureService != null && region.TerrainMapImage != UUID.Zero)
                {
                    vars.Add("RegionImageURL", webTextureService.GetTextureURL(region.TerrainMapImage));
                }
                else
                {
                    vars.Add("RegionImageURL", "images/icons/no_picture.jpg");
                }

                // Menu Region
                vars.Add("MenuRegionTitle", translator.GetTranslatedString("MenuRegionTitle"));
                vars.Add("MenuParcelTitle", translator.GetTranslatedString("MenuParcelTitle"));
                vars.Add("MenuOwnerTitle", translator.GetTranslatedString("MenuOwnerTitle"));

                vars.Add("RegionInformationText", translator.GetTranslatedString("RegionInformationText"));
                vars.Add("OwnerNameText", translator.GetTranslatedString("OwnerNameText"));
                vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText"));
                vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText"));
                vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
                vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText"));
                vars.Add("RegionInfoText", translator.GetTranslatedString("RegionInfoText"));
                vars.Add("RegionOnlineText", translator.GetTranslatedString("RegionOnlineText"));
                vars.Add("NumberOfUsersInRegionText", translator.GetTranslatedString("NumberOfUsersInRegionText"));
                vars.Add("ParcelsInRegionText", translator.GetTranslatedString("ParcelsInRegionText"));

                // Style Switcher
                vars.Add("styles1", translator.GetTranslatedString("styles1"));
                vars.Add("styles2", translator.GetTranslatedString("styles2"));
                vars.Add("styles3", translator.GetTranslatedString("styles3"));
                vars.Add("styles4", translator.GetTranslatedString("styles4"));
                vars.Add("styles5", translator.GetTranslatedString("styles5"));

                vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText"));
                vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText"));
                vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText"));

                // Language Switcher
                vars.Add("en", translator.GetTranslatedString("en"));
                vars.Add("fr", translator.GetTranslatedString("fr"));
                vars.Add("de", translator.GetTranslatedString("de"));
                vars.Add("it", translator.GetTranslatedString("it"));
                vars.Add("es", translator.GetTranslatedString("es"));
            }

            return(vars);
        }