/// <summary> /// Prepares the layout of the web part. /// </summary> protected override void PrepareLayout() { StartLayout(); Append("<div"); // Width string width = Width; if (!string.IsNullOrEmpty(width)) { Append(" style=\"width: ", width, "\""); } if (IsDesign) { Append(" id=\"", ShortClientID, "_env\">"); Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">"); switch (ViewMode) { case ViewModeEnum.Design: case ViewModeEnum.DesignDisabled: { Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">"); // Add header container AddHeaderContainer(); Append("</td></tr>"); } break; } Append("<tr><td style=\"width: 100%;\">"); } else { Append(">"); } // Add the tabs tabs = new TabContainer(); tabs.ID = "tabs"; AddControl(tabs); if (IsDesign) { Append("</td>"); // Resizers if (AllowDesignMode) { // Width resizer Append("<td class=\"HorizontalResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " return false;\"> </td></tr>"); // Height resizer Append("<tr><td class=\"VerticalResizer\" onmousedown=\"", GetVerticalResizerScript("tabs_body", "Height"), " return false;\"> </td>"); Append("<td class=\"BothResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " ", GetVerticalResizerScript("tabs_body", "Height"), " return false;\"> </td>"); } Append("</tr>"); } // Tab headers string[] headers = TextHelper.EnsureLineEndings(TabHeaders, "\n").Split('\n'); if ((ActiveTabIndex >= 1) && (ActiveTabIndex <= Tabs)) { tabs.ActiveTabIndex = ActiveTabIndex - 1; } bool hideEmpty = HideEmptyTabs; for (int i = 1; i <= Tabs; i++) { // Create new tab CMSTabPanel tab = new CMSTabPanel(); tab.ID = "tab" + i; // Prepare the header string header = null; if (headers.Length >= i) { header = ResHelper.LocalizeString(headers[i - 1]); header = HTMLHelper.HTMLEncode(header); } if (String.IsNullOrEmpty(header)) { header = "Tab " + i; } tab.HeaderText = header; tab.HideIfZoneEmpty = hideEmpty; tabs.Tabs.Add(tab); tab.WebPartZone = AddZone(ID + "_" + i, header, tab); } // Setup the tabs tabs.ScrollBars = ControlsHelper.GetScrollbarsEnum(Scrollbars); if (!String.IsNullOrEmpty(TabsCSSClass)) { tabs.CssClass = TabsCSSClass; } tabs.TabStripPlacement = GetTabStripPlacement(TabStripPlacement); if (!String.IsNullOrEmpty(Height)) { tabs.Height = new Unit(Height); } if (IsDesign) { // Footer if (AllowDesignMode) { Append("<tr><td class=\"LayoutFooter cms-bootstrap\" colspan=\"2\"><div class=\"LayoutFooterContent\">"); Append("<div class=\"LayoutLeftActions\">"); // Pane actions AppendAddAction(ResHelper.GetString("Layout.AddTab"), "Tabs"); if (Tabs > 1) { AppendRemoveAction(ResHelper.GetString("Layout.RemoveTab"), "Tabs"); } Append("</div></div></td></tr>"); } Append("</table>"); } Append("</div>"); FinishLayout(); }
/// <summary> /// Prepares the layout of the web part. /// </summary> protected override void PrepareLayout() { StartLayout(); Append("<div"); // Width string width = Width; if (!string.IsNullOrEmpty(width)) { Append(" style=\"width: ", width, "\""); } if (IsDesign) { Append(" id=\"", ShortClientID, "_env\">"); Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">"); switch (ViewMode) { case ViewModeEnum.Design: case ViewModeEnum.DesignDisabled: { Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">"); // Add header container AddHeaderContainer(); Append("</td></tr>"); } break; } Append("<tr><td style=\"width: 100%;\">"); } else { Append(">"); } // Add the tabs tabs = new TabContainer(); tabs.ID = "tabs"; AddControl(tabs); if (IsDesign) { Append("</td>"); // Resizers if (AllowDesignMode) { // Width resizer Append("<td class=\"HorizontalResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " return false;\"> </td></tr>"); // Height resizer Append("<tr><td class=\"VerticalResizer\" onmousedown=\"", GetVerticalResizerScript("tabs_body", "Height"), " return false;\"> </td>"); Append("<td class=\"BothResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " ", GetVerticalResizerScript("tabs_body", "Height"), " return false;\"> </td>"); } Append("</tr>"); } // Tab headers string[] headers = TextHelper.EnsureLineEndings(TabHeaders, "\n").Split('\n'); if ((ActiveTabIndex >= 1) && (ActiveTabIndex <= Tabs)) { tabs.ActiveTabIndex = ActiveTabIndex - 1; } bool hideEmpty = HideEmptyTabs; for (int i = 1; i <= Tabs; i++) { // Create new tab CMSTabPanel tab = new CMSTabPanel(); 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; } tab.HeaderText = header; tab.HideIfZoneEmpty = hideEmpty; tabs.Tabs.Add(tab); tab.WebPartZone = AddZone(ID + "_" + i, header, tab); } // Setup the tabs tabs.ScrollBars = ControlsHelper.GetScrollbarsEnum(Scrollbars); if (!String.IsNullOrEmpty(TabsCSSClass)) { tabs.CssClass = TabsCSSClass; } tabs.TabStripPlacement = GetTabStripPlacement(TabStripPlacement); if (!String.IsNullOrEmpty(Height)) { tabs.Height = new Unit(Height); } if (IsDesign) { // Footer if (AllowDesignMode) { Append("<tr><td class=\"LayoutFooter cms-bootstrap\" colspan=\"2\"><div class=\"LayoutFooterContent\">"); Append("<div class=\"LayoutLeftActions\">"); // Pane actions AppendAddAction(ResHelper.GetString("Layout.AddTab"), "Tabs"); if (Tabs > 1) { AppendRemoveAction(ResHelper.GetString("Layout.RemoveTab"), "Tabs"); } Append("</div></div></td></tr>"); } Append("</table>"); } Append("</div>"); FinishLayout(); }
/// <summary> /// Prepares the layout of the web part. /// </summary> protected override void PrepareLayout() { //make a unique id for the div, this is to deal with multiple instances of the control on the same page Random ran = new Random(); UniqueHtmlId = "vectorTabAccordion" + ran.Next(10000, 999999); IsMobileView = Request.IsMobileBrowser(); StartLayout(); StringBuilder result = new StringBuilder(); result.Append("<div "); // Width string width = Width; if (!string.IsNullOrEmpty(width)) { result.Append(" style=\"width: ", width, "\""); } if (IsDesign) { result.Append(" id=\"", ShortClientID, "_env\">"); result.Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">"); switch (ViewMode) { case ViewModeEnum.Design: case ViewModeEnum.DesignDisabled: { result.Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">"); // Add header container AddHeaderContainer(); result.Append("</td></tr>"); } break; } result.Append("<tr><td style=\"width: 100%;\">"); } else { result.Append(">"); } // Add the tabs tabs = new TabContainer(); tabs.ID = "tabs"; if (IsDesign) { result.Append("</td>"); // Resizers if (AllowDesignMode) { // Width resizer result.Append("<td class=\"HorizontalResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " return false;\"> </td></tr>"); // Height resizer result.Append("<tr><td class=\"VerticalResizer\" onmousedown=\"", GetVerticalResizerScript("tabs_body", "Height"), " return false;\"> </td>"); result.Append("<td class=\"BothResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " ", GetVerticalResizerScript("tabs_body", "Height"), " return false;\"> </td>"); } result.Append("</tr>"); } // Tab headers string[] headers = TextHelper.EnsureLineEndings(TabHeaders, "\n").Split('\n'); if ((ActiveTabIndex >= 1) && (ActiveTabIndex <= Tabs)) { tabs.ActiveTabIndex = ActiveTabIndex - 1; } bool hideEmpty = HideEmptyTabs; for (int i = 1; i <= Tabs; i++) { // Create new tab CMSTabPanel tab = new CMSTabPanel(); tab.ID = "tab" + i; // Prepare the header string header = null; if (headers.Length >= i) { header = ResHelper.LocalizeString(headers[i - 1]); header = HTMLHelper.HTMLEncode(header); } if (String.IsNullOrEmpty(header)) { header = "Tab " + i; } tab.HeaderText = header; tab.HideIfZoneEmpty = hideEmpty; tabs.Tabs.Add(tab); tab.WebPartZone = AddZone(ID + "_" + i, header, tab); } if (IsDesign || !IsMobileView) { //show tabs in design mode AddControl(tabs); } else { //show tab content in view mode ShowTabContent(); } // Setup the tabs tabs.ScrollBars = ControlsHelper.GetScrollbarsEnum(Scrollbars); if (!String.IsNullOrEmpty(TabsCSSClass)) { tabs.CssClass = TabsCSSClass; } tabs.TabStripPlacement = GetTabStripPlacement(TabStripPlacement); if (!String.IsNullOrEmpty(Height)) { tabs.Height = new Unit(Height); } if (IsDesign) { // Footer if (AllowDesignMode) { result.Append("<tr><td class=\"LayoutFooter cms-bootstrap\" colspan=\"2\"><div class=\"LayoutFooterContent\">"); result.Append("<div class=\"LayoutLeftActions\">"); // Pane actions AppendAddAction(ResHelper.GetString("Layout.AddTab"), "Tabs"); if (Tabs > 1) { AppendRemoveAction(ResHelper.GetString("Layout.RemoveTab"), "Tabs"); } result.Append("</div></div></td></tr>"); } result.Append("</table>"); } result.Append("</div>"); //Append(result.ToString()); FinishLayout(); }