Esempio n. 1
0
        private void ClearTabCacheInternal(int portalId, bool clearRuntime)
        {
            RemoveFormattedCacheKey(DataCache.TabCacheKey, clearRuntime, portalId);
            RemoveFormattedCacheKey(DataCache.TabAliasSkinCacheKey, clearRuntime, portalId);
            RemoveFormattedCacheKey(DataCache.TabCustomAliasCacheKey, clearRuntime, portalId);
            RemoveFormattedCacheKey(DataCache.TabUrlCacheKey, clearRuntime, portalId);
            RemoveFormattedCacheKey(DataCache.TabPermissionCacheKey, clearRuntime, portalId);
            Dictionary <string, Locale> locales = LocaleController.Instance.GetLocales(portalId);

            if (locales == null || locales.Count == 0)
            {
                //At least attempt to remove default locale
                string defaultLocale = PortalController.GetPortalDefaultLanguage(portalId);
                RemoveCacheKey(string.Format(DataCache.TabPathCacheKey, defaultLocale, portalId), clearRuntime);
            }
            else
            {
                foreach (Locale portalLocale in LocaleController.Instance.GetLocales(portalId).Values)
                {
                    RemoveCacheKey(string.Format(DataCache.TabPathCacheKey, portalLocale.Code, portalId), clearRuntime);
                }
            }

            RemoveCacheKey(string.Format(DataCache.TabPathCacheKey, Null.NullString, portalId), clearRuntime);
            RemoveCacheKey(string.Format(DataCache.TabSettingsCacheKey, portalId), clearRuntime);
        }
Esempio n. 2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ProfileUpdateCompleted runs when the Profile has been updated
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	3/20/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void ProfileUpdateCompleted(object sender, EventArgs e)
        {
            if (IsUserOrAdmin == false)
            {
                return;
            }
            if (IsUser)
            {
                //Notify the user that his/her profile was updated
                Mail.SendMail(User, MessageType.ProfileUpdated, PortalSettings);

                ProfilePropertyDefinition localeProperty = User.Profile.GetProperty("PreferredLocale");
                if (localeProperty.IsDirty)
                {
                    //store preferredlocale in cookie, if none specified set to portal default.
                    if (User.Profile.PreferredLocale == string.Empty)
                    {
                        Localization.SetLanguage(PortalController.GetPortalDefaultLanguage(User.PortalID));
                    }
                    else
                    {
                        Localization.SetLanguage(User.Profile.PreferredLocale);
                    }
                }
            }

            //Redirect to same page (this will update all controls for any changes to profile
            //and leave us at Page 0 (User Credentials)
            Response.Redirect(Request.RawUrl, true);
        }
        private void ClearPortalCacheInternal(int portalId, bool cascade, bool clearRuntime)
        {
            this.RemoveFormattedCacheKey(DataCache.PortalSettingsCacheKey, clearRuntime, portalId, string.Empty);

            var locales = LocaleController.Instance.GetLocales(portalId);

            if (locales == null || locales.Count == 0)
            {
                // At least attempt to remove default locale
                string defaultLocale = PortalController.GetPortalDefaultLanguage(portalId);
                this.RemoveCacheKey(string.Format(DataCache.PortalCacheKey, portalId, defaultLocale), clearRuntime);
                this.RemoveCacheKey(string.Format(DataCache.PortalCacheKey, portalId, Null.NullString), clearRuntime);
                this.RemoveFormattedCacheKey(DataCache.PortalSettingsCacheKey, clearRuntime, portalId, defaultLocale);
            }
            else
            {
                foreach (Locale portalLocale in LocaleController.Instance.GetLocales(portalId).Values)
                {
                    this.RemoveCacheKey(string.Format(DataCache.PortalCacheKey, portalId, portalLocale.Code), clearRuntime);
                    this.RemoveFormattedCacheKey(DataCache.PortalSettingsCacheKey, clearRuntime, portalId, portalLocale.Code);
                }

                this.RemoveCacheKey(string.Format(DataCache.PortalCacheKey, portalId, Null.NullString), clearRuntime);
                this.RemoveFormattedCacheKey(DataCache.PortalSettingsCacheKey, clearRuntime, portalId, Null.NullString);
            }

            if (cascade)
            {
                foreach (KeyValuePair <int, TabInfo> tabPair in TabController.Instance.GetTabsByPortal(portalId))
                {
                    this.ClearModuleCacheInternal(tabPair.Value.TabID, clearRuntime);
                }

                foreach (ModuleInfo moduleInfo in ModuleController.Instance.GetModules(portalId))
                {
                    this.RemoveCacheKey("GetModuleSettings" + moduleInfo.ModuleID, clearRuntime);
                }
            }

            // Clear "portal keys" for Portal
            this.ClearFolderCacheInternal(portalId, clearRuntime);
            this.ClearCacheKeysByPortalInternal(portalId, clearRuntime);
            this.ClearDesktopModuleCacheInternal(portalId, clearRuntime);
            this.ClearTabCacheInternal(portalId, clearRuntime);

            this.RemoveCacheKey(string.Format(DataCache.RolesCacheKey, portalId), clearRuntime);
            this.RemoveCacheKey(string.Format(DataCache.JournalTypesCacheKey, portalId), clearRuntime);
        }
Esempio n. 4
0
        private void ClearPortalCacheInternal(int portalId, bool cascade, bool clearRuntime)
        {
            RemoveFormattedCacheKey(DataCache.PortalSettingsCacheKey, clearRuntime, portalId);

            Dictionary <string, Locale> locales = LocaleController.Instance.GetLocales(portalId);

            if (locales == null || locales.Count == 0)
            {
                //At least attempt to remove default locale
                string defaultLocale = PortalController.GetPortalDefaultLanguage(portalId);
                RemoveCacheKey(String.Format(DataCache.PortalCacheKey, portalId, defaultLocale), clearRuntime);
            }
            else
            {
                foreach (Locale portalLocale in LocaleController.Instance.GetLocales(portalId).Values)
                {
                    RemoveCacheKey(String.Format(DataCache.PortalCacheKey, portalId, portalLocale.Code), clearRuntime);
                }
            }
            if (cascade)
            {
                var objTabs = new TabController();
                foreach (KeyValuePair <int, TabInfo> tabPair in objTabs.GetTabsByPortal(portalId))
                {
                    ClearModuleCacheInternal(tabPair.Value.TabID, clearRuntime);
                }
                var moduleController = new ModuleController();
                foreach (ModuleInfo moduleInfo in moduleController.GetModules(portalId))
                {
                    RemoveCacheKey("GetModuleSettings" + moduleInfo.ModuleID, clearRuntime);
                }
            }

            //Clear "portal keys" for Portal
            ClearFolderCacheInternal(portalId, clearRuntime);
            ClearCacheKeysByPortalInternal(portalId, clearRuntime);
            ClearDesktopModuleCacheInternal(portalId, clearRuntime);
            ClearTabCacheInternal(portalId, clearRuntime);

            RemoveCacheKey(String.Format(DataCache.RolesCacheKey, portalId), clearRuntime);
            RemoveCacheKey(String.Format(DataCache.JournalTypesCacheKey, portalId), clearRuntime);
        }
Esempio n. 5
0
        private void ClearPortalCacheInternal(int portalId, bool cascade, bool clearRuntime)
        {
            RemoveFormattedCacheKey(DataCache.PortalSettingsCacheKey, clearRuntime, portalId);
            Dictionary <string, Locale> locales = CommonLibrary.Services.Localization.Localization.GetLocales(portalId);

            if (locales.Count == 0)
            {
                //At least attempt to remove default locale
                string defaultLocale = PortalController.GetPortalDefaultLanguage(portalId);
                RemoveCacheKey(String.Format(DataCache.PortalCacheKey, portalId.ToString() + "-" + defaultLocale), clearRuntime);
            }
            else
            {
                foreach (Locale portalLocale in Localization.Localization.GetLocales(portalId).Values)
                {
                    RemoveCacheKey(String.Format(DataCache.PortalCacheKey, portalId.ToString() + "-" + portalLocale.Code), clearRuntime);
                }
            }
            if (cascade)
            {
                TabController objTabs = new TabController();
                foreach (KeyValuePair <int, TabInfo> tabPair in objTabs.GetTabsByPortal(portalId))
                {
                    ClearModuleCacheInternal(tabPair.Value.TabID, clearRuntime);
                }
                ModuleController moduleController = new ModuleController();
                foreach (ModuleInfo moduleInfo in moduleController.GetModules(portalId))
                {
                    RemoveCacheKey("GetModuleSettings" + moduleInfo.ModuleID.ToString(), clearRuntime);
                }
            }
            ClearFolderCacheInternal(portalId, clearRuntime);
            ClearCacheKeysByPortalInternal(portalId, clearRuntime);
            ClearDesktopModuleCacheInternal(portalId, clearRuntime);
            ClearTabCacheInternal(portalId, clearRuntime);
        }