Example #1
0
        /// <summary>
        /// cmdEmail_Click runs when the clear cache button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/27/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdCache_Click(object sender, EventArgs e)
        {
            // clear entire cache
            DataCache.ClearHostCache(true);

            Response.Redirect(Request.RawUrl, true);
        }
Example #2
0
        /// <summary>
        /// Updates the specified config.
        /// </summary>
        /// <param name="config">The config.</param>
        /// <param name="clearCache">if set to <c>true</c> will clear cache after update the setting.</param>
        public void Update(ConfigurationSetting config, bool clearCache)
        {
            var objEventLog = new EventLogController();

            try
            {
                if (GetSettings().ContainsKey(config.Key))
                {
                    DataProvider.Instance().UpdateHostSetting(config.Key, config.Value, config.IsSecure, UserController.GetCurrentUserInfo().UserID);
                    objEventLog.AddLog(config.Key,
                                       config.Value,
                                       PortalController.GetCurrentPortalSettings(),
                                       UserController.GetCurrentUserInfo().UserID,
                                       EventLogController.EventLogType.HOST_SETTING_UPDATED);
                }
                else
                {
                    DataProvider.Instance().AddHostSetting(config.Key, config.Value, config.IsSecure, UserController.GetCurrentUserInfo().UserID);
                    objEventLog.AddLog(config.Key,
                                       config.Value,
                                       PortalController.GetCurrentPortalSettings(),
                                       UserController.GetCurrentUserInfo().UserID,
                                       EventLogController.EventLogType.HOST_SETTING_CREATED);
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }

            if ((clearCache))
            {
                DataCache.ClearHostCache(false);
            }
        }
Example #3
0
 public static void RemoveDesktopModuleFromPortals(int desktopModuleID)
 {
     DataProvider.Instance().DeletePortalDesktopModules(Null.NullInteger, desktopModuleID);
     Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
     objEventLog.AddLog("DesktopModuleID", desktopModuleID.ToString(), PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.PORTALDESKTOPMODULE_DELETED);
     DataCache.ClearHostCache(true);
 }
Example #4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the Update LinkButton is clicked.
        /// It saves the current Search Settings
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/9/2004	Modified
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnUpdateClick(object sender, EventArgs e)
        {
            try
            {
                Page.Validate();
                if (Page.IsValid)
                {
                    if (Globals.IsHostTab(ModuleContext.PortalSettings.ActiveTab.TabID))
                    {
                        HostController.Instance.Update("MaxSearchWordLength", txtMaxWordLength.Text);
                        HostController.Instance.Update("MinSearchWordLength", txtMinWordLength.Text);
                        HostController.Instance.Update("SearchIncludeCommon", chkIncludeCommon.Checked ? "Y" : "N");
                        HostController.Instance.Update("SearchIncludeNumeric", chkIncludeNumeric.Checked ? "Y" : "N");

                        //clear host settings cache
                        DataCache.ClearHostCache(false);
                    }
                    else
                    {
                        PortalController.UpdatePortalSetting(ModuleContext.PortalId, "MaxSearchWordLength", txtMaxWordLength.Text);
                        PortalController.UpdatePortalSetting(ModuleContext.PortalId, "MinSearchWordLength", txtMinWordLength.Text);
                        PortalController.UpdatePortalSetting(ModuleContext.PortalId, "SearchIncludeCommon", chkIncludeCommon.Checked ? "Y" : "N");
                        PortalController.UpdatePortalSetting(ModuleContext.PortalId, "SearchIncludeNumeric", chkIncludeNumeric.Checked ? "Y" : "N");
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #5
0
        public bool Install()
        {
            InstallerInfo.Log.StartJob(Util.INSTALL_Start);
            bool bStatus = true;

            try
            {
                InstallPackages();
            }
            catch (Exception ex)
            {
                InstallerInfo.Log.AddFailure(ex);
                bStatus = false;
            }
            finally
            {
                if (!string.IsNullOrEmpty(TempInstallFolder))
                {
                    CommonLibrary.Common.Globals.DeleteFolderRecursive(TempInstallFolder);
                }
                InstallerInfo.Log.AddInfo(Util.FOLDER_DeletedBackup);
            }
            if (InstallerInfo.Log.Valid)
            {
                InstallerInfo.Log.EndJob(Util.INSTALL_Success);
            }
            else
            {
                InstallerInfo.Log.EndJob(Util.INSTALL_Failed);
                bStatus = false;
            }
            LogInstallEvent("Package", "Install");
            DataCache.ClearHostCache(true);
            return(bStatus);
        }
        public void UpdateHostSetting(string SettingName, string SettingValue, bool SettingIsSecure, bool clearCache)
        {
            IDataReader dr = null;

            try
            {
                dr = DataProvider.Instance().GetHostSetting(SettingName);
                Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
                if (dr.Read())
                {
                    DataProvider.Instance().UpdateHostSetting(SettingName, SettingValue, SettingIsSecure, UserController.GetCurrentUserInfo().UserID);
                    objEventLog.AddLog(SettingName.ToString(), SettingValue.ToString(), PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.HOST_SETTING_UPDATED);
                }
                else
                {
                    DataProvider.Instance().AddHostSetting(SettingName, SettingValue, SettingIsSecure, UserController.GetCurrentUserInfo().UserID);
                    objEventLog.AddLog(SettingName.ToString(), SettingValue.ToString(), PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.HOST_SETTING_CREATED);
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }
            finally
            {
                CBO.CloseDataReader(dr, true);
            }
            if (clearCache)
            {
                DataCache.ClearHostCache(false);
            }
        }
Example #7
0
        public string UpgradeModule(string Version)
        {
            // Upgrade 03.02.00
            // Sets the Modules with Image to Media

            if (string.Equals(Version, "03.02.00"))
            {
                try
                {
                    MediaController objMC = new MediaController();
                    objMC.UpgradeMedia(GetModuleDefID("DNN_Image"), GetModuleDefID("DNN_Media"));
                    // clear entire cache
                    DataCache.ClearHostCache(true);

                    return("True");
                }
                catch (Exception ex)
                {
                    Exceptions.LogException(ex);
                    return("False");
                }
            }

            return("True");
        }
        /// <summary>
        /// cmdUpdate_Click runs when the Update LinkButton is clicked.
        /// It saves the current Search Settings
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/9/2004	Modified
        /// </history>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId)
                {
                    HostSettingsController objHostSettings = new HostSettingsController();
                    objHostSettings.UpdateHostSetting("MaxSearchWordLength", txtMaxWordLength.Text);
                    objHostSettings.UpdateHostSetting("MinSearchWordLength", txtMinWordLength.Text);
                    objHostSettings.UpdateHostSetting("SearchIncludeCommon", Convert.ToString(chkIncludeCommon.Checked ? "Y" : "N"));
                    objHostSettings.UpdateHostSetting("SearchIncludeNumeric", Convert.ToString(chkIncludeNumeric.Checked ? "Y" : "N"));

                    // clear host settings cache
                    DataCache.ClearHostCache(false);
                }
                else
                {
                    ModuleController objModules = new ModuleController();
                    objModules.UpdateModuleSetting(ModuleId, "MaxSearchWordLength", txtMaxWordLength.Text);
                    objModules.UpdateModuleSetting(ModuleId, "MinSearchWordLength", txtMinWordLength.Text);
                    objModules.UpdateModuleSetting(ModuleId, "SearchIncludeCommon", Convert.ToString(chkIncludeCommon.Checked ? "Y" : "N"));
                    objModules.UpdateModuleSetting(ModuleId, "SearchIncludeNumeric", Convert.ToString(chkIncludeNumeric.Checked ? "Y" : "N"));
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #9
0
 public void DeleteDesktopModule(int desktopModuleID)
 {
     dataProvider.DeleteDesktopModule(desktopModuleID);
     Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
     objEventLog.AddLog("DesktopModuleID", desktopModuleID.ToString(), PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.DESKTOPMODULE_DELETED);
     DataCache.ClearHostCache(true);
 }
 public static void AddDesktopModuleToPortals(int desktopModuleId)
 {
     foreach (PortalInfo portal in PortalController.Instance.GetPortals())
     {
         AddDesktopModuleToPortal(portal.PortalID, desktopModuleId, true, false);
     }
     DataCache.ClearHostCache(true);
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// SaveModuleDefinition saves the Module Definition to the database
        /// </summary>
        /// <param name="moduleDefinition">The Module Definition to save</param>
        /// <param name="saveChildren">A flag that determines whether the child objects are also saved</param>
        /// <param name="clearCache">A flag that determines whether to clear the host cache</param>
        /// <history>
        ///     [cnurse]	01/14/2008   Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static int SaveModuleDefinition(ModuleDefinitionInfo moduleDefinition, bool saveChildren, bool clearCache)
        {
            int moduleDefinitionID = moduleDefinition.ModuleDefID;

            if (moduleDefinitionID == Null.NullInteger)
            {
                //Add new Module Definition
                moduleDefinitionID = dataProvider.AddModuleDefinition(moduleDefinition.DesktopModuleID,
                                                                      moduleDefinition.FriendlyName,
                                                                      moduleDefinition.DefinitionName,
                                                                      moduleDefinition.DefaultCacheTime,
                                                                      UserController.GetCurrentUserInfo().UserID);
            }
            else
            {
                //Upgrade Module Definition
                dataProvider.UpdateModuleDefinition(moduleDefinition.ModuleDefID, moduleDefinition.FriendlyName, moduleDefinition.DefinitionName, moduleDefinition.DefaultCacheTime, UserController.GetCurrentUserInfo().UserID);
            }
            if (saveChildren)
            {
                foreach (KeyValuePair <string, PermissionInfo> kvp in moduleDefinition.Permissions)
                {
                    kvp.Value.ModuleDefID = moduleDefinitionID;

                    //check if permission exists
                    var       permissionController = new PermissionController();
                    ArrayList permissions          = permissionController.GetPermissionByCodeAndKey(kvp.Value.PermissionCode, kvp.Value.PermissionKey);
                    if (permissions != null && permissions.Count == 1)
                    {
                        var permission = (PermissionInfo)permissions[0];
                        kvp.Value.PermissionID = permission.PermissionID;
                        permissionController.UpdatePermission(kvp.Value);
                    }
                    else
                    {
                        permissionController.AddPermission(kvp.Value);
                    }
                }
                foreach (KeyValuePair <string, ModuleControlInfo> kvp in moduleDefinition.ModuleControls)
                {
                    kvp.Value.ModuleDefID = moduleDefinitionID;

                    //check if definition exists
                    ModuleControlInfo moduleControl = ModuleControlController.GetModuleControlByControlKey(kvp.Value.ControlKey, kvp.Value.ModuleDefID);
                    if (moduleControl != null)
                    {
                        kvp.Value.ModuleControlID = moduleControl.ModuleControlID;
                    }
                    ModuleControlController.SaveModuleControl(kvp.Value, clearCache);
                }
            }
            if (clearCache)
            {
                DataCache.ClearHostCache(true);
            }
            return(moduleDefinitionID);
        }
Example #12
0
        /// <summary>
        /// Updates the specified settings.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public void Update(Dictionary <string, string> settings)
        {
            foreach (KeyValuePair <string, string> settingKvp in settings)
            {
                Update(settingKvp.Key, settingKvp.Value, false);
            }

            DataCache.ClearHostCache(false);
        }
Example #13
0
        /// <inheritdoc/>
        void IHostSettingsService.Update(IDictionary <string, string> settings)
        {
            foreach (KeyValuePair <string, string> settingKvp in settings)
            {
                this.Update(settingKvp.Key, settingKvp.Value, false);
            }

            DataCache.ClearHostCache(false);
        }
Example #14
0
        public static void AddDesktopModuleToPortals(int desktopModuleID)
        {
            PortalController controller = new PortalController();

            foreach (PortalInfo portal in controller.GetPortals())
            {
                AddDesktopModuleToPortal(portal.PortalID, desktopModuleID, true, false);
            }
            DataCache.ClearHostCache(true);
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// DeleteDesktopModule deletes a Desktop Module By ID
 /// </summary>
 /// <param name="desktopModuleID">The ID of the Desktop Module to delete</param>
 /// -----------------------------------------------------------------------------
 public void DeleteDesktopModule(int desktopModuleID)
 {
     DataProvider.DeleteDesktopModule(desktopModuleID);
     EventLogController.Instance.AddLog("DesktopModuleID",
                                        desktopModuleID.ToString(),
                                        PortalController.Instance.GetCurrentPortalSettings(),
                                        UserController.Instance.GetCurrentUserInfo().UserID,
                                        EventLogController.EventLogType.DESKTOPMODULE_DELETED);
     DataCache.ClearHostCache(true);
 }
Example #16
0
        public void DeletePortalInfo(int portalId)
        {
            UserController.DeleteUsers(portalId, false, true);

            DataProvider.Instance().DeletePortalInfo(portalId);

            EventLogController.Instance.AddLog("PortalId", portalId.ToString(), GetCurrentPortalSettingsInternal(), UserController.Instance.GetCurrentUserInfo().UserID, EventLogController.EventLogType.PORTALINFO_DELETED);

            DataCache.ClearHostCache(true);
        }
 public static void RemoveDesktopModuleFromPortals(int desktopModuleId)
 {
     DataProvider.Instance().DeletePortalDesktopModules(Null.NullInteger, desktopModuleId);
     EventLogController.Instance.AddLog("DesktopModuleID",
                                        desktopModuleId.ToString(),
                                        PortalController.Instance.GetCurrentPortalSettings(),
                                        UserController.Instance.GetCurrentUserInfo().UserID,
                                        EventLogController.EventLogType.PORTALDESKTOPMODULE_DELETED);
     DataCache.ClearHostCache(true);
 }
        public UserBasicDto UpdateUserBasicInfo(UserBasicDto userBasicDto)
        {
            var user     = UserController.Instance.GetUser(PortalSettings.PortalId, userBasicDto.UserId);
            int portalId = PortalSettings.PortalId;

            if (user == null)
            {
                throw new ArgumentException("UserNotExist");
            }

            if (userBasicDto.UserId == PortalSettings.AdministratorId)
            {
                //Clear the Portal Cache
                DataCache.ClearPortalCache(portalId, true);
            }
            if (user.IsSuperUser)
            {
                DataCache.ClearHostCache(true);
            }
            user.DisplayName = userBasicDto.Displayname;
            user.Email       = userBasicDto.Email;

            //Update DisplayName to conform to Format
            if (!string.IsNullOrEmpty(PortalSettings.Registration.DisplayNameFormat))
            {
                user.UpdateDisplayName(PortalSettings.Registration.DisplayNameFormat);
            }
            //either update the username or update the user details

            if (CanUpdateUsername(user) && !PortalSettings.Registration.UseEmailAsUserName)
            {
                UserController.ChangeUsername(user.UserID, userBasicDto.Username);
                user.Username = userBasicDto.Username;
            }

            //DNN-5874 Check if unique display name is required
            if (PortalSettings.Registration.RequireUniqueDisplayName)
            {
                var usersWithSameDisplayName = (List <UserInfo>)MembershipProvider.Instance().GetUsersBasicSearch(portalId, 0, 2, "DisplayName", true, "DisplayName", user.DisplayName);
                if (usersWithSameDisplayName.Any(u => u.UserID != user.UserID))
                {
                    throw new ArgumentException("DisplayNameNotUnique");
                }
            }

            UserController.UpdateUser(portalId, user);

            if (PortalSettings.Registration.UseEmailAsUserName && (user.Username.ToLowerInvariant() != user.Email.ToLowerInvariant()))
            {
                UserController.ChangeUsername(user.UserID, user.Email);
            }
            return
                (UserBasicDto.FromUserInfo(UserController.Instance.GetUser(PortalSettings.PortalId, userBasicDto.UserId)));
        }
Example #19
0
        public void DeleteModuleDefinition(int moduleDefinitionId)
        {
            PermissionController permissionController = new PermissionController();

            foreach (PermissionInfo permission in permissionController.GetPermissionsByModuleDefID(moduleDefinitionId))
            {
                permissionController.DeletePermission(permission.PermissionID);
            }
            dataProvider.DeleteModuleDefinition(moduleDefinitionId);
            DataCache.ClearHostCache(true);
        }
Example #20
0
 private void ClearCache()
 {
     if (this.PortalId == Null.NullInteger)
     {
         DataCache.ClearHostCache(false);
     }
     else
     {
         DataCache.ClearPortalCache(this.PortalId, false);
     }
     CacheController.FlushPageIndexFromCache();
     CacheController.FlushFriendlyUrlSettingsFromCache();
 }
Example #21
0
        /// <summary>
        /// Handles the <see cref="Button.Click"/> event of the <see cref="ReplaceTextHtmlButton"/> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ReplaceTextHtmlButton_Click(object sender, EventArgs e)
        {
            // Get the initial caching level
            var initialCachingLevel = (int)Host.PerformanceSetting;

            try
            {
                var searchValue      = this.SearchTextBox.Text.Trim();
                var replacementValue = this.ReplacementTextBox.Text;
                if (string.IsNullOrEmpty(searchValue))
                {
                    return;
                }

                DataTable searchResults = DataProvider.Instance.SearchUniqueTextHtmlContent(searchValue, this.SearchPortalId, this.LowerTabId, this.UpperTabId);

                // Disable caching
                new HostSettingsController().UpdateHostSetting("PerformanceSetting", ((int)Globals.PerformanceSettings.NoCaching).ToString(CultureInfo.InvariantCulture));
                DataCache.ClearHostCache(true);

                foreach (DataRow searchResultRow in searchResults.Rows)
                {
                    var moduleId = (int)searchResultRow["ModuleID"];
                    var tabId    = (int)searchResultRow["TabID"];
                    var portalId = (int)searchResultRow["PortalID"];
                    var content  = searchResultRow["Content"].ToString();

                    CreateNewTextHtmlVersion(searchValue, replacementValue, moduleId, tabId, portalId, content);
                }

                this.ReplacementResultsLabel.Text = string.Format(
                    CultureInfo.CurrentCulture,
                    Localization.GetString("TextHtmlReplacementResults.Format", this.LocalResourceFile),
                    searchValue,
                    replacementValue,
                    searchResults.Rows.Count);
                this.ReplacementResultsLabel.Visible = true;
                this.ResultsGrid.Visible             = false;
                this.PublishResultsGrid.Visible      = false;
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
            finally
            {
                // Enable caching with
                // the initial caching level
                new HostSettingsController().UpdateHostSetting("PerformanceSetting", initialCachingLevel.ToString(CultureInfo.InvariantCulture));
            }
        }
Example #22
0
 protected void OnUpdateSkinsClick(object sender, EventArgs e)
 {
     try
     {
         //Update skin changes
         Attributes.Update();
     }
     catch (Exception exc)
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
     finally
     {
         DataCache.ClearHostCache(false);
     }
 }
Example #23
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Install method installs the feature.
        /// </summary>
        /// -----------------------------------------------------------------------------
        public bool Install()
        {
            InstallerInfo.Log.StartJob(Util.INSTALL_Start);
            bool bStatus = true;

            try
            {
                bool clearClientCache = false;
                InstallPackages(ref clearClientCache);
                if (clearClientCache)
                {
                    //Update the version of the client resources - so the cache is cleared
                    HostController.Instance.IncrementCrmVersion(true);
                }
            }
            catch (Exception ex)
            {
                InstallerInfo.Log.AddFailure(ex);
                bStatus = false;
            }
            finally
            {
                //Delete Temp Folder
                if (!string.IsNullOrEmpty(TempInstallFolder))
                {
                    Globals.DeleteFolderRecursive(TempInstallFolder);
                }
                InstallerInfo.Log.AddInfo(Util.FOLDER_DeletedBackup);
            }
            if (InstallerInfo.Log.Valid)
            {
                InstallerInfo.Log.EndJob(Util.INSTALL_Success);
            }
            else
            {
                InstallerInfo.Log.EndJob(Util.INSTALL_Failed);
                bStatus = false;
            }

            //log installation event
            LogInstallEvent("Package", "Install");

            //Clear Host Cache
            DataCache.ClearHostCache(true);

            return(bStatus);
        }
Example #24
0
        public void UpdateHostSetting(string SettingName, string SettingValue, bool SettingIsSecure)
        {
            IDataReader dr = DataProvider.Instance().GetHostSetting(SettingName);

            if (dr.Read())
            {
                DataProvider.Instance().UpdateHostSetting(SettingName, SettingValue, SettingIsSecure);
            }
            else
            {
                DataProvider.Instance().AddHostSetting(SettingName, SettingValue, SettingIsSecure);
            }
            dr.Close();

            // clear host cache
            DataCache.ClearHostCache(false);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// SaveModuleControl updates a Module Control in the database.
        /// </summary>
        /// <param name="moduleControl">The Module Control to save.</param>
        /// <param name="clearCache">A flag that determines whether to clear the host cache.</param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        public static int SaveModuleControl(ModuleControlInfo moduleControl, bool clearCache)
        {
            int moduleControlID = moduleControl.ModuleControlID;

            if (moduleControlID == Null.NullInteger)
            {
                // Add new Module Definition
                moduleControlID = dataProvider.AddModuleControl(
                    moduleControl.ModuleDefID,
                    moduleControl.ControlKey,
                    moduleControl.ControlTitle,
                    moduleControl.ControlSrc,
                    moduleControl.IconFile,
                    Convert.ToInt32(moduleControl.ControlType),
                    moduleControl.ViewOrder,
                    moduleControl.HelpURL,
                    moduleControl.SupportsPartialRendering,
                    moduleControl.SupportsPopUps,
                    UserController.Instance.GetCurrentUserInfo().UserID);
            }
            else
            {
                // Upgrade Module Control
                dataProvider.UpdateModuleControl(
                    moduleControl.ModuleControlID,
                    moduleControl.ModuleDefID,
                    moduleControl.ControlKey,
                    moduleControl.ControlTitle,
                    moduleControl.ControlSrc,
                    moduleControl.IconFile,
                    Convert.ToInt32(moduleControl.ControlType),
                    moduleControl.ViewOrder,
                    moduleControl.HelpURL,
                    moduleControl.SupportsPartialRendering,
                    moduleControl.SupportsPopUps,
                    UserController.Instance.GetCurrentUserInfo().UserID);
            }

            if (clearCache)
            {
                DataCache.ClearHostCache(true);
            }

            return(moduleControlID);
        }
Example #26
0
        protected void OnUpdateSmtpClick(object sender, EventArgs e)
        {
            try
            {
                var returnUrl = ReturnUrl;

                if (IsHost)
                {
                    smtpServerSettings.Update(ref returnUrl);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
            finally
            {
                DataCache.ClearHostCache(false);
            }
        }
Example #27
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DeleteModuleDefinition deletes a Module Definition By ID
        /// </summary>
        /// <param name="moduleDefinitionId">The ID of the Module Definition to delete</param>
        /// -----------------------------------------------------------------------------
        public void DeleteModuleDefinition(int moduleDefinitionId)
        {
            //Delete associated permissions
            var permissionController = new PermissionController();

            foreach (PermissionInfo permission in permissionController.GetPermissionsByModuleDefID(moduleDefinitionId))
            {
                permissionController.DeletePermission(permission.PermissionID);
            }
            dataProvider.DeleteModuleDefinition(moduleDefinitionId);
            DataCache.ClearHostCache(true);

            // queue remove module definition from search index
            var document = new SearchDocumentToDelete
            {
                ModuleDefId = moduleDefinitionId
            };

            DataProvider.Instance().AddSearchDeletedItems(document);
        }
Example #28
0
        public static int SaveDesktopModule(DesktopModuleInfo desktopModule, bool saveChildren, bool clearCache)
        {
            int desktopModuleID = desktopModule.DesktopModuleID;

            Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
            if (desktopModuleID == Null.NullInteger)
            {
                desktopModuleID = dataProvider.AddDesktopModule(desktopModule.PackageID, desktopModule.ModuleName, desktopModule.FolderName, desktopModule.FriendlyName, desktopModule.Description, desktopModule.Version, desktopModule.IsPremium, desktopModule.IsAdmin, desktopModule.BusinessControllerClass, desktopModule.SupportedFeatures,
                                                                desktopModule.CompatibleVersions, desktopModule.Dependencies, desktopModule.Permissions, UserController.GetCurrentUserInfo().UserID);
                objEventLog.AddLog(desktopModule, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.DESKTOPMODULE_CREATED);
            }
            else
            {
                dataProvider.UpdateDesktopModule(desktopModule.DesktopModuleID, desktopModule.PackageID, desktopModule.ModuleName, desktopModule.FolderName, desktopModule.FriendlyName, desktopModule.Description, desktopModule.Version, desktopModule.IsPremium, desktopModule.IsAdmin, desktopModule.BusinessControllerClass,
                                                 desktopModule.SupportedFeatures, desktopModule.CompatibleVersions, desktopModule.Dependencies, desktopModule.Permissions, UserController.GetCurrentUserInfo().UserID);
                objEventLog.AddLog(desktopModule, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.DESKTOPMODULE_UPDATED);
            }
            if (saveChildren)
            {
                foreach (ModuleDefinitionInfo definition in desktopModule.ModuleDefinitions.Values)
                {
                    definition.DesktopModuleID = desktopModuleID;
                    ModuleDefinitionInfo moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(definition.FriendlyName, desktopModuleID);
                    if (moduleDefinition != null)
                    {
                        definition.ModuleDefID = moduleDefinition.ModuleDefID;
                    }
                    ModuleDefinitionController.SaveModuleDefinition(definition, saveChildren, clearCache);
                }
            }
            if (clearCache)
            {
                DataCache.ClearHostCache(true);
            }
            return(desktopModuleID);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the Upgrade button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/27/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void UpdateSettings(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    // TODO: Remove after refactor: this code/functionality has been copied to ..\AdvancedSettings\SmtpServerSettings.aspx)
                    //show warning message when set custom smtp port and app running under medium trust, but still can
                    //save the settings because maybe some host providers use a modified medium trusy config and allow
                    //this permission.
                    var smtpServer  = txtSMTPServer.Text;
                    var smtpWarning = !string.IsNullOrEmpty(smtpServer) &&
                                      smtpServer != DotNetNuke.Entities.Host.Host.SMTPServer &&
                                      smtpServer.Contains(":") &&
                                      smtpServer.Split(':')[1] != "25" &&
                                      !SecurityPolicy.HasAspNetHostingPermission();

                    HostController.Instance.Update("CheckUpgrade", chkUpgrade.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("DisplayBetaNotice", chkBetaNotice.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("HostPortalId", hostPortalsCombo.SelectedValue);
                    HostController.Instance.Update("HostTitle", txtHostTitle.Text, false);
                    HostController.Instance.Update("HostURL", txtHostURL.Text, false);
                    HostController.Instance.Update("HostEmail", txtHostEmail.Text.Trim(), false);
                    HostController.Instance.Update("PaymentProcessor", processorCombo.SelectedItem.Text, false);
                    HostController.Instance.Update("ProcessorUserId", txtUserId.Text, false);
                    HostController.Instance.Update("ProcessorPassword", txtPassword.Text, false);
                    HostController.Instance.Update("HostFee", txtHostFee.Text, false);
                    HostController.Instance.Update("HostCurrency", currencyCombo.SelectedValue, false);
                    HostController.Instance.Update("HostSpace", txtHostSpace.Text, false);
                    HostController.Instance.Update("PageQuota", txtPageQuota.Text, false);
                    HostController.Instance.Update("UserQuota", txtUserQuota.Text, false);
                    HostController.Instance.Update("SiteLogStorage", optSiteLogStorage.SelectedItem.Value, false);
                    HostController.Instance.Update("SiteLogBuffer", txtSiteLogBuffer.Text, false);
                    HostController.Instance.Update("SiteLogHistory", txtSiteLogHistory.Text, false);
                    HostController.Instance.Update("DemoPeriod", txtDemoPeriod.Text, false);
                    HostController.Instance.Update("DemoSignup", chkDemoSignup.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("Copyright", chkCopyright.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("DefaultDocType", docTypeCombo.SelectedValue, false);
                    HostController.Instance.Update("RememberCheckbox", chkRemember.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("EnableCustomModuleCssClass", chkUseCustomModuleCssClass.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("DisableUsersOnline", chkUsersOnline.Checked ? "N" : "Y", false);
                    HostController.Instance.Update("AutoAccountUnlockDuration", txtAutoAccountUnlock.Text, false);
                    HostController.Instance.Update("UsersOnlineTime", txtUsersOnlineTime.Text, false);
                    HostController.Instance.Update("ProxyServer", txtProxyServer.Text, false);
                    HostController.Instance.Update("ProxyPort", txtProxyPort.Text, false);
                    HostController.Instance.Update("ProxyUsername", txtProxyUsername.Text, false);
                    HostController.Instance.Update("ProxyPassword", txtProxyPassword.Text, false);
                    HostController.Instance.Update("WebRequestTimeout", txtWebRequestTimeout.Text, false);
                    // TODO: Refactor: call smtpServerSettings.Update(); This code/functionality has been copied to ..\AdvancedSettings\SmtpServerSettings.aspx)
                    HostController.Instance.Update("SMTPServer", txtSMTPServer.Text, false);
                    HostController.Instance.Update("SMTPAuthentication", optSMTPAuthentication.SelectedItem.Value, false);
                    HostController.Instance.Update("SMTPUsername", txtSMTPUsername.Text, false);
                    HostController.Instance.Update("SMTPPassword", txtSMTPPassword.Text, false);
                    HostController.Instance.Update("SMTPEnableSSL", chkSMTPEnableSSL.Checked ? "Y" : "N", false);
                    // end of code copied to smtpServerSettings.Update()
                    HostController.Instance.Update("FileExtensions", txtFileExtensions.Text, false);
                    HostController.Instance.Update("UseCustomErrorMessages", chkUseCustomErrorMessages.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("UseFriendlyUrls", chkUseFriendlyUrls.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("EnableRequestFilters", chkEnableRequestFilters.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("ControlPanel", cboControlPanel.SelectedItem.Value, false);
                    HostController.Instance.Update("SchedulerMode", cboSchedulerMode.SelectedItem.Value, false);
                    HostController.Instance.Update("PerformanceSetting", cboPerformance.SelectedItem.Value, false);
                    HostController.Instance.Update("AuthenticatedCacheability", cboCacheability.SelectedItem.Value, false);
                    HostController.Instance.Update("PageStatePersister", cboPageState.SelectedItem.Value);
                    HostController.Instance.Update("ModuleCaching", cboModuleCacheProvider.SelectedItem.Value, false);
                    if (PageCacheRow.Visible)
                    {
                        HostController.Instance.Update("PageCaching", cboPageCacheProvider.SelectedItem.Value, false);
                    }
                    HostController.Instance.Update("EnableModuleOnLineHelp", chkEnableHelp.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("EnableFileAutoSync", chkAutoSync.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("HelpURL", txtHelpURL.Text, false);
                    HostController.Instance.Update("EnableContentLocalization", chkEnableContentLocalization.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("MessageSchedulerBatchSize", txtBatch.Text, false);

                    HostController.Instance.Update("EventLogBuffer", chkLogBuffer.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("DefaultPortalSkin", hostSkinCombo.SelectedValue, false);
                    HostController.Instance.Update("DefaultAdminSkin", editSkinCombo.SelectedValue, false);
                    HostController.Instance.Update("DefaultPortalContainer", hostContainerCombo.SelectedValue, false);
                    HostController.Instance.Update("DefaultAdminContainer", editContainerCombo.SelectedValue, false);
                    HostController.Instance.Update("jQueryDebug", chkJQueryDebugVersion.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("jQueryHosted", chkJQueryUseHosted.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("jQueryUrl", txtJQueryHostedUrl.Text, false);
                    HostController.Instance.Update("jQueryUIUrl", txtJQueryUIHostedUrl.Text, false);
                    HostController.Instance.Update("EnableMsAjaxCDN", chkMsAjaxCdn.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("EnableTelerikCDN", chkTelerikCdn.Checked ? "Y" : "N", false);
                    HostController.Instance.Update("TelerikCDNBasicUrl", txtTelerikBasicUrl.Text, false);
                    HostController.Instance.Update("TelerikCDNSecureUrl", txtTelerikSecureUrl.Text, false);
                    HostController.Instance.Update("AsyncTimeout", txtAsyncTimeout.Text, false);
                    HostController.Instance.Update(ClientResourceSettings.EnableCompositeFilesKey, chkCrmEnableCompositeFiles.Checked.ToString(CultureInfo.InvariantCulture));
                    HostController.Instance.Update(ClientResourceSettings.MinifyCssKey, chkCrmMinifyCss.Checked.ToString(CultureInfo.InvariantCulture));
                    HostController.Instance.Update(ClientResourceSettings.MinifyJsKey, chkCrmMinifyJs.Checked.ToString(CultureInfo.InvariantCulture));

                    UpdateSchedule();

                    // TODO: Remove after refactor: this code/functionality has been copied to ..\AdvancedSettings\SmtpServerSettings.aspx)
                    var redirectUrl = Request.RawUrl;
                    if (smtpWarning && redirectUrl.IndexOf("smtpwarning=true", StringComparison.InvariantCultureIgnoreCase) == -1)
                    {
                        redirectUrl = string.Format("{0}{1}smtpwarning=true", redirectUrl, redirectUrl.Contains("?") ? "&" : "?");
                    }
                    Response.Redirect(redirectUrl, true);
                }
                catch (Exception exc)
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }
                finally
                {
                    DataCache.ClearHostCache(false);
                }
            }
        }
 /// <summary>
 /// Enable Cache Expirataion. This control won't affect core caching provider, its behavior determined by extended caching provider.
 /// This property designed for when process long time action, extended caching provider should not sync cache between web servers to improve performance.
 /// </summary>
 /// <seealso cref="CacheExpirationDisable"/>
 internal static void EnableCacheExpiration()
 {
     CacheExpirationDisable = false;
     DataCache.ClearHostCache(true);
     Logger.Warn("Enable cache expiration.");
 }