Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Applies the settings from the currently loaded options.
        /// </summary>
        private void ApplyOptions(Options options)
        {
            _Options = options;
            _WebSiteExtender.Enabled = options.Enabled;
            _WebSiteExtender.RestrictAccessToFolder(ProtectedFolder, options.Access);
            _WebSiteExtender.ProtectFolder(ProtectedFolder);

            if(!options.Enabled) {
                Status = FeedFilterStrings.StatusDisabled;
            } else {
                Status = FeedFilterStrings.StatusEnabled;
            }
        }
Ejemplo n.º 4
0
        /// <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);
        }