public void Start() { foreach (ItemDefinition definition in definitions.GetDefinitions()) { if(IsPage(definition)) { TabContainerAttribute seoTab = new TabContainerAttribute("seo", SeoTabTitle, 30); definition.Add(seoTab); AddEditableText(definition, TitleTitle, SeoConcern.HeadTitle, 151, 200); AddEditableText(definition, MetaKeywordsTitle, SeoConcern.MetaKeywords, 152, 400); AddEditableText(definition, MetaDescriptionTitle, SeoConcern.MetaDescription, 153, 1000); } } }
protected override Control AddEditor(Control container) { var panel = AddPanel(container); foreach (var themeDirectory in GetThemeDirectories()) { var themeName = Path.GetFileName(themeDirectory); if (string.IsNullOrEmpty(themeName)) continue; var tabContainer = new TabContainerAttribute(themeName + "-tab", themeName, 0); var tab = tabContainer.AddTo(panel) as TabPanel; var editor = new ItemEditor { ID = themeName.ToLower() }; editor.Init += OnChildEditorInit; tab.Controls.Add(editor); AddValidator(tab); } return panel; }
/// <summary> /// Ensures that a <see cref="TabContainerAttribute"/> exists on the item definition and /// adds it if it does not. /// </summary> /// <param name="itemDefinition">Specifies the <see cref="ItemDefinition"/> that should /// include the tab.</param> /// <param name="tabName">Specifies the desired <see cref="TabContainerAttribute.Name"/>.</param> /// <param name="tabText">Specifies the desired <see cref="TabContainerAttribute.TabText"/> /// this value is only used if no value is already present.</param> /// <param name="tabSortOrder">Specifies the desired /// <see cref="TabContainerAttribute.SortOrder"/> this value is only used if no value is /// already present.</param> public static void EnsureTab(this ItemDefinition itemDefinition, string tabName, string tabText, int tabSortOrder) { if (itemDefinition == null) throw new ArgumentNullException("itemDefinition", "itemDefinition is null."); if (String.IsNullOrEmpty(tabName)) throw new ArgumentException("tabName is null or empty.", "tabName"); if (String.IsNullOrEmpty(tabText)) throw new ArgumentException("tabText is null or empty.", "tabText"); if (itemDefinition.Containers.Any(container => container.Name == tabName)) return; // Already has tab TabContainerAttribute tab = new TabContainerAttribute( tabName, tabText, tabSortOrder); Debug.WriteLine(string.Format("{0} tab added to {1}", tabText, itemDefinition.Title)); itemDefinition.Add(tab); }