コード例 #1
0
ファイル: index.cs プロジェクト: nhede/WhiteCore-Dev
        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>();

            string      username = filename.Split('/').LastOrDefault();
            UserAccount account  = null;

            if (httpRequest.Query.ContainsKey("userid"))
            {
                string userid = httpRequest.Query["userid"].ToString();

                account = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                          GetUserAccount(null, UUID.Parse(userid));
            }
            else if (httpRequest.Query.ContainsKey("name"))
            {
                string name = httpRequest.Query.ContainsKey("name") ? httpRequest.Query["name"].ToString() : username;
                name    = name.Replace('.', ' ');
                name    = name.Replace("%20", " ");
                account = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                          GetUserAccount(null, name);
            }
            else
            {
                username = username.Replace("%20", " ");
                webInterface.Redirect(httpResponse, "/webprofile/?name=" + username);
                return(vars);
            }

            if (account == null)
            {
                return(vars);
            }

            /* Allow access to the system user info - needed for Estate owner Profiles of regions
             * if ( Utilities.IsSystemUser(account.PrincipalID) )
             *      return vars;
             */

            vars.Add("UserName", account.Name);
            //  TODO: User Profile inworld shows this as the standard mm/dd/yyyy
            //  Do we want this to be localised into the users Localisation or keep it as standard ?
            //
            //  vars.Add("UserBorn", Culture.LocaleDate(Util.ToDateTime(account.Created)));
            vars.Add("UserBorn", Util.ToDateTime(account.Created).ToShortDateString());

            IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>().
                                       GetUserProfile(account.PrincipalID);
            string picUrl = "../images/icons/no_avatar.jpg";

            if (profile != null)
            {
                vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup);

                if (profile.Partner != UUID.Zero)
                {
                    account = webInterface.Registry.RequestModuleInterface <IUserAccountService> ().
                              GetUserAccount(null, profile.Partner);
                    vars.Add("UserPartner", account.Name);
                }
                else
                {
                    vars.Add("UserPartner", "No partner");
                }
                vars.Add("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText);
                IWebHttpTextureService webhttpService =
                    webInterface.Registry.RequestModuleInterface <IWebHttpTextureService> ();
                if (webhttpService != null && profile.Image != UUID.Zero)
                {
                    picUrl = webhttpService.GetTextureURL(profile.Image);
                }
            }
            else
            {
                // no profile yet
                vars.Add("UserType", "Guest");
                vars.Add("UserPartner", "Not specified yet");
                vars.Add("UserAboutMe", "Nothing here yet");
            }
            vars.Add("UserPictureURL", picUrl);

            // TODO:  This is only showing online status if you are logged in ??
            UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest);

            if (ourAccount != null)
            {
                IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService>();
                var             friends        = friendsService.GetFriends(account.PrincipalID);
                UUID            friendID       = UUID.Zero;
                if (friends.Any(f => UUID.TryParse(f.Friend, out friendID) && friendID == ourAccount.PrincipalID))
                {
                    IAgentInfoService agentInfoService =
                        webInterface.Registry.RequestModuleInterface <IAgentInfoService>();
                    IGridService gridService = webInterface.Registry.RequestModuleInterface <IGridService>();
                    UserInfo     ourInfo     = agentInfoService.GetUserInfo(account.PrincipalID.ToString());
                    if (ourInfo != null && ourInfo.IsOnline)
                    {
                        vars.Add("OnlineLocation", gridService.GetRegionByUUID(null, ourInfo.CurrentRegionID).RegionName);
                    }
                    vars.Add("UserIsOnline", ourInfo != null && ourInfo.IsOnline);
                    vars.Add("IsOnline",
                             ourInfo != null && ourInfo.IsOnline
                                 ? translator.GetTranslatedString("Online")
                                 : translator.GetTranslatedString("Offline"));
                }
                else
                {
                    vars.Add("OnlineLocation", "");
                    vars.Add("UserIsOnline", false);
                    vars.Add("IsOnline", translator.GetTranslatedString("Offline"));
                }
            }
            else
            {
                vars.Add("OnlineLocation", "");
                vars.Add("UserIsOnline", false);
                vars.Add("IsOnline", translator.GetTranslatedString("Offline"));
            }

            // Menus
            vars.Add("MenuProfileTitle", translator.GetTranslatedString("MenuProfileTitle"));
            vars.Add("TooltipsMenuProfile", translator.GetTranslatedString("TooltipsMenuProfile"));
            vars.Add("MenuGroupTitle", translator.GetTranslatedString("MenuGroupTitle"));
            vars.Add("TooltipsMenuGroups", translator.GetTranslatedString("TooltipsMenuGroups"));
            vars.Add("MenuPicksTitle", translator.GetTranslatedString("MenuPicksTitle"));
            vars.Add("TooltipsMenuPicks", translator.GetTranslatedString("TooltipsMenuPicks"));
            vars.Add("MenuRegionsTitle", translator.GetTranslatedString("MenuRegionsTitle"));
            vars.Add("TooltipsMenuRegions", translator.GetTranslatedString("TooltipsMenuRegions"));

            // User data
            vars.Add("UserProfileFor", translator.GetTranslatedString("UserProfileFor"));
            vars.Add("ResidentSince", translator.GetTranslatedString("ResidentSince"));
            vars.Add("AccountType", translator.GetTranslatedString("AccountType"));
            vars.Add("PartnersName", translator.GetTranslatedString("PartnersName"));
            vars.Add("AboutMe", translator.GetTranslatedString("AboutMe"));
            vars.Add("IsOnlineText", translator.GetTranslatedString("IsOnlineText"));
            vars.Add("OnlineLocationText", translator.GetTranslatedString("OnlineLocationText"));

            // 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);
        }
