コード例 #1
0
        private void LoadForm()
        {
            var moduleSettings = new ModuleController().GetModuleSettings(ModuleId);
            var settings       = WhatsNewModuleSettings.CreateFromModuleSettings(moduleSettings);

            txtNumItems.Text          = settings.Rows.ToString();
            txtTemplate.Text          = settings.Format;
            txtHeader.Text            = settings.Header;
            txtFooter.Text            = settings.Footer;
            chkRSS.Checked            = settings.RSSEnabled;
            chkTopicsOnly.Checked     = settings.TopicsOnly;
            chkRandomOrder.Checked    = settings.RandomOrder;
            chkIgnoreSecurity.Checked = settings.RSSIgnoreSecurity;
            chkIncludeBody.Checked    = settings.RSSIncludeBody;
            txtCache.Text             = settings.RSSCacheTimeout.ToString();
            txtTags.Text = settings.Tags;

            BindForumsTree();

            if (settings.Forums != string.Empty)
            {
                CheckNodes(settings.Forums);
            }

            pnlRSS.Visible      = chkRSS.Checked;
            rqvTxtCache.Enabled = chkRSS.Checked;
        }
コード例 #2
0
        //Private Sub tsTags_Callback(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.CallBackEventArgs) Handles tsTags.Callback
        //    tsTags.Datasource = DataProvider.Instance.Tags_Search(PortalId, ModuleId, e.Parameter.ToString + "%")
        //    tsTags.Refresh(e.Output)
        //End Sub

        private void lnkUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // Construct Forums
                var forums = string.Empty;
                if (GetNodeCount() != trForums.CheckedNodes.Count)
                {
                    if (trForums.CheckedNodes.Count > 1)
                    {
                        forums = string.Empty;
                        foreach (TreeNode tr in trForums.CheckedNodes)
                        {
                            if (tr.Value.Contains("F:"))
                            {
                                forums += tr.Value.Split(':')[1] + ":";
                            }
                        }
                    }
                    else
                    {
                        var sv = trForums.CheckedNodes[0].Value;
                        if (sv.Contains("F:"))
                        {
                            forums = sv.Split(':')[1];
                        }
                    }
                }

                var mc = new ModuleController();

                // Load the current settings
                var settings = WhatsNewModuleSettings.CreateFromModuleSettings(mc.GetModuleSettings(ModuleId));

                // Update Settings Values
                settings.Forums = forums;

                int rows;
                if (int.TryParse(txtNumItems.Text, out rows))
                {
                    settings.Rows = int.Parse(txtNumItems.Text);
                }

                settings.Format      = txtTemplate.Text;
                settings.Header      = txtHeader.Text;
                settings.Footer      = txtFooter.Text;
                settings.RSSEnabled  = chkRSS.Checked;
                settings.TopicsOnly  = chkTopicsOnly.Checked;
                settings.RandomOrder = chkRandomOrder.Checked;
                settings.Tags        = txtTags.Text;

                if (chkRSS.Checked)
                {
                    settings.RSSIgnoreSecurity = chkIgnoreSecurity.Checked;
                    settings.RSSIncludeBody    = chkIncludeBody.Checked;

                    int rssCacheTimeout;
                    if (int.TryParse(txtCache.Text, out rssCacheTimeout))
                    {
                        settings.RSSCacheTimeout = rssCacheTimeout;
                    }
                }

                // Save Settings
                settings.Save(mc, ModuleId);

                // Redirect back to the portal home page
                Response.Redirect(Common.Globals.NavigateURL(), true);
            }
            catch (Exception exc)
            {
                Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
            }
        }