/// <summary> /// On RowDataBound add CMSCheckbox to the row. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvObjects_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var row = (DataRowView)e.Row.DataItem; string codeName = ValidationHelper.GetString(row[codeNameColumnName], ""); CMSCheckBox checkBox = GetCheckBox(codeName); if (!e.Row.Cells[0].Controls.OfType <CMSCheckBox>().Any(ccb => ccb.ID == checkBox.ID)) { e.Row.Cells[0].Controls.Add(checkBox); } AddAvailableItem(codeName); if (IsInConflict(codeName)) { // Adjust warning message for existing object - it will be either overwritten, or just a binding will be added (if allowed in import settings) string warningMessage = Settings.ImportOnlyNewObjects ? "importgridview.import.warningNewObjects" : "importgridview.import.warning"; var icon = new CMSIcon { ID = "warning-icon", CssClass = "RightAlignAlign icon-exclamation-triangle color-orange-80 warning-icon", ToolTip = GetString(warningMessage), }; if (!e.Row.Cells[1].Controls.OfType <CMSIcon>().Any(ci => ci.ID == icon.ID)) { e.Row.Cells[1].Controls.Add(icon); } } } }
/// <summary> /// Get object icon. /// </summary> /// <param name="childObj">Object to process</param> /// <param name="col">Column name</param> private CMSIcon GetObjectIcon(object childObj, string col) { string iconClass = GetIconClass(childObj, col); var icon = new CMSIcon { CssClass = iconClass }; return(icon); }
protected override void Render(HtmlTextWriter writer) { if (SystemContext.DevelopmentMode) { // Render the resources var resources = LocalizationHelper.CurrentResources; if (resources != null) { StringBuilder sb = new StringBuilder(); // Sort the items by List <DictionaryEntry> list = new List <DictionaryEntry>(resources.Count); foreach (DictionaryEntry item in resources) { list.Add(item); } list.Sort(CompareStrings); bool lastUnknown = false; sb.Append("<div class=\"MenuHeader\">", ResHelper.GetString("localizable.localize"), "</div>"); var warningIcon = new CMSIcon { CssClass = "icon-exclamation-triangle color-orange-80 warning-icon" }.GetRenderedHTML(); foreach (DictionaryEntry item in list) { string key = (string)item.Key; string value = ValidationHelper.GetString(item.Value, ""); // Handle the unknown status bool unknown = key.EqualsCSafe(value, false); if (!unknown && lastUnknown) { sb.Append("<div class=\"Separator\"> </div>"); } lastUnknown = unknown; value = HTMLHelper.HTMLEncode(TextHelper.LimitLength(HTMLHelper.StripTags(value), 70)); sb.Append("<div class=\"Item\" onclick=\"EditString('", HTMLHelper.HTMLEncode(ScriptHelper.GetString(key, false)) + "'); return false;\"><div class=\"ItemPadding\">", (unknown ? warningIcon : ""), "<span class=\"Name\"><strong>", value, "</strong> (", TextHelper.LimitLength(HTMLHelper.HTMLEncode(key), 50), ")</span></div></div>"); } ltlStrings.Text = sb.ToString(); } } base.Render(writer); }
/// <summary> /// Get html for icon. /// </summary> /// <param name="name">Name</param> /// <param name="icon">CMSIcon</param> /// <param name="jsHandler">Handler for on click event.</param> private static string GetIconHtml(string name, CMSIcon icon, string jsHandler) { var label = new Label(); label.Text = name; var panel = new CMSPanel(); panel.Controls.Add(icon); panel.Controls.Add(label); panel.Attributes.Add("onclick", jsHandler + "return false;"); string iconHtml = panel.GetRenderedHTML(); return(iconHtml); }
protected override void Render(HtmlTextWriter writer) { if (SystemContext.DevelopmentMode) { // Render the resources var resources = LocalizationHelper.CurrentResources; if (resources != null) { StringBuilder sb = new StringBuilder(); // Sort the items by List<DictionaryEntry> list = new List<DictionaryEntry>(resources.Count); foreach (DictionaryEntry item in resources) { list.Add(item); } list.Sort(CompareStrings); bool lastUnknown = false; sb.Append("<div class=\"MenuHeader\">", ResHelper.GetString("localizable.localize"), "</div>"); var warningIcon = new CMSIcon{ CssClass = "icon-exclamation-triangle color-orange-80 warning-icon" }.GetRenderedHTML(); foreach (DictionaryEntry item in list) { string key = (string)item.Key; string value = ValidationHelper.GetString(item.Value, ""); // Handle the unknown status bool unknown = key.EqualsCSafe(value, false); if (!unknown && lastUnknown) { sb.Append("<div class=\"Separator\"> </div>"); } lastUnknown = unknown; value = HTMLHelper.HTMLEncode(TextHelper.LimitLength(HTMLHelper.StripTags(value), 70)); sb.Append("<div class=\"Item\" onclick=\"EditString('", HTMLHelper.HTMLEncode(ScriptHelper.GetString(key, false)) + "'); return false;\"><div class=\"ItemPadding\">", (unknown ? warningIcon : ""), "<span class=\"Name\"><strong>", value, "</strong> (", TextHelper.LimitLength(HTMLHelper.HTMLEncode(key), 50), ")</span></div></div>"); } ltlStrings.Text = sb.ToString(); } } base.Render(writer); }
/// <summary> /// On RowDataBound add CMSCheckbox to the row. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvObjects_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var row = (DataRowView)e.Row.DataItem; string codeName = ValidationHelper.GetString(row[codeNameColumnName], ""); e.Row.Cells[0].Controls.Add(GetCheckBox(codeName)); AddAvailableItem(codeName); if (IsInConflict(codeName)) { var icon = new CMSIcon { ID = "warning-icon", CssClass = "RightAlignAlign icon-exclamation-triangle color-orange-80 warning-icon", ToolTip = GetString("importgridview.import.warning"), }; e.Row.Cells[1].Controls.Add(icon); } } }
/// <summary> /// Returns Label control that displays font icon specified by ccs class /// </summary> /// <param name="cssClass">Font icon css class</param> /// <param name="toolTip">Icon tooltip</param> private Label GetIcon(string cssClass, string toolTip) { Label iconWrapper = new Label { CssClass = "info-icon" }; toolTip = ScriptHelper.FormatTooltipString(toolTip, false, false); CMSIcon helpIcon = new CMSIcon { CssClass = cssClass, ToolTip = toolTip }; // Enable HTML formating in tooltip helpIcon.Attributes.Add("data-html", "true"); iconWrapper.Controls.Add(helpIcon); return(iconWrapper); }
protected void Page_Load(object sender, EventArgs e) { gridMatrix.OrderBy = "Matrix.RoleDisplayName, Matrix.RoleID, Matrix.PermissionOrder"; gridMatrix.CssClass = "permission-matrix"; gridMatrix.OnItemChanged += gridMatrix_OnItemChanged; gridMatrix.DataLoaded += gridMatrix_DataLoaded; // Warning icon for disabled permissions CMSIcon iconWarning = new CMSIcon { CssClass = "icon-exclamation-triangle warning-icon", ToolTip = GetString("PermissionMatrix.GlobalAdminOnly"), AlternativeText = GetString("PermissionMatrix.GlobalAdminOnly") }; if (PermissionsAsRows) { gridMatrix.CheckRowPermissions += gridMatrix_CheckPermissions; gridMatrix.DisabledRowMark = iconWarning.GetRenderedHTML(); } else { gridMatrix.CheckColumnPermissions += gridMatrix_CheckPermissions; gridMatrix.DisabledColumnMark = iconWarning.GetRenderedHTML(); } gridMatrix.ContentBeforeRowCssClass = "content-before"; gridMatrix.OnGetRowItemCssClass += gridMatrix_OnGetRowItemCssClass; gridMatrix.NoRecordsMessage = GetString("general.emptymatrix"); currentUser = MembershipContext.AuthenticatedUser; // Is current user authorized to manage permissions? if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Permissions", "Manage")) { gridMatrix.Enabled = false; ShowWarning(string.Format(GetString("general.accessdeniedonpermissionname"), "Manage"), null, null); } }
/// <summary> /// Gets basic controls to render status HTML /// </summary> /// <param name="statusIconClass">Status icon CSS class</param> /// <param name="statusTextClass">Status text CSS class</param> /// <param name="statusText">Status text</param> private IEnumerable <WebControl> GetBasicStatusControls(string statusIconClass, string statusTextClass, string statusText) { List <WebControl> statusControls = new List <WebControl>(); // Status icon for available URL CMSIcon statusIcon = new CMSIcon { CssClass = statusIconClass, }; statusControls.Add(statusIcon); // Status text for available URL Label lblStatus = new Label { Text = statusText, CssClass = statusTextClass }; statusControls.Add(lblStatus); return(statusControls); }
/// <summary> /// Method for adding button to controls. /// </summary> /// <param name="outerPanel">Panel to be added to</param> /// <param name="identifier">Index of button</param> private void AddButtonTo(CMSPanel outerPanel, int identifier) { MenuItem button = Buttons[identifier]; string caption = button.Text; string tooltip = button.Tooltip; string cssClass = button.CssClass; string onClick = button.OnClientClick; string redirectUrl = button.RedirectUrl; string imagePath = button.ImagePath; string iconClass = button.IconClass; string alt = button.ImageAltText; int minWidth = button.MinimalWidth; ImageAlign imageAlign = GetImageAlign(button.ImageAlign); // Generate button image WebControl image = null; if (!string.IsNullOrEmpty(imagePath)) { var buttonImage = new Image { ID = "img" + identifier, CssClass = "MenuButtonImage", EnableViewState = false, AlternateText = alt ?? caption, ImageAlign = imageAlign, ImageUrl = ResolveUrl(imagePath) }; image = buttonImage; } else if (!string.IsNullOrEmpty(iconClass)) { var icon = new CMSIcon { ID = "ico" + identifier, EnableViewState = false, ToolTip = tooltip, CssClass = "cms-icon-80 " + iconClass }; image = icon; } // Generate button text Literal captionLiteral = new Literal(); captionLiteral.ID = "ltlCaption" + identifier; captionLiteral.EnableViewState = false; string separator = (imageAlign == ImageAlign.Top) ? "<br />" : "\n"; captionLiteral.Text = String.Format("{0}<span class=\"MenuButtonText\">{1}</span>", separator, caption); CMSPanel pnlSubItems = null; if (button.SubItems.Count > 0) { // Ensure jQuery tool is loaded ScriptHelper.RegisterJQueryTools(Page); // Register support script ScriptHelper.RegisterScriptFile(Page, "~/CMSAdminControls/UI/UniMenu/UniMenu.js"); // Append sub-menu toggle script onClick = "CMSUniMenu.ToogleSubMenu(this);" + onClick; // Append arrow down image for indication sub menu captionLiteral.Text += @"<i aria-hidden=""true"" class=""icon-caret-right-down cms-icon-30""></i>"; // Create submenu pnlSubItems = CreateSubMenu(button, cssClass, identifier); } // Generate button link HyperLink buttonLink = new HyperLink(); buttonLink.ID = "btn" + identifier; buttonLink.EnableViewState = false; if (image != null) { buttonLink.Controls.Add(image); } buttonLink.Controls.Add(captionLiteral); if (!string.IsNullOrEmpty(redirectUrl)) { buttonLink.NavigateUrl = ResolveUrl(redirectUrl); } // Generate left border CMSPanel pnlLeft = new CMSPanel(); pnlLeft.ID = "pnlLeft" + identifier; pnlLeft.ShortID = "pl" + identifier; pnlLeft.EnableViewState = false; pnlLeft.CssClass = "Left" + cssClass; // Generate middle part of button CMSPanel pnlMiddle = new CMSPanel(); pnlMiddle.ID = "pnlMiddle" + identifier; pnlMiddle.ShortID = "pm" + identifier; pnlMiddle.EnableViewState = false; pnlMiddle.CssClass = "Middle" + cssClass; pnlMiddle.Controls.Add(buttonLink); if (minWidth > 0) { pnlMiddle.Style.Add("min-width", minWidth + "px"); // IE7 issue with min-width CMSPanel pnlMiddleTmp = new CMSPanel(); pnlMiddleTmp.EnableViewState = false; pnlMiddleTmp.Style.Add("width", minWidth + "px"); pnlMiddle.Controls.Add(pnlMiddleTmp); } // Add sub items if exists if (pnlSubItems != null) { pnlMiddle.Controls.Add(pnlSubItems); } // Generate right border CMSPanel pnlRight = new CMSPanel(); pnlRight.ID = "pnlRight" + identifier; pnlRight.ShortID = "pr" + identifier; pnlRight.EnableViewState = false; pnlRight.CssClass = "Right" + cssClass; // Generate whole button CMSPanel pnlButton = new CMSPanel(); pnlButton.ID = "pnlButton" + identifier; pnlButton.ShortID = BUTTON_PANEL_SHORTID + identifier; // Propagate attributes to panel for JavaScript use foreach (var entry in button.Attributes) { pnlButton.Attributes.Add(entry.Key, entry.Value); } pnlButton.EnableViewState = false; if (button.AllowToggle && button.IsToggled) { cssClass += SelectedSuffix; } pnlButton.CssClass = cssClass; if (button.AllowToggle) { pnlButton.CssClass += " Toggle"; EnsureAllowToggleScript(); } //Generate button table (IE7 issue) Table tabButton = new Table(); TableRow tabRow = new TableRow(); TableCell tabCellLeft = new TableCell(); TableCell tabCellMiddle = new TableCell(); TableCell tabCellRight = new TableCell(); tabButton.CellPadding = 0; tabButton.CellSpacing = 0; tabButton.Rows.Add(tabRow); tabRow.Cells.Add(tabCellLeft); tabRow.Cells.Add(tabCellMiddle); tabRow.Cells.Add(tabCellRight); // Add inner controls tabCellLeft.Controls.Add(pnlLeft); tabCellMiddle.Controls.Add(pnlMiddle); tabCellRight.Controls.Add(pnlRight); pnlButton.Controls.Add(tabButton); pnlButton.ToolTip = tooltip ?? caption; outerPanel.Controls.Add(pnlButton); if (AllowDraggable) { mStartupScript.Append(String.Format("$cmsj( '#{0}' ).draggable({{ helper:{1}, scope:'{2}' }});", pnlButton.ClientID, GetDraggableHandler(button.DraggableTemplateHandler), button.DraggableScope)); } if (!AllowSelection && button.AllowToggle) { onClick = "ToggleButton(this);" + onClick; } pnlButton.Attributes["onclick"] = CheckChanges ? "if (CheckChanges()) {" + onClick + "}" : onClick; // In case of horizontal layout if (HorizontalLayout) { // Stack buttons underneath pnlButton.Style.Add("clear", "both"); } else { // Stack buttons side-by-side pnlButton.Style.Add("float", "left"); } if (button.IsSelectable) { // Collect panel client IDs for JavaScript mElemsIds += "#" + pnlButton.ClientID + ","; if (AllowSelection && (identifier == SelectedIndex)) { // Button should be selected by default, remember its ClientID for JavaScript defaultSelectedClientID = "#" + pnlButton.ClientID; } } }
/// <summary> /// Initialize wizard header. /// </summary> /// <param name="index">Step index</param> private void InitializeHeader(int index) { Help.Visible = true; StartHelp.Visible = true; StartHelp.TopicName = Help.TopicName = HELP_TOPIC_LINK; lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - "; string[] stepIcons = { " icon-cogwheel", " icon-database", " icon-separate", " icon-check-circle icon-style-allow" }; string[] stepTitles = { GetString("install.sqlsetting"), GetString("install.lbldatabase"), GetString("install.separation"), GetString("install.finishstep") }; // Set common properties to each step icon for (var i = 0; i < stepIcons.Length; i++) { // Step panel var pnlStepIcon = new Panel(); pnlStepIcon.ID = "stepPanel" + i; pnlStepIcon.CssClass = "install-step-panel"; pnlHeaderImages.Controls.Add(pnlStepIcon); // Step icon var icon = new CMSIcon(); icon.ID = "stepIcon" + i; icon.CssClass = "install-step-icon cms-icon-200" + stepIcons[i]; icon.Attributes.Add("aria-hidden", "true"); pnlStepIcon.Controls.Add(icon); // Step icon title var title = new HtmlGenericControl("title"); title.ID = "stepTitle" + i; title.InnerText = stepTitles[i]; title.Attributes.Add("class", "install-step-title"); pnlStepIcon.Controls.Add(title); // Render separator only between step icons if (i < stepIcons.Length - 1) { // Separator panel var pnlSeparator = new Panel(); pnlSeparator.ID = "separatorPanel" + i; pnlSeparator.CssClass = "install-step-icon-separator"; pnlHeaderImages.Controls.Add(pnlSeparator); // Separator icon var separatorIcon = new CMSIcon(); separatorIcon.CssClass = "icon-arrow-right cms-icon-150"; separatorIcon.Attributes.Add("aria-hidden", "true"); pnlSeparator.Controls.Add(separatorIcon); } } switch (index) { // SQL server and authentication mode case 0: lblHeader.Text += ResHelper.GetString("separationDB.Step0"); SetSelectedCSSClass("stepPanel0"); break; // Database case 1: lblHeader.Text += ResHelper.GetFileString("separationDB.Step1"); SetSelectedCSSClass("stepPanel1"); break; // Separation case 2: StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("separationDB.Step2"); SetSelectedCSSClass("stepPanel2"); break; // Finish step case 3: lblHeader.Text += ResHelper.GetFileString("Install.Step7"); SetSelectedCSSClass("stepPanel3"); break; } lblHeader.Text = string.Format(lblHeader.Text, wzdInstaller.ActiveStepIndex + 1); }
/// <summary> /// Get object icon. /// </summary> /// <param name="childObj">Object to process</param> /// <param name="col">Column name</param> private CMSIcon GetObjectIcon(object childObj, string col) { string iconClass = GetIconClass(childObj, col); var icon = new CMSIcon { CssClass = iconClass }; return icon; }
/// <summary> /// Get html for icon. /// </summary> /// <param name="name">Name</param> /// <param name="icon">CMSIcon</param> /// <param name="jsHandler">Handler for on click event.</param> private static string GetIconHtml(string name, CMSIcon icon, string jsHandler) { var label = new Label(); label.Text = name; var panel = new CMSPanel(); panel.Controls.Add(icon); panel.Controls.Add(label); panel.Attributes.Add("onclick", jsHandler + "return false;"); string iconHtml = panel.GetRenderedHTML(); return iconHtml; }
/// <summary> /// Initialize wizard header /// </summary> /// <param name="index">Step index</param> private void InitializeHeader(int index) { Help.Visible = true; StartHelp.Visible = true; StartHelp.TopicName = Help.TopicName = HELP_TOPIC_LINK; lblHeader.Text = $"{ResHelper.GetFileString("Install.Step")} - "; string[] stepIcons = { " icon-cogwheel", " icon-database", " icon-check-circle icon-style-allow" }; string[] stepTitles = { ResHelper.GetFileString("install.sqlsetting"), ResHelper.GetFileString("install.lbldatabase"), ResHelper.GetFileString("install.finishstep") }; // Set common properties to each step icon for (var i = 0; i < stepIcons.Length; i++) { // Step panel var pnlStepIcon = new Panel(); pnlStepIcon.ID = "stepPanel" + i; pnlStepIcon.CssClass = "install-step-panel"; pnlHeaderImages.Controls.Add(pnlStepIcon); // Step icon var icon = new CMSIcon(); icon.ID = "stepIcon" + i; icon.CssClass = "install-step-icon cms-icon-200" + stepIcons[i]; icon.Attributes.Add("aria-hidden", "true"); pnlStepIcon.Controls.Add(icon); // Step icon title var title = new HtmlGenericControl("title"); title.ID = "stepTitle" + i; title.InnerText = stepTitles[i]; title.Attributes.Add("class", "install-step-title"); pnlStepIcon.Controls.Add(title); // Render separator only between step icons if (i < stepIcons.Length - 1) { // Separator panel var pnlSeparator = new Panel(); pnlSeparator.ID = "separatorPanel" + i; pnlSeparator.CssClass = "install-step-icon-separator"; pnlHeaderImages.Controls.Add(pnlSeparator); // Separator icon var separatorIcon = new CMSIcon(); separatorIcon.CssClass = "icon-arrow-right cms-icon-150"; separatorIcon.Attributes.Add("aria-hidden", "true"); pnlSeparator.Controls.Add(separatorIcon); } } switch (index) { // SQL server and authentication mode case 0: lblHeader.Text += ResHelper.GetFileString("Install.Step0"); SetSelectedCSSClass("stepPanel0"); break; // Database case 1: lblHeader.Text += ResHelper.GetFileString("Install.Step1"); SetSelectedCSSClass("stepPanel1"); break; // web.config permissions case 2: StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("Install.Step3"); SetSelectedCSSClass("stepPanel1"); break; // Database creation log case 3: StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("Install.Step2"); lblDBProgress.Text = ResHelper.GetFileString("Install.lblDBProgress"); SetSelectedCSSClass("stepPanel1"); break; // License import case 4: lblHeader.Text += ResHelper.GetFileString("Install.Step4"); SetSelectedCSSClass("stepPanel1"); break; // Finish step case 5: lblHeader.Text += ResHelper.GetFileString("Install.Step5"); SetSelectedCSSClass("stepPanel2"); break; case COLLATION_DIALOG_INDEX: lblHeader.Text += ResHelper.GetFileString("Install.Step6"); SetSelectedCSSClass("stepPanel1"); break; } // Calculate step number if (PreviousStep == index) { StepOperation = 0; } ActualStep += StepOperation; lblHeader.Text = String.Format(lblHeader.Text, ActualStep + 1); PreviousStep = index; }
/// <summary> /// Generates panel with buttons loaded from given UI Element. /// </summary> /// <param name="uiElementId">ID of the UI Element</param> protected Panel GetButtons(int uiElementId) { const int bigButtonMinimalWidth = 40; const int smallButtonMinimalWidth = 66; Panel pnlButtons = null; // Load the buttons manually from UI Element DataSet ds = UIElementInfoProvider.GetChildUIElements(uiElementId); // When no child found if (DataHelper.DataSourceIsEmpty(ds)) { // Try to use group element as button ds = UIElementInfoProvider.GetUIElements("ElementID = " + uiElementId, null); if (!DataHelper.DataSourceIsEmpty(ds)) { DataRow dr = ds.Tables[0].Rows[0]; string url = ValidationHelper.GetString(dr["ElementTargetURL"], ""); // Use group element as button only if it has URL specified if (string.IsNullOrEmpty(url)) { ds = null; } } } if (!DataHelper.DataSourceIsEmpty(ds)) { // Filter the dataset according to UI Profile FilterElements(ds); int small = 0; int count = ds.Tables[0].Rows.Count; // No buttons, render nothing if (count == 0) { return null; } // Prepare the panel pnlButtons = new Panel(); pnlButtons.CssClass = "ActionButtons"; // Prepare the table Table tabGroup = new Table(); TableRow tabGroupRow = new TableRow(); tabGroup.CellPadding = 0; tabGroup.CellSpacing = 0; tabGroup.EnableViewState = false; tabGroupRow.EnableViewState = false; tabGroup.Rows.Add(tabGroupRow); List<Panel> panels = new List<Panel>(); for (int i = 0; i < count; i++) { // Get current and next button UIElementInfo uiElement = new UIElementInfo(ds.Tables[0].Rows[i]); UIElementInfo sel = UIContextHelper.CheckSelectedElement(uiElement, UIContext); if (sel != null) { String selectionSuffix = ValidationHelper.GetString(UIContext["selectionSuffix"], String.Empty); StartingPage = UIContextHelper.GetElementUrl(sel, UIContext) + selectionSuffix; HighlightItem = uiElement.ElementName; } // Raise button creating event if (OnButtonCreating != null) { OnButtonCreating(this, new UniMenuArgs { UIElement = uiElement }); } UIElementInfo uiElementNext = null; if (i < count - 1) { uiElementNext = new UIElementInfo(ds.Tables[0].Rows[i + 1]); } // Set the first button if (mFirstUIElement == null) { mFirstUIElement = uiElement; } // Get the sizes of current and next button. Button is large when it is the only in the group bool isSmall = (uiElement.ElementSize == UIElementSizeEnum.Regular) && (count > 1); bool isResized = (uiElement.ElementSize == UIElementSizeEnum.Regular) && (!isSmall); bool isNextSmall = (uiElementNext != null) && (uiElementNext.ElementSize == UIElementSizeEnum.Regular); // Set the CSS class according to the button size string cssClass = (isSmall ? "SmallButton" : "BigButton"); string elementName = uiElement.ElementName; // Display only caption - do not substitute with Display name when empty string elementCaption = ResHelper.LocalizeString(uiElement.ElementCaption); // Create main button panel CMSPanel pnlButton = new CMSPanel() { ID = "pnlButton" + elementName, ShortID = "b" + elementName }; pnlButton.Attributes.Add("name", elementName); pnlButton.CssClass = cssClass; // Remember the first button if (firstPanel == null) { firstPanel = pnlButton; } // Remember the selected button if ((preselectedPanel == null) && elementName.EqualsCSafe(HighlightItem, true)) { preselectedPanel = pnlButton; // Set the selected button if (mHighlightedUIElement == null) { mHighlightedUIElement = uiElement; } } // URL or behavior string url = uiElement.ElementTargetURL; if (!string.IsNullOrEmpty(url) && url.StartsWithCSafe("javascript:", true)) { pnlButton.Attributes["onclick"] = url.Substring("javascript:".Length); } else { url = UIContextHelper.GetElementUrl(uiElement, UIContext); if (url != String.Empty) { string buttonSelection = (RememberSelectedItem ? "SelectButton(this);" : ""); // Ensure hash code if required url = MacroResolver.Resolve(URLHelper.EnsureHashToQueryParameters(url)); if (!String.IsNullOrEmpty(TargetFrameset)) { if (uiElement.ElementType == UIElementTypeEnum.PageTemplate) { url = URLHelper.UpdateParameterInUrl(url, "displaytitle", "false"); } String target = UseIFrame ? String.Format("frames['{0}']", TargetFrameset) : String.Format("parent.frames['{0}']", TargetFrameset); pnlButton.Attributes["onclick"] = String.Format("{0}{1}.location.href = '{2}';", buttonSelection, target, URLHelper.ResolveUrl(url)); } else { pnlButton.Attributes["onclick"] = String.Format("{0}self.location.href = '{1}';", buttonSelection, URLHelper.ResolveUrl(url)); } } } // Tooltip if (!string.IsNullOrEmpty(uiElement.ElementDescription)) { pnlButton.ToolTip = ResHelper.LocalizeString(uiElement.ElementDescription); } else { pnlButton.ToolTip = elementCaption; } pnlButton.EnableViewState = false; // Ensure correct grouping of small buttons if (isSmall && (small == 0)) { small++; Panel pnlSmallGroup = new Panel() { ID = "pnlGroupSmall" + uiElement.ElementName }; if (IsRTL) { pnlSmallGroup.Style.Add("float", "right"); pnlSmallGroup.Style.Add("text-align", "right"); } else { pnlSmallGroup.Style.Add("float", "left"); pnlSmallGroup.Style.Add("text-align", "left"); } pnlSmallGroup.EnableViewState = false; pnlSmallGroup.Controls.Add(pnlButton); panels.Add(pnlSmallGroup); } // Generate button link HyperLink buttonLink = new HyperLink() { ID = "lnkButton" + uiElement.ElementName, EnableViewState = false }; // Generate button image Image buttonImage = new Image() { ID = "imgButton" + uiElement.ElementName, ImageAlign = (isSmall ? ImageAlign.AbsMiddle : ImageAlign.Top), AlternateText = elementCaption, EnableViewState = false }; // Use icon path if (!string.IsNullOrEmpty(uiElement.ElementIconPath)) { string iconPath = GetImagePath(uiElement.ElementIconPath); // Check if element size was changed if (isResized) { // Try to get larger icon string largeIconPath = iconPath.Replace("list.png", "module.png"); if (FileHelper.FileExists(largeIconPath)) { iconPath = largeIconPath; } } buttonImage.ImageUrl = GetImageUrl(iconPath); buttonLink.Controls.Add(buttonImage); } // Use Icon class else if (!string.IsNullOrEmpty(uiElement.ElementIconClass)) { var icon = new CMSIcon { ID = string.Format("ico_{0}_{1}", identifier, i), EnableViewState = false, ToolTip = pnlButton.ToolTip, CssClass = "cms-icon-80 " + uiElement.ElementIconClass }; buttonLink.Controls.Add(icon); } // Load default module icon if ElementIconPath is not specified else { buttonImage.ImageUrl = GetImageUrl("CMSModules/module.png"); buttonLink.Controls.Add(buttonImage); } // Generate caption text Literal captionLiteral = new Literal() { ID = "ltlCaption" + uiElement.ElementName, Text = (isSmall ? "\n" : "<br />") + elementCaption, EnableViewState = false }; buttonLink.Controls.Add(captionLiteral); //Generate button table (IE7 issue) Table tabButton = new Table(); TableRow tabRow = new TableRow(); TableCell tabCellLeft = new TableCell(); TableCell tabCellMiddle = new TableCell(); TableCell tabCellRight = new TableCell(); tabButton.CellPadding = 0; tabButton.CellSpacing = 0; tabButton.EnableViewState = false; tabRow.EnableViewState = false; tabCellLeft.EnableViewState = false; tabCellMiddle.EnableViewState = false; tabCellRight.EnableViewState = false; tabButton.Rows.Add(tabRow); tabRow.Cells.Add(tabCellLeft); tabRow.Cells.Add(tabCellMiddle); tabRow.Cells.Add(tabCellRight); // Generate left border Panel pnlLeft = new Panel() { ID = "pnlLeft" + uiElement.ElementName, CssClass = "Left" + cssClass, EnableViewState = false }; // Generate middle part of button Panel pnlMiddle = new Panel() { ID = "pnlMiddle" + uiElement.ElementName, CssClass = "Middle" + cssClass }; pnlMiddle.Controls.Add(buttonLink); Panel pnlMiddleTmp = new Panel() { EnableViewState = false }; if (isSmall) { pnlMiddle.Style.Add("min-width", smallButtonMinimalWidth + "px"); // IE7 issue with min-width pnlMiddleTmp.Style.Add("width", smallButtonMinimalWidth + "px"); pnlMiddle.Controls.Add(pnlMiddleTmp); } else { pnlMiddle.Style.Add("min-width", bigButtonMinimalWidth + "px"); // IE7 issue with min-width pnlMiddleTmp.Style.Add("width", bigButtonMinimalWidth + "px"); pnlMiddle.Controls.Add(pnlMiddleTmp); } pnlMiddle.EnableViewState = false; // Generate right border Panel pnlRight = new Panel() { ID = "pnlRight" + uiElement.ElementName, CssClass = "Right" + cssClass, EnableViewState = false }; // Add inner controls tabCellLeft.Controls.Add(pnlLeft); tabCellMiddle.Controls.Add(pnlMiddle); tabCellRight.Controls.Add(pnlRight); pnlButton.Controls.Add(tabButton); // If there were two small buttons in a row end the grouping div if ((small == 2) || (isSmall && !isNextSmall)) { small = 0; // Add the button to the small buttons grouping panel panels[panels.Count - 1].Controls.Add(pnlButton); } else { if (small == 0) { // Add the generated button into collection panels.Add(pnlButton); } } if (small == 1) { small++; } // Raise button created event if (OnButtonCreated != null) { OnButtonCreated(this, new UniMenuArgs { UIElement = uiElement, TargetUrl = url, ButtonControl = pnlButton, ImageControl = buttonImage }); } } // Add all panels to control foreach (Panel panel in panels) { TableCell tabGroupCell = new TableCell() { VerticalAlign = VerticalAlign.Top, EnableViewState = false }; tabGroupCell.Controls.Add(panel); tabGroupRow.Cells.Add(tabGroupCell); } pnlButtons.Controls.Add(tabGroup); } return pnlButtons; }
/// <summary> /// Returns Label control that displays font icon specified by ccs class /// </summary> /// <param name="cssClass">Font icon css class</param> /// <param name="toolTip">Icon tooltip</param> private Label GetIcon(string cssClass, string toolTip) { Label iconWrapper = new Label { CssClass = "info-icon" }; toolTip = ScriptHelper.FormatTooltipString(toolTip, false, false); CMSIcon helpIcon = new CMSIcon { CssClass = cssClass, ToolTip = toolTip }; // Enable HTML formating in tooltip helpIcon.Attributes.Add("data-html", "true"); iconWrapper.Controls.Add(helpIcon); return iconWrapper; }
/// <summary> /// Gets basic controls to render status HTML /// </summary> /// <param name="statusIconClass">Status icon CSS class</param> /// <param name="statusTextClass">Status text CSS class</param> /// <param name="statusText">Status text</param> private IEnumerable<WebControl> GetBasicStatusControls(string statusIconClass, string statusTextClass, string statusText) { List<WebControl> statusControls = new List<WebControl>(); // Status icon for available URL CMSIcon statusIcon = new CMSIcon { CssClass = statusIconClass, }; statusControls.Add(statusIcon); // Status text for available URL Label lblStatus = new Label { Text = statusText, CssClass = statusTextClass }; statusControls.Add(lblStatus); return statusControls; }
/// <summary> /// Generates panel with buttons loaded from given UI Element. /// </summary> /// <param name="uiElementId">ID of the UI Element</param> protected Panel GetButtons(int uiElementId) { const int bigButtonMinimalWidth = 40; const int smallButtonMinimalWidth = 66; Panel pnlButtons = null; // Load the buttons manually from UI Element DataSet ds = UIElementInfoProvider.GetChildUIElements(uiElementId); // When no child found if (DataHelper.DataSourceIsEmpty(ds)) { // Try to use group element as button ds = UIElementInfoProvider.GetUIElements("ElementID = " + uiElementId, null); if (!DataHelper.DataSourceIsEmpty(ds)) { DataRow dr = ds.Tables[0].Rows[0]; string url = ValidationHelper.GetString(dr["ElementTargetURL"], ""); // Use group element as button only if it has URL specified if (string.IsNullOrEmpty(url)) { ds = null; } } } if (!DataHelper.DataSourceIsEmpty(ds)) { // Filter the dataset according to UI Profile FilterElements(ds); int small = 0; int count = ds.Tables[0].Rows.Count; // No buttons, render nothing if (count == 0) { return(null); } // Prepare the panel pnlButtons = new Panel(); pnlButtons.CssClass = "ActionButtons"; // Prepare the table Table tabGroup = new Table(); TableRow tabGroupRow = new TableRow(); tabGroup.CellPadding = 0; tabGroup.CellSpacing = 0; tabGroup.EnableViewState = false; tabGroupRow.EnableViewState = false; tabGroup.Rows.Add(tabGroupRow); List <Panel> panels = new List <Panel>(); for (int i = 0; i < count; i++) { // Get current and next button UIElementInfo uiElement = new UIElementInfo(ds.Tables[0].Rows[i]); UIElementInfo sel = UIContextHelper.CheckSelectedElement(uiElement, UIContext); if (sel != null) { String selectionSuffix = ValidationHelper.GetString(UIContext["selectionSuffix"], String.Empty); StartingPage = UIContextHelper.GetElementUrl(sel, UIContext) + selectionSuffix; HighlightItem = uiElement.ElementName; } // Raise button creating event if (OnButtonCreating != null) { OnButtonCreating(this, new UniMenuArgs { UIElement = uiElement }); } UIElementInfo uiElementNext = null; if (i < count - 1) { uiElementNext = new UIElementInfo(ds.Tables[0].Rows[i + 1]); } // Set the first button if (mFirstUIElement == null) { mFirstUIElement = uiElement; } // Get the sizes of current and next button. Button is large when it is the only in the group bool isSmall = (uiElement.ElementSize == UIElementSizeEnum.Regular) && (count > 1); bool isResized = (uiElement.ElementSize == UIElementSizeEnum.Regular) && (!isSmall); bool isNextSmall = (uiElementNext != null) && (uiElementNext.ElementSize == UIElementSizeEnum.Regular); // Set the CSS class according to the button size string cssClass = (isSmall ? "SmallButton" : "BigButton"); string elementName = uiElement.ElementName; // Display only caption - do not substitute with Display name when empty string elementCaption = ResHelper.LocalizeString(uiElement.ElementCaption); // Create main button panel CMSPanel pnlButton = new CMSPanel() { ID = "pnlButton" + elementName, ShortID = "b" + elementName }; pnlButton.Attributes.Add("name", elementName); pnlButton.CssClass = cssClass; // Remember the first button if (firstPanel == null) { firstPanel = pnlButton; } // Remember the selected button if ((preselectedPanel == null) && elementName.EqualsCSafe(HighlightItem, true)) { preselectedPanel = pnlButton; // Set the selected button if (mHighlightedUIElement == null) { mHighlightedUIElement = uiElement; } } // URL or behavior string url = uiElement.ElementTargetURL; if (!string.IsNullOrEmpty(url) && url.StartsWithCSafe("javascript:", true)) { pnlButton.Attributes["onclick"] = url.Substring("javascript:".Length); } else { url = UIContextHelper.GetElementUrl(uiElement, UIContext); if (url != String.Empty) { string buttonSelection = (RememberSelectedItem ? "SelectButton(this);" : ""); // Ensure hash code if required url = MacroResolver.Resolve(URLHelper.EnsureHashToQueryParameters(url)); if (!String.IsNullOrEmpty(TargetFrameset)) { if (uiElement.ElementType == UIElementTypeEnum.PageTemplate) { url = URLHelper.UpdateParameterInUrl(url, "displaytitle", "false"); } String target = UseIFrame ? String.Format("frames['{0}']", TargetFrameset) : String.Format("parent.frames['{0}']", TargetFrameset); pnlButton.Attributes["onclick"] = String.Format("{0}{1}.location.href = '{2}';", buttonSelection, target, UrlResolver.ResolveUrl(url)); } else { pnlButton.Attributes["onclick"] = String.Format("{0}self.location.href = '{1}';", buttonSelection, UrlResolver.ResolveUrl(url)); } } } // Tooltip if (!string.IsNullOrEmpty(uiElement.ElementDescription)) { pnlButton.ToolTip = ResHelper.LocalizeString(uiElement.ElementDescription); } else { pnlButton.ToolTip = elementCaption; } pnlButton.EnableViewState = false; // Ensure correct grouping of small buttons if (isSmall && (small == 0)) { small++; Panel pnlSmallGroup = new Panel() { ID = "pnlGroupSmall" + uiElement.ElementName }; if (IsRTL) { pnlSmallGroup.Style.Add("float", "right"); pnlSmallGroup.Style.Add("text-align", "right"); } else { pnlSmallGroup.Style.Add("float", "left"); pnlSmallGroup.Style.Add("text-align", "left"); } pnlSmallGroup.EnableViewState = false; pnlSmallGroup.Controls.Add(pnlButton); panels.Add(pnlSmallGroup); } // Generate button link HyperLink buttonLink = new HyperLink() { ID = "lnkButton" + uiElement.ElementName, EnableViewState = false }; // Generate button image Image buttonImage = new Image() { ID = "imgButton" + uiElement.ElementName, ImageAlign = (isSmall ? ImageAlign.AbsMiddle : ImageAlign.Top), AlternateText = elementCaption, EnableViewState = false }; // Use icon path if (!string.IsNullOrEmpty(uiElement.ElementIconPath)) { string iconPath = GetImagePath(uiElement.ElementIconPath); // Check if element size was changed if (isResized) { // Try to get larger icon string largeIconPath = iconPath.Replace("list.png", "module.png"); if (FileHelper.FileExists(largeIconPath)) { iconPath = largeIconPath; } } buttonImage.ImageUrl = GetImageUrl(iconPath); buttonLink.Controls.Add(buttonImage); } // Use Icon class else if (!string.IsNullOrEmpty(uiElement.ElementIconClass)) { var icon = new CMSIcon { ID = string.Format("ico_{0}_{1}", identifier, i), EnableViewState = false, ToolTip = pnlButton.ToolTip, CssClass = "cms-icon-80 " + uiElement.ElementIconClass }; buttonLink.Controls.Add(icon); } // Load default module icon if ElementIconPath is not specified else { buttonImage.ImageUrl = GetImageUrl("CMSModules/module.png"); buttonLink.Controls.Add(buttonImage); } // Generate caption text Literal captionLiteral = new Literal() { ID = "ltlCaption" + uiElement.ElementName, Text = (isSmall ? "\n" : "<br />") + elementCaption, EnableViewState = false }; buttonLink.Controls.Add(captionLiteral); //Generate button table (IE7 issue) Table tabButton = new Table(); TableRow tabRow = new TableRow(); TableCell tabCellLeft = new TableCell(); TableCell tabCellMiddle = new TableCell(); TableCell tabCellRight = new TableCell(); tabButton.CellPadding = 0; tabButton.CellSpacing = 0; tabButton.EnableViewState = false; tabRow.EnableViewState = false; tabCellLeft.EnableViewState = false; tabCellMiddle.EnableViewState = false; tabCellRight.EnableViewState = false; tabButton.Rows.Add(tabRow); tabRow.Cells.Add(tabCellLeft); tabRow.Cells.Add(tabCellMiddle); tabRow.Cells.Add(tabCellRight); // Generate left border Panel pnlLeft = new Panel() { ID = "pnlLeft" + uiElement.ElementName, CssClass = "Left" + cssClass, EnableViewState = false }; // Generate middle part of button Panel pnlMiddle = new Panel() { ID = "pnlMiddle" + uiElement.ElementName, CssClass = "Middle" + cssClass }; pnlMiddle.Controls.Add(buttonLink); Panel pnlMiddleTmp = new Panel() { EnableViewState = false }; if (isSmall) { pnlMiddle.Style.Add("min-width", smallButtonMinimalWidth + "px"); // IE7 issue with min-width pnlMiddleTmp.Style.Add("width", smallButtonMinimalWidth + "px"); pnlMiddle.Controls.Add(pnlMiddleTmp); } else { pnlMiddle.Style.Add("min-width", bigButtonMinimalWidth + "px"); // IE7 issue with min-width pnlMiddleTmp.Style.Add("width", bigButtonMinimalWidth + "px"); pnlMiddle.Controls.Add(pnlMiddleTmp); } pnlMiddle.EnableViewState = false; // Generate right border Panel pnlRight = new Panel() { ID = "pnlRight" + uiElement.ElementName, CssClass = "Right" + cssClass, EnableViewState = false }; // Add inner controls tabCellLeft.Controls.Add(pnlLeft); tabCellMiddle.Controls.Add(pnlMiddle); tabCellRight.Controls.Add(pnlRight); pnlButton.Controls.Add(tabButton); // If there were two small buttons in a row end the grouping div if ((small == 2) || (isSmall && !isNextSmall)) { small = 0; // Add the button to the small buttons grouping panel panels[panels.Count - 1].Controls.Add(pnlButton); } else { if (small == 0) { // Add the generated button into collection panels.Add(pnlButton); } } if (small == 1) { small++; } // Raise button created event if (OnButtonCreated != null) { OnButtonCreated(this, new UniMenuArgs { UIElement = uiElement, TargetUrl = url, ButtonControl = pnlButton, ImageControl = buttonImage }); } } // Add all panels to control foreach (Panel panel in panels) { TableCell tabGroupCell = new TableCell() { VerticalAlign = VerticalAlign.Top, EnableViewState = false }; tabGroupCell.Controls.Add(panel); tabGroupRow.Cells.Add(tabGroupCell); } pnlButtons.Controls.Add(tabGroup); } return(pnlButtons); }
/// <summary> /// Method for adding sub menu item into menu. /// </summary> /// <param name="pnlMenu">Menu container control</param> /// <param name="item">Sub menu item definition</param> /// <param name="cssClass">Button css class</param> /// <param name="subIdentifier">Button identifier</param> private void AddSubMenuItem(CMSPanel pnlMenu, SubMenuItem item, string cssClass, int subIdentifier) { if (String.IsNullOrEmpty(item.ControlPath)) { // Generate sub item CMSPanel pnlItem = new CMSPanel(); pnlItem.ID = "pnlSubItem" + subIdentifier; pnlItem.ShortID = "pi" + subIdentifier; pnlItem.CssClass = "Item ItemPadding"; pnlItem.ToolTip = item.Tooltip; if (!String.IsNullOrEmpty(item.OnClientClick)) { pnlItem.Attributes["onclick"] = item.OnClientClick.Replace("##BUTTON##", "$cmsj(this).parents('." + cssClass + "').get(0)"); } if (!String.IsNullOrEmpty(item.ImagePath)) { string altText = String.IsNullOrEmpty(item.ImageAltText) ? item.Text : item.ImageAltText; // Generate sub items text CMSPanel pnlIcon = new CMSPanel(); pnlIcon.ID = "pnlIcon"; pnlIcon.ShortID = "pii" + subIdentifier; pnlIcon.CssClass = "Icon"; Literal subItemImage = new Literal(); subItemImage.ID = "ltlSubItemImage" + subIdentifier; subItemImage.EnableViewState = false; subItemImage.Text = String.Format("<img src=\"{0}\" alt=\"{1}\" /> ", ResolveUrl(item.ImagePath), GetString(altText)); pnlIcon.Controls.Add(subItemImage); pnlItem.Controls.Add(pnlIcon); } // Add custom HTML attributes foreach (var htmlAttribute in item.HtmlAttributes) { pnlItem.Attributes[htmlAttribute.Key] = HTMLHelper.HTMLEncode(htmlAttribute.Value); } // Generate sub items text CMSPanel pnlText = new CMSPanel(); pnlText.ID = "pnlText"; pnlText.ShortID = "pt" + subIdentifier; pnlText.CssClass = "Name"; Label subItemText = new Label(); subItemText.ID = "ltlSubItem" + subIdentifier; subItemText.EnableViewState = false; subItemText.Text = GetString(item.Text); pnlText.Controls.Add(subItemText); pnlItem.Controls.Add(pnlText); if (!String.IsNullOrEmpty(item.RightImagePath)) { string altText = String.IsNullOrEmpty(item.RightImageAltText) ? item.Text : item.RightImageAltText; // Generate sub item right icon Literal subRightItemImage = new Literal(); subRightItemImage.ID = "ltlSubRightItemImage" + subIdentifier; subRightItemImage.EnableViewState = false; subRightItemImage.Text = String.Format("<img class=\"RightIcon\" src=\"{0}\" alt=\"{1}\" /> ", ResolveUrl(item.RightImagePath), GetString(altText)); CMSPanel pnlRightIcon = CreateRightIconPanel(subIdentifier); pnlRightIcon.Controls.Add(subRightItemImage); pnlItem.Controls.Add(pnlRightIcon); } else if (!string.IsNullOrEmpty(item.RightImageIconClass)) { string altText = String.IsNullOrEmpty(item.RightImageAltText) ? item.Text : item.RightImageAltText; var icon = new CMSIcon { ID = "ico" + subIdentifier, EnableViewState = false, ToolTip = GetString(altText), CssClass = "cms-icon-80 " + item.RightImageIconClass }; CMSPanel pnlRightIcon = CreateRightIconPanel(subIdentifier); pnlRightIcon.Controls.Add(icon); pnlItem.Controls.Add(pnlRightIcon); } pnlMenu.Controls.Add(pnlItem); } else { // Load menu item control Control ctrl = LoadUserControl(item.ControlPath); if (ctrl != null) { pnlMenu.Controls.Add(ctrl); } } }
/// <summary> /// Initialize wizard header. /// </summary> /// <param name="index">Step index</param> private void InitializeHeader(int index) { Help.Visible = true; StartHelp.Visible = true; StartHelp.TopicName = Help.TopicName = HELP_TOPIC_LINK; lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - "; string[] stepIcons = { " icon-cogwheel", " icon-merge", " icon-check-circle icon-style-allow" }; string[] stepTitles = { GetString("install.prerequisites"), GetString("install.merging"), GetString("install.finishstep") }; // Set common properties to each step icon for (var i = 0; i < stepIcons.Length; i++) { // Step panel var pnlStepIcon = new Panel(); pnlStepIcon.ID = "stepPanel" + i; pnlStepIcon.CssClass = "install-step-panel"; pnlHeaderImages.Controls.Add(pnlStepIcon); // Step icon var icon = new CMSIcon(); icon.ID = "stepIcon" + i; icon.CssClass = "install-step-icon cms-icon-200" + stepIcons[i]; icon.Attributes.Add("aria-hidden", "true"); pnlStepIcon.Controls.Add(icon); // Step icon title var title = new HtmlGenericControl("title"); title.ID = "stepTitle" + i; title.InnerText = stepTitles[i]; title.Attributes.Add("class", "install-step-title"); pnlStepIcon.Controls.Add(title); // Render separator only between step icons if (i < stepIcons.Length - 1) { // Separator panel var pnlSeparator = new Panel(); pnlSeparator.ID = "separatorPanel" + i; pnlSeparator.CssClass = "install-step-icon-separator"; pnlHeaderImages.Controls.Add(pnlSeparator); // Separator icon var separatorIcon = new CMSIcon(); separatorIcon.CssClass = "icon-arrow-right cms-icon-150"; separatorIcon.Attributes.Add("aria-hidden", "true"); pnlSeparator.Controls.Add(separatorIcon); } } switch (index) { // Ready case 0: { lblHeader.Text += GetString("separationDB.joinStep0"); SetSelectedCSSClass("stepPanel0"); break; } // Progress case 1: { StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("separationDB.joinStep1"); SetSelectedCSSClass("stepPanel1"); break; } // Finish step case 2: { lblHeader.Text += ResHelper.GetFileString("Install.Step7"); SetSelectedCSSClass("stepPanel2"); break; } } lblHeader.Text = string.Format(lblHeader.Text, wzdInstaller.ActiveStepIndex + 1); }
/// <summary> /// On RowDataBound add CMSCheckbox to the row. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvObjects_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var row = (DataRowView)e.Row.DataItem; string codeName = ValidationHelper.GetString(row[codeNameColumnName], ""); CMSCheckBox checkBox = GetCheckBox(codeName); if (!e.Row.Cells[0].Controls.OfType<CMSCheckBox>().Any(ccb=> ccb.ID == checkBox.ID)) { e.Row.Cells[0].Controls.Add(checkBox); } AddAvailableItem(codeName); if (IsInConflict(codeName)) { var icon = new CMSIcon { ID = "warning-icon", CssClass = "RightAlignAlign icon-exclamation-triangle color-orange-80 warning-icon", ToolTip = GetString("importgridview.import.warning"), }; if (!e.Row.Cells[1].Controls.OfType<CMSIcon>().Any(ci => ci.ID == icon.ID)) { e.Row.Cells[1].Controls.Add(icon); } } } }
/// <summary> /// Initialize wizard header. /// </summary> /// <param name="index">Step index</param> private void InitializeHeader(int index) { Help.Visible = true; StartHelp.Visible = true; StartHelp.TopicName = Help.TopicName = HELP_TOPIC_LINK; lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - "; string[] stepIcons = { " icon-cogwheel", " icon-database", " icon-separate", " icon-check-circle icon-style-allow" }; string[] stepTitles = { GetString("install.sqlsetting"), GetString("install.lbldatabase"), GetString("install.separation"), GetString("install.finishstep") }; // Set common properties to each step icon for (var i = 0; i < stepIcons.Length; i++) { // Step panel var pnlStepIcon = new Panel(); pnlStepIcon.ID = "stepPanel" + i; pnlStepIcon.CssClass = "install-step-panel"; pnlHeaderImages.Controls.Add(pnlStepIcon); // Step icon var icon = new CMSIcon(); icon.ID = "stepIcon" + i; icon.CssClass = "install-step-icon cms-icon-200" + stepIcons[i]; icon.Attributes.Add("aria-hidden", "true"); pnlStepIcon.Controls.Add(icon); // Step icon title var title = new HtmlGenericControl("title"); title.ID = "stepTitle" + i; title.InnerText = stepTitles[i]; title.Attributes.Add("class", "install-step-title"); pnlStepIcon.Controls.Add(title); // Render separator only between step icons if (i < stepIcons.Length - 1) { // Separator panel var pnlSeparator = new Panel(); pnlSeparator.ID = "separatorPanel" + i; pnlSeparator.CssClass = "install-step-icon-separator"; pnlHeaderImages.Controls.Add(pnlSeparator); // Separator icon var separatorIcon = new CMSIcon(); separatorIcon.CssClass = "icon-arrow-right cms-icon-150"; separatorIcon.Attributes.Add("aria-hidden", "true"); pnlSeparator.Controls.Add(separatorIcon); } } var currentStepIndex = wzdInstaller.ActiveStepIndex; switch (index) { // SQL server and authentication mode case 0: lblHeader.Text += ResHelper.GetString("separationDB.Step0"); SetSelectedCSSClass("stepPanel0"); break; // Database case 1: case COLLATION_DIALOG_INDEX: lblHeader.Text += ResHelper.GetFileString("separationDB.Step1"); SetSelectedCSSClass("stepPanel1"); currentStepIndex = 1; break; // Separation case 2: StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("separationDB.Step2"); SetSelectedCSSClass("stepPanel2"); break; // Finish step case 3: lblHeader.Text += ResHelper.GetFileString("Install.Step7"); SetSelectedCSSClass("stepPanel3"); break; } lblHeader.Text = string.Format(lblHeader.Text, currentStepIndex + 1); }
/// <summary> /// Initialize wizard header /// </summary> /// <param name="index">Step index</param> private void InitializeHeader(int index) { Help.Visible = true; StartHelp.Visible = true; StartHelp.TopicName = Help.TopicName = HELP_TOPIC_LINK; lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - "; string[] stepIcons = { " icon-cogwheel", " icon-database", " icon-layout", " icon-check-circle icon-style-allow" }; string[] stepTitles = { GetString("install.sqlsetting"), GetString("install.lbldatabase"), GetString("install.step5"), GetString("install.finishstep") }; // Set common properties to each step icon for (var i = 0; i < stepIcons.Length; i++) { // Step panel var pnlStepIcon = new Panel(); pnlStepIcon.ID = "stepPanel" + i; pnlStepIcon.CssClass = "install-step-panel"; pnlHeaderImages.Controls.Add(pnlStepIcon); // Step icon var icon = new CMSIcon(); icon.ID = "stepIcon" + i; icon.CssClass = "install-step-icon cms-icon-200" + stepIcons[i]; icon.Attributes.Add("aria-hidden", "true"); pnlStepIcon.Controls.Add(icon); // Step icon title var title = new HtmlGenericControl("title"); title.ID = "stepTitle" + i; title.InnerText = stepTitles[i]; title.Attributes.Add("class", "install-step-title"); pnlStepIcon.Controls.Add(title); // Render separator only between step icons if (i < stepIcons.Length - 1) { // Separator panel var pnlSeparator = new Panel(); pnlSeparator.ID = "separatorPanel" + i; pnlSeparator.CssClass = "install-step-icon-separator"; pnlHeaderImages.Controls.Add(pnlSeparator); // Separator icon var separatorIcon = new CMSIcon(); separatorIcon.CssClass = "icon-arrow-right cms-icon-150"; separatorIcon.Attributes.Add("aria-hidden", "true"); pnlSeparator.Controls.Add(separatorIcon); } } switch (index) { // SQL server and authentication mode case 0: { lblHeader.Text += ResHelper.GetFileString("Install.Step0"); SetSelectedCSSClass("stepPanel0"); break; } // Database case 1: { lblHeader.Text += ResHelper.GetFileString("Install.Step1"); SetSelectedCSSClass("stepPanel1"); break; } // web.config permissions case 2: { StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("Install.Step3"); SetSelectedCSSClass("stepPanel1"); break; } // Database creation log case 3: { StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("Install.Step2"); SetSelectedCSSClass("stepPanel1"); break; } // License import case 4: { lblHeader.Text += ResHelper.GetFileString("Install.Step4"); SetSelectedCSSClass("stepPanel1"); break; } // Starter site selection case 5: { lblHeader.Text += ResHelper.GetFileString("Install.Step5"); SetSelectedCSSClass("stepPanel2"); break; } // Import log case 6: { StartHelp.Visible = Help.Visible = false; lblHeader.Text += ResHelper.GetFileString("Install.Step6"); SetSelectedCSSClass("stepPanel2"); break; } // Finish step case 7: { lblHeader.Text += ResHelper.GetFileString("Install.Step7"); SetSelectedCSSClass("stepPanel3"); break; } case 8: { lblHeader.Text += ResHelper.GetFileString("Install.Step8"); SetSelectedCSSClass("stepPanel1"); break; } } // Calculate step number if (PreviousStep == index) { StepOperation = 0; } ActualStep += StepOperation; lblHeader.Text = string.Format(lblHeader.Text, ActualStep + 1); PreviousStep = index; }