コード例 #2
0
ファイル: world.cs プロジェクト: pctec2012/WhiteCore-Dev
        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> ();
            // worldview
            var webTextureService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService> ();

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

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

            // get region list
            List <Dictionary <string, object> > RegionListVars = new List <Dictionary <string, object> > ();
            var sortBy = new Dictionary <string, bool> ();

            sortBy.Add("RegionName", true);
            var regionData = Framework.Utilities.DataManager.RequestPlugin <IRegionData> ();
            var regions    = regionData.GetList(0, RegionFlags.Hyperlink | RegionFlags.Foreign | RegionFlags.Hidden,
                                                null, 10, sortBy);

            foreach (var region in regions)
            {
                string info;
                info = (region.RegionArea < 1000000) ? region.RegionArea + " m2" : (region.RegionArea / 1000000) + " km2";
                info = info + ", " + region.RegionTerrain;

                var regionviewURL = "";
                if (webTextureService != null && worldViewEnabled && region.IsOnline)
                {
                    regionviewURL = webTextureService.GetRegionWorldViewURL(region.RegionID);
                }

                RegionListVars.Add(new Dictionary <string, object> {
                    { "RegionLocX", region.RegionLocX / Constants.RegionSize },
                    { "RegionLocY", region.RegionLocY / Constants.RegionSize },
                    { "RegionName", region.RegionName },
                    { "RegionInfo", info },
                    { "RegionStatus", region.IsOnline ? "Online" : "Offline" },
                    { "RegionID", region.RegionID },
                    { "RegionURI", region.RegionURI },
                    { "RegionWorldViewURL", regionviewURL }
                });
            }

            vars.Add("RegionList", RegionListVars);
            vars.Add("RegionText", translator.GetTranslatedString("Region"));
            vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText"));

            vars.Add("MainServerURL", webInterface.GridURL);
            vars.Add("WorldMap", translator.GetTranslatedString("WorldMap"));
            vars.Add("WorldMapText", translator.GetTranslatedString("WorldMapText"));

            var settings = webInterface.GetWebUISettings();

            vars.Add("MapCenterX", settings.MapCenter.X);
            vars.Add("MapCenterY", settings.MapCenter.Y);

            return(vars);
        }
