public override void UpdateSettings()
        {
            try
            {
                var modules = new ModuleController();
                if (ddlChooseDisplayType.SelectedIndex > 0)
                {
                    modules.UpdateTabModuleSetting(TabModuleId, "DisplayType", ddlChooseDisplayType.SelectedValue);
                }

                modules.UpdateTabModuleSetting(TabModuleId, "LogBreadCrumb", (chkLogBreadcrumb.Checked ? "true" : "false"));
                modules.UpdateTabModuleSetting(TabModuleId, "Overrideable", (chkOverrideable.Checked ? "true" : "false"));
                //// && ddlChooseDisplayType.SelectedValue != "ItemListing" ? "true" : "false"));
                modules.UpdateTabModuleSetting(TabModuleId, "AllowTitleUpdate", (chkAllowTitleUpdate.Checked ? "true" : "false"));
                modules.UpdateTabModuleSetting(TabModuleId, "CacheTime", txtCacheTime.Text.Trim());

                modules.UpdateTabModuleSetting(TabModuleId, "SupportWLW", (chkEnableWLWSupport.Checked ? "true" : "false"));

                ////foreach (ModuleSettingsBase settingsControl in settingsChildren)
                ////{
                ////    settingsControl.UpdateSettings();
                ////}

                _currentSettingsBase.UpdateSettings();

                if (divArticleDisplay.Visible && divArticleDisplay.Controls.Count > 0)
                {
                    var articleOverrideSettings = divArticleDisplay.Controls[0] as ModuleSettingsBase;
                    if (articleOverrideSettings != null)
                    {
                        articleOverrideSettings.UpdateSettings();
                    }
                }

                if (divCategoryDisplay.Visible && divCategoryDisplay.Controls.Count > 0)
                {
                    var categoryOverrideSettings = divCategoryDisplay.Controls[0] as ModuleSettingsBase;
                    if (categoryOverrideSettings != null)
                    {
                        categoryOverrideSettings.UpdateSettings();
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #2
0
        /// <summary>
        /// cmdUpdate_Click runs when the Update LinkButton is clicked.
        /// It saves the current Site Settings
        /// </summary>
        /// <history>
        ///     [cnurse]	10/18/2004	documented
        ///     [cnurse]	10/19/2004	modified to support custm module specific settings
        /// </history>
        protected void cmdUpdate_Click(object Sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    ModuleController objModules     = new ModuleController();
                    bool             AllTabsChanged = false;

                    // tab administrators can only manage their own tab
                    if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false)
                    {
                        chkAllTabs.Enabled    = false;
                        chkDefault.Enabled    = false;
                        chkAllModules.Enabled = false;
                        cboTab.Enabled        = false;
                    }

                    // update module
                    ModuleInfo objModule = objModules.GetModule(moduleId, TabId, false);

                    objModule.ModuleID    = moduleId;
                    objModule.ModuleTitle = txtTitle.Text;
                    objModule.Alignment   = cboAlign.SelectedItem.Value;
                    objModule.Color       = txtColor.Text;
                    objModule.Border      = txtBorder.Text;
                    objModule.IconFile    = ctlIcon.Url;
                    if (!String.IsNullOrEmpty(txtCacheTime.Text))
                    {
                        objModule.CacheTime = int.Parse(txtCacheTime.Text);
                    }
                    else
                    {
                        objModule.CacheTime = 0;
                    }
                    objModule.TabID = TabId;
                    if (objModule.AllTabs != chkAllTabs.Checked)
                    {
                        AllTabsChanged = true;
                    }
                    objModule.AllTabs = chkAllTabs.Checked;
                    switch (int.Parse(cboVisibility.SelectedItem.Value))
                    {
                    case 0:

                        objModule.Visibility = VisibilityState.Maximized;
                        break;

                    case 1:

                        objModule.Visibility = VisibilityState.Minimized;
                        break;

                    case 2:

                        objModule.Visibility = VisibilityState.None;
                        break;
                    }
                    objModule.IsDeleted = false;
                    objModule.Header    = txtHeader.Text;
                    objModule.Footer    = txtFooter.Text;
                    if (!String.IsNullOrEmpty(txtStartDate.Text))
                    {
                        objModule.StartDate = Convert.ToDateTime(txtStartDate.Text);
                    }
                    else
                    {
                        objModule.StartDate = Null.NullDate;
                    }
                    if (!String.IsNullOrEmpty(txtEndDate.Text))
                    {
                        objModule.EndDate = Convert.ToDateTime(txtEndDate.Text);
                    }
                    else
                    {
                        objModule.EndDate = Null.NullDate;
                    }
                    objModule.ContainerSrc           = ctlModuleContainer.SkinSrc;
                    objModule.ModulePermissions      = dgPermissions.Permissions;
                    objModule.InheritViewPermissions = chkInheritPermissions.Checked;
                    objModule.DisplayTitle           = chkDisplayTitle.Checked;
                    objModule.DisplayPrint           = chkDisplayPrint.Checked;
                    objModule.DisplaySyndicate       = chkDisplaySyndicate.Checked;
                    objModule.IsDefaultModule        = chkDefault.Checked;
                    objModule.AllModules             = chkAllModules.Checked;
                    objModules.UpdateModule(objModule);

                    //Update Custom Settings
                    if (ctlSpecific != null)
                    {
                        ctlSpecific.UpdateSettings();
                    }

                    //These Module Copy/Move statements must be
                    //at the end of the Update as the Controller code assumes all the
                    //Updates to the Module have been carried out.

                    //Check if the Module is to be Moved to a new Tab
                    if (!chkAllTabs.Checked)
                    {
                        int newTabId = int.Parse(cboTab.SelectedItem.Value);
                        if (TabId != newTabId)
                        {
                            objModules.MoveModule(moduleId, TabId, newTabId, "");
                        }
                    }

                    //'Check if Module is to be Added/Removed from all Tabs
                    if (AllTabsChanged)
                    {
                        ArrayList arrTabs = Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true);
                        if (chkAllTabs.Checked)
                        {
                            objModules.CopyModule(moduleId, TabId, arrTabs, true);
                        }
                        else
                        {
                            objModules.DeleteAllModules(moduleId, TabId, arrTabs, false, false);
                        }
                    }

                    // Navigate back to admin page
                    Response.Redirect(Globals.NavigateURL(), true);
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }