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>(); IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); GridNewsItem news; if (requestParameters.ContainsKey("Submit")) { string title = requestParameters["NewsTitle"].ToString(); string text = requestParameters["NewsText"].ToString(); string id = requestParameters["NewsID"].ToString(); news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", id); if (news != null) { connector.RemoveGeneric(UUID.Zero, "WebGridNews", id); GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) }; connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD()); response = "<h3>News item editted successfully, redirecting to main page</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" + "</script>"; } return(null); } news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString()); if (news != null) { vars.Add("NewsTitle", news.Title); vars.Add("NewsText", news.Text); vars.Add("NewsID", news.ID.ToString()); vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle")); vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText")); vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText")); vars.Add("Submit", translator.GetTranslatedString("Submit")); } return(vars); }
private Hashtable EnvironmentSettings(Hashtable m_dhttpMethod, UUID agentID) { Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = ""; IScenePresence SP = m_scene.GetScenePresence(agentID); if (SP == null) { return(responsedata); //They don't exist } if (m_info == null) { IGenericsConnector gc = DataManager.DataManager.RequestPlugin <IGenericsConnector>(); if (gc != null) { DatabaseWrapper d = gc.GetGeneric <DatabaseWrapper>(m_scene.RegionInfo.RegionID, "EnvironmentSettings", ""); if (d != null) { m_info = d.Info; } } } if (m_info != null) { responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_info); } return(responsedata); }
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>(); IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); GridWelcomeScreen welcomeInfo = null; if (connector != null) { welcomeInfo = connector.GetGeneric <GridWelcomeScreen>(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen"); } if (welcomeInfo == null) { welcomeInfo = GridWelcomeScreen.Default; } vars.Add("Title", welcomeInfo.SpecialWindowMessageTitle); vars.Add("Text", welcomeInfo.SpecialWindowMessageText); vars.Add("Color", welcomeInfo.SpecialWindowMessageColor); vars.Add("Active", welcomeInfo.SpecialWindowActive); return(vars); }
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>(); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridNewsItem news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString()); if (news != null) { vars.Add("NewsTitle", news.Title); vars.Add("NewsText", news.Text); vars.Add("NewsID", news.ID.ToString()); } else { if (httpRequest.Query["newsid"].ToString() == "-1") { vars.Add("NewsTitle", "No news to report"); vars.Add("NewsText", ""); } else { vars.Add("NewsTitle", "Invalid News Item"); vars.Add("NewsText", ""); } vars.Add("NewsID", "-1"); } vars.Add("News", translator.GetTranslatedString("News")); vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle")); vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText")); vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText")); return(vars); }
public static uint GetVersion() { IGenericsConnector generics = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector> (); OSDWrapper version = generics.GetGeneric <OSDWrapper> (UUID.Zero, Schema + "Version", ""); return(version == null ? 0 : (uint)version.Info.AsInteger()); }
public static bool RequiresInitialUpdate() { IGenericsConnector generics = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector> (); OSDWrapper version = generics.GetGeneric <OSDWrapper> (UUID.Zero, Schema + "Version", ""); return(version == null || version.Info.AsInteger() < 1); }
private byte[] EnvironmentSettings(Stream request, UUID agentID) { IScenePresence SP = m_scene.GetScenePresence(agentID); if (SP == null) { return(new byte[0]); //They don't exist } if (m_info == null) { IGenericsConnector gc = DataManager.DataManager.RequestPlugin <IGenericsConnector>(); if (gc != null) { OSDWrapper d = gc.GetGeneric <OSDWrapper>(m_scene.RegionInfo.RegionID, "EnvironmentSettings", ""); if (d != null) { m_info = d.Info; } } } if (m_info != null) { return(OSDParser.SerializeLLSDXmlBytes(m_info)); } return(new byte[0]); }
public static bool RequiresUpdate() { IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); OSDWrapper version = generics.GetGeneric <OSDWrapper>(UUID.Zero, Schema + "Version", ""); return(version == null || version.Info.AsInteger() < CurrentVersion); }
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>(); IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); var settings = connector.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); if (requestParameters.ContainsKey("Submit")) { settings.MapCenter.X = int.Parse(requestParameters["GridCenterX"].ToString()); settings.MapCenter.Y = int.Parse(requestParameters["GridCenterY"].ToString()); settings.HideLanguageTranslatorBar = requestParameters["HideLanguageBar"].ToString() == "1"; settings.HideStyleBar = requestParameters["HideStyleBar"].ToString() == "1"; connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD()); response = "Successfully updated settings."; return(null); } else if (requestParameters.ContainsKey("IgnorePagesUpdates")) { settings.LastPagesVersionUpdateIgnored = PagesMigrator.CurrentVersion; connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD()); } else if (requestParameters.ContainsKey("IgnoreSettingsUpdates")) { settings.LastSettingsVersionUpdateIgnored = PagesMigrator.CurrentVersion; connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD()); } vars.Add("GridCenterX", settings.MapCenter.X); vars.Add("GridCenterY", settings.MapCenter.Y); 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("GridCenterXText", translator.GetTranslatedString("GridCenterXText")); vars.Add("GridCenterYText", translator.GetTranslatedString("GridCenterYText")); 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); }
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>(); IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); if (requestParameters.ContainsKey("Submit")) { GridWelcomeScreen submittedInfo = new GridWelcomeScreen(); submittedInfo.SpecialWindowMessageTitle = requestParameters["SpecialWindowTitle"].ToString(); submittedInfo.SpecialWindowMessageText = requestParameters["SpecialWindowText"].ToString(); submittedInfo.SpecialWindowMessageColor = requestParameters["SpecialWindowColor"].ToString(); submittedInfo.SpecialWindowActive = requestParameters["SpecialWindowStatus"].ToString() == "1"; submittedInfo.GridStatus = requestParameters["GridStatus"].ToString() == "1"; connector.AddGeneric(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen", submittedInfo.ToOSD()); response = "Successfully saved data"; return(null); } GridWelcomeScreen welcomeInfo = connector.GetGeneric <GridWelcomeScreen>(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen"); if (welcomeInfo == null) { welcomeInfo = GridWelcomeScreen.Default; } vars.Add("OpenNewsManager", translator.GetTranslatedString("OpenNewsManager")); vars.Add("SpecialWindowTitleText", translator.GetTranslatedString("SpecialWindowTitleText")); vars.Add("SpecialWindowTextText", translator.GetTranslatedString("SpecialWindowTextText")); vars.Add("SpecialWindowColorText", translator.GetTranslatedString("SpecialWindowColorText")); vars.Add("SpecialWindowStatusText", translator.GetTranslatedString("SpecialWindowStatusText")); vars.Add("WelcomeScreenManagerFor", translator.GetTranslatedString("WelcomeScreenManagerFor")); vars.Add("GridStatus", translator.GetTranslatedString("GridStatus")); vars.Add("Online", translator.GetTranslatedString("Online")); vars.Add("Offline", translator.GetTranslatedString("Offline")); vars.Add("Enabled", translator.GetTranslatedString("Enabled")); vars.Add("Disabled", translator.GetTranslatedString("Disabled")); vars.Add("SpecialWindowTitle", welcomeInfo.SpecialWindowMessageTitle); vars.Add("SpecialWindowMessage", welcomeInfo.SpecialWindowMessageText); vars.Add("SpecialWindowActive", welcomeInfo.SpecialWindowActive ? "selected" : ""); vars.Add("SpecialWindowInactive", welcomeInfo.SpecialWindowActive ? "" : "selected"); vars.Add("GridActive", welcomeInfo.GridStatus ? "selected" : ""); vars.Add("GridInactive", welcomeInfo.GridStatus ? "" : "selected"); vars.Add("SpecialWindowColorRed", welcomeInfo.SpecialWindowMessageColor == "red" ? "selected" : ""); vars.Add("SpecialWindowColorYellow", welcomeInfo.SpecialWindowMessageColor == "yellow" ? "selected" : ""); vars.Add("SpecialWindowColorGreen", welcomeInfo.SpecialWindowMessageColor == "green" ? "selected" : ""); vars.Add("SpecialWindowColorWhite", welcomeInfo.SpecialWindowMessageColor == "white" ? "selected" : ""); vars.Add("Submit", translator.GetTranslatedString("Submit")); 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>(); IAgentInfoConnector recentUsers = Framework.Utilities.DataManager.RequestPlugin <IAgentInfoConnector>(); IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); GridWelcomeScreen welcomeInfo = connector.GetGeneric <GridWelcomeScreen>(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen"); if (welcomeInfo == null) { welcomeInfo = GridWelcomeScreen.Default; } IConfigSource config = webInterface.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource; vars.Add("GridStatus", translator.GetTranslatedString("GridStatus")); vars.Add("GridOnline", welcomeInfo.GridStatus ? translator.GetTranslatedString("Online") : translator.GetTranslatedString("Offline")); vars.Add("TotalUserCount", translator.GetTranslatedString("TotalUserCount")); vars.Add("UserCount", webInterface.Registry.RequestModuleInterface <IUserAccountService>(). NumberOfUserAccounts(null, "").ToString()); vars.Add("TotalRegionCount", translator.GetTranslatedString("TotalRegionCount")); vars.Add("RegionCount", Framework.Utilities.DataManager.RequestPlugin <IRegionData>(). Count((RegionFlags)0, (RegionFlags)0).ToString()); vars.Add("UniqueVisitors", translator.GetTranslatedString("UniqueVisitors")); vars.Add("UniqueVisitorCount", recentUsers.RecentlyOnline((uint)TimeSpan.FromDays(30).TotalSeconds, false).ToString()); vars.Add("OnlineNow", translator.GetTranslatedString("OnlineNow")); vars.Add("OnlineNowCount", recentUsers.RecentlyOnline(5 * 60, true).ToString()); vars.Add("RecentlyOnline", translator.GetTranslatedString("RecentlyOnline")); vars.Add("RecentlyOnlineCount", recentUsers.RecentlyOnline(10 * 60, false).ToString()); vars.Add("HGActiveText", translator.GetTranslatedString("HyperGrid")); string disabled = translator.GetTranslatedString("Disabled"), enabled = translator.GetTranslatedString("Enabled"); vars.Add("HGActive", disabled + "(TODO: FIX)"); vars.Add("VoiceActiveLabel", translator.GetTranslatedString("Voice")); vars.Add("VoiceActive", config.Configs["Voice"] != null && config.Configs["Voice"].GetString("Module", "GenericVoice") != "GenericVoice" ? enabled : disabled); vars.Add("CurrencyActiveLabel", translator.GetTranslatedString("Currency")); vars.Add("CurrencyActive", webInterface.Registry.RequestModuleInterface <IMoneyModule>() != null ? enabled : disabled); return(vars); }
public OpenRegionSettings GetSettings(UUID regionID) { OpenRegionSettings settings = new OpenRegionSettings(); IGenericsConnector connector = DataManager.DataManager.RequestPlugin <IGenericsConnector>(); if (connector != null) { settings = connector.GetGeneric <OpenRegionSettings>(regionID, "OpenRegionSettings", "OpenRegionSettings") ?? new OpenRegionSettings(); } return(settings); }
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>(); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridNewsItem news; if (requestParameters.ContainsKey("Submit")) { string title = requestParameters["NewsTitle"].ToString(); string text = requestParameters["NewsText"].ToString(); string id = requestParameters["NewsID"].ToString(); news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", id); connector.RemoveGeneric(UUID.Zero, "WebGridNews", id); GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) }; connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD()); vars["ErrorMessage"] = "News item edit successfully"; webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename); return(vars); } else { vars["ErrorMessage"] = ""; } news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString()); vars.Add("NewsTitle", news.Title); vars.Add("NewsText", news.Text); vars.Add("NewsID", news.ID.ToString()); vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle")); vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText")); vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText")); vars.Add("Submit", translator.GetTranslatedString("Submit")); return(vars); }
public void FinishStartup(Scene scene, IConfigSource source, ISimulationBase openSimBase) { IEstateConnector EstateConnector = DataManager.RequestPlugin <IEstateConnector>(); if (EstateConnector != null) { EstateSettings ES; if (EstateConnector.LoadEstateSettings(scene.RegionInfo.RegionID, out ES) && ES == null) { //It found the estate service, but found no estates for this region, make a new one m_log.Warn("Your region " + scene.RegionInfo.RegionName + " is not part of an estate."); ES = CreateEstateInfo(scene); } else if (ES != null) { //It found the estate service and it found an estate for this region } else { //It could not find the estate service, wait until it can find it m_log.Warn("We could not find the estate service for this sim. Please make sure that your URLs are correct in grid mode."); while (true) { MainConsole.Instance.CmdPrompt("Press enter to try again."); if (EstateConnector.LoadEstateSettings(scene.RegionInfo.RegionID, out ES) && ES == null) { ES = CreateEstateInfo(scene); break; } else if (ES != null) { break; } } } //Get the password from the database now that we have either created a new estate and saved it, joined a new estate, or just reloaded IGenericsConnector g = DataManager.RequestPlugin <IGenericsConnector>(); EstatePassword s = null; if (g != null) { s = g.GetGeneric <EstatePassword>(scene.RegionInfo.RegionID, "EstatePassword", ES.EstateID.ToString(), new EstatePassword()); } if (s != null) { ES.EstatePass = s.Password; } scene.RegionInfo.EstateSettings = ES; } }
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>(); vars.Add("WorldMap", translator.GetTranslatedString("WorldMap")); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); var settings = connector.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); vars.Add("GridCenterX", settings.MapCenter.X); vars.Add("GridCenterY", settings.MapCenter.Y); 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>(); // 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")); IGenericsConnector generics = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); var settings = generics.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); 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", ""); } return(vars); }
public void AddRegion(Scene scene) { m_scene = scene; scene.EventManager.OnMakeRootAgent += OnNewClient; scene.EventManager.OnRegisterCaps += OnRegisterCaps; scene.RegisterModuleInterface <IOpenRegionSettingsModule>(this); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); if (connector != null) { m_settings = connector.GetGeneric <OpenRegionSettings>(scene.RegionInfo.RegionID, "OpenRegionSettings", "OpenRegionSettings", new OpenRegionSettings()); if (m_settings == null) { m_settings = new OpenRegionSettings(); } } ReadConfig(scene); }
protected void ChangeEstate(string module, string[] cmd) { IEstateConnector EstateConnector = DataManager.RequestPlugin <IEstateConnector>(); if (EstateConnector != null) { if (MainConsole.Instance.ConsoleScene == null) { m_log.Warn("Select a region before using this command."); return; } Scene scene = (Scene)MainConsole.Instance.ConsoleScene; string removeFromEstate = MainConsole.Instance.CmdPrompt("Are you sure you want to leave the estate for region " + scene.RegionInfo.RegionName + "?", "yes"); if (removeFromEstate == "yes") { if (!EstateConnector.DelinkRegion(scene.RegionInfo.RegionID, scene.RegionInfo.EstateSettings.EstatePass)) { m_log.Warn("Unable to remove this region from the estate."); return; } scene.RegionInfo.EstateSettings = CreateEstateInfo(scene); IGenericsConnector g = DataManager.RequestPlugin <IGenericsConnector>(); EstatePassword s = null; if (g != null) { s = g.GetGeneric <EstatePassword>(scene.RegionInfo.RegionID, "EstatePassword", scene.RegionInfo.EstateSettings.EstateID.ToString(), new EstatePassword()); } if (s != null) { scene.RegionInfo.EstateSettings.EstatePass = s.Password; } } else { m_log.Warn("No action has been taken."); } } }
private bool GetUserData(UUID uuid, out UserData data) { return((data = m_generics.GetGeneric <UserData>(UUID.Zero, "ForeignUsers", uuid.ToString())) != null); }
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 (requestParameters.ContainsKey("Submit")) { string AvatarName = requestParameters["AvatarName"].ToString(); string AvatarPassword = requestParameters["AvatarPassword"].ToString(); string FirstName = requestParameters["FirstName"].ToString(); string LastName = requestParameters["LastName"].ToString(); string UserAddress = requestParameters["UserAddress"].ToString(); string UserZip = requestParameters["UserZip"].ToString(); string UserCity = requestParameters["UserCity"].ToString(); string UserEmail = requestParameters["UserEmail"].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"; IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); var settings = generics.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); 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 == "") { IAgentConnector con = Aurora.DataManager.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; /*if (activationRequired) * { * UUID activationToken = UUID.Random(); * agent.OtherAgentInformation["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + PasswordHash); * resp["WebUIActivationToken"] = activationToken; * }*/ con.UpdateAgent(agent); if (AvatarArchive != "") { IProfileConnector profileData = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(); profileData.CreateNewProfile(userID); IUserProfileInfo profile = profileData.GetUserProfile(userID); profile.AArchiveName = AvatarArchive + ".database"; profile.IsNewUser = true; profileData.UpdateUserProfile(profile); } response = "<h3>Successfully created account, redirecting to main page</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html\";}, 3000);" + "</script>"; } else { 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> > monthsArgs = new List <Dictionary <string, object> >(); for (int i = 1; i <= 12; i++) { monthsArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > yearsArgs = new List <Dictionary <string, object> >(); for (int i = 1900; i <= 2013; i++) { yearsArgs.Add(new Dictionary <string, object> { { "Value", i } }); } vars.Add("Days", daysArgs); vars.Add("Months", monthsArgs); vars.Add("Years", yearsArgs); List <AvatarArchive> archives = Aurora.DataManager.DataManager.RequestPlugin <IAvatarArchiverConnector>().GetAvatarArchives(true); List <Dictionary <string, object> > avatarArchives = new List <Dictionary <string, object> >(); IWebHttpTextureService webTextureService = webInterface.Registry. RequestModuleInterface <IWebHttpTextureService>(); foreach (var archive in archives) { avatarArchives.Add(new Dictionary <string, object> { { "AvatarArchiveName", archive.Name }, { "AvatarArchiveSnapshotID", archive.Snapshot }, { "AvatarArchiveSnapshotURL", webTextureService.GetTextureURL(UUID.Parse(archive.Snapshot)) } }); } vars.Add("AvatarArchive", avatarArchives); IConfig loginServerConfig = webInterface.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs["LoginService"]; string tosLocation = ""; if (loginServerConfig != null && loginServerConfig.GetBoolean("UseTermsOfServiceOnFirstLogin", false)) { tosLocation = loginServerConfig.GetString("FileNameOfTOS", ""); } string ToS = "There are no Terms of Service currently. This may be changed at any point in the future."; if (tosLocation != "") { System.IO.StreamReader reader = new System.IO.StreamReader(System.IO.Path.Combine(Environment.CurrentDirectory, tosLocation)); ToS = reader.ReadToEnd(); reader.Close(); } vars.Add("ToSMessage", ToS); vars.Add("TermsOfServiceAccept", translator.GetTranslatedString("TermsOfServiceAccept")); vars.Add("TermsOfServiceText", translator.GetTranslatedString("TermsOfServiceText")); 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"); return(vars); }
/// <summary> /// Register this region with the grid service /// </summary> /// <param name = "scene"></param> /// <param name = "returnResponseFirstTime">Should we try to walk the user through what went wrong?</param> /// <param name="continueTrying"> </param> /// <param name="password"> </param> public bool RegisterRegionWithGrid(IScene scene, bool returnResponseFirstTime, bool continueTrying, string password) { GridRegion region = BuildGridRegion(scene.RegionInfo); IGenericsConnector g = DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridSessionID s = null; IGridService GridService = scene.RequestModuleInterface <IGridService>(); if (g != null) //Get the sessionID from the database if possible { s = g.GetGeneric <GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID"); } if (s == null) { s = new GridSessionID { SessionID = scene.RegionInfo.GridSecureSessionID }; //Set it from the regionInfo if it knows anything } scene.RequestModuleInterface <ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region); //Tell the grid service about us RegisterRegion error = GridService.RegisterRegion(region, s.SessionID, password); if (error.Error == String.Empty) { s.SessionID = error.SessionID; //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it scene.RegionInfo.GridSecureSessionID = error.SessionID; //Update our local copy of what our region flags are scene.RegionInfo.RegionFlags = error.RegionFlags; scene.RegionInfo.ScopeID = error.Region.ScopeID; scene.RegionInfo.AllScopeIDs = error.Region.AllScopeIDs; //Save the new SessionID to the database if (g != null) { g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD()); } m_knownNeighbors[scene.RegionInfo.RegionID] = error.Neighbors; return(true); //Success } if (returnResponseFirstTime && !continueTrying) { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region with grid failed again - " + error.Error); return(false); } //Parse the error and try to do something about it if at all possible if (error.Error == "Region location is reserved") { MainConsole.Instance.Error( "[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.Prompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.Prompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } else if (error.Error == "Region overlaps another region") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region location you specified is already in use. You must move your region."); int X = 0, Y = 0; int.TryParse( MainConsole.Instance.Prompt("New Region Location X", (scene.RegionInfo.RegionLocX / 256).ToString()), out X); int.TryParse( MainConsole.Instance.Prompt("New Region Location Y", (scene.RegionInfo.RegionLocY / 256).ToString()), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } else if (error.Error.Contains("Can't move this region")) { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - You can not move this region. Moving it back to its original position."); //Opensim Grid Servers don't have this functionality. try { string[] position = error.Error.Split(','); scene.RegionInfo.RegionLocX = int.Parse(position[1]) * Constants.RegionSize; scene.RegionInfo.RegionLocY = int.Parse(position[2]) * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } catch (Exception e) { MainConsole.Instance.Error( "Unable to move the region back to its original position, is this an opensim server? Please manually move the region back."); throw e; } } else if (error.Error == "Duplicate region name") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region name you specified is already in use. Please change the name."); string oldRegionName = scene.RegionInfo.RegionName; scene.RegionInfo.RegionName = MainConsole.Instance.Prompt("New Region Name", ""); IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(oldRegionName, scene.RegionInfo); } } else if (error.Error == "Region locked out") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid the failed - The region you are attempting to join has been blocked from connecting. Please connect another region."); MainConsole.Instance.Prompt("Press enter when you are ready to exit"); Environment.Exit(0); } else if (error.Error == "Could not reach grid service") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The grid service can not be found! Please make sure that you can connect to the grid server and that the grid server is on."); MainConsole.Instance.Error( "You should also make sure you've provided the correct address and port of the grid service."); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else if (error.Error == "Wrong Session ID") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - Wrong Session ID for this region!"); MainConsole.Instance.Error( "This means that this region has failed to connect to the grid server and needs removed from it before it can connect again."); MainConsole.Instance.Error( "If you are running the Aurora.Server instance this region is connecting to, type \"clear grid region <RegionName>\" and then press enter on this console and it will work"); MainConsole.Instance.Error( "If you are not running the Aurora.Server instance this region is connecting to, please contact your grid operator so that he can fix it"); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - " + error.Error + "!"); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } return(RegisterRegionWithGrid(scene, true, continueTrying, password)); }
/// <summary> /// Register this region with the grid service /// </summary> /// <param name="scene"></param> public void RegisterRegionWithGrid(IScene scene) { GridRegion region = BuildGridRegion(scene.RegionInfo); IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridSessionID s = null; IGridService GridService = scene.RequestModuleInterface <IGridService>(); if (g != null) //Get the sessionID from the database if possible { s = g.GetGeneric <GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", new GridSessionID()); } if (s == null) { s = new GridSessionID(); //Set it from the regionInfo if it knows anything s.SessionID = scene.RegionInfo.GridSecureSessionID; } scene.RequestModuleInterface <ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region); //Tell the grid service about us string error = GridService.RegisterRegion(region, s.SessionID, out s.SessionID); if (error == String.Empty) { //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it scene.RegionInfo.GridSecureSessionID = s.SessionID; //Save the new SessionID to the database g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD()); } else { //Parse the error and try to do something about it if at all possible if (error == "Region location is reserved") { m_log.Error("[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } if (error == "Region overlaps another region") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region location you specified is already in use. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } if (error.Contains("Can't move this region")) { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - You can not move this region. Moving it back to its original position."); //Opensim Grid Servers don't have this functionality. try { string[] position = error.Split(','); scene.RegionInfo.RegionLocX = int.Parse(position[1]) * Constants.RegionSize; scene.RegionInfo.RegionLocY = int.Parse(position[2]) * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } catch (Exception e) { m_log.Error("Unable to move the region back to its original position, is this an opensim server? Please manually move the region back."); throw e; } } if (error == "Duplicate region name") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region name you specified is already in use. Please change the name."); string oldRegionName = scene.RegionInfo.RegionName; scene.RegionInfo.RegionName = MainConsole.Instance.CmdPrompt("New Region Name", ""); IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(oldRegionName, scene.RegionInfo); } } if (error == "Region locked out") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid the failed - The region you are attempting to join has been blocked from connecting. Please connect another region."); MainConsole.Instance.CmdPrompt("Press enter when you are ready to exit"); Environment.Exit(0); } if (error == "Error communicating with grid service") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The grid service can not be found! Please make sure that you can connect to the grid server and that the grid server is on."); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } if (error == "Wrong Session ID") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - Wrong Session ID for this region!"); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - " + error + "!"); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } RegisterRegionWithGrid(scene); } }
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> >(); IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); var settings = generics.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); GridPage rootPage = generics.GetGeneric <GridPage>(UUID.Zero, "WebPages", "Root"); 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) } }); } 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")); // 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); }
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>(); #region Find pages List <Dictionary <string, object> > pages = new List <Dictionary <string, object> >(); IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridPage rootPage = generics.GetGeneric <GridPage>(UUID.Zero, "WebPages", "Root"); rootPage.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition)); List <GridPage> allPages = new List <GridPage>(rootPage.Children); foreach (GridPage page in rootPage.Children) { allPages.AddRange(page.Children); } allPages.RemoveAll((a) => !a.ShowInMenu); string MenuItem = requestParameters.ContainsKey("MenuItem") ? requestParameters["MenuItem"].ToString() : ""; foreach (GridPage page in allPages) { pages.Add(new Dictionary <string, object> { { "Value", page.Location }, { "Name", page.Location }, { "PageSelected", MenuItem == page.Location ? "selected=\"selected\"" : "" } }); } vars.Add("PagesList", pages); #endregion bool changed = false; string error = translator.GetTranslatedString("ChangesSavedSuccessfully"); if (requestParameters.ContainsKey("DeleteItem")) { rootPage.RemovePageByLocation(MenuItem, null); generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD()); webInterface.Redirect(httpResponse, "index.html?page=page_manager", filename); } if (requestParameters.ContainsKey("AddItem")) { //generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD()); vars.Add("EdittingPageID", -2); vars.Add("DisplayEdit", true); } if (requestParameters.ContainsKey("SelectItem")) { GridPage page = rootPage.GetPageByLocation(MenuItem); vars.Add("PageTitle", page.MenuTitle); vars.Add("PageTooltip", page.MenuToolTip); vars.Add("PageID", page.MenuID); vars.Add("PagePosition", page.MenuPosition); vars.Add("PageLocation", page.Location); vars.Add("EdittingPageID", page.MenuID); vars.Add("RequiresLoginYes", page.LoggedInRequired ? "selected=\"selected\"" : ""); vars.Add("RequiresLoginNo", !page.LoggedInRequired ? "selected=\"selected\"" : ""); vars.Add("RequiresLogoutYes", page.LoggedOutRequired ? "selected=\"selected\"" : ""); vars.Add("RequiresLogoutNo", !page.LoggedOutRequired ? "selected=\"selected\"" : ""); vars.Add("RequiresAdminYes", page.AdminRequired ? "selected=\"selected\"" : ""); vars.Add("RequiresAdminNo", !page.AdminRequired ? "selected=\"selected\"" : ""); vars.Add("RequiresAdminLevel", page.AdminLevelRequired); vars.Add("DisplayInMenuYes", page.ShowInMenu ? "selected=\"selected\"" : ""); vars.Add("DisplayInMenuNo", !page.ShowInMenu ? "selected=\"selected\"" : ""); vars.Add("DisplayEdit", true); pages = new List <Dictionary <string, object> > { new Dictionary <string, object> { { "Value", "Top Level" }, { "Name", translator.GetTranslatedString("TopLevel") }, { "PageSelected", "" } } }; GridPage parent = rootPage.GetParent(page); foreach (GridPage p in allPages) { pages.Add(new Dictionary <string, object> { { "Value", p.Location }, { "Name", p.Location }, { "PageSelected", parent.Location == p.Location ? "selected=\"selected\"" : "" } }); } vars.Add("ParentPagesList", pages); } else { vars.Add("PageTitle", ""); vars.Add("PageTooltip", ""); vars.Add("PageID", ""); vars.Add("PagePosition", ""); vars.Add("PageLocation", ""); if (!vars.ContainsKey("EdittingPageID")) { vars.Add("EdittingPageID", ""); } vars.Add("RequiresLoginYes", ""); vars.Add("RequiresLoginNo", ""); vars.Add("RequiresLogoutYes", ""); vars.Add("RequiresLogoutNo", ""); vars.Add("RequiresAdminYes", ""); vars.Add("RequiresAdminNo", ""); vars.Add("RequiresAdminLevel", "1"); pages = new List <Dictionary <string, object> > { new Dictionary <string, object> { { "Value", "Top Level" }, { "Name", translator.GetTranslatedString("TopLevel") }, { "PageSelected", "" } } }; foreach (GridPage p in allPages) { pages.Add(new Dictionary <string, object> { { "Value", p.Location }, { "Name", p.Location }, { "PageSelected", "" } }); } vars.Add("ParentPagesList", pages); } if (requestParameters.ContainsKey("SaveMenuItem")) { changed = true; string edittingPageID = requestParameters["EdittingPageID"].ToString(); string PageTitle = requestParameters["PageTitle"].ToString(); string PageTooltip = requestParameters["PageTooltip"].ToString(); string PagePosition = requestParameters["PagePosition"].ToString(); string PageID = requestParameters["PageID"].ToString(); string PageLocation = requestParameters["PageLocation"].ToString(); bool RequiresLogin = bool.Parse(requestParameters["RequiresLogin"].ToString()); bool RequiresLogout = bool.Parse(requestParameters["RequiresLogout"].ToString()); bool RequiresAdmin = bool.Parse(requestParameters["RequiresAdmin"].ToString()); bool DisplayInMenu = bool.Parse(requestParameters["DisplayInMenu"].ToString()); string ParentMenuItem = requestParameters["ParentMenuItem"].ToString(); int RequiredAdminLevel = int.Parse(requestParameters["RequiredAdminLevel"].ToString()); GridPage page = rootPage.GetPage(edittingPageID); bool add = page == null; if (page == null) { page = new GridPage { MenuID = PageLocation, ShowInMenu = true } } ; page.Location = PageLocation; page.MenuID = PageID; page.MenuPosition = int.Parse(PagePosition); page.MenuTitle = PageTitle; page.MenuToolTip = PageTooltip; page.LoggedInRequired = RequiresLogin; page.LoggedOutRequired = RequiresLogout; page.AdminRequired = RequiresAdmin; page.AdminLevelRequired = RequiredAdminLevel; page.ShowInMenu = DisplayInMenu; GridPage parent = rootPage.GetPageByLocation(ParentMenuItem); if (parent != page) { if (!add) { rootPage.RemovePage(edittingPageID, page); } if (parent != null) { parent.Children.Add(page); } else //Top Level { rootPage.Children.Add(page); } } else { error = translator.GetTranslatedString("CannotSetParentToChild"); } generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD()); webInterface.Redirect(httpResponse, "index.html?page=page_manager", filename); } vars.Add("PageTitleText", translator.GetTranslatedString("PageTitleText")); vars.Add("PageTooltipText", translator.GetTranslatedString("PageTooltipText")); vars.Add("PagePositionText", translator.GetTranslatedString("PagePositionText")); vars.Add("PageIDText", translator.GetTranslatedString("PageIDText")); vars.Add("PageLocationText", translator.GetTranslatedString("PageLocationText")); vars.Add("SaveMenuItemChanges", translator.GetTranslatedString("SaveMenuItemChanges")); vars.Add("RequiresLoginText", translator.GetTranslatedString("RequiresLoginText")); vars.Add("RequiresLogoutText", translator.GetTranslatedString("RequiresLogoutText")); vars.Add("RequiresAdminText", translator.GetTranslatedString("RequiresAdminText")); vars.Add("RequiresAdminLevelText", translator.GetTranslatedString("RequiresAdminLevelText")); vars.Add("DisplayInMenu", translator.GetTranslatedString("DisplayInMenu")); vars.Add("SelectItem", translator.GetTranslatedString("SelectItem")); vars.Add("DeleteItem", translator.GetTranslatedString("DeleteItem")); vars.Add("AddItem", translator.GetTranslatedString("AddItem")); vars.Add("PageManager", translator.GetTranslatedString("PageManager")); vars.Add("ParentText", translator.GetTranslatedString("ParentText")); vars.Add("Yes", translator.GetTranslatedString("Yes")); vars.Add("No", translator.GetTranslatedString("No")); vars.Add("ChangesSavedSuccessfully", changed ? error : ""); 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>(); 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); } vars.Add("UserName", account.Name); vars.Add("UserBorn", Util.ToDateTime(account.Created).ToShortDateString()); vars.Add("UserType", account.UserTitle == "" ? "Resident" : account.UserTitle); IUserProfileInfo profile = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(). GetUserProfile(account.PrincipalID); if (profile != null) { 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); string url = "../images/icons/no_picture.jpg"; IWebHttpTextureService webhttpService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService>(); if (webhttpService != null && profile.Image != UUID.Zero) { url = webhttpService.GetTextureURL(profile.Image); } vars.Add("UserPictureURL", url); } 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)) { ICapsService capsService = webInterface.Registry.RequestModuleInterface <ICapsService>(); IClientCapsService clientCaps = capsService == null ? null : capsService.GetClientCapsService(account.PrincipalID); if (clientCaps != null) { vars.Add("OnlineLocation", clientCaps.GetRootCapsService().Region.RegionName); } vars.Add("UserIsOnline", clientCaps != null); vars.Add("IsOnline", clientCaps != null ? 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")); } // Menu Profile vars.Add("MenuProfileTitle", translator.GetTranslatedString("MenuProfileTitle")); vars.Add("MenuGroupTitle", translator.GetTranslatedString("MenuGroupTitle")); vars.Add("MenuPicksTitle", translator.GetTranslatedString("MenuPicksTitle")); 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")); IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); var settings = generics.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); vars.Add("ShowLanguageTranslatorBar", !settings.HideLanguageTranslatorBar); vars.Add("ShowStyleBar", !settings.HideStyleBar); return(vars); }