コード例 #3
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>();

            IWebHttpTextureService webhttpService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService>();

            UserAccount account = Authenticator.GetAuthentication(httpRequest);

            if (account == null)
            {
                return(vars);
            }

            vars.Add("UserName", account.Name);
            //  TODO: User Profile inworld shows this as the standard mm/dd/yyyy
            //  Do we want this to be localised into the users Localisation or keep it as standard
            vars.Add("UserBorn", Util.ToDateTime(account.Created).ToShortDateString());

            IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>().GetUserProfile(account.PrincipalID);
            string           picUrl  = "../images/icons/no_avatar.jpg";

            if (profile != null)
            {
                vars.Add("UserType", profile.MembershipGroup == "" ? "Citizen" : profile.MembershipGroup);

                if (profile.Partner != UUID.Zero)
                {
                    account = webInterface.Registry.RequestModuleInterface <IUserAccountService>().GetUserAccount(null, profile.Partner);
                    vars.Add("UserPartner", account.Name);
                }
                else
                {
                    vars.Add("UserPartner", "No partner");
                }

                vars.Add("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText);

                if (webhttpService != null && profile.Image != UUID.Zero)
                {
                    picUrl = webhttpService.GetTextureURL(profile.Image);
                }
            }
            else
            {
                // no profile yet
                vars.Add("UserType", "Citizen");
                vars.Add("UserPartner", "Not specified yet");
                vars.Add("UserAboutMe", "Nothing here yet");
            }

            vars.Add("UserPictureURL", picUrl);

            // TODO:  This is only showing online status if you are logged in ??
            UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest);

            if (ourAccount != null)
            {
                IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService>();
                var             friends        = friendsService.GetFriends(account.PrincipalID);
                UUID            friendID       = UUID.Zero;

                if (friends.Any(f => UUID.TryParse(f.Friend, out friendID) && friendID == ourAccount.PrincipalID))
                {
                    IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService>();
                    IGridService      gridService      = webInterface.Registry.RequestModuleInterface <IGridService>();
                    UserInfo          ourInfo          = agentInfoService.GetUserInfo(account.PrincipalID.ToString());

                    if (ourInfo != null && ourInfo.IsOnline)
                    {
                        vars.Add("OnlineLocation", gridService.GetRegionByUUID(null, ourInfo.CurrentRegionID).RegionName);
                    }

                    vars.Add("UserIsOnline", ourInfo != null && ourInfo.IsOnline);
                    vars.Add("IsOnline",
                             ourInfo != null && ourInfo.IsOnline
                        ? translator.GetTranslatedString("Online")
                        : translator.GetTranslatedString("Offline"));
                }
                else
                {
                    vars.Add("OnlineLocation", "");
                    vars.Add("UserIsOnline", false);
                    vars.Add("IsOnline", translator.GetTranslatedString("Offline"));
                }
            }
            else
            {
                vars.Add("OnlineLocation", "");
                vars.Add("UserIsOnline", false);
                vars.Add("IsOnline", translator.GetTranslatedString("Offline"));
            }

            vars.Add("UsersGroupsText", translator.GetTranslatedString("UsersGroupsText"));

            IGroupsServiceConnector             groupsConnector = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector>();
            List <Dictionary <string, object> > groups          = new List <Dictionary <string, object> >();

            if (groupsConnector != null)
            {
                var groupsIn = groupsConnector.GetAgentGroupMemberships(account.PrincipalID, account.PrincipalID);

                if (groupsIn != null)
                {
                    foreach (var grp in groupsIn)
                    {
                        var    grpData = groupsConnector.GetGroupProfile(account.PrincipalID, grp.GroupID);
                        string url     = "../images/icons/no_groups.jpg";

                        if (grpData != null)
                        {
                            if (webhttpService != null && grpData.InsigniaID != UUID.Zero)
                            {
                                url = webhttpService.GetTextureURL(grpData.InsigniaID);
                            }

                            groups.Add(new Dictionary <string, object> {
                                { "GroupPictureURL", url },
                                { "GroupName", grp.GroupName }
                            });
                        }
                    }
                }

                if (groups.Count == 0)
                {
                    groups.Add(new Dictionary <string, object> {
                        { "GroupPictureURL", "../images/icons/no_groups.jpg" },
                        { "GroupName", "None yet" }
                    });
                }
            }

            vars.Add("GroupNameText", translator.GetTranslatedString("GroupNameText"));
            vars.Add("Groups", groups);
            vars.Add("GroupsJoined", groups.Count);

            // Menus
            vars.Add("MenuProfileTitle", translator.GetTranslatedString("MenuProfileTitle"));
            vars.Add("TooltipsMenuProfile", translator.GetTranslatedString("TooltipsMenuProfile"));
            vars.Add("MenuGroupTitle", translator.GetTranslatedString("MenuGroupTitle"));
            vars.Add("TooltipsMenuGroups", translator.GetTranslatedString("TooltipsMenuGroups"));
            vars.Add("MenuPicksTitle", translator.GetTranslatedString("MenuPicksTitle"));
            vars.Add("TooltipsMenuPicks", translator.GetTranslatedString("TooltipsMenuPicks"));
            vars.Add("MenuRegionsTitle", translator.GetTranslatedString("MenuRegionsTitle"));
            vars.Add("TooltipsMenuRegions", translator.GetTranslatedString("TooltipsMenuRegions"));

            // User data
            vars.Add("UserProfileFor", translator.GetTranslatedString("UserProfileFor"));
            vars.Add("ResidentSince", translator.GetTranslatedString("ResidentSince"));
            vars.Add("AccountType", translator.GetTranslatedString("AccountType"));
            vars.Add("PartnersName", translator.GetTranslatedString("PartnersName"));
            vars.Add("AboutMe", translator.GetTranslatedString("AboutMe"));
            vars.Add("IsOnlineText", translator.GetTranslatedString("IsOnlineText"));
            vars.Add("OnlineLocationText", translator.GetTranslatedString("OnlineLocationText"));

            // 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("ga", translator.GetTranslatedString("ga"));
            vars.Add("it", translator.GetTranslatedString("it"));
            vars.Add("es", translator.GetTranslatedString("es"));
            vars.Add("nl", translator.GetTranslatedString("nl"));
            vars.Add("ru", translator.GetTranslatedString("ru"));
            vars.Add("zh_CN", translator.GetTranslatedString("zh_CN"));

            var settings = webInterface.GetWebUISettings();

            vars.Add("ShowLanguageTranslatorBar", !settings.HideLanguageTranslatorBar);
            vars.Add("ShowStyleBar", !settings.HideStyleBar);

            return(vars);
        }
コード例 #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"))
            {
                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"));

                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.Count);
                    List <Dictionary <string, object> > users = new List <Dictionary <string, object> >();
                    foreach (var client in usersInRegion)
                    {
                        UserAccount account = userService.GetUserAccount(null, 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> 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.GlobalID);
                        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("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);
        }
コード例 #5
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>();

            #region Find pages

            List <Dictionary <string, object> > pages = new List <Dictionary <string, object> >();

            var settings = webInterface.GetWebUISettings();
            var rootPage = webInterface.GetGridPages();

            rootPage.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition));

            foreach (GridPage page in rootPage.Children)
            {
                if (page.LoggedOutRequired && Authenticator.CheckAuthentication(httpRequest))
                {
                    continue;
                }
                if (page.LoggedInRequired && !Authenticator.CheckAuthentication(httpRequest))
                {
                    continue;
                }
                if (page.AdminRequired && !Authenticator.CheckAdminAuthentication(httpRequest, page.AdminLevelRequired))
                {
                    continue;
                }

                List <Dictionary <string, object> > childPages = new List <Dictionary <string, object> >();
                page.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition));
                foreach (GridPage childPage in page.Children)
                {
                    if (childPage.LoggedOutRequired && Authenticator.CheckAuthentication(httpRequest))
                    {
                        continue;
                    }
                    if (childPage.LoggedInRequired && !Authenticator.CheckAuthentication(httpRequest))
                    {
                        continue;
                    }
                    if (childPage.AdminRequired &&
                        !Authenticator.CheckAdminAuthentication(httpRequest, childPage.AdminLevelRequired))
                    {
                        continue;
                    }

                    childPages.Add(new Dictionary <string, object>
                    {
                        { "ChildMenuItemID", childPage.MenuID },
                        { "ChildShowInMenu", childPage.ShowInMenu },
                        { "ChildMenuItemLocation", childPage.Location },
                        {
                            "ChildMenuItemTitleHelp",
                            GetTranslatedString(translator, childPage.MenuToolTip, childPage, true)
                        },
                        {
                            "ChildMenuItemTitle",
                            GetTranslatedString(translator, childPage.MenuTitle, childPage, false)
                        }
                    });

                    //Add one for menu.js
                    pages.Add(new Dictionary <string, object>
                    {
                        { "MenuItemID", childPage.MenuID },
                        { "ShowInMenu", false },
                        { "MenuItemLocation", childPage.Location }
                    });
                }

                pages.Add(new Dictionary <string, object>
                {
                    { "MenuItemID", page.MenuID },
                    { "ShowInMenu", page.ShowInMenu },
                    { "HasChildren", page.Children.Count > 0 },
                    { "ChildrenMenuItems", childPages },
                    { "MenuItemLocation", page.Location },
                    { "MenuItemTitleHelp", GetTranslatedString(translator, page.MenuToolTip, page, true) },
                    { "MenuItemTitle", GetTranslatedString(translator, page.MenuTitle, page, false) },
                    { "MenuItemToolTip", GetTranslatedString(translator, page.MenuToolTip, page, true) }
                });
            }
            vars.Add("MenuItems", pages);

            #endregion

            // Tooltips Urls
            vars.Add("TooltipsWelcomeScreen", translator.GetTranslatedString("TooltipsWelcomeScreen"));
            vars.Add("TooltipsWorldMap", translator.GetTranslatedString("TooltipsWorldMap"));

            // 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"));

            // Index Page
            vars.Add("HomeText", translator.GetTranslatedString("HomeText"));
            vars.Add("HomeTextWelcome", translator.GetTranslatedString("HomeTextWelcome"));
            vars.Add("HomeTextTips", translator.GetTranslatedString("HomeTextTips"));
            vars.Add("WelcomeScreen", translator.GetTranslatedString("WelcomeScreen"));
            vars.Add("WelcomeToText", translator.GetTranslatedString("WelcomeToText"));

            if (PagesMigrator.RequiresUpdate() &&
                PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored))
            {
                vars.Add("PagesUpdateRequired",
                         translator.GetTranslatedString("Pages") + " " +
                         translator.GetTranslatedString("DefaultsUpdated"));
            }
            else
            {
                vars.Add("PagesUpdateRequired", "");
            }
            if (SettingsMigrator.RequiresUpdate() &&
                SettingsMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastSettingsVersionUpdateIgnored))
            {
                vars.Add("SettingsUpdateRequired",
                         translator.GetTranslatedString("Settings") + " " +
                         translator.GetTranslatedString("DefaultsUpdated"));
            }
            else
            {
                vars.Add("SettingsUpdateRequired", "");
            }

            vars.Add("ShowLanguageTranslatorBar", !settings.HideLanguageTranslatorBar);
            vars.Add("ShowStyleBar", !settings.HideStyleBar);

            vars.Add("Maintenance", false);
            vars.Add("NoMaintenance", true);
            return(vars);
        }
