/// <summary> /// See interface docs. /// </summary> /// <param name="parameters"></param> public void Startup(PluginStartupParameters parameters) { Singleton = this; var options = OptionsStorage.Load(this); _HtmlLocaliser = Factory.Resolve <IHtmlLocaliser>(); _HtmlLocaliser.Initialise(); _HtmlLocaliser.AddResourceStrings(typeof(DatabaseEditorStrings)); BaseStationDatabase = Factory.ResolveSingleton <IAutoConfigBaseStationDatabase>().Database; BaseStationDatabase.WriteSupportEnabled = true; _WebSiteExtender = Factory.Resolve <IWebSiteExtender>(); _WebSiteExtender.Enabled = false; _WebSiteExtender.WebRootSubFolder = "Web"; _WebSiteExtender.InjectContent = @"<script src=""script-DatabaseEditor/inject.js"" type=""text/javascript"">"; _WebSiteExtender.InjectMapPages(); _WebSiteExtender.InjectReportPages(); _WebSiteExtender.Initialise(parameters); _WebSiteExtender.ProtectFolder(ProtectedFolder); parameters.WebSite.HtmlLoadedFromFile += WebSite_HtmlLoadedFromFile; var redirection = Factory.ResolveSingleton <IRedirectionConfiguration>(); redirection.AddRedirection("/DatabaseEditor", "/DatabaseEditor/index.html", RedirectionContext.Any); redirection.AddRedirection("/DatabaseEditor/", "/DatabaseEditor/index.html", RedirectionContext.Any); ApplyOptions(options); }
/// <summary> /// See interface docs. /// </summary> /// <param name="parameters"></param> public void Startup(PluginStartupParameters parameters) { Singleton = this; var options = OptionsStorage.Load(this); _HtmlLocaliser = Factory.Singleton.Resolve <IHtmlLocaliser>(); _HtmlLocaliser.Initialise(); _HtmlLocaliser.AddResourceStrings(typeof(DatabaseEditorStrings)); _BaseStationDatabase = Factory.Singleton.Resolve <IAutoConfigBaseStationDatabase>().Singleton.Database; _BaseStationDatabase.WriteSupportEnabled = true; _WebSiteExtender = Factory.Singleton.Resolve <IWebSiteExtender>(); _WebSiteExtender.Enabled = false; _WebSiteExtender.WebRootSubFolder = "Web"; _WebSiteExtender.InjectContent = @"<script src=""script-DatabaseEditor/inject.js"" type=""text/javascript"">"; _WebSiteExtender.InjectMapPages(); _WebSiteExtender.InjectReportPages(); _WebSiteExtender.PageHandlers.Add(String.Format("/{0}/SingleAircraftSearch.json", ProtectedFolder), SingleAircraftSearch); _WebSiteExtender.PageHandlers.Add(String.Format("/{0}/SingleAircraftSave.json", ProtectedFolder), SingleAircraftSave); _WebSiteExtender.Initialise(parameters); _WebSiteExtender.ProtectFolder(ProtectedFolder); parameters.WebSite.HtmlLoadedFromFile += WebSite_HtmlLoadedFromFile; ApplyOptions(options); }
public void TestInitialise() { _OriginalFactory = Factory.TakeSnapshot(); _Extender = Factory.Singleton.Resolve <IWebSiteExtender>(); _WebSite = TestUtilities.CreateMockInstance <IWebSite>(); _PluginStartupParameters = new PluginStartupParameters(null, null, _WebSite.Object, "PluginFolder"); _AddSiteRoot = null; _RemoveSiteRoot = null; _WebSite.Setup(r => r.AddSiteRoot(It.IsAny <SiteRoot>())).Callback((SiteRoot siteRoot) => _AddSiteRoot = siteRoot); _WebSite.Setup(r => r.RemoveSiteRoot(It.IsAny <SiteRoot>())).Callback((SiteRoot siteRoot) => _RemoveSiteRoot = siteRoot); _AddHtmlContentInjectors = new List <HtmlContentInjector>(); _RemoveHtmlContentInjectors = new List <HtmlContentInjector>(); _WebSite.Setup(r => r.AddHtmlContentInjector(It.IsAny <HtmlContentInjector>())).Callback((HtmlContentInjector injector) => _AddHtmlContentInjectors.Add(injector)); _WebSite.Setup(r => r.RemoveHtmlContentInjector(It.IsAny <HtmlContentInjector>())).Callback((HtmlContentInjector injector) => _RemoveHtmlContentInjectors.Add(injector)); _AutoConfigWebServer = TestUtilities.CreateMockSingleton <IAutoConfigWebServer>(); _WebServer = TestUtilities.CreateMockInstance <IWebServer>(); _AutoConfigWebServer.Setup(r => r.WebServer).Returns(_WebServer.Object); _Request = TestUtilities.CreateMockInstance <IRequest>(); _Response = TestUtilities.CreateMockInstance <IResponse>(); }
/// <summary> /// See interface docs. /// </summary> /// <param name="parameters"></param> public void Startup(PluginStartupParameters parameters) { Singleton = this; var options = OptionsStorage.Load(this); _HtmlLocaliser = Factory.Resolve <IHtmlLocaliser>(); _HtmlLocaliser.Initialise(); _HtmlLocaliser.AddResourceStrings(typeof(FeedFilterStrings)); _WebSiteExtender = Factory.Resolve <IWebSiteExtender>(); _WebSiteExtender.Enabled = false; _WebSiteExtender.WebRootSubFolder = "Web"; _WebSiteExtender.PageHandlers.Add(String.Format("/{0}/FetchFilterConfiguration.json", ProtectedFolder), FetchFilterConfiguration); _WebSiteExtender.PageHandlers.Add(String.Format("/{0}/SaveFilterConfiguration.json", ProtectedFolder), SaveFilterConfiguration); _WebSiteExtender.Initialise(parameters); var redirection = Factory.ResolveSingleton <IRedirectionConfiguration>(); redirection.AddRedirection("/FeedFilter", "/FeedFilter/index.html", RedirectionContext.Any); redirection.AddRedirection("/FeedFilter/", "/FeedFilter/index.html", RedirectionContext.Any); parameters.WebSite.HtmlLoadedFromFile += WebSite_HtmlLoadedFromFile; ApplyOptions(options); }
/// <summary> /// See interface docs. /// </summary> /// <param name="parameters"></param> public void Startup(PluginStartupParameters parameters) { Singleton = this; _Options = OptionsStorage.Load(); var pathFromRoot = String.Format("/{0}/", ProtectedFolder); _WebAdminViewManager.Startup(parameters.WebSite); _WebAdminViewManager.RegisterTranslations(typeof(VirtualRadar.WebSite.WebSiteStrings), "", false); _WebAdminViewManager.RegisterTranslations(typeof(VirtualRadar.Localisation.Strings), "Server", false); _WebAdminViewManager.RegisterTranslations(typeof(WebAdminStrings), "WebAdmin", true); // Views that have a menu entry _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Index.html", WebAdminStrings.WA_Home, () => new View.MainView(parameters.UPnpManager, parameters.FlightSimulatorAircraftList), null)); _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Settings.html", WebAdminStrings.WA_Title_Options, () => new View.SettingsView(), null)); _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Log.html", WebAdminStrings.WA_Title_Log, () => new View.LogView(), null)); _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "AircraftDetailLookupLog.html", WebAdminStrings.WS_Title_AircraftLookup_Log, () => new View.AircraftOnlineLookupLogView(), null)); _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "ConnectorActivityLog.html", Strings.ConnectorActivityLog, () => new View.ConnectorActivityLogView(), null)); _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Queues.html", WebAdminStrings.WA_Title_Queues, () => new View.QueuesView(), null)); _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "About.html", WebAdminStrings.WA_Title_About, () => new View.AboutView(), null)); // Views that do not have a menu entry _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Statistics.html", null, () => new View.StatisticsView(), null)); // Plugin options views _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "WebAdminPluginOptions.html", WebAdminStrings.PluginName, () => new View.WebAdminPluginOptionsView(), null) { Plugin = this, }); _WebAdminViewManager.RegisterWebAdminViewFolder(PluginFolder, "Web"); _WebSiteExtender = Factory.Resolve <IWebSiteExtender>(); _WebSiteExtender.Enabled = _Options.Enabled; _WebSiteExtender.PageHandlers.Add(String.Format("/{0}/ViewMap.json", ProtectedFolder), WebSite_HandleViewMapJson); _WebSiteExtender.ProtectFolder(ProtectedFolder); _WebSiteExtender.Initialise(parameters); var redirection = Factory.ResolveSingleton <IRedirectionConfiguration>(); redirection.AddRedirection("/WebAdmin", "/WebAdmin/Index.html", RedirectionContext.Any); redirection.AddRedirection("/WebAdmin/", "/WebAdmin/Index.html", RedirectionContext.Any); ApplyOptions(_Options); }