public override void DataBind() { ThemeConfigurationData themeConfig = ObjectManager.Get <ThemeConfigurationData>(ThemeConfigurationData.GetKey(Request.QueryString[Graffiti.Core.API.QueryStringKey.Theme])); themeConfig.Theme = Request.QueryString[Graffiti.Core.API.QueryStringKey.Theme]; ConfigurationForm.ConfigurationData = themeConfig; bool hasGroups = false; if (themeConfig.PropertyGroups != null) { foreach (Telligent.DynamicConfiguration.Components.PropertyGroup group in themeConfig.PropertyGroups) { if (group.Visible) { hasGroups = true; break; } } } Save.Visible = hasGroups; ConfigWrapper.Visible = hasGroups; NoConfigWrapper.Visible = !hasGroups; if (!hasGroups) { SetMessage(StatusType.Warning, "The selected theme does not require any additional configuration."); } base.DataBind(); }
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 }; }
internal void RevertFiles() { List <ThemeFileInfo> themeFileInfoList = ThemeFileInfos.ToList(); ThemeConfigurationData configuration = ThemeConfigurationDatas.GetFactoryDefaultThemeConfigurationData(_siteThemeTypeId, _siteThemeName); themeFileInfoList.ForEach(info => { if (info.HasConfiguredVersion) { ThemeFiles.DeleteFile(info.ThemeFile.ThemeTypeID, info.ThemeFile.ThemeContextID, info.ThemeFile.ThemeName, info.ThemeFile.PropertyName, info.ThemeFile.FileName); return; } if (info.HasDeletedConfiguredVersion) { IEnumerable <ThemeFile> themeFiles = ThemeFiles.DeserializeThemeFiles(configuration, info.ThemeFile.PropertyName, configuration.GetCustomValue(info.ThemeFile.PropertyName, String.Empty)); ThemeFile themeFile = themeFiles.FirstOrDefault( t => String.Compare(t.FileName, info.ThemeFile.FileName, StringComparison.OrdinalIgnoreCase) == 0); if (themeFile != null) { IList <ThemeFile> list = ThemeFiles.DeserializeThemeFiles(_siteThemeTypeId, _themeContextId, _siteThemeName, info.ThemeFile.PropertyName, _themeConfigurationData.GetCustomValue( info.ThemeFile.PropertyName, String.Empty)); list.Add(themeFile); string value = ThemeFiles.SerializeThemeFiles(list); _themeConfigurationData.SetCustomValue( info.ThemeFile.PropertyName, value); ThemeConfigurationDatas.Update(_themeConfigurationData); } } }); }
protected void RestoreDefaults_Click(object sender, EventArgs e) { ThemeConfigurationData data = ConfigurationForm.ConfigurationData as ThemeConfigurationData; if (data != null) { foreach (Telligent.DynamicConfiguration.Components.PropertyGroup group in data.PropertyGroups) { foreach (Telligent.DynamicConfiguration.Components.Property property in group.GetAllProperties()) { data.ClearValue(property); } } ConfigurationForm.ReloadControlValuesFromConfigurationData(); ConfigurationForm.Commit(); SetMessage(StatusType.Success, "The default values have been restored and saved."); } }
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(); }
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 }; }