コード例 #6
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>();
            var settings = webInterface.GetWebUISettings();

            if (requestParameters.ContainsKey("Submit"))
            {
                settings.WebRegistration = requestParameters["WebRegistration"].ToString() == "1";
                settings.MapCenter.X     = int.Parse(requestParameters["GridCenterX"].ToString());
                settings.MapCenter.Y     = int.Parse(requestParameters["GridCenterY"].ToString());
                settings.LocalFrontPage  = requestParameters["LocalFrontPage"].ToString();

                if (settings.LocalFrontPage != "")
                {
                    settings.LocalFrontPage = "local/" + settings.LocalFrontPage;
                }

                settings.LocalCSS                  = requestParameters["LocalCSS"].ToString();
                settings.HideSlideshowBar          = requestParameters["HideSlideshowBar"].ToString() == "1";
                settings.HideLanguageTranslatorBar = requestParameters["HideLanguageBar"].ToString() == "1";
                settings.HideStyleBar              = requestParameters["HideStyleBar"].ToString() == "1";

                if (settings.LocalCSS != "")
                {
                    settings.LocalCSS     = "local/" + settings.LocalCSS;
                    settings.HideStyleBar = true;                               // not needed if a local style is used
                }

                webInterface.SaveWebUISettings(settings);

                response = "Successfully updated WebUI settings.";

                return(null);
            }
            else if (requestParameters.ContainsKey("IgnorePagesUpdates"))
            {
                settings.LastPagesVersionUpdateIgnored = PagesMigrator.CurrentVersion;
                webInterface.SaveWebUISettings(settings);
            }
            else if (requestParameters.ContainsKey("IgnoreSettingsUpdates"))
            {
                settings.LastSettingsVersionUpdateIgnored = PagesMigrator.CurrentVersion;
                webInterface.SaveWebUISettings(settings);
            }

            vars.Add("WebRegistrationNo", !settings.WebRegistration ? "selected=\"selected\"" : "");
            vars.Add("WebRegistrationYes", settings.WebRegistration ? "selected=\"selected\"" : "");
            vars.Add("GridCenterX", settings.MapCenter.X);
            vars.Add("GridCenterY", settings.MapCenter.Y);

            if (settings.LocalFrontPage.StartsWith("local/"))
            {
                vars.Add("LocalFrontPage", settings.LocalFrontPage.Remove(0, 6));                // remove 'local/' prefix
            }
            else
            {
                vars.Add("LocalFrontPage", settings.LocalFrontPage);
            }

            if (settings.LocalCSS.StartsWith("local/"))
            {
                vars.Add("LocalCSS", settings.LocalCSS.Remove(0, 6));                            // remove 'local/' prefix
            }
            else
            {
                vars.Add("LocalCSS", settings.LocalCSS);
            }

            vars.Add("HideSlideshowBarNo", !settings.HideSlideshowBar ? "selected=\"selected\"" : "");
            vars.Add("HideSlideshowBarYes", settings.HideSlideshowBar ? "selected=\"selected\"" : "");
            vars.Add("HideLanguageBarNo", !settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
            vars.Add("HideLanguageBarYes", settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
            vars.Add("HideStyleBarNo", !settings.HideStyleBar ? "selected=\"selected\"" : "");
            vars.Add("HideStyleBarYes", settings.HideStyleBar ? "selected=\"selected\"" : "");
            vars.Add("IgnorePagesUpdates", PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored)
                         ? ""
                         : "checked");

            vars.Add("IgnoreSettingsUpdates", settings.LastSettingsVersionUpdateIgnored != SettingsMigrator.CurrentVersion ? "" : "checked");

            vars.Add("SettingsManager", translator.GetTranslatedString("SettingsManager"));
            vars.Add("IgnorePagesUpdatesText", translator.GetTranslatedString("IgnorePagesUpdatesText"));
            vars.Add("IgnoreSettingsUpdatesText", translator.GetTranslatedString("IgnoreSettingsUpdatesText"));
            vars.Add("WebRegistrationText", translator.GetTranslatedString("WebRegistrationText"));
            vars.Add("GridCenterXText", translator.GetTranslatedString("GridCenterXText"));
            vars.Add("GridCenterYText", translator.GetTranslatedString("GridCenterYText"));
            vars.Add("LocalFrontPageText", translator.GetTranslatedString("LocalFrontPageText"));
            vars.Add("LocalCSSText", translator.GetTranslatedString("LocalCSSText"));
            vars.Add("WelcomeMessageText", translator.GetTranslatedString("WelcomeMessageText"));
            vars.Add("HideSlideshowBarText", translator.GetTranslatedString("HideSlideshowBarText"));
            vars.Add("HideLanguageBarText", translator.GetTranslatedString("HideLanguageBarText"));
            vars.Add("HideStyleBarText", translator.GetTranslatedString("HideStyleBarText"));
            vars.Add("Save", translator.GetTranslatedString("Save"));
            vars.Add("No", translator.GetTranslatedString("No"));
            vars.Add("Yes", translator.GetTranslatedString("Yes"));

            return(vars);
        }
