/// <summary> /// Prepares the layout of the web part. /// </summary> protected override void PrepareLayout() { StartLayout(true); // Tab headers string[] headers = TextHelper.EnsureLineEndings(TabHeaders, "\n").Split('\n'); if ((ActiveTabIndex >= 1) && (ActiveTabIndex <= Tabs)) { tabs.ActiveTabIndex = ActiveTabIndex - 1; } for (int i = 1; i <= Tabs; i++) { // Create new tab TabPanel tab = new TabPanel(); tab.ID = "tab" + i; // Prepare the header string header = null; if (headers.Length >= i) { header = ResHelper.LocalizeString(headers[i - 1]); } if (String.IsNullOrEmpty(header)) { header = "Tab " + i; } tabs.Tabs.Add(tab); AddZone(ID + "_" + i, header, tab); if (IsDesign) { header = EditableWebPartProperty.GetHTMLCode(null, this, "TabHeaders", i, EditablePropertyTypeEnum.TextBox, header, null, null, null, true); } else { header = EditableWebPartProperty.ApplyReplacements(HttpUtility.HtmlEncode(header), false); } tab.HeaderText = header; } // Wireframe design tabs.TabStripPlacement = GetTabStripPlacement(TabStripPlacement); tabs.CssClass = "WireframeTabs"; // Set width / height string width = Width; if (!String.IsNullOrEmpty(width)) { tabs.Width = new Unit(width); } if (IsDesign && AllowDesignMode) { // Pane actions if (Tabs > 1) { AppendRemoveAction(GetString("Layout.RemoveTab"), "Tabs", "icon-times", null); Append(" "); } AppendAddAction(GetString("Layout.AddTab"), "Tabs", "icon-plus", null); resElem.ResizedElementID = tabs.ClientID; } // Render the actions string actions = FinishLayout(false); if (!String.IsNullOrEmpty(actions)) { pnlActions.Visible = true; ltlActions.Text = actions; } }
/// <summary> /// Prepares the layout of the web part. /// </summary> protected override void PrepareLayout() { StartLayout(true); // Pane headers string[] headers = TextHelper.EnsureLineEndings(PaneHeaders, "\n").Split('\n'); for (int i = 1; i <= Panes; i++) { // Create new pane AccordionPane pane = new AccordionPane(); pane.ID = "pane" + i; // Prepare the header string header = null; if (headers.Length >= i) { header = ResHelper.LocalizeString(headers[i - 1]); } if (String.IsNullOrEmpty(header)) { header = "Pane " + i; } string title = header; if (IsDesign) { header = EditableWebPartProperty.GetHTMLCode(null, this, "PaneHeaders", i, EditablePropertyTypeEnum.TextBox, header, null, null, null, true); } else { header = EditableWebPartProperty.ApplyReplacements(HttpUtility.HtmlEncode(header), false); } pane.Header = new TextTransformationTemplate(header); acc.Panes.Add(pane); var zone = AddZone(ID + "_" + i, title, pane.ContentContainer); zone.Wireframe = true; } // Setup the accordion if ((ActivePaneIndex >= 1) && (ActivePaneIndex <= acc.Panes.Count)) { acc.SelectedIndex = ActivePaneIndex - 1; } // If no active pane is selected and doesn't require opened one, do not preselect any if (!acc.RequireOpenedPane && (ActivePaneIndex < 0)) { acc.SelectedIndex = -1; } // Wireframe design acc.CssClass = "WireframeAccordion"; acc.ContentCssClass = "WireframeAccordionContent"; acc.HeaderCssClass = "WireframeAccordionHeader"; acc.HeaderSelectedCssClass = "WireframeAccordionSelectedHeader"; acc.RequireOpenedPane = RequireOpenedPane; acc.AutoSize = AutoSize.None; // Set width / height string width = Width; if (!String.IsNullOrEmpty(width)) { acc.Width = new Unit(width); } if (IsDesign && AllowDesignMode) { // Pane actions if (Panes > 1) { AppendRemoveAction(GetString("Layout.RemoveLastPane"), "Panes", "CMSModules/CMS_PortalEngine/Wireframes/Remove.png", null); Append(" "); } AppendAddAction(GetString("Layout.AddPane"), "Panes", "CMSModules/CMS_PortalEngine/Wireframes/Add.png", null); resElem.ResizedElementID = acc.ClientID; } // Render the actions string actions = FinishLayout(false); if (!String.IsNullOrEmpty(actions)) { pnlActions.Visible = true; ltlActions.Text = actions; } }