Beispiel #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     UpdateSettings saves the modified settings to the Database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void UpdateSettings()
        {
            // Do not update report definition if the user is not a SuperUser
            if (this.UserInfo.IsSuperUser)
            {
                // Update the settings
                this.UpdateDataSourceSettings();

                // Save the report definition
                ReportsController.UpdateReportDefinition(this.ModuleId, this.Report);
            }

            // Non-SuperUsers can change TabModuleSettings (display settings)

            // Update cache duration (0 => no caching)
            var duration = "0";

            if (this.chkCaching.Checked)
            {
                duration = this.txtCacheDuration.Text;
            }

            this.Report.CacheDuration = int.Parse(duration);
            this.Report.ShowInfoPane  = this.chkShowInfoPane.Checked;
            this.Report.ShowControls  = this.chkShowControls.Checked;
            this.Report.AutoRunReport = this.chkAutoRunReport.Checked;
            this.Report.TokenReplace  = this.chkTokenReplace.Checked;

            // and Visualizer Settings
            this.Report.Visualizer = this.VisualizerDropDown.SelectedValue;
            this.Report.VisualizerSettings.Clear();
            var settings = this.GetSettingsControlFromView(this.VisualizerSettings.GetActiveView());

            if (settings != null)
            {
                settings.SaveSettings(this.Report.VisualizerSettings);
            }

            // Save the report view and clear the cache
            ReportsController.UpdateReportView(this.TabModuleId, this.Report);

            // refresh cache
            ModuleController.SynchronizeModule(this.ModuleId);
            ReportsController.ClearCachedResults(this.ModuleId);
        }
Beispiel #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     LoadSettings loads the settings from the Database and displays them
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void LoadSettings()
        {
            if (!this.Page.IsPostBack)
            {
                this.Report = ReportsController.GetReport(this.ModuleConfiguration);
                if (ReferenceEquals(this.Report, null))
                {
                    this.Report = new ReportInfo();
                }

                var reportsModuleSettingsRepository = new ReportsModuleSettingsRepository();
                var reportsModuleSettings           = reportsModuleSettingsRepository.GetSettings(this.ModuleConfiguration);

                // If the user has permission to see the Data Source Settings
                if (this.CheckPermissions())
                {
                    // Load the fields
                    this.txtTitle.Text       = reportsModuleSettings.Title;
                    this.txtDescription.Text = reportsModuleSettings.Description;
                    this.txtParameters.Text  = reportsModuleSettings.Parameters;

                    // Load the Data Source Settings
                    var temp_extensionName = reportsModuleSettings.DataSource;
                    this.LoadExtensionSettings("DataSource", ref temp_extensionName, "DataSourceName.Text",
                                               "DataSource.Text", ReportsConstants.DEFAULT_DataSource,
                                               this.DataSourceDropDown,
                                               this.DataSourceSettings, this.DataSourceNotConfiguredView,
                                               this.Report.DataSourceSettings,
                                               ReportsConstants.FILENAME_RESX_DataSource, true);
                    this.Report.DataSource = temp_extensionName;

                    // Load the filtering settings
                    var encodeBuilder = new StringBuilder();
                    var decodeBuilder = new StringBuilder();
                    foreach (List <ConverterInstanceInfo> list in this.Report.Converters.Values)
                    {
                        foreach (var Converter in list)
                        {
                            StringBuilder builder = null;
                            if ("HtmlEncode".Equals(Converter.ConverterName))
                            {
                                builder = encodeBuilder;
                            }
                            else if ("HtmlDecode".Equals(Converter.ConverterName))
                            {
                                builder = decodeBuilder;
                            }

                            if (builder != null)
                            {
                                if (builder.Length > 0)
                                {
                                    builder.Append(",");
                                }
                                builder.Append(Converter.FieldName);
                            }
                        }
                    }
                    this.txtHtmlEncode.Text = encodeBuilder.ToString();
                    this.txtHtmlDecode.Text = decodeBuilder.ToString();
                }

                this.txtCacheDuration.Text    = reportsModuleSettings.CacheDuration.ToString();
                this.chkShowInfoPane.Checked  = reportsModuleSettings.ShowInfoPane;
                this.chkShowControls.Checked  = reportsModuleSettings.ShowControls;
                this.chkAutoRunReport.Checked = reportsModuleSettings.AutoRunReport;
                this.chkTokenReplace.Checked  = reportsModuleSettings.TokenReplace;

                // Set the caching checkbox
                if (reportsModuleSettings.CacheDuration <= 0)
                {
                    this.chkCaching.Checked   = false;
                    this.Report.CacheDuration = 0;
                }
                else
                {
                    this.chkCaching.Checked = true;
                }

                // Update the cache duration text box visibility
                this.UpdateCachingSpan();

                // Load Visualizer Settings
                var temp_extensionName2 = reportsModuleSettings.Visualizer;
                this.LoadExtensionSettings("Visualizer", ref temp_extensionName2, "VisualizerName.Text",
                                           "Visualizer.Text", ReportsConstants.DEFAULT_Visualizer,
                                           this.VisualizerDropDown,
                                           this.VisualizerSettings, null, this.Report.VisualizerSettings,
                                           ReportsConstants.FILENAME_RESX_Visualizer, false);
                this.Report.Visualizer = temp_extensionName2;
            }
        }