コード例 #7
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> ();

            // homescreen login
            string error = "";

            if (requestParameters.ContainsKey("username") && requestParameters.ContainsKey("password"))
            {
                string username = requestParameters ["username"].ToString();
                string password = requestParameters ["password"].ToString();

                ILoginService loginService = webInterface.Registry.RequestModuleInterface <ILoginService> ();

                if (loginService.VerifyClient(UUID.Zero, username, "UserAccount", password))
                {
                    UUID        sessionID = UUID.Random();
                    UserAccount account   = webInterface.Registry.RequestModuleInterface <IUserAccountService> ().GetUserAccount(null, username);
                    Authenticator.AddAuthentication(sessionID, account);

                    if (account.UserLevel > 0)
                    {
                        Authenticator.AddAdminAuthentication(sessionID, account);
                    }

                    httpResponse.AddCookie(new System.Web.HttpCookie("SessionID", sessionID.ToString())
                    {
                        Expires = DateTime.MinValue,
                        Path    = ""
                    });

                    response = "<h3>Successfully logged in</h3>" +
                               "<script language=\"javascript\">" +
                               "setTimeout(function() {window.location.href = \"index.html\";}, 0);" +
                               "</script>";
                }
                else
                {
                    response = "<h3>Failed to verify user name and password</h3>";
                }

                return(null);
            }

            // Tooltips Urls
            vars.Add("TooltipsWelcomeScreen", translator.GetTranslatedString("TooltipsWelcomeScreen"));
            vars.Add("TooltipsWorldMap", translator.GetTranslatedString("TooltipsWorldMap"));

            // Index Page
            vars.Add("HomeText", translator.GetTranslatedString("HomeText"));
            vars.Add("HomeTextWelcome", translator.GetTranslatedString("HomeTextWelcome"));
            vars.Add("HomeTextTips", translator.GetTranslatedString("HomeTextTips"));
            vars.Add("WelcomeScreen", translator.GetTranslatedString("WelcomeScreen"));
            vars.Add("WelcomeToText", translator.GetTranslatedString("WelcomeToText"));

            // login
            vars.Add("UserLogin", !Authenticator.CheckAuthentication(httpRequest));
            vars.Add("ErrorMessage", error);
            vars.Add("Login", translator.GetTranslatedString("Login"));
            vars.Add("UserNameText", translator.GetTranslatedString("UserName"));
            vars.Add("PasswordText", translator.GetTranslatedString("Password"));
            vars.Add("ForgotPassword", translator.GetTranslatedString("ForgotPassword"));
            vars.Add("Submit", translator.GetTranslatedString("Login"));

            // greythane - 20160826 - do menu and setting updates
            var settings = webInterface.GetWebUISettings();

            if (PagesMigrator.RequiresUpdate() &&
                PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored))
            {
                vars.Add("PagesUpdateRequired",
                         translator.GetTranslatedString("Pages") + " " +
                         translator.GetTranslatedString("UpdateRequired"));
            }
            else
            {
                vars.Add("PagesUpdateRequired", "");
            }

            if (SettingsMigrator.RequiresUpdate() &&
                SettingsMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastSettingsVersionUpdateIgnored))
            {
                vars.Add("SettingsUpdateRequired",
                         translator.GetTranslatedString("Settings") + " " +
                         translator.GetTranslatedString("UpdateRequired"));
            }
            else
            {
                vars.Add("SettingsUpdateRequired", "");
            }

            vars.Add("ShowSlideshowBar", !settings.HideSlideshowBar);

            // user setup news inclusion
            if (settings.LocalFrontPage == "")
            {
                vars.Add("LocalPage", false);
                vars.Add("LocalFrontPage", "");
            }
            else
            {
                vars.Add("LocalPage", true);
                vars.Add("LocalFrontPage", settings.LocalFrontPage);
            }

            return(vars);
        }
