Example #1
0
        public void Initialize()
        {
            _utilities =
                Telligent.Evolution.Extensibility.Version1.PluginManager.GetSingleton <IThemeUtilities>();

            if (_utilities == null || !_utilities.EnableThemePageControls)
            {
                return;
            }

            ContentFragmentPageService           = Services.Get <IContentFragmentPageService>();
            ContentFragmentScopedPropertyService = Services.Get <IContentFragmentScopedPropertyService>();
            ThemeTypeService        = Services.Get <IThemeTypeService>();
            _userThemeTypeId        = CSContext.Current.SiteSettings.UserThemeTypeID;
            _siteThemeTypeId        = SiteThemeContext.Instance().ThemeTypeID;
            _groupThemeTypeId       = CSContext.Current.SiteSettings.GroupThemeTypeID;
            _blogThemeTypeId        = CSContext.Current.SiteSettings.BlogThemeTypeID;
            _themeContextId         = Guid.Empty;
            _siteThemeName          = CSContext.Current.SiteTheme;
            _themeConfigurationData = ThemeConfigurationDatas.GetThemeConfigurationData(_siteThemeTypeId,
                                                                                        _themeContextId,
                                                                                        _siteThemeName, false);
            _themeFileFolders = new List <string>
            {
                Constants.ThemeStylesheetFiles,
                Constants.ThemePrintStylesheetFiles,
                Constants.ThemeJavascriptFiles,
                Constants.ThemeGeneralFiles
            };
        }
Example #2
0
        internal void RevertConfiguration()
        {
            ThemeConfigurationData themeConfigurationData = ThemeConfigurationDatas.GetThemeConfigurationData(_siteThemeTypeId,
                                                                                                              _themeContextId, _siteThemeName, false);

            if (themeConfigurationData == null)
            {
                return;
            }

            PropertyGroup[] propertyGroups = themeConfigurationData.PropertyGroups;

            foreach (
                Property current in
                propertyGroups.SelectMany(
                    propertyGroup =>
                    propertyGroup.GetAllProperties()
                    .Where(current => !_themeFileFolders.Contains(current.ID))))
            {
                themeConfigurationData.ClearValue(current);
            }

            themeConfigurationData.Commit();
        }