예제 #1
0
        /// <summary>
        /// Save the Presentation.Table settings to the settings file
        /// </summary>
        /// <param name="tableNode">XML-node for the Presentation.Table settings</param>
        public void Save(XmlNode tableNode)
        {
            string  xpath;
            XmlNode node;

            xpath = "./tableTransformation";
            SettingsHelper.SetSettingValue(xpath, tableNode, TableTransformation.ToString());

            xpath = "./defaultLayout";
            SettingsHelper.SetSettingValue(xpath, tableNode, DefaultLayout.ToString());

            xpath = "./maxColumns";
            SettingsHelper.SetSettingValue(xpath, tableNode, MaxColumns.ToString());

            xpath = "./maxRows";
            SettingsHelper.SetSettingValue(xpath, tableNode, MaxRows.ToString());

            xpath = "./titleVisible";
            SettingsHelper.SetSettingValue(xpath, tableNode, TitleVisible.ToString());

            xpath = "./useStickyHeaderFullscreen";
            SettingsHelper.SetSettingValue(xpath, tableNode, UseStickyHeaderFullscreen.ToString());


            xpath = "./attributes";
            node  = SettingsHelper.GetNode(tableNode, xpath);
            _attributeSettings.Save(node);
        }
예제 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandBarNode">XML-node for the Presentation.CommandBar settings</param>
        public CommandBarSettings(XmlNode commandBarNode)
        {
            string  xpath;
            XmlNode node;

            xpath    = "./viewMode";
            ViewMode = SettingsHelper.GetSettingValue(xpath, commandBarNode, PCAxis.Web.Controls.CommandBar.CommandBarViewMode.DropDown);

            xpath       = "./operations";
            node        = commandBarNode.SelectSingleNode(xpath);
            xpath       = ".//plugin";
            _operations = SettingsHelper.GetSettingValue(xpath, node);

            xpath = "./operationShortcuts";
            node  = commandBarNode.SelectSingleNode(xpath);
            xpath = ".//plugin";
            _operationShortcuts = SettingsHelper.GetSettingValue(xpath, node);

            xpath          = "./outputFormats";
            node           = commandBarNode.SelectSingleNode(xpath);
            xpath          = ".//outputFormat";
            _outputFormats = SettingsHelper.GetSettingValue(xpath, node);

            xpath = "./outputFormatShortcuts";
            node  = commandBarNode.SelectSingleNode(xpath);
            xpath = ".//outputFormat";
            _outputFormatShortcuts = SettingsHelper.GetSettingValue(xpath, node);

            xpath = "./presentationViews";
            //node = commandBarNode.SelectSingleNode(xpath);
            node  = SettingsHelper.GetNode(commandBarNode, xpath);
            xpath = ".//plugin";
            _presentationViews = SettingsHelper.GetSettingValue(xpath, node);

            xpath = "./presentationViewShortcuts";
            //node = commandBarNode.SelectSingleNode(xpath);
            node  = SettingsHelper.GetNode(commandBarNode, xpath);
            xpath = ".//plugin";
            _presentationViewShortcuts = SettingsHelper.GetSettingValue(xpath, node);

            xpath = "./commandBarShortcuts";
            node  = commandBarNode.SelectSingleNode(xpath);
            xpath = ".//plugin";
            _commandBarShortcuts = SettingsHelper.GetSettingValue(xpath, node);

            xpath             = "./operationButtons";
            node              = commandBarNode.SelectSingleNode(xpath);
            xpath             = ".//plugin";
            _operationButtons = SettingsHelper.GetSettingValue(xpath, node);

            xpath            = "./fileTypeButtons";
            node             = commandBarNode.SelectSingleNode(xpath);
            xpath            = ".//outputFormat";
            _fileTypeButtons = SettingsHelper.GetSettingValue(xpath, node);

            xpath = "./presentationViewButtons";
            node  = SettingsHelper.GetNode(commandBarNode, xpath);
            xpath = ".//plugin";
            _presentationViewButtons = SettingsHelper.GetSettingValue(xpath, node);
        }