コード例 #8
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>();
            var settings = webInterface.GetWebUISettings();

            bool adminUser         = Authenticator.CheckAdminAuthentication(httpRequest, Constants.USER_GOD_CUSTOMER_SERVICE);
            bool allowRegistration = settings.WebRegistration;
            bool anonymousLogins;

            // allow configuration to override the web settings
            var     simBase           = webInterface.Registry.RequestModuleInterface <ISimulationBase>();
            IConfig loginServerConfig = simBase.ConfigSource.Configs["LoginService"];

            if (loginServerConfig != null)
            {
                anonymousLogins   = loginServerConfig.GetBoolean("AllowAnonymousLogin", allowRegistration);
                allowRegistration = (allowRegistration || anonymousLogins);
            }

            if (!adminUser && !allowRegistration)
            {
                vars.Add("ErrorMessage", "");
                vars.Add("RegistrationText", translator.GetTranslatedString("RegistrationText"));
                vars.Add("RegistrationsDisabled", translator.GetTranslatedString("RegistrationsDisabled"));
                vars.Add("Registrations", false);
                vars.Add("NoRegistrations", true);
                return(vars);
            }

            if (requestParameters.ContainsKey("Submit"))
            {
                string AvatarName          = requestParameters["AvatarName"].ToString();
                string AvatarPassword      = requestParameters["AvatarPassword"].ToString();
                string AvatarPasswordCheck = requestParameters["AvatarPassword2"].ToString();
                string FirstName           = requestParameters["FirstName"].ToString();
                string LastName            = requestParameters["LastName"].ToString();
                //removed - greythane - deemed not used
                //string UserAddress = requestParameters["UserAddress"].ToString();
                //string UserZip = requestParameters["UserZip"].ToString();
                string UserCity       = requestParameters["UserCity"].ToString();
                string UserEmail      = requestParameters["UserEmail"].ToString();
                string UserHomeRegion = requestParameters["UserHomeRegion"].ToString();
                string UserDOBMonth   = requestParameters["UserDOBMonth"].ToString();
                string UserDOBDay     = requestParameters["UserDOBDay"].ToString();
                string UserDOBYear    = requestParameters["UserDOBYear"].ToString();
                string AvatarArchive  = requestParameters.ContainsKey("AvatarArchive")
                                           ? requestParameters["AvatarArchive"].ToString()
                                           : "";
                bool ToSAccept = requestParameters.ContainsKey("ToSAccept") &&
                                 requestParameters["ToSAccept"].ToString() == "Accepted";

                string UserType = requestParameters.ContainsKey("UserType")         // only admins can set membership
                    ? requestParameters ["UserType"].ToString()
                    : "Resident";

                // revise UserDOBMonth to a number
                UserDOBMonth = ShortMonthToNumber(UserDOBMonth);

                // revise Type flags
                int UserFlags = WebHelpers.UserTypeToUserFlags(UserType);

                // a bit of idiot proofing
                if (AvatarName == "")
                {
                    response = "<h3>" + translator.GetTranslatedString("AvatarNameError") + "</h3>";
                    return(null);
                }
                if ((AvatarPassword == "") || (AvatarPassword != AvatarPasswordCheck))
                {
                    response = "<h3>" + translator.GetTranslatedString("AvatarPasswordError") + "</h3>";
                    return(null);
                }
                if (UserEmail == "")
                {
                    response = "<h3>" + translator.GetTranslatedString("AvatarEmailError") + "</h3>";
                    return(null);
                }

                // Thish -  Only one space is allowed in the name to seperate First and Last of the avatar name
                if (AvatarName.Split(' ').Length != 2)
                {
                    response = "<h3>" + translator.GetTranslatedString("AvatarNameSpacingError") + "</h3>";
                    return(null);
                }

                // so far so good...
                if (ToSAccept)
                {
                    AvatarPassword = Util.Md5Hash(AvatarPassword);

                    IUserAccountService accountService =
                        webInterface.Registry.RequestModuleInterface <IUserAccountService>();
                    UUID   userID = UUID.Random();
                    string error  = accountService.CreateUser(userID, settings.DefaultScopeID, AvatarName, AvatarPassword,
                                                              UserEmail);
                    if (error == "")
                    {
                        // set the user account type
                        UserAccount account = accountService.GetUserAccount(null, userID);
                        account.UserFlags = UserFlags;
                        accountService.StoreUserAccount(account);

                        // create and save agent info
                        IAgentConnector con = Framework.Utilities.DataManager.RequestPlugin <IAgentConnector> ();
                        con.CreateNewAgent(userID);
                        IAgentInfo agent = con.GetAgent(userID);
                        agent.OtherAgentInformation ["RLFirstName"] = FirstName;
                        agent.OtherAgentInformation ["RLLastName"]  = LastName;
                        //agent.OtherAgentInformation ["RLAddress"] = UserAddress;
                        agent.OtherAgentInformation ["RLCity"] = UserCity;
                        //agent.OtherAgentInformation ["RLZip"] = UserZip;
                        agent.OtherAgentInformation ["UserDOBMonth"] = UserDOBMonth;
                        agent.OtherAgentInformation ["UserDOBDay"]   = UserDOBDay;
                        agent.OtherAgentInformation ["UserDOBYear"]  = UserDOBYear;
                        agent.OtherAgentInformation ["UserFlags"]    = UserFlags;

                        /*if (activationRequired)
                         * {
                         *  UUID activationToken = UUID.Random();
                         *  agent.OtherAgentInformation["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + PasswordHash);
                         *  resp["WebUIActivationToken"] = activationToken;
                         * }*/
                        con.UpdateAgent(agent);

                        // create user profile details
                        IProfileConnector profileData =
                            Framework.Utilities.DataManager.RequestPlugin <IProfileConnector> ();
                        if (profileData != null)
                        {
                            IUserProfileInfo profile = profileData.GetUserProfile(userID);
                            if (profile == null)
                            {
                                profileData.CreateNewProfile(userID);
                                profile = profileData.GetUserProfile(userID);
                            }

                            if (AvatarArchive != "")
                            {
                                profile.AArchiveName = AvatarArchive;

                                List <AvatarArchive> avarchives = webInterface.Registry.RequestModuleInterface <IAvatarAppearanceArchiver>().GetAvatarArchives();
                                UUID snapshotUUID = UUID.Zero;
                                foreach (var archive in avarchives)
                                {
                                    if (archive.FolderName == AvatarArchive)
                                    {
                                        snapshotUUID = archive.Snapshot;
                                    }
                                }

                                if (snapshotUUID != UUID.Zero)
                                {
                                    profile.Image = snapshotUUID;
                                }
                            }
                            profile.MembershipGroup = WebHelpers.UserFlagToType(UserFlags, webInterface.EnglishTranslator);     // membership is english
                            profile.IsNewUser       = true;
                            profileData.UpdateUserProfile(profile);
                        }

                        IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService> ();
                        Vector3           position         = new Vector3(128, 128, 25);
                        Vector3           lookAt           = new Vector3(0, 0, 22);

                        if (agentInfoService != null)
                        {
                            agentInfoService.SetHomePosition(userID.ToString(), (UUID)UserHomeRegion, position, lookAt);
                        }

                        vars.Add("ErrorMessage", "Successfully created account, redirecting to main page");
                        response = "<h3>Successfully created account, redirecting to main page</h3>" +
                                   "<script language=\"javascript\">" +
                                   "setTimeout(function() {window.location.href = \"index.html\";}, 3000);" +
                                   "</script>";
                    }
                    else
                    {
                        vars.Add("ErrorMessage", "<h3>" + error + "</h3>");
                        response = "<h3>" + error + "</h3>";
                    }
                }
                else
                {
                    response = "<h3>You did not accept the Terms of Service agreement.</h3>";
                }
                return(null);
            }

            List <Dictionary <string, object> > daysArgs = new List <Dictionary <string, object> >();

            for (int i = 1; i <= 31; i++)
            {
                daysArgs.Add(new Dictionary <string, object> {
                    { "Value", i }
                });
            }

            List <Dictionary <string, object> > yearsArgs = new List <Dictionary <string, object> >();

            for (int i = 1950; i <= 2013; i++)
            {
                yearsArgs.Add(new Dictionary <string, object> {
                    { "Value", i }
                });
            }

            vars.Add("Days", daysArgs);
            vars.Add("Months", WebHelpers.ShortMonthSelections(translator));   //.monthsArgs);
            vars.Add("Years", yearsArgs);

            var sortBy = new Dictionary <string, bool>();

            sortBy.Add("RegionName", true);

            var RegionListVars = new List <Dictionary <string, object> >();
            var regions        = Framework.Utilities.DataManager.RequestPlugin <IRegionData>().Get((RegionFlags)0,
                                                                                                   RegionFlags.Hyperlink |
                                                                                                   RegionFlags.Foreign |
                                                                                                   RegionFlags.Hidden,
                                                                                                   null, null, sortBy);

            foreach (var region in regions)
            {
                RegionListVars.Add(new Dictionary <string, object> {
                    { "RegionName", region.RegionName },
                    { "RegionUUID", region.RegionID }
                });
            }

            vars.Add("RegionList", RegionListVars);
            vars.Add("UserHomeRegionText", translator.GetTranslatedString("UserHomeRegionText"));


            vars.Add("UserTypeText", translator.GetTranslatedString("UserTypeText"));
            vars.Add("UserType", WebHelpers.UserTypeArgs(translator));

            vars.Add("AvatarArchive", WebHelpers.AvatarSelections(webInterface.Registry));

            string tosLocation = "";

            if (loginServerConfig != null && loginServerConfig.GetBoolean("UseTermsOfServiceOnFirstLogin", false))
            {
                tosLocation = loginServerConfig.GetString("FileNameOfTOS", "");
                tosLocation = PathHelpers.VerifyReadFile(tosLocation, ".txt", simBase.DefaultDataPath);
            }
            string ToS = "There are no Terms of Service currently. This may be changed at any point in the future.";

            if (tosLocation != "")
            {
                StreamReader reader = new StreamReader(Path.Combine(Environment.CurrentDirectory, tosLocation));
                try
                {
                    ToS = reader.ReadToEnd();
                }
                finally
                {
                    reader.Close();
                }
            }

            // check for user name seed
            string[] m_userNameSeed = null;
            if (loginServerConfig != null)
            {
                string userNameSeed = loginServerConfig.GetString("UserNameSeed", "");
                if (userNameSeed != "")
                {
                    m_userNameSeed = userNameSeed.Split(',');
                }
            }

            Utilities.MarkovNameGenerator ufNames = new Utilities.MarkovNameGenerator();
            Utilities.MarkovNameGenerator ulNames = new Utilities.MarkovNameGenerator();
            string[] nameSeed = m_userNameSeed == null ? Utilities.UserNames : m_userNameSeed;

            string firstName   = ufNames.FirstName(nameSeed, 3, 4);
            string lastName    = ulNames.FirstName(nameSeed, 5, 6);
            string enteredName = firstName + " " + lastName;

            vars.Add("AvatarName", enteredName);
            vars.Add("ToSMessage", ToS);
            vars.Add("TermsOfServiceAccept", translator.GetTranslatedString("TermsOfServiceAccept"));
            vars.Add("TermsOfServiceText", translator.GetTranslatedString("TermsOfServiceText"));
            vars.Add("RegistrationsDisabled", "");
            //vars.Add("RegistrationsDisabled", translator.GetTranslatedString("RegistrationsDisabled"));
            vars.Add("RegistrationText", translator.GetTranslatedString("RegistrationText"));
            vars.Add("AvatarNameText", translator.GetTranslatedString("AvatarNameText"));
            vars.Add("AvatarPasswordText", translator.GetTranslatedString("Password"));
            vars.Add("AvatarPasswordConfirmationText", translator.GetTranslatedString("PasswordConfirmation"));
            vars.Add("AvatarScopeText", translator.GetTranslatedString("AvatarScopeText"));
            vars.Add("FirstNameText", translator.GetTranslatedString("FirstNameText"));
            vars.Add("LastNameText", translator.GetTranslatedString("LastNameText"));
            vars.Add("UserAddressText", translator.GetTranslatedString("UserAddressText"));
            vars.Add("UserZipText", translator.GetTranslatedString("UserZipText"));
            vars.Add("UserCityText", translator.GetTranslatedString("UserCityText"));
            vars.Add("UserCountryText", translator.GetTranslatedString("UserCountryText"));
            vars.Add("UserDOBText", translator.GetTranslatedString("UserDOBText"));
            vars.Add("UserEmailText", translator.GetTranslatedString("UserEmailText"));
            vars.Add("Accept", translator.GetTranslatedString("Accept"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));
            vars.Add("SubmitURL", "register.html");
            vars.Add("ErrorMessage", "");
            vars.Add("Registrations", true);
            vars.Add("NoRegistrations", false);

            return(vars);
        }