protected override void OnInit(EventArgs e) { dataTab = this.TabViewDetails.NewTabPage("Videos"); dataTab.Controls.Add(this.tabVideos); btnDownloadVideos = dataTab.Menu.NewImageButton(); btnDownloadVideos.ID = "btnDownloadVideos"; btnDownloadVideos.AlternateText = "Download"; btnDownloadVideos.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnDownloadVideos.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_download.png"; btnDownloadVideos.ValidationGroup = ""; btnRemoveFromChannel = dataTab.Menu.NewImageButton(); btnRemoveFromChannel.ID = "btnRemoveFromChannel"; btnRemoveFromChannel.AlternateText = "Remove from channel"; btnRemoveFromChannel.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnRemoveFromChannel.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_remove_from_channel.png"; btnRemoveFromChannel.ValidationGroup = ""; this.pagerVideos.PageIndexChanged += pagerVideos_PageIndexChanged; this.btnChangeChannel.Click += btnChangeChannel_Click; }
protected override void OnInit(EventArgs e) { dataTab = this.TabViewDetails.NewTabPage("Videos"); dataTab.Controls.Add(this.tabVideos); btnDownloadVideos = dataTab.Menu.NewImageButton(); btnDownloadVideos.ID = "btnDownloadVideos"; btnDownloadVideos.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnDownloadVideos.AlternateText = "Download"; btnDownloadVideos.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_download.png"; btnDownloadVideos.ValidationGroup = ""; btnAddToChannel = dataTab.Menu.NewImageButton(); btnAddToChannel.ID = "btnAddToChannel"; btnAddToChannel.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnAddToChannel.AlternateText = "AddToChannel"; btnAddToChannel.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_add_to_channel.png"; btnAddToChannel.ValidationGroup = ""; btnDeleteVideo = dataTab.Menu.NewImageButton(); btnDeleteVideo.ID = "btnDeleteVideo"; btnDeleteVideo.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnDeleteVideo.AlternateText = "Delete"; btnDeleteVideo.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_delete_video.png"; btnDeleteVideo.ValidationGroup = ""; this.pagerVideos.PageIndexChanged += pagerVideos_PageIndexChanged; }
protected override void OnInit(EventArgs e) { this._db = ApplicationContext.Current.DatabaseContext.Database; // Tab setup FirstTab = tabControl.NewTabPage("First"); FirstTab.Controls.Add(SettingsPane); SecondTab = tabControl.NewTabPage("Second"); SecondTab.Controls.Add(CreateEventPane); ThirdTab = tabControl.NewTabPage("Third"); ThirdTab.Controls.Add(ShowEventsPane); //save button ImageButton save = FirstTab.Menu.NewImageButton(); save.Click += new ImageClickEventHandler(this.save_click); save.AlternateText = "Save"; save.ImageUrl = GlobalSettings.Path + "/images/editor/save.gif"; ImageButton save2 = SecondTab.Menu.NewImageButton(); save2.Click += new ImageClickEventHandler(this.save_event_click); save2.AlternateText = "Save"; save2.ImageUrl = GlobalSettings.Path + "/images/editor/save.gif"; }
protected void AddButton( string cssClass, string text, TabPage tabPage, EventHandler method ) { if ( method != null ) { MenuButton button = tabPage.Menu.NewButton(); button.Text = text; button.CssClass = cssClass; button.Click += method; } }
public TabPage NewTabPage(string text) { Tabs.Add(text); TabPage tp = new TabPage(); tp.Width = this.Width; tp.ID = this.ID + "_tab0" + (Panels.Count + 1) + "layer"; Panels.Add(tp); this.Controls.Add(tp); return tp; }
protected override void OnInit(EventArgs e) { this._db = ApplicationContext.Current.DatabaseContext.Database; // Tab setup FirstTab = TabView1.NewTabPage("Settings"); FirstTab.Controls.Add(SettingsPane); //save button ImageButton save = FirstTab.Menu.NewImageButton(); save.Click += new ImageClickEventHandler(this.save_click); save.AlternateText = "Save"; save.ImageUrl = GlobalSettings.Path + "/images/editor/save.gif"; }
protected override void OnInit(EventArgs e) { base.OnInit(e); #region Details Tab dataTab = TabViewDetails.NewTabPage("API Settings"); dataTab.Controls.Add(panelSettings); //Create a save button for the details tab. SetSaveButtonProperties("btnSaveSettings"); dataTab = TabViewDetails.NewTabPage("Distributor Details"); dataTab.Controls.Add(panelInfo); #endregion }
protected override void OnInit(EventArgs e) { base.OnInit(e); this.Pager1.PageIndexChanged += Pager1_PageIndexChanged; dataTab = TabViewDetails.NewTabPage("Narnoo Media - Search"); dataTab.Controls.Add(this.tabSearch); btnDownload = dataTab.Menu.NewImageButton(); btnDownload.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnDownload.ID = "btnDownload"; //btnAdd.Click += new ImageClickEventHandler(btnAdd_Click); btnDownload.AlternateText = "Download"; btnDownload.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_download.png"; btnDownload.ValidationGroup = ""; this.btnSearch.Click += btnSearch_Click; }
protected override void OnInit(EventArgs e) { dataTab = this.TabViewDetails.NewTabPage("Albums"); dataTab.Controls.Add(this.tabAlbums); InitBtnDownloadAlbums(); AddChangeOperatorButton("btnChangeOperator1"); this.ddlAlbumsPageIndex.SelectedIndexChanged += ddlAlbumsPageIndex_SelectedIndexChanged; this.btnChangeAlbums.Click += btnChangeAlbums_Click; this.pagerAlbumImages.PageIndexChanged += pagerAlbumImages_PageIndexChanged; dataTab = this.TabViewDetails.NewTabPage("Images"); dataTab.Controls.Add(this.tabImages); InitBtnDownloadImages(); AddChangeOperatorButton("btnChangeOperator2"); this.pagerImages.PageIndexChanged += pagerImages_PageIndexChanged; dataTab = this.TabViewDetails.NewTabPage("Brochures"); dataTab.Controls.Add(this.tabBrochures); InitBtnDownloadBrochures(); this.pagerBrochures.PageIndexChanged += pagerBrochures_PageIndexChanged; dataTab = this.TabViewDetails.NewTabPage("Videos"); dataTab.Controls.Add(this.tabVideos); InitBtnDownloadVideos(); InitBtnAddToChannel(); AddChangeOperatorButton("btnChangeOperator4"); this.pagerVideos.PageIndexChanged += pagerVideos_PageIndexChanged; dataTab = this.TabViewDetails.NewTabPage("Text"); dataTab.Controls.Add(this.tabText); AddChangeOperatorButton("btnChangeOperator5"); this.pagerText.PageIndexChanged += pagerText_PageIndexChanged; this.btnReloadTabView.Click += ReloadTabView; }
protected override void OnInit(EventArgs e) { dataTab = this.TabViewDetails.NewTabPage("Brochures"); dataTab.Controls.Add(this.tabBrochures); btnDownloadBrochures = dataTab.Menu.NewImageButton(); btnDownloadBrochures.ID = "btnDownloadBrochures"; btnDownloadBrochures.AlternateText = "Download"; btnDownloadBrochures.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnDownloadBrochures.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_download.png"; btnDownloadBrochures.ValidationGroup = ""; btnDeleteBrochures = dataTab.Menu.NewImageButton(); btnDeleteBrochures.ID = "btnDeleteBrochures"; btnDeleteBrochures.AlternateText = "Delete"; btnDeleteBrochures.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnDeleteBrochures.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_delete_brochures.png"; btnDeleteBrochures.ValidationGroup = ""; this.pagerBrochures.PageIndexChanged += pagerBrochures_PageIndexChanged; }
protected override void OnInit(EventArgs e) { dataTab = this.TabViewDetails.NewTabPage("Albums"); dataTab.Controls.Add(this.tabAlbums); //Create a save button from the current datatab. btnDownloadAlbums = dataTab.Menu.NewImageButton(); btnDownloadAlbums.ID = "btnDownloadAlbumImage"; btnDownloadAlbums.AlternateText = "Download"; btnDownloadAlbums.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnDownloadAlbums.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_download.png"; btnDownloadAlbums.ValidationGroup = ""; btnRemoveFromAlbum = dataTab.Menu.NewImageButton(); btnRemoveFromAlbum.ID = "btnRemoveFromAlbum"; btnRemoveFromAlbum.AlternateText = "Remove"; btnRemoveFromAlbum.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnRemoveFromAlbum.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_remove_from_album.png"; btnRemoveFromAlbum.ValidationGroup = ""; this.ddlAlbumsPageIndex.SelectedIndexChanged += ddlAlbumsPageIndex_SelectedIndexChanged; this.btnChangeAlbums.Click += btnChangeAlbums_Click; this.pagerAlbumImages.PageIndexChanged += pagerAlbumImages_PageIndexChanged; }
protected override void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); // Tab setup InfoTabPage = TabView1.NewTabPage("Macro Properties"); InfoTabPage.Controls.Add(Pane1); InfoTabPage.Controls.Add(Pane1_2); InfoTabPage.Controls.Add(Pane1_3); InfoTabPage.Controls.Add(Pane1_4); Parameters = TabView1.NewTabPage("Parameters"); Parameters.Controls.Add(Panel2); ImageButton save = InfoTabPage.Menu.NewImageButton(); save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif"; save.ID = "save"; ImageButton save2 = Parameters.Menu.NewImageButton(); save2.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif"; base.OnInit(e); }
private void AddControlNew(Property p, TabPage tp, string cap) { IDataType dt = p.PropertyType.DataTypeDefinition.DataType; dt.DataEditor.Editor.ID = string.Format("prop_{0}", p.PropertyType.Alias); dt.Data.PropertyId = p.Id; //Add the DataType to an internal dictionary, which will be used to call the save method on the IDataEditor //and to retrieve the value from IData in editContent.aspx.cs, so that it can be set on the legacy Document class. DataTypes.Add(p.PropertyType.Alias, dt); // check for buttons IDataFieldWithButtons df1 = dt.DataEditor.Editor as IDataFieldWithButtons; if (df1 != null) { ((Control)df1).ID = p.PropertyType.Alias; if (df1.MenuIcons.Length > 0) tp.Menu.InsertSplitter(); // Add buttons int c = 0; bool atEditHtml = false; bool atSplitter = false; foreach (object o in df1.MenuIcons) { try { MenuIconI m = (MenuIconI)o; MenuIconI mi = tp.Menu.NewIcon(); mi.ImageURL = m.ImageURL; mi.OnClickCommand = m.OnClickCommand; mi.AltText = m.AltText; mi.ID = tp.ID + "_" + m.ID; if (m.ID == "html") atEditHtml = true; else atEditHtml = false; atSplitter = false; } catch { tp.Menu.InsertSplitter(); atSplitter = true; } // Testing custom styles in editor if (atSplitter && atEditHtml && dt.DataEditor.TreatAsRichTextEditor) { DropDownList ddl = tp.Menu.NewDropDownList(); ddl.Style.Add("margin-bottom", "5px"); ddl.Items.Add(ui.Text("buttons", "styleChoose", null)); ddl.ID = tp.ID + "_editorStyle"; if (StyleSheet.GetAll().Length > 0) { foreach (StyleSheet s in StyleSheet.GetAll()) { foreach (StylesheetProperty sp in s.Properties) { ddl.Items.Add(new ListItem(sp.Text, sp.Alias)); } } } ddl.Attributes.Add("onChange", "addStyle(this, '" + p.PropertyType.Alias + "');"); atEditHtml = false; } c++; } } // check for element additions IMenuElement menuElement = dt.DataEditor.Editor as IMenuElement; if (menuElement != null) { // add separator tp.Menu.InsertSplitter(); // add the element tp.Menu.NewElement(menuElement.ElementName, menuElement.ElementIdPreFix + p.Id.ToString(), menuElement.ElementClass, menuElement.ExtraMenuWidth); } Pane pp = new Pane(); Control holder = new Control(); holder.Controls.Add(dt.DataEditor.Editor); if (p.PropertyType.DataTypeDefinition.DataType.DataEditor.ShowLabel) { string caption = p.PropertyType.Name; if (p.PropertyType.Description != null && p.PropertyType.Description != String.Empty) switch (UmbracoSettings.PropertyContextHelpOption) { case "icon": caption += " <img src=\"" + this.ResolveUrl(SystemDirectories.Umbraco) + "/images/help.png\" class=\"umbPropertyContextHelp\" alt=\"" + p.PropertyType.Description + "\" title=\"" + p.PropertyType.Description + "\" />"; break; case "text": caption += "<br /><small>" + umbraco.library.ReplaceLineBreaks(p.PropertyType.Description) + "</small>"; break; } pp.addProperty(caption, holder); } else pp.addProperty(holder); // Validation if (p.PropertyType.Mandatory) { try { var rq = new RequiredFieldValidator { ControlToValidate = dt.DataEditor.Editor.ID, CssClass = "error" }; rq.Style.Add(HtmlTextWriterStyle.Display, "block"); rq.Style.Add(HtmlTextWriterStyle.Padding, "2px"); var component = dt.DataEditor.Editor; // holder.FindControl(rq.ControlToValidate); var attribute = (ValidationPropertyAttribute)TypeDescriptor.GetAttributes(component)[typeof(ValidationPropertyAttribute)]; PropertyDescriptor pd = null; if (attribute != null) { pd = TypeDescriptor.GetProperties(component, null)[attribute.Name]; } if (pd != null) { rq.EnableClientScript = false; rq.Display = ValidatorDisplay.Dynamic; string[] errorVars = { p.PropertyType.Name, cap }; rq.ErrorMessage = ui.Text("errorHandling", "errorMandatory", errorVars, null) + "<br/>"; holder.Controls.AddAt(0, rq); } } catch (Exception valE) { HttpContext.Current.Trace.Warn("contentControl", "EditorControl (" + dt.DataTypeName + ") does not support validation", valE); } } // RegExp Validation if (p.PropertyType.ValidationRegExp != "") { try { var rv = new RegularExpressionValidator { ControlToValidate = dt.DataEditor.Editor.ID, CssClass = "error" }; rv.Style.Add(HtmlTextWriterStyle.Display, "block"); rv.Style.Add(HtmlTextWriterStyle.Padding, "2px"); var component = dt.DataEditor.Editor; // holder.FindControl(rq.ControlToValidate); var attribute = (ValidationPropertyAttribute)TypeDescriptor.GetAttributes(component)[typeof(ValidationPropertyAttribute)]; PropertyDescriptor pd = null; if (attribute != null) { pd = TypeDescriptor.GetProperties(component, null)[attribute.Name]; } if (pd != null) { rv.ValidationExpression = p.PropertyType.ValidationRegExp; rv.EnableClientScript = false; rv.Display = ValidatorDisplay.Dynamic; string[] errorVars = { p.PropertyType.Name, cap }; rv.ErrorMessage = ui.Text("errorHandling", "errorRegExp", errorVars, null) + "<br/>"; holder.Controls.AddAt(0, rv); } } catch (Exception valE) { HttpContext.Current.Trace.Warn("contentControl", "EditorControl (" + dt.DataTypeName + ") does not support validation", valE); } } // This is once again a nasty nasty hack to fix gui when rendering wysiwygeditor if (dt.DataEditor.TreatAsRichTextEditor) { tp.Controls.Add(dt.DataEditor.Editor); } else { Panel ph = new Panel(); ph.Attributes.Add("style", "padding: 0; position: relative;"); // NH 4.7.1, latest styles added to support CP item: 30363 ph.Controls.Add(pp); tp.Controls.Add(ph); } }
private void AddSaveAndPublishButtons(ref TabPage tp) { MenuImageButton menuSave = tp.Menu.NewImageButton(); menuSave.ID = tp.ID + "_save"; menuSave.ImageUrl = UmbracoPath + "/images/editor/save.gif"; menuSave.Click += new ImageClickEventHandler(SaveClick); menuSave.OnClickCommand = "invokeSaveHandlers();"; menuSave.AltText = ui.Text("buttons", "save", null); if (_canPublish == publishModes.Publish) { MenuImageButton menuPublish = tp.Menu.NewImageButton(); menuPublish.ID = tp.ID + "_publish"; menuPublish.ImageUrl = UmbracoPath + "/images/editor/saveAndPublish.gif"; menuPublish.OnClickCommand = "invokeSaveHandlers();"; menuPublish.Click += new ImageClickEventHandler(DoSaveAndPublish); menuPublish.AltText = ui.Text("buttons", "saveAndPublish", null); } else if (_canPublish == publishModes.SendToPublish) { MenuImageButton menuToPublish = tp.Menu.NewImageButton(); menuToPublish.ID = tp.ID + "_topublish"; menuToPublish.ImageUrl = UmbracoPath + "/images/editor/saveToPublish.gif"; menuToPublish.OnClickCommand = "invokeSaveHandlers();"; menuToPublish.Click += new ImageClickEventHandler(DoSaveToPublish); menuToPublish.AltText = ui.Text("buttons", "saveToPublish", null); } }
/// <summary> /// Loades PropertyTypes by Tab using the Legacy API. /// </summary> /// <param name="tab"></param> /// <param name="tabPage"></param> /// <param name="inTab"></param> private void LoadPropertyTypes(ContentType.TabI tab, TabPage tabPage, Hashtable inTab) { // Iterate through the property types and add them to the tab // zb-00036 #29889 : fix property types getter to get the right set of properties // ge : had a bit of a corrupt db and got weird NRE errors so rewrote this to catch the error and rethrow with detail var propertyTypes = tab.GetPropertyTypes(_content.ContentType.Id); foreach (var propertyType in propertyTypes.OrderBy(x => x.SortOrder)) { var property = _content.getProperty(propertyType); if (property != null && tabPage != null) { AddControlNew(property, tabPage, tab.Caption); // adding this check, as we occasionally get an already in dictionary error, though not sure why if (!inTab.ContainsKey(propertyType.Id.ToString(CultureInfo.InvariantCulture))) inTab.Add(propertyType.Id.ToString(CultureInfo.InvariantCulture), true); } else { throw new ArgumentNullException( string.Format( "Property {0} ({1}) on Content Type {2} could not be retrieved for Document {3} on Tab Page {4}. To fix this problem, delete the property and recreate it.", propertyType.Alias, propertyType.Id, _content.ContentType.Alias, _content.Id, tab.Caption)); } } }
/// <summary> /// Loades PropertyTypes by Tab/PropertyGroup using the new API. /// </summary> /// <param name="contentType"></param> /// <param name="tabPage"></param> /// <param name="inTab"></param> /// <param name="tabId"></param> /// <param name="tabCaption"></param> private void LoadPropertyTypes(IContentTypeComposition contentType, TabPage tabPage, Hashtable inTab, int tabId, string tabCaption) { var propertyGroups = contentType.CompositionPropertyGroups.Where(x => x.Id == tabId || x.ParentId == tabId); var propertyTypeAliases = propertyGroups.SelectMany(x => x.PropertyTypes.OrderBy(y => y.SortOrder).Select(y => new Tuple<int, string, int>(y.Id, y.Alias, y.SortOrder))); foreach (var items in propertyTypeAliases) { var property = _content.getProperty(items.Item2); if (property != null) { AddControlNew(property, tabPage, tabCaption); if (!inTab.ContainsKey(items.Item1.ToString(CultureInfo.InvariantCulture))) inTab.Add(items.Item1.ToString(CultureInfo.InvariantCulture), true); } else { throw new ArgumentNullException( string.Format( "Property {0} ({1}) on Content Type {2} could not be retrieved for Document {3} on Tab Page {4}. To fix this problem, delete the property and recreate it.", items.Item2, items.Item1, _content.ContentType.Alias, _content.Id, tabCaption)); } } }
/// <summary> /// Create and setup all of the controls child controls. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); _prntpage = (UmbracoEnsuredPage)Page; int i = 0; Hashtable inTab = new Hashtable(); // zb-00036 #29889 : load it only once if (_virtualTabs == null) _virtualTabs = _content.ContentType.getVirtualTabs.ToList(); if(_contentType == null) _contentType = ContentType.GetContentType(_content.ContentType.Id); foreach (ContentType.TabI tab in _virtualTabs) { var tabPage = this.Panels[i] as TabPage; if (tabPage == null) { throw new ArgumentException("Unable to load tab \"" + tab.Caption + "\""); } tabPage.Style.Add("text-align", "center"); //Legacy vs New API loading of PropertyTypes if (_contentType.ContentTypeItem != null) { LoadPropertyTypes(_contentType.ContentTypeItem, tabPage, inTab, tab.Id, tab.Caption); } else { LoadPropertyTypes(tab, tabPage, inTab); } i++; } // Add property pane tpProp = NewTabPage(ui.Text("general", "properties", null)); AddSaveAndPublishButtons(ref tpProp); tpProp.Controls.Add( new LiteralControl("<div id=\"errorPane_" + tpProp.ClientID + "\" style=\"display: none; text-align: left; color: red;width: 100%; border: 1px solid red; background-color: #FCDEDE\"><div><b>There were errors - data has not been saved!</b><br/></div></div>")); //if the property is not in a tab, add it to the general tab var props = _content.GenericProperties; foreach (Property p in props) { if (inTab[p.PropertyType.Id.ToString()] == null) AddControlNew(p, tpProp, ui.Text("general", "properties", null)); } }
/// <summary> /// Create and setup all of the controls child controls. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); SaveAndPublish += new EventHandler(standardSaveAndPublishHandler); Save += new EventHandler(standardSaveAndPublishHandler); prntpage = (UmbracoEnsuredPage)Page; int i = 0; var inTab = new Hashtable(); // zb-00036 #29889 : load it only once if (virtualTabs == null) virtualTabs = _content.ContentType.getVirtualTabs.ToList(); foreach (ContentType.TabI t in virtualTabs) { var tp = this.Panels[i] as TabPage; if (tp == null) { throw new ArgumentException("Unable to load tab \"" + t.Caption + "\""); } //TabPage tp = NewTabPage(t.Caption); //addSaveAndPublishButtons(ref tp); tp.Style.Add("text-align", "center"); // Iterate through the property types and add them to the tab // zb-00036 #29889 : fix property types getter to get the right set of properties foreach (PropertyType pt in t.GetPropertyTypes(_content.ContentType.Id)) { // table.Rows.Add(addControl(_content.getProperty(editPropertyType.Alias), tp)); addControlNew(_content.getProperty(pt), tp, t.Caption); inTab.Add(pt.Id.ToString(), true); } i++; } // Add property pane tpProp = NewTabPage(ui.Text("general", "properties", null)); addSaveAndPublishButtons(ref tpProp); tpProp.Controls.Add( new LiteralControl("<div id=\"errorPane_" + tpProp.ClientID + "\" style=\"display: none; text-align: left; color: red;width: 100%; border: 1px solid red; background-color: #FCDEDE\"><div><b>There were errors - data has not been saved!</b><br/></div></div>")); //if the property is not in a tab, add it to the general tab var props = _content.GenericProperties; foreach (Property p in props) { if (inTab[p.PropertyType.Id.ToString()] == null) addControlNew(p, tpProp, ui.Text("general", "properties", null)); } }
/// <summary> /// Create and setup all of the controls child controls. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); SaveAndPublish += new EventHandler(standardSaveAndPublishHandler); Save += new EventHandler(standardSaveAndPublishHandler); prntpage = (UmbracoEnsuredPage)Page; int i = 0; var inTab = new Hashtable(); // zb-00036 #29889 : load it only once if (virtualTabs == null) virtualTabs = _content.ContentType.getVirtualTabs.ToList(); foreach (ContentType.TabI tab in virtualTabs) { var tabPage = this.Panels[i] as TabPage; if (tabPage == null) { throw new ArgumentException("Unable to load tab \"" + tab.Caption + "\""); } //TabPage tp = NewTabPage(t.Caption); //addSaveAndPublishButtons(ref tp); tabPage.Style.Add("text-align", "center"); // Iterate through the property types and add them to the tab // zb-00036 #29889 : fix property types getter to get the right set of properties // ge : had a bit of a corrupt db and got weird NRE errors so rewrote this to catch the error and rethrow with detail foreach (PropertyType propertyType in tab.GetPropertyTypes(_content.ContentType.Id)) { // table.Rows.Add(addControl(_content.getProperty(editPropertyType.Alias), tp)); var property = _content.getProperty(propertyType); if (property != null && tabPage != null) { addControlNew(property, tabPage, tab.Caption); // adding this check, as we occasionally get an already in dictionary error, though not sure why if (!inTab.ContainsKey(propertyType.Id.ToString())) inTab.Add(propertyType.Id.ToString(), true); } else { throw new ArgumentNullException(string.Format("Property {0} ({1}) on Content Type {2} could not be retrieved for Document {3} on Tab Page {4}. To fix this problem, delete the property and recreate it.", propertyType.Alias, propertyType.Id, _content.ContentType.Alias, _content.Id, tab.Caption)); } } i++; } // Add property pane tpProp = NewTabPage(ui.Text("general", "properties", null)); addSaveAndPublishButtons(ref tpProp); tpProp.Controls.Add( new LiteralControl("<div id=\"errorPane_" + tpProp.ClientID + "\" style=\"display: none; text-align: left; color: red;width: 100%; border: 1px solid red; background-color: #FCDEDE\"><div><b>There were errors - data has not been saved!</b><br/></div></div>")); //if the property is not in a tab, add it to the general tab var props = _content.GenericProperties; foreach (Property p in props) { if (inTab[p.PropertyType.Id.ToString()] == null) addControlNew(p, tpProp, ui.Text("general", "properties", null)); } }
protected override void OnInit(EventArgs e) { // Tab setup InfoTabPage = TabView1.NewTabPage("Macro Properties"); InfoTabPage.Controls.Add(Pane1); InfoTabPage.Controls.Add(Pane1_2); InfoTabPage.Controls.Add(Pane1_3); InfoTabPage.Controls.Add(Pane1_4); Parameters = TabView1.NewTabPage("Parameters"); Parameters.Controls.Add(Panel2); MenuButton save = TabView1.Menu.NewButton(); save.ButtonType = MenuButtonType.Primary; save.Text = ui.Text("save"); save.ID = "save"; base.OnInit(e); }
public TabPage NewTabPage(string text) { Tabs.Add(text); TabPage tp = new TabPage(); tp.Width = this.Width; tp.ID = "tab0" + (TabPages.Count + 1); tp.Text = text; tp.parent = this; Panels.Add(tp); TabPages.Add(tp.ID, tp); _tabsHolder.Controls.Add(tp); return tp; }