예제 #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="tableNode">XML-node for the Presentation.Table settings</param>
        public TableSettings(XmlNode tableNode)
        {
            string  xpath;
            XmlNode node;

            xpath = "./tableTransformation";
            TableTransformation = SettingsHelper.GetSettingValue(xpath, tableNode, PCAxis.Web.Controls.TableTransformationType.NoTransformation);

            xpath         = "./defaultLayout";
            DefaultLayout = SettingsHelper.GetSettingValue(xpath, tableNode, PCAxis.Web.Controls.TableLayoutType.Layout1);

            xpath      = "./maxColumns";
            MaxColumns = SettingsHelper.GetSettingValue(xpath, tableNode, 50);

            xpath   = "./maxRows";
            MaxRows = SettingsHelper.GetSettingValue(xpath, tableNode, 10000);

            xpath        = "./titleVisible";
            TitleVisible = SettingsHelper.GetSettingValue(xpath, tableNode, true);

            xpath = "./useStickyHeaderFullscreen";
            UseStickyHeaderFullscreen = SettingsHelper.GetSettingValue(xpath, tableNode, true);

            xpath = "./attributes";
            node  = SettingsHelper.GetNode(tableNode, xpath);
            _attributeSettings = new AttributeSettings(node);
        }
예제 #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="generalNode">XML-node for the Features settings</param>
        public FeaturesSettings(XmlNode featuresNode)
        {
            string  xpath;
            XmlNode node;

            xpath = "./general";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _featuresGeneralSettings = new FeaturesGeneralSettings(node);

            xpath           = "./charts";
            node            = SettingsHelper.GetNode(featuresNode, xpath);
            _chartsSettings = new ChartsSettings(node);

            xpath        = "./api";
            node         = SettingsHelper.GetNode(featuresNode, xpath);
            _apiSettings = new ApiSettings(node);

            xpath           = "./search";
            node            = SettingsHelper.GetNode(featuresNode, xpath);
            _searchSettings = new SearchSettings(node);

            xpath = "./backgroundWorker";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _backgroundWorkerSettings = new BackgroundWorkerSettings(node);

            xpath = "./savedQuery";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _savedQuerySettings = new SavedQuerySettings(node);
        }
예제 #5
0
        /// <summary>
        /// Read the settings file and load the settings
        /// </summary>
        /// <returns>True if the settings was loaded successfully, else false</returns>
        private bool LoadSettings()
        {
            string  xpath;
            XmlNode node, settingsNode;

            //try
            //{
            //Load settings-file
            XmlDocument xdoc = new XmlDocument();

            if (File.Exists(_path))
            {
                //try
                //{
                xdoc.Load(_path);
                //}
                //catch (Exception e)
                //{
                //    _logger.Error("Error when trying to load settings.", e);
                //    _logger.ErrorFormat("Could not use file {0}",_path);
                //    _logger.Warn("Continuing using empty settings.");
                //    xdoc = new XmlDocument();
                //    xdoc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><settings></settings>");
                //}
            }
            else
            {
                xdoc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><settings></settings>");
            }

            xpath        = "/settings";
            settingsNode = xdoc.SelectSingleNode(xpath);

            xpath = "/settings/homePages";
            node  = SettingsHelper.GetNode(settingsNode, xpath);
            _homepagesSettings = new HomepagesSettings(node);

            xpath = "/settings/searchIndex";
            node  = SettingsHelper.GetNode(settingsNode, xpath);
            _searchIndexSettings = new SearchIndexSettings(node);

            xpath       = "/settings/protection";
            node        = SettingsHelper.GetNode(settingsNode, xpath);
            _protection = new ProtectionSettings(node);

            xpath     = "/settings/metadata";
            node      = SettingsHelper.GetNode(settingsNode, xpath);
            _metadata = new MetadataSettings(node);

            //}
            //catch (System.Exception ex)
            //{
            //    _logger.Error("::LoadSettings() : Error when loading settings : " + ex.Message);
            //    return false;
            //}

//            _logger.Info("Database settings-file '" + _path + "' was loaded successfully");
            return(true);
        }
예제 #6
0
파일: Settings.cs 프로젝트: trygu/PxWeb
        /// <summary>
        /// Read the settings file and load the settings
        /// </summary>
        /// <returns>True if the settings was loaded successfully, else false</returns>
        private bool LoadSettings()
        {
            string  xpath;
            XmlNode node;

            try
            {
                _logger.Info("Load settings file (settings.config) started");

                //Load settings-file
                XmlDocument xdoc = new XmlDocument();
                xdoc.Load(_path);

                xpath            = "/settings/general";
                node             = xdoc.SelectSingleNode(xpath);
                _generalSettings = new GeneralSettings(node);

                xpath         = "/settings/menu";
                node          = xdoc.SelectSingleNode(xpath);
                _menuSettings = new MenuSettings(node);

                xpath = "/settings/selection";
                node  = xdoc.SelectSingleNode(xpath);
                _selectionSettings = new SelectionSettings(node);

                xpath = "/settings/presentation";
                node  = xdoc.SelectSingleNode(xpath);
                _presentationSettings = new PresentationSettings(node);

                xpath = "/settings/features";
                //node = xdoc.SelectSingleNode(xpath);
                node = SettingsHelper.GetNode(xdoc, xpath);
                _featuresSettings = new FeaturesSettings(node);

                xpath = "/settings/navigation";
                //node = SettingsHelper.GetNode(xdoc, xpath);
                node = xdoc.SelectSingleNode(xpath);
                _navigationSettings = new NavigationSettings(node);
            }
            catch (System.Exception ex)
            {
                _logger.Error("::LoadSettings() : Error when loading settings : " + ex.Message);
                return(false);
            }

            _logger.Info("Settings-file '" + _path + "' was loaded successfully");
            return(true);
        }
예제 #7
0
        /// <summary>
        /// Save the database settings to the settings file
        /// </summary>
        public void Save()
        {
            string  xpath;
            XmlNode node, settingsNode;

            XmlDocument xdoc = new XmlDocument();

            if (File.Exists(_path))
            {
                xdoc.Load(_path);
            }
            else
            {
                xdoc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><settings></settings>");

                // Create database directory if it does not exist
                FileInfo f = new FileInfo(_path);
                if (!System.IO.Directory.Exists(f.DirectoryName))
                {
                    System.IO.Directory.CreateDirectory(f.DirectoryName);
                }
            }

            xpath        = "/settings";
            settingsNode = xdoc.SelectSingleNode(xpath);

            xpath = "/settings/homePages";
            node  = SettingsHelper.GetNode(settingsNode, xpath);
            _homepagesSettings.Save(node);

            xpath = "/settings/searchIndex";
            node  = SettingsHelper.GetNode(settingsNode, xpath);
            _searchIndexSettings.Save(node);

            xpath = "/settings/protection";
            node  = SettingsHelper.GetNode(settingsNode, xpath);
            _protection.Save(node);

            xpath = "/settings/metadata";
            node  = SettingsHelper.GetNode(settingsNode, xpath);
            _metadata.Save(node);

            _logger.InfoFormat("Saving settings to file: {0}.", _path);
            xdoc.Save(_path);
            _logger.InfoFormat("Saving done.");
        }
예제 #8
0
파일: Settings.cs 프로젝트: trygu/PxWeb
        /// <summary>
        /// Save settings to the settings file
        /// </summary>
        public static void Save()
        {
            string  xpath;
            XmlNode node;

            //Load the existing settings file
            XmlDocument xdoc = new XmlDocument();

            xdoc.Load(_path);

            xpath = "/settings/general";
            node  = xdoc.SelectSingleNode(xpath);
            ((GeneralSettings)_newSettings.General).Save(node);

            xpath = "/settings/menu";
            node  = xdoc.SelectSingleNode(xpath);
            ((MenuSettings)_newSettings.Menu).Save(node);

            xpath = "/settings/selection";
            node  = xdoc.SelectSingleNode(xpath);
            ((SelectionSettings)_newSettings.Selection).Save(node);

            xpath = "/settings/presentation";
            node  = xdoc.SelectSingleNode(xpath);
            ((PresentationSettings)_newSettings.Presentation).Save(node);

            xpath = "/settings/features";
            //node = xdoc.SelectSingleNode(xpath);
            node = SettingsHelper.GetNode(xdoc, xpath);
            ((FeaturesSettings)_newSettings.Features).Save(node);

            xpath = "/settings/navigation";
            node  = xdoc.SelectSingleNode(xpath);
            ((NavigationSettings)_newSettings.Navigation).Save(node);

            xdoc.Save(_path);
            _logger.Info("Settings-file was successfully saved");

            //Expose new settings to PX-Web
            _settings = _newSettings;

            _settings.UpdateCoreSettings();
        }
예제 #9
0
        /// <summary>
        /// Save Features settings to the settings file
        /// </summary>
        /// <param name="generalNode">XML-node for the Features settings</param>
        public void Save(XmlNode featuresNode)
        {
            string  xpath;
            XmlNode node;

            // Save Features.General settings
            xpath = "./general";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _featuresGeneralSettings.Save(node);

            // Save Features.Charts settings
            xpath = "./charts";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _chartsSettings.Save(node);

            // Save Features.Api settings
            xpath = "./api";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _apiSettings.Save(node);

            // Save Features.Search settings
            xpath = "./search";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _searchSettings.Save(node);

            // Save Features.BackgroundWorker settings
            xpath = "./backgroundWorker";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _backgroundWorkerSettings.Save(node);
            // Save Features.BackgroundWorker settings
            xpath = "./backgroundWorker";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _backgroundWorkerSettings.Save(node);

            //Save Features.SavedQuery settings
            xpath = "./savedQuery";
            node  = SettingsHelper.GetNode(featuresNode, xpath);
            _savedQuerySettings.Save(node);
        }
예제 #10
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="chartsNode">XML-node for the Charts settings</param>
        public ChartsSettings(XmlNode chartsNode)
        {
            string  xpath;
            XmlNode node;

            xpath  = "./height";
            Height = SettingsHelper.GetSettingValue(xpath, chartsNode, 480);

            xpath     = "./maxHeight";
            MaxHeight = SettingsHelper.GetSettingValue(xpath, chartsNode, 2000);

            xpath = "./width";
            Width = SettingsHelper.GetSettingValue(xpath, chartsNode, 680);

            xpath    = "./maxWidth";
            MaxWidth = SettingsHelper.GetSettingValue(xpath, chartsNode, 3000);

            xpath   = "./colors";
            node    = SettingsHelper.GetNode(chartsNode, xpath);
            xpath   = ".//color";
            _colors = SettingsHelper.GetSettingValue(xpath, node);

            xpath         = "./lineThickness";
            LineThickness = SettingsHelper.GetSettingValue(xpath, chartsNode, 3);

            xpath            = "./maxLineThickness";
            MaxLineThickness = SettingsHelper.GetSettingValue(xpath, chartsNode, 10);

            xpath    = "./logotype";
            Logotype = SettingsHelper.GetSettingValue(xpath, chartsNode, "");

            xpath     = "./maxValues";
            MaxValues = SettingsHelper.GetSettingValue(xpath, chartsNode, 50);

            xpath         = "./timeSortOrder";
            TimeSortOrder = SettingsHelper.GetSettingValue(xpath, chartsNode, ChartSettings.SortType.None);

            xpath            = "./labelOrientation";
            LabelOrientation = SettingsHelper.GetSettingValue(xpath, chartsNode, ChartSettings.OrientationType.Horizontal);

            xpath         = "./font";
            node          = SettingsHelper.GetNode(chartsNode, xpath);
            _fontSettings = new ChartFontSettings(node);

            xpath           = "./legend";
            node            = SettingsHelper.GetNode(chartsNode, xpath);
            _legendSettings = new ChartLegendSettings(node);

            xpath = "./guidelines";
            node  = SettingsHelper.GetNode(chartsNode, xpath);
            _guidelinesSettings = new ChartGuidelinesSettings(node);

            xpath      = "./showSourse";
            ShowSource = SettingsHelper.GetSettingValue(xpath, chartsNode, false);

            xpath    = "./showLogo";
            ShowLogo = SettingsHelper.GetSettingValue(xpath, chartsNode, false);

            xpath = "./lineThicknessPhrame";
            LineThicknessPhrame = SettingsHelper.GetSettingValue(xpath, chartsNode, 1);

            xpath           = "./lineColorPhrame";
            LineColorPhrame = SettingsHelper.GetSettingValue(xpath, chartsNode, "#000000");

            xpath = "./backgroundColorGraphs";
            BackgroundColorGraphs = SettingsHelper.GetSettingValue(xpath, chartsNode, "#FFFFFF");
        }
예제 #11
0
        /// <summary>
        /// Save Features.Charts settings to the settings file
        /// </summary>
        /// <param name="generalNode">XML-node for the Features.Charts settings</param>
        public void Save(XmlNode chartsNode)
        {
            string  xpath;
            XmlNode node;

            xpath = "./height";
            SettingsHelper.SetSettingValue(xpath, chartsNode, Height.ToString());

            xpath = "./maxHeight";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxHeight.ToString());

            xpath = "./width";
            SettingsHelper.SetSettingValue(xpath, chartsNode, Width.ToString());

            xpath = "./maxWidth";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxWidth.ToString());

            xpath = "./colors";
            SettingsHelper.SetSettingValue(xpath, chartsNode, "color", Colors);

            xpath = "./lineThickness";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LineThickness.ToString());

            xpath = "./maxLineThickness";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxLineThickness.ToString());

            xpath = "./logotype";
            SettingsHelper.SetSettingValue(xpath, chartsNode, Logotype);

            xpath = "./maxValues";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxValues.ToString());

            xpath = "./timeSortOrder";
            SettingsHelper.SetSettingValue(xpath, chartsNode, TimeSortOrder.ToString());

            xpath = "./labelOrientation";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LabelOrientation.ToString());

            xpath = "./font";
            node  = SettingsHelper.GetNode(chartsNode, xpath);
            _fontSettings.Save(node);

            xpath = "./legend";
            node  = SettingsHelper.GetNode(chartsNode, xpath);
            _legendSettings.Save(node);

            xpath = "./guidelines";
            node  = SettingsHelper.GetNode(chartsNode, xpath);
            _guidelinesSettings.Save(node);

            xpath = "./showSourse";
            SettingsHelper.SetSettingValue(xpath, chartsNode, ShowSource.ToString());

            xpath = "./showLogo";
            SettingsHelper.SetSettingValue(xpath, chartsNode, ShowLogo.ToString());

            xpath = "./lineThicknessPhrame";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LineThicknessPhrame.ToString());

            xpath = "./lineColorPhrame";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LineColorPhrame.ToString());

            xpath = "./backgroundColorGraphs";
            SettingsHelper.SetSettingValue(xpath, chartsNode, BackgroundColorGraphs.ToString());
        }
예제 #12
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="selectionNode">XML-node for the Selection settings</param>
        public SelectionSettings(XmlNode selectionNode)
        {
            string  xpath;
            XmlNode node;

            xpath           = "./cellLimitScreen";
            CellLimitScreen = SettingsHelper.GetSettingValue(xpath, selectionNode, 10000);

            xpath             = "./showMandatoryMark";
            ShowMandatoryMark = SettingsHelper.GetSettingValue(xpath, selectionNode, true);

            xpath = "./showSelectionLimits";
            ShowSelectionLimits = SettingsHelper.GetSettingValue(xpath, selectionNode, true);

            xpath             = "./allowAggregations";
            AllowAggregations = SettingsHelper.GetSettingValue(xpath, selectionNode, true);

            xpath = "./hierarchies";
            node  = selectionNode.SelectSingleNode(xpath);
            _hierarchiesSettings = new HierarchiesSettings(node);

            xpath = "./markingTips";
            node  = selectionNode.SelectSingleNode(xpath);
            _markingTipsSettings = new MarkingTipsSettings(node);

            xpath = "./maxRowsWithoutSearch";
            MaxRowsWithoutSearch = SettingsHelper.GetSettingValue(xpath, selectionNode, 500);

            xpath = "./alwaysShowTimeVariableWithoutSearch";
            AlwaysShowTimeVariableWithoutSearch = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath    = "./listSize";
            ListSize = SettingsHelper.GetSettingValue(xpath, selectionNode, 6);

            xpath = "./presentationViews";
            node  = SettingsHelper.GetNode(selectionNode, xpath);
            xpath = ".//plugin";
            _presentationViews = SettingsHelper.GetSettingValue(xpath, node);

            xpath          = "./outputFormats";
            node           = selectionNode.SelectSingleNode(xpath);
            xpath          = ".//outputFormat";
            _outputFormats = SettingsHelper.GetSettingValue(xpath, node);

            xpath = "./valuesetMustBeSelectedFirst";
            ValuesetMustBeSelectedFirst = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath = "./showAllAvailableValuesSearchButton";
            ShowAllAvailableValuesSearchButton = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath            = "./searchButtonMode";
            SearchButtonMode = SettingsHelper.GetSettingValue(xpath, selectionNode, PCAxis.Web.Controls.VariableSelectorSearchButtonViewMode.ManyValues);

            xpath         = "./titleFromMenu";
            TitleFromMenu = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath = "./standardApplicationHeadTitle";
            StandardApplicationHeadTitle = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath           = "./metadataAsLinks";
            MetadataAsLinks = SettingsHelper.GetSettingValue(xpath, selectionNode, true);

            xpath = "./selectValuesFromGroup";
            SelectValuesFromGroup = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath = "./buttonsForContentVariable";
            ButtonsForContentVariable = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath = "./searchValuesBeginningOfWordCheckBoxDefaultChecked";
            SearchValuesBeginningOfWordCheckBoxDefaultChecked = SettingsHelper.GetSettingValue(xpath, selectionNode, false);

            xpath = "./preSelectFirstContentAndTime";
            PreSelectFirstContentAndTime = SettingsHelper.GetSettingValue(xpath, selectionNode, false);
        }