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 = Aurora.DataManager.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 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 title = requestParameters["NewsTitle"].ToString(); string text = requestParameters["NewsText"].ToString(); IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>(); GridNewsItem item = new GridNewsItem {Text = text, Time = DateTime.Now, Title = title}; item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1; connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD()); response = "<h3>News item added successfully, redirecting to main page</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" + "</script>"; return null; } vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle")); vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText")); vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText")); 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>(); var usersList = new List<Dictionary<string, object>>(); uint amountPerQuery = 10; int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; uint count = Framework.Utilities.DataManager.RequestPlugin<IAgentInfoConnector>().RecentlyOnline(5*60, true); int maxPages = (int) (count/amountPerQuery) - 1; if (start == -1) start = (int) (maxPages < 0 ? 0 : maxPages); vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var users = Framework.Utilities.DataManager.RequestPlugin<IAgentInfoConnector>() .RecentlyOnline(5*60, true, new Dictionary<string, bool>(), (uint) start, amountPerQuery); IUserAccountService accountService = webInterface.Registry.RequestModuleInterface<IUserAccountService>(); IGridService gridService = webInterface.Registry.RequestModuleInterface<IGridService>(); foreach (var user in users) { var region = gridService.GetRegionByUUID(null, user.CurrentRegionID); var account = accountService.GetUserAccount(region.AllScopeIDs, UUID.Parse(user.UserID)); if (account != null && region != null) usersList.Add(new Dictionary<string, object> { {"UserName", account.Name}, {"UserRegion", region.RegionName}, {"UserID", user.UserID}, {"UserRegionID", region.RegionID} }); } if (requestParameters.ContainsKey("Order")) { if (requestParameters["Order"].ToString() == "RegionName") usersList.Sort((a, b) => a["UserRegion"].ToString().CompareTo(b["UserRegion"].ToString())); if (requestParameters["Order"].ToString() == "UserName") usersList.Sort((a, b) => a["UserName"].ToString().CompareTo(b["UserName"].ToString())); } vars.Add("UsersOnlineList", usersList); vars.Add("OnlineUsersText", translator.GetTranslatedString("OnlineUsersText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); 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>(); vars.Add("DisplayLG1", "display: none;"); vars.Add("DisplayLG2", "display: none;"); vars.Add("DisplayLG3", "display: none;"); vars.Add("DisplayLG4", "display: none;"); vars.Add("DisplayLG5", "display: none;"); if (translator.LanguageName == "en") vars["DisplayLG1"] = ""; if (translator.LanguageName == "fr") vars["DisplayLG2"] = ""; if (translator.LanguageName == "de") vars["DisplayLG3"] = ""; if (translator.LanguageName == "it") vars["DisplayLG4"] = ""; if (translator.LanguageName == "es") vars["DisplayLG5"] = ""; 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 = 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()); 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()); 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 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 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("ResetMenu")) { PagesMigrator.ResetToDefaults(); response = translator.GetTranslatedString("ChangesSavedSuccessfully"); return null; } if (requestParameters.ContainsKey("ResetSettings")) { SettingsMigrator.ResetToDefaults(); response = translator.GetTranslatedString("ChangesSavedSuccessfully"); return null; } vars.Add("FactoryReset", translator.GetTranslatedString("FactoryReset")); vars.Add("ResetMenuText", translator.GetTranslatedString("ResetMenuText")); vars.Add("ResetSettingsText", translator.GetTranslatedString("ResetSettingsText")); vars.Add("ResetMenuInfoText", translator.GetTranslatedString("ResetMenuText")); vars.Add("ResetSettingsInfoText", translator.GetTranslatedString("ResetSettingsInfoText")); vars.Add("Reset", translator.GetTranslatedString("Reset")); 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 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 (httpRequest.Query.Contains("delete")) { string newsID = httpRequest.Query["delete"].ToString(); connector.RemoveGeneric(UUID.Zero, "WebGridNews", newsID); vars["Success"] = "Successfully deleted the news item"; } else vars["Success"] = ""; var newsItems = connector.GetGenerics<GridNewsItem>(UUID.Zero, "WebGridNews"); vars.Add("News", newsItems.ConvertAll<Dictionary<string, object>>(item => item.ToDictionary())); vars.Add("NewsManager", translator.GetTranslatedString("NewsManager")); vars.Add("EditNewsItem", translator.GetTranslatedString("EditNewsItem")); vars.Add("AddNewsItem", translator.GetTranslatedString("AddNewsItem")); vars.Add("DeleteNewsItem", translator.GetTranslatedString("DeleteNewsItem")); vars.Add("NewsTitleText", translator.GetTranslatedString("NewsTitleText")); vars.Add("NewsDateText", translator.GetTranslatedString("NewsDateText")); vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText")); vars.Add("DeleteNewsText", translator.GetTranslatedString("DeleteNewsText")); 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>(); // Style Switcher vars.Add("styles1", translator.GetTranslatedString("styles1")); vars.Add("styles2", translator.GetTranslatedString("styles2")); vars.Add("styles3", translator.GetTranslatedString("styles3")); vars.Add("styles4", translator.GetTranslatedString("styles4")); vars.Add("styles5", translator.GetTranslatedString("styles5")); vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText")); vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText")); vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText")); // Language Switcher vars.Add("en", translator.GetTranslatedString("en")); vars.Add("fr", translator.GetTranslatedString("fr")); vars.Add("de", translator.GetTranslatedString("de")); vars.Add("it", translator.GetTranslatedString("it")); vars.Add("es", translator.GetTranslatedString("es")); return vars; }
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator) { var vars = new Dictionary<string, object>(); if (requestParameters.ContainsKey("Submit")) { string title = requestParameters["NewsTitle"].ToString(); string text = requestParameters["NewsText"].ToString(); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>(); GridNewsItem item = new GridNewsItem { Text = text, Time = DateTime.Now, Title = title }; item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1; connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD()); vars["ErrorMessage"] = "News item added successfully"; webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename); return vars; } else vars["ErrorMessage"] = ""; vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle")); vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText")); vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText")); 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) { var vars = new Dictionary<string, object>(); IAgentInfoConnector users = DataManager.DataManager.RequestPlugin<IAgentInfoConnector>(); IGenericsConnector connector = Aurora.DataManager.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", DataManager.DataManager.RequestPlugin<IRegionData>(). Count((Framework.RegionFlags)0, (Framework.RegionFlags)0).ToString()); vars.Add("UniqueVisitors", translator.GetTranslatedString("UniqueVisitors")); vars.Add("UniqueVisitorCount", users.RecentlyOnline((uint)TimeSpan.FromDays(30).TotalSeconds, false).ToString()); vars.Add("OnlineNow", translator.GetTranslatedString("OnlineNow")); vars.Add("OnlineNowCount", users.RecentlyOnline(5 * 60, true).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 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 regionslist = new List<Dictionary<string, object>>(); uint amountPerQuery = 10; if (requestParameters.ContainsKey("Submit")) { IGridService gridService = webInterface.Registry.RequestModuleInterface<IGridService>(); string regionname = requestParameters["regionname"].ToString(); int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; uint count = gridService.GetRegionsByNameCount(null, regionname); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) start = (int)(maxPages < 0 ? 0 : maxPages); vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var regions = gridService.GetRegionsByName(null, regionname, (uint)start, amountPerQuery); if (regions != null) { foreach (var region in regions) { regionslist.Add(new Dictionary<string, object> { { "RegionName", region.RegionName }, { "RegionID", region.RegionID } }); } } } else { vars.Add("CurrentPage", 0); vars.Add("NextOne", 0); vars.Add("BackOne", 0); } vars.Add("RegionsList", regionslist); vars.Add("RegionSearchText", translator.GetTranslatedString("RegionSearchText")); vars.Add("SearchForRegionText", translator.GetTranslatedString("SearchForRegionText")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("Search", translator.GetTranslatedString("Search")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); vars.Add("SearchResultForRegionText", translator.GetTranslatedString("SearchResultForRegionText")); vars.Add("RegionMoreInfo", translator.GetTranslatedString("RegionMoreInfo")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); 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>(); vars.Add("ChatText", translator.GetTranslatedString("ChatText")); 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>(); vars.Add("WebsiteDownInfoText", translator.GetTranslatedString("WebsiteDownInfoText")); vars.Add("WebsiteDownText", translator.GetTranslatedString("WebsiteDownText")); 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>(); 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>(); List<Dictionary<string, object>> RegionListVars = new List<Dictionary<string, object>>(); var sortBy = new Dictionary<string, bool>(); if (httpRequest.Query.ContainsKey("region")) sortBy.Add(httpRequest.Query["region"].ToString(), true); else if (httpRequest.Query.ContainsKey("Order")) sortBy.Add(httpRequest.Query["Order"].ToString(), true); uint amountPerQuery = 50; int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; uint count = DataManager.DataManager.RequestPlugin<IRegionData>().Count((Framework.RegionFlags)0, Framework.RegionFlags.Hyperlink | Framework.RegionFlags.Foreign | Framework.RegionFlags.Hidden); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) start = (int)(maxPages < 0 ? 0 : maxPages); vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var regions = DataManager.DataManager.RequestPlugin<IRegionData>().Get((Framework.RegionFlags)0, Framework.RegionFlags.Hyperlink | Framework.RegionFlags.Foreign | Framework.RegionFlags.Hidden, (uint)(start * amountPerQuery), amountPerQuery, sortBy); foreach (var region in regions) RegionListVars.Add(new Dictionary<string, object> { { "RegionLocX", region.RegionLocX / Constants.RegionSize }, { "RegionLocY", region.RegionLocY / Constants.RegionSize }, { "RegionName", region.RegionName }, { "RegionID", region.RegionID } }); vars.Add("RegionList", RegionListVars); vars.Add("RegionText", translator.GetTranslatedString("Region")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("RegionLocXText", translator.GetTranslatedString("RegionLocXText")); vars.Add("RegionLocYText", translator.GetTranslatedString("RegionLocYText")); vars.Add("SortByLocX", translator.GetTranslatedString("SortByLocX")); vars.Add("SortByLocY", translator.GetTranslatedString("SortByLocY")); vars.Add("SortByName", translator.GetTranslatedString("SortByName")); vars.Add("RegionListText", translator.GetTranslatedString("RegionListText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); vars.Add("RegionMoreInfo", translator.GetTranslatedString("RegionMoreInfo")); 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>(); vars.Add("Logout", translator.GetTranslatedString("Logout")); vars.Add("LoggedOutSuccessfullyText", translator.GetTranslatedString("LoggedOutSuccessfullyText")); Authenticator.RemoveAuthentication(httpRequest); 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>(); IMapService mapService = webInterface.Registry.RequestModuleInterface<IMapService>(); vars.Add("WorldMapServiceURL", mapService.MapServiceURL.Remove(mapService.MapServiceURL.Length - 1)); vars.Add("WorldMapAPIServiceURL", mapService.MapServiceAPIURL.Remove(mapService.MapServiceAPIURL.Length - 1)); 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 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, redirecting to main page</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; } 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("Submit")); return vars; }
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, Hashtable query, OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator) { var vars = new Dictionary<string, object>(); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>(); bool changed = false; if (requestParameters.ContainsKey("Submit")) { changed = true; 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()); } GridWelcomeScreen welcomeInfo = connector.GetGeneric<GridWelcomeScreen>(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen"); if (welcomeInfo == null) welcomeInfo = GridWelcomeScreen.Default; 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")); vars.Add("ChangesSavedSuccessfully", changed ? translator.GetTranslatedString("ChangesSavedSuccessfully") : ""); return vars; }
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, Hashtable query, OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator) { var vars = new Dictionary<string, object>(); vars.Add("News", translator.GetTranslatedString("News")); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>(); var newsItems = connector.GetGenerics<GridNewsItem>(UUID.Zero, "WebGridNews"); if (newsItems.Count == 0) newsItems.Add(GridNewsItem.NoNewsItem); vars.Add("NewsList", newsItems.ConvertAll<Dictionary<string, object>>(item => item.ToDictionary())); 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>(); vars.Add("ColorBoxImageText", translator.GetTranslatedString("ColorBoxImageText")); vars.Add("ColorBoxOfText", translator.GetTranslatedString("ColorBoxOfText")); vars.Add("ColorBoxPreviousText", translator.GetTranslatedString("ColorBoxPreviousText")); vars.Add("ColorBoxNextText", translator.GetTranslatedString("ColorBoxNextText")); vars.Add("ColorBoxCloseText", translator.GetTranslatedString("ColorBoxCloseText")); vars.Add("ColorBoxStartSlideshowText", translator.GetTranslatedString("ColorBoxStartSlideshowText")); vars.Add("ColorBoxStopSlideshowText", translator.GetTranslatedString("ColorBoxStopSlideshowText")); 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>(); 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) { var vars = new Dictionary<string, object>(); vars.Add("HelpText", translator.GetTranslatedString("HelpText")); vars.Add("HelpViewersConfigText", translator.GetTranslatedString("HelpViewersConfigText")); vars.Add("AngstormViewer", translator.GetTranslatedString("AngstormViewer")); vars.Add("VoodooViewer", translator.GetTranslatedString("VoodooViewer")); vars.Add("AstraViewer", translator.GetTranslatedString("AstraViewer")); vars.Add("ImprudenceViewer", translator.GetTranslatedString("ImprudenceViewer")); vars.Add("PhoenixViewer", translator.GetTranslatedString("PhoenixViewer")); vars.Add("SingularityViewer", translator.GetTranslatedString("SingularityViewer")); vars.Add("ZenViewer", translator.GetTranslatedString("ZenViewer")); return vars; }
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, Hashtable query, OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator) { var vars = new Dictionary<string, object>(); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>(); GridWelcomeScreen 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, out string response) { response = null; var vars = new Dictionary<string, object>(); vars.Add("Sun", translator.GetTranslatedString("Sun")); vars.Add("Mon", translator.GetTranslatedString("Mon")); vars.Add("Tue", translator.GetTranslatedString("Tue")); vars.Add("Wed", translator.GetTranslatedString("Wed")); vars.Add("Thu", translator.GetTranslatedString("Thu")); vars.Add("Fri", translator.GetTranslatedString("Fri")); vars.Add("Sat", translator.GetTranslatedString("Sat")); vars.Add("Sunday", translator.GetTranslatedString("Sunday")); vars.Add("Monday", translator.GetTranslatedString("Monday")); vars.Add("Tuesday", translator.GetTranslatedString("Tuesday")); vars.Add("Wednesday", translator.GetTranslatedString("Wednesday")); vars.Add("Thursday", translator.GetTranslatedString("Thursday")); vars.Add("Friday", translator.GetTranslatedString("Friday")); vars.Add("Saturday", translator.GetTranslatedString("Saturday")); vars.Add("Jan", translator.GetTranslatedString("Jan")); vars.Add("Feb", translator.GetTranslatedString("Feb")); vars.Add("Mar", translator.GetTranslatedString("Mar")); vars.Add("Apr", translator.GetTranslatedString("Apr")); vars.Add("May", translator.GetTranslatedString("May")); vars.Add("Jun", translator.GetTranslatedString("Jun")); vars.Add("Jul", translator.GetTranslatedString("Jul")); vars.Add("Aug", translator.GetTranslatedString("Aug")); vars.Add("Sep", translator.GetTranslatedString("Sep")); vars.Add("Oct", translator.GetTranslatedString("Oct")); vars.Add("Nov", translator.GetTranslatedString("Nov")); vars.Add("Dec", translator.GetTranslatedString("Dec")); vars.Add("January", translator.GetTranslatedString("January")); vars.Add("February", translator.GetTranslatedString("February")); vars.Add("March", translator.GetTranslatedString("March")); vars.Add("April", translator.GetTranslatedString("April")); vars.Add("June", translator.GetTranslatedString("June")); vars.Add("July", translator.GetTranslatedString("July")); vars.Add("August", translator.GetTranslatedString("August")); vars.Add("September", translator.GetTranslatedString("September")); vars.Add("October", translator.GetTranslatedString("October")); vars.Add("November", translator.GetTranslatedString("November")); vars.Add("December", translator.GetTranslatedString("December")); return vars; }
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, Hashtable query, OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator) { var vars = new Dictionary<string, object>(); List<Dictionary<string, object>> RegionListVars = new List<Dictionary<string, object>>(); var sortBy = new Dictionary<string, bool>(); if (query.ContainsKey("region")) sortBy.Add(query["region"].ToString(), true); var regions = DataManager.DataManager.RequestPlugin<IRegionData>().Get((Framework.RegionFlags)0, Framework.RegionFlags.Hyperlink | Framework.RegionFlags.Foreign | Framework.RegionFlags.Hidden, null, null, sortBy); foreach (var region in regions) RegionListVars.Add(new Dictionary<string, object> { { "RegionLocX", region.RegionLocX / Constants.RegionSize }, { "RegionLocY", region.RegionLocY / Constants.RegionSize }, { "RegionName", region.RegionName } }); vars.Add("RegionList", RegionListVars); vars.Add("RegionText", translator.GetTranslatedString("Region")); return vars; }
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, Hashtable query, OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator) { var vars = new Dictionary<string, object>(); 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.Zero)) { UUID sessionID = UUID.Random(); UserAccount account = webInterface.Registry.RequestModuleInterface<IUserAccountService>().GetUserAccount(UUID.Zero, username); Authenticator.AddAuthentication(sessionID, account.PrincipalID); if (account.UserLevel > 0) Authenticator.AddAdminAuthentication(sessionID, account.PrincipalID); httpResponse.AddCookie(new System.Web.HttpCookie("SessionID", sessionID.ToString()) { Expires = DateTime.MinValue, Path = "" }); httpResponse.StatusCode = (int)HttpStatusCode.Redirect; httpResponse.AddHeader("Location", "/welcomescreen/index.html"); return vars; } else error = "Failed to verify user name and password"; } 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("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>(); if (httpRequest.Query.ContainsKey("regionid")) { GridRegion region = webInterface.Registry.RequestModuleInterface <IGridService>().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("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.InfoUUID); parcel.Add("ParcelName", p.Name); parcel.Add("ParcelOwnerUUID", p.OwnerID); IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); if (accountService != null) { var account = accountService.GetUserAccount(null, p.OwnerID); if (account == null) { parcel.Add("ParcelOwnerName", translator.GetTranslatedString("NoAccountFound")); } else { parcel.Add("ParcelOwnerName", account.Name); } } parcels.Add(parcel); } vars.Add("ParcelInRegion", parcels); vars.Add("NumberOfParcelsInRegion", parcels.Count); } IWebHttpTextureService webTextureService = webInterface.Registry. RequestModuleInterface <IWebHttpTextureService>(); if (webTextureService != null && region.TerrainMapImage != UUID.Zero) { vars.Add("RegionImageURL", webTextureService.GetTextureURL(region.TerrainMapImage)); } else { vars.Add("RegionImageURL", "images/icons/no_picture.jpg"); } // Menu Region vars.Add("MenuRegionTitle", translator.GetTranslatedString("MenuRegionTitle")); vars.Add("MenuParcelTitle", translator.GetTranslatedString("MenuParcelTitle")); vars.Add("MenuOwnerTitle", translator.GetTranslatedString("MenuOwnerTitle")); vars.Add("RegionInformationText", translator.GetTranslatedString("RegionInformationText")); vars.Add("OwnerNameText", translator.GetTranslatedString("OwnerNameText")); vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText")); vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText")); vars.Add("RegionInfoText", translator.GetTranslatedString("RegionInfoText")); vars.Add("RegionOnlineText", translator.GetTranslatedString("RegionOnlineText")); vars.Add("NumberOfUsersInRegionText", translator.GetTranslatedString("NumberOfUsersInRegionText")); vars.Add("ParcelsInRegionText", translator.GetTranslatedString("ParcelsInRegionText")); // Style Switcher vars.Add("styles1", translator.GetTranslatedString("styles1")); vars.Add("styles2", translator.GetTranslatedString("styles2")); vars.Add("styles3", translator.GetTranslatedString("styles3")); vars.Add("styles4", translator.GetTranslatedString("styles4")); vars.Add("styles5", translator.GetTranslatedString("styles5")); vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText")); vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText")); vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText")); // Language Switcher vars.Add("en", translator.GetTranslatedString("en")); vars.Add("fr", translator.GetTranslatedString("fr")); vars.Add("de", translator.GetTranslatedString("de")); vars.Add("it", translator.GetTranslatedString("it")); vars.Add("es", translator.GetTranslatedString("es")); } return(vars); }
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>(); 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") || username.Contains('.')) { string name = httpRequest.Query.ContainsKey("name") ? httpRequest.Query["name"].ToString() : username; name = name.Replace('.', ' '); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, name); } else { username = username.Replace("%20", " "); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, username); } 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); } 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); } // Menu Profile vars.Add("MenuProfileTitle", translator.GetTranslatedString("MenuProfileTitle")); vars.Add("MenuGroupTitle", translator.GetTranslatedString("MenuGroupTitle")); vars.Add("MenuPicksTitle", translator.GetTranslatedString("MenuPicksTitle")); vars.Add("UserIsOnline", clientCaps != null); vars.Add("IsOnline", clientCaps != null ? translator.GetTranslatedString("Online") : translator.GetTranslatedString("Offline")); 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")); 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>(); List <Dictionary <string, object> > RegionListVars = new List <Dictionary <string, object> >(); var sortBy = new Dictionary <string, bool>(); if (httpRequest.Query.ContainsKey("region")) { sortBy.Add(httpRequest.Query["region"].ToString(), true); } else if (httpRequest.Query.ContainsKey("Order")) { sortBy.Add(httpRequest.Query["Order"].ToString(), true); } uint amountPerQuery = 50; int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; uint count = DataManager.DataManager.RequestPlugin <IRegionData>().Count((Framework.RegionFlags) 0, Framework.RegionFlags.Hyperlink | Framework.RegionFlags.Foreign | Framework.RegionFlags.Hidden); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (int)(maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var regions = DataManager.DataManager.RequestPlugin <IRegionData>().Get((Framework.RegionFlags) 0, Framework.RegionFlags.Hyperlink | Framework.RegionFlags.Foreign | Framework.RegionFlags.Hidden, (uint)(start * amountPerQuery), amountPerQuery, sortBy); foreach (var region in regions) { RegionListVars.Add(new Dictionary <string, object> { { "RegionLocX", region.RegionLocX / Constants.RegionSize }, { "RegionLocY", region.RegionLocY / Constants.RegionSize }, { "RegionName", region.RegionName }, { "RegionID", region.RegionID } }); } vars.Add("RegionList", RegionListVars); vars.Add("RegionText", translator.GetTranslatedString("Region")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("RegionLocXText", translator.GetTranslatedString("RegionLocXText")); vars.Add("RegionLocYText", translator.GetTranslatedString("RegionLocYText")); vars.Add("SortByLocX", translator.GetTranslatedString("SortByLocX")); vars.Add("SortByLocY", translator.GetTranslatedString("SortByLocY")); vars.Add("SortByName", translator.GetTranslatedString("SortByName")); vars.Add("RegionListText", translator.GetTranslatedString("RegionListText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); vars.Add("RegionMoreInfo", translator.GetTranslatedString("RegionMoreInfo")); 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>(); #region Find pages List <Dictionary <string, object> > pages = new List <Dictionary <string, object> >(); IGenericsConnector generics = Framework.Utilities.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 if (requestParameters.ContainsKey("DeleteItem")) { rootPage.RemovePageByLocation(MenuItem, null); generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD()); response = "<h3>Successfully updated menu</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html\";}, 0);" + "</script>"; return(null); } if (requestParameters.ContainsKey("AddItem")) { 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")) { 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); } response = "<h3>Successfully updated menu</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html\";}, 0);" + "</script>"; } else { response = "<h3>" + translator.GetTranslatedString("CannotSetParentToChild") + "</h3>"; } generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD()); return(null); } 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")); 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()); IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(). GetUserProfile(account.PrincipalID); vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup); 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)) { 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")); } // 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 = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); var settings = generics.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); vars.Add("ShowLanguageTranslatorBar", !settings.HideLanguageTranslatorBar); vars.Add("ShowStyleBar", !settings.HideStyleBar); 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>(); 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") || username.Contains('.')) { string name = httpRequest.Query.ContainsKey("name") ? httpRequest.Query["name"].ToString() : username; name = name.Replace('.', ' '); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, name); } else { username = username.Replace("%20", " "); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, username); } if (account == null) { return(vars); } vars.Add("UserName", account.Name); vars.Add("UserType", account.UserTitle == "" ? "Resident" : account.UserTitle); IProfileConnector profileConnector = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(); IUserProfileInfo profile = profileConnector == null ? null : profileConnector.GetUserProfile(account.PrincipalID); IWebHttpTextureService webhttpService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService>(); 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"; if (webhttpService != null && profile.Image != UUID.Zero) { url = webhttpService.GetTextureURL(profile.Image); } vars.Add("UserPictureURL", url); List <Dictionary <string, object> > picks = new List <Dictionary <string, object> >(); foreach (var pick in profileConnector.GetPicks(profile.PrincipalID)) { url = "../images/icons/no_picture.jpg"; if (webhttpService != null && pick.SnapshotUUID != UUID.Zero) { url = webhttpService.GetTextureURL(pick.SnapshotUUID); } picks.Add(new Dictionary <string, object> { { "PickSnapshotURL", url }, { "PickName", pick.OriginalName }, { "PickSim", pick.SimName }, { "PickLocation", pick.GlobalPos } }); } vars.Add("Picks", picks); } vars.Add("UsersPicksText", translator.GetTranslatedString("UsersPicksText")); 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 error = ""; UserAccount user = Authenticator.GetAuthentication(httpRequest); if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitPasswordChange") { string password = requestParameters["password"].ToString(); string passwordconf = requestParameters["passwordconf"].ToString(); response = "Success"; if (passwordconf != password) { response = "Passwords do not match"; } else { IAuthenticationService authService = webInterface.Registry.RequestModuleInterface <IAuthenticationService>(); if (authService != null) { error = authService.SetPassword(user.PrincipalID, "UserAccount", password) ? "" : "Failed to set your password, try again later"; } else { response = "No authentication service was available to change your password"; } } return(null); } else if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitEmailChange") { string email = requestParameters["email"].ToString(); IUserAccountService userService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); if (userService != null) { user.Email = email; userService.StoreUserAccount(user); response = "Success"; } else { response = "No authentication service was available to change your password"; } return(null); } else if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitDeleteUser") { string username = requestParameters["username"].ToString(); string password = requestParameters["password"].ToString(); ILoginService loginService = webInterface.Registry.RequestModuleInterface <ILoginService>(); if (loginService.VerifyClient(UUID.Zero, username, "UserAccount", password)) { IUserAccountService userService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); if (userService != null) { userService.DeleteUser(user.PrincipalID, user.Name, password, true, false); response = "Successfully deleted account."; } else { response = "User service unavailable, please try again later"; } } else { response = "Wrong username or password"; } return(null); } vars.Add("ErrorMessage", error); vars.Add("ChangeUserInformationText", translator.GetTranslatedString("ChangeUserInformationText")); vars.Add("ChangePasswordText", translator.GetTranslatedString("ChangePasswordText")); vars.Add("NewPasswordText", translator.GetTranslatedString("NewPasswordText")); vars.Add("NewPasswordConfirmationText", translator.GetTranslatedString("NewPasswordConfirmationText")); vars.Add("ChangeEmailText", translator.GetTranslatedString("ChangeEmailText")); vars.Add("NewEmailText", translator.GetTranslatedString("NewEmailText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("PasswordText", translator.GetTranslatedString("PasswordText")); vars.Add("DeleteUserText", translator.GetTranslatedString("DeleteUserText")); vars.Add("DeleteText", translator.GetTranslatedString("DeleteText")); vars.Add("DeleteUserInfoText", translator.GetTranslatedString("DeleteUserInfoText")); 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>(); 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); }
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>(); var usersList = new List <Dictionary <string, object> >(); uint amountPerQuery = 10; int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; uint count = DataManager.DataManager.RequestPlugin <IAgentInfoConnector>().RecentlyOnline(5 * 60, true); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (int)(maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var users = DataManager.DataManager.RequestPlugin <IAgentInfoConnector>().RecentlyOnline(5 * 60, true, new Dictionary <string, bool>(), (uint)start, amountPerQuery); IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); IGridService gridService = webInterface.Registry.RequestModuleInterface <IGridService>(); foreach (var user in users) { var region = gridService.GetRegionByUUID(null, user.CurrentRegionID); var account = accountService.GetUserAccount(region.AllScopeIDs, UUID.Parse(user.UserID)); if (account != null && region != null) { usersList.Add(new Dictionary <string, object> { { "UserName", account.Name }, { "UserRegion", region.RegionName }, { "UserID", user.UserID }, { "UserRegionID", region.RegionID } }); } } if (requestParameters.ContainsKey("Order")) { if (requestParameters["Order"].ToString() == "RegionName") { usersList.Sort((a, b) => a["UserRegion"].ToString().CompareTo(b["UserRegion"].ToString())); } if (requestParameters["Order"].ToString() == "UserName") { usersList.Sort((a, b) => a["UserName"].ToString().CompareTo(b["UserName"].ToString())); } } vars.Add("UsersOnlineList", usersList); vars.Add("OnlineUsersText", translator.GetTranslatedString("OnlineUsersText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); 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") || username.Contains('.')) { string name = httpRequest.Query.ContainsKey("name") ? httpRequest.Query["name"].ToString() : username; name = name.Replace('.', ' '); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, name); } else { username = username.Replace("%20", " "); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, username); } if (account == null) { return(vars); } vars.Add("UserName", account.Name); IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(). GetUserProfile(account.PrincipalID); vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup); IWebHttpTextureService webhttpService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService>(); 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"; if (webhttpService != null && profile.Image != UUID.Zero) { url = webhttpService.GetTextureURL(profile.Image); } vars.Add("UserPictureURL", url); } vars.Add("UsersGroupsText", translator.GetTranslatedString("UsersGroupsText")); IGroupsServiceConnector groupsConnector = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector>(); if (groupsConnector != null) { List <Dictionary <string, object> > groups = new List <Dictionary <string, object> >(); foreach (var grp in groupsConnector.GetAgentGroupMemberships(account.PrincipalID, account.PrincipalID)) { var grpData = groupsConnector.GetGroupProfile(account.PrincipalID, grp.GroupID); string url = "../images/icons/no_picture.jpg"; if (webhttpService != null && grpData.InsigniaID != UUID.Zero) { url = webhttpService.GetTextureURL(grpData.InsigniaID); } groups.Add(new Dictionary <string, object> { { "GroupPictureURL", url }, { "GroupName", grp.GroupName } }); } vars.Add("Groups", groups); vars.Add("GroupsJoined", groups.Count); } 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>(); #region Find pages List <Dictionary <string, object> > pages = new List <Dictionary <string, object> >(); IGenericsConnector generics = Framework.Utilities.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, out string response) { response = null; var vars = new Dictionary <string, object>(); var regionslist = new List <Dictionary <string, object> >(); uint amountPerQuery = 10; if (requestParameters.ContainsKey("Submit")) { IGridService gridService = webInterface.Registry.RequestModuleInterface <IGridService>(); string regionname = requestParameters["regionname"].ToString(); int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; uint count = gridService.GetRegionsByNameCount(null, regionname); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (int)(maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var regions = gridService.GetRegionsByName(null, regionname, (uint)start, amountPerQuery); if (regions != null) { foreach (var region in regions) { regionslist.Add(new Dictionary <string, object> { { "RegionName", region.RegionName }, { "RegionID", region.RegionID } }); } } } else { vars.Add("CurrentPage", 0); vars.Add("NextOne", 0); vars.Add("BackOne", 0); } vars.Add("RegionsList", regionslist); vars.Add("RegionSearchText", translator.GetTranslatedString("RegionSearchText")); vars.Add("SearchForRegionText", translator.GetTranslatedString("SearchForRegionText")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("Search", translator.GetTranslatedString("Search")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); vars.Add("SearchResultForRegionText", translator.GetTranslatedString("SearchResultForRegionText")); vars.Add("RegionMoreInfo", translator.GetTranslatedString("RegionMoreInfo")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); 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>(); var usersList = new List <Dictionary <string, object> >(); uint amountPerQuery = 10; if (requestParameters.ContainsKey("Submit")) { IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); string username = requestParameters["username"].ToString(); int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; uint count = accountService.NumberOfUserAccounts(null, username); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (int)(maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var users = accountService.GetUserAccounts(null, username, (uint)start, amountPerQuery); foreach (var user in users) { usersList.Add(new Dictionary <string, object> { { "UserName", user.Name }, { "UserID", user.PrincipalID }, { "CanEdit", Authenticator.CheckAdminAuthentication(httpRequest) } }); } } else { vars.Add("CurrentPage", 0); vars.Add("NextOne", 0); vars.Add("BackOne", 0); } vars.Add("UsersList", usersList); vars.Add("UserSearchText", translator.GetTranslatedString("UserSearchText")); vars.Add("SearchForUserText", translator.GetTranslatedString("SearchForUserText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("Search", translator.GetTranslatedString("Search")); vars.Add("SearchResultForUserText", translator.GetTranslatedString("SearchResultForUserText")); vars.Add("EditText", translator.GetTranslatedString("EditText")); vars.Add("EditUserAccountText", translator.GetTranslatedString("EditUserAccountText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); 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 error = ""; UUID user = httpRequest.Query.ContainsKey("userid") ? UUID.Parse(httpRequest.Query["userid"].ToString()) : UUID.Parse(requestParameters["userid"].ToString()); IUserAccountService userService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); var agentService = Framework.Utilities.DataManager.RequestPlugin <IAgentConnector>(); UserAccount account = userService.GetUserAccount(null, user); IAgentInfo agent = agentService.GetAgent(user); if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitPasswordChange") { string password = requestParameters["password"].ToString(); string passwordconf = requestParameters["passwordconf"].ToString(); if (password != passwordconf) { response = "Passwords do not match"; } else { IAuthenticationService authService = webInterface.Registry.RequestModuleInterface <IAuthenticationService>(); if (authService != null) { response = authService.SetPassword(user, "UserAccount", password) ? "Successfully set password" : "Failed to set your password, try again later"; } else { response = "No authentication service was available to change your password"; } } return(null); } else if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitEmailChange") { string email = requestParameters["email"].ToString(); if (userService != null) { account.Email = email; userService.StoreUserAccount(account); response = "Successfully updated email"; } else { response = "No authentication service was available to change your password"; } return(null); } else if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitDeleteUser") { string username = requestParameters["username"].ToString(); response = "Deleted user successfully"; if (username == account.Name) { userService.DeleteUser(account.PrincipalID, account.Name, "", false, false); } else { response = "The user name did not match"; } return(null); } if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitTempBanUser") { int timeDays = int.Parse(requestParameters["TimeDays"].ToString()); int timeHours = int.Parse(requestParameters["TimeHours"].ToString()); int timeMinutes = int.Parse(requestParameters["TimeMinutes"].ToString()); agent.Flags |= IAgentFlags.TempBan; DateTime until = DateTime.Now.AddDays(timeDays).AddHours(timeHours).AddMinutes(timeMinutes); agent.OtherAgentInformation["TemperaryBanInfo"] = until; agentService.UpdateAgent(agent); error = "User has been banned."; } if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitBanUser") { agent.Flags |= IAgentFlags.PermBan; agentService.UpdateAgent(agent); error = "User has been banned."; } if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitUnbanUser") { agent.Flags &= ~IAgentFlags.TempBan; agent.Flags &= ~IAgentFlags.PermBan; agent.OtherAgentInformation.Remove("TemperaryBanInfo"); agentService.UpdateAgent(agent); error = "User has been unbanned."; } if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitLoginAsUser") { Authenticator.ChangeAuthentication(httpRequest, account); webInterface.Redirect(httpResponse, "/"); return(vars); } if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitKickUser") { string message = requestParameters["KickMessage"].ToString(); IGridWideMessageModule messageModule = webInterface.Registry.RequestModuleInterface <IGridWideMessageModule>(); if (messageModule != null) { messageModule.KickUser(account.PrincipalID, message); } response = "User has been kicked."; return(null); } if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitMessageUser") { string message = requestParameters["Message"].ToString(); IGridWideMessageModule messageModule = webInterface.Registry.RequestModuleInterface <IGridWideMessageModule>(); if (messageModule != null) { messageModule.MessageUser(account.PrincipalID, message); } response = "User has been sent the message."; return(null); } string bannedUntil = ""; bool userBanned = agent == null ? false : ((agent.Flags & IAgentFlags.PermBan) == IAgentFlags.PermBan || (agent.Flags & IAgentFlags.TempBan) == IAgentFlags.TempBan); bool TempUserBanned = false; if (userBanned) { if ((agent.Flags & IAgentFlags.TempBan) == IAgentFlags.TempBan && agent.OtherAgentInformation["TemperaryBanInfo"].AsDate() < DateTime.Now.ToUniversalTime()) { userBanned = false; agent.Flags &= ~IAgentFlags.TempBan; agent.Flags &= ~IAgentFlags.PermBan; agent.OtherAgentInformation.Remove("TemperaryBanInfo"); agentService.UpdateAgent(agent); } else { DateTime bannedTime = agent.OtherAgentInformation["TemperaryBanInfo"].AsDate(); TempUserBanned = bannedTime != Util.UnixEpoch; bannedUntil = string.Format("{0} {1}", bannedTime.ToShortDateString(), bannedTime.ToLongTimeString()); } } bool userOnline = false; IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService>(); if (agentInfoService != null) { UserInfo info = agentInfoService.GetUserInfo(account.PrincipalID.ToString()); userOnline = info != null ? info.IsOnline : false; } vars.Add("UserOnline", userOnline); vars.Add("NotUserBanned", !userBanned); vars.Add("UserBanned", userBanned); vars.Add("TempUserBanned", TempUserBanned); vars.Add("BannedUntil", bannedUntil); vars.Add("EmailValue", account.Email); vars.Add("UserID", account.PrincipalID); vars.Add("UserName", account.Name); vars.Add("ErrorMessage", error); vars.Add("ChangeUserInformationText", translator.GetTranslatedString("ChangeUserInformationText")); vars.Add("ChangePasswordText", translator.GetTranslatedString("ChangePasswordText")); vars.Add("NewPasswordText", translator.GetTranslatedString("NewPasswordText")); vars.Add("NewPasswordConfirmationText", translator.GetTranslatedString("NewPasswordConfirmationText")); vars.Add("ChangeEmailText", translator.GetTranslatedString("ChangeEmailText")); vars.Add("NewEmailText", translator.GetTranslatedString("NewEmailText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("PasswordText", translator.GetTranslatedString("PasswordText")); vars.Add("DeleteUserText", translator.GetTranslatedString("DeleteUserText")); vars.Add("DeleteText", translator.GetTranslatedString("DeleteText")); vars.Add("DeleteUserInfoText", translator.GetTranslatedString("DeleteUserInfoText")); vars.Add("Submit", translator.GetTranslatedString("Submit")); vars.Add("Login", translator.GetTranslatedString("Login")); vars.Add("TypeUserNameToConfirm", translator.GetTranslatedString("TypeUserNameToConfirm")); vars.Add("AdminLoginInAsUserText", translator.GetTranslatedString("AdminLoginInAsUserText")); vars.Add("AdminLoginInAsUserInfoText", translator.GetTranslatedString("AdminLoginInAsUserInfoText")); vars.Add("AdminDeleteUserText", translator.GetTranslatedString("AdminDeleteUserText")); vars.Add("AdminDeleteUserInfoText", translator.GetTranslatedString("AdminDeleteUserInfoText")); vars.Add("AdminUnbanUserText", translator.GetTranslatedString("AdminUnbanUserText")); vars.Add("AdminTempBanUserText", translator.GetTranslatedString("AdminTempBanUserText")); vars.Add("AdminTempBanUserInfoText", translator.GetTranslatedString("AdminTempBanUserInfoText")); vars.Add("AdminBanUserText", translator.GetTranslatedString("AdminBanUserText")); vars.Add("AdminBanUserInfoText", translator.GetTranslatedString("AdminBanUserInfoText")); vars.Add("BanText", translator.GetTranslatedString("BanText")); vars.Add("UnbanText", translator.GetTranslatedString("UnbanText")); vars.Add("TimeUntilUnbannedText", translator.GetTranslatedString("TimeUntilUnbannedText")); vars.Add("EdittingText", translator.GetTranslatedString("EdittingText")); vars.Add("BannedUntilText", translator.GetTranslatedString("BannedUntilText")); vars.Add("KickAUserInfoText", translator.GetTranslatedString("KickAUserInfoText")); vars.Add("KickAUserText", translator.GetTranslatedString("KickAUserText")); vars.Add("KickMessageText", translator.GetTranslatedString("KickMessageText")); vars.Add("KickUserText", translator.GetTranslatedString("KickUserText")); vars.Add("MessageAUserText", translator.GetTranslatedString("MessageAUserText")); vars.Add("MessageAUserInfoText", translator.GetTranslatedString("MessageAUserInfoText")); vars.Add("MessageUserText", translator.GetTranslatedString("MessageUserText")); List <Dictionary <string, object> > daysArgs = new List <Dictionary <string, object> >(); for (int i = 0; i <= 100; i++) { daysArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > hoursArgs = new List <Dictionary <string, object> >(); for (int i = 0; i <= 23; i++) { hoursArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > minutesArgs = new List <Dictionary <string, object> >(); for (int i = 0; i <= 59; i++) { minutesArgs.Add(new Dictionary <string, object> { { "Value", i } }); } vars.Add("Days", daysArgs); vars.Add("Hours", hoursArgs); vars.Add("Minutes", minutesArgs); vars.Add("DaysText", translator.GetTranslatedString("DaysText")); vars.Add("HoursText", translator.GetTranslatedString("HoursText")); vars.Add("MinutesText", translator.GetTranslatedString("MinutesText")); return(vars); }