private static string ProcessStyleSheet(string styleSheetContent, MasterPageTheme masterPageTheme, MasterPageThemeColor masterPageThemeColor) { string[] keyNames = null; if (masterPageTheme == MasterPageTheme.Modern) { keyNames = new string[] { "AddNew.png", "NotificationCross.png", "SearchLense.png" }; } else if (masterPageTheme == MasterPageTheme.Gradient) { keyNames = new string[] { "MainMenuBottom.gif", "MainMenuItemRight.gif", "MainMenuItemLeft.gif" , "SubmenuButtonItemMiddle.gif", "SubmenuButtonItemLeft.gif", "SubmenuButtonItemRight.gif" , "SubmenuFirstLevelItemMiddle.gif", "SubmenuFirstLevelItemLeft.gif", "SubmenuFirstLevelItemRight.gif" , "SubmenuSecondLevelItemPointer.gif" , "SubmenuLastSecondLevelItemMiddle.gif", "SubmenuLastSecondLevelItemLeft.gif", "SubmenuLastSecondLevelItemRight.gif" }; } return(ProcessStyleSheet(styleSheetContent, keyNames, ResourceProvider.GetMasterPageThemeColorResource(masterPageTheme, masterPageThemeColor, "{0}"))); }
internal static bool IsMasterPageThemeColorStyleSheet(string resourceName, out MasterPageTheme masterPageTheme, out MasterPageThemeColor masterPageThemeColor) { masterPageTheme = MasterPageTheme.Standard; masterPageThemeColor = MasterPageThemeColor.Red; foreach (MasterPageTheme theme in Enum.GetValues(typeof(MasterPageTheme))) { foreach (MasterPageThemeColor themeColor in Enum.GetValues(typeof(MasterPageThemeColor))) { if (resourceName.EndsWith(GetMasterPageThemeColorStyleSheet(theme, themeColor), StringComparison.OrdinalIgnoreCase)) { masterPageTheme = theme; masterPageThemeColor = themeColor; return(true); } } } return(false); }
internal static string GetMasterPageThemeColorResource(MasterPageTheme theme, MasterPageThemeColor color, string resourceName) { return(string.Format(CultureInfo.InvariantCulture, "Images.MasterPageThemes.{0}{1}.{2}", theme, ((color == MasterPageThemeColor.NotSet) ? null : color.ToString()), resourceName)); }
internal static string GetMasterPageThemeColorStyleSheet(MasterPageTheme theme, MasterPageThemeColor color) { return(string.Format(CultureInfo.InvariantCulture, "Styles.MasterPageThemes.{0}{1}.css", theme, ((color == MasterPageThemeColor.NotSet) ? null : color.ToString()))); }
internal static string GetMasterPageThemeBaseStyleSheet(MasterPageTheme theme) { return(string.Format(CultureInfo.InvariantCulture, "Styles.MasterPageThemes.{0}.css", theme)); }
private static void GetEmbeddedResource(string resourceName, ref byte[] content, ref string contentType, ref string name, ref bool cacheable) { if (string.IsNullOrEmpty(resourceName)) { return; } string[] parts = resourceName.Split('?'); resourceName = parts[0]; name = GetResourceFileName(resourceName); contentType = MimeType.GetMimeType(Support.GetLastPartOfString(resourceName, ".", true), MimeType.Text); resourceName = ManifestResourceNamePrefix + "." + resourceName; MasterPageTheme masterPageTheme = MasterPageTheme.Standard; MasterPageThemeColor masterPageThemeColor = MasterPageThemeColor.Red; DetailMenuTheme detailMenuTheme = DetailMenuTheme.Standard; if (resourceName.EndsWith(CustomStyleSheet, StringComparison.OrdinalIgnoreCase)) { cacheable = false; string styleSheet = null; if (parts.Length > 0) { object obj = Support.ConvertStringToType(parts[1], typeof(Guid)); if (obj != null) { styleSheet = SettingProvider.GetCustomStyleSheet((Guid)obj); } } if (!Support.StringIsNullOrEmpty(styleSheet)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(styleSheet, FrameworkConfiguration.Current.WebApplication.MasterPage.Theme, FrameworkConfiguration.Current.WebApplication.MasterPage.ThemeColor)); } else { content = new byte[] { } }; } else if (resourceName.EndsWith(ComboBoxModernStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessComboBoxModernStyleSheet(GetManifestResourceString(resourceName))); } else if (IsMasterPageThemeColorStyleSheet(resourceName, out masterPageTheme, out masterPageThemeColor)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(GetManifestResourceString(resourceName), masterPageTheme, masterPageThemeColor)); } else if (IsDetailMenuThemeStyleSheet(resourceName, out detailMenuTheme)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(GetManifestResourceString(resourceName), detailMenuTheme)); } else if (resourceName.EndsWith(BootstrapStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessBootstrapStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(FancyBoxStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessFancyBoxStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(GlobalModernStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(GetManifestResourceString(resourceName), MasterPageTheme.Modern, MasterPageThemeColor.NotSet)); } else if (resourceName.EndsWith(CommonGridViewModernStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessCommonGridViewModernStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(AccountSettingsStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessAccountSettingsStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(CreditCardRegistrationStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessCreditCardRegistrationStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(OnOffSwitchStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessOnOffSwitchStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(NoticeMessageBoxStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessNoticeMessageBoxStyleSheet(GetManifestResourceString(resourceName))); } else { content = GetManifestResourceBytes(resourceName); } }
/// <summary> /// Creates child controls. /// </summary> protected override void CreateChildControls() { this.Controls.Clear(); if (this.Items.Count == 0) { return; } HtmlGenericControl mainContainer = null; HtmlGenericControl container = null; HtmlGenericControl innerContainer = null; HtmlGenericControl bar = null; HtmlGenericControl ul = null; HtmlGenericControl p = null; ControlList controlList = null; Control itemLink = null; Guid mainMenuItemId = this.SelectedActionId; try { mainContainer = new HtmlGenericControl("div"); mainContainer.Attributes["class"] = "Mp_Mm"; this.Controls.Add(mainContainer); MasterPageTheme theme = FrameworkConfiguration.Current.WebApplication.MasterPage.Theme; switch (theme) { case MasterPageTheme.Gradient: case MasterPageTheme.StandardTabs: case MasterPageTheme.Modern: ul = new HtmlGenericControl("ul"); string cssClass = null; if (theme == MasterPageTheme.Modern) { p = new HtmlGenericControl("p"); p.Attributes["class"] = "mobile-nav"; p.InnerHtml = Resources.MainMenu_MenuLink_Text; innerContainer = new HtmlGenericControl("div"); innerContainer.Attributes["class"] = "col-sm-12"; innerContainer.Controls.Add(p); innerContainer.Controls.Add(ul); container = new HtmlGenericControl("div"); container.Attributes["class"] = "container"; container.Controls.Add(innerContainer); mainContainer.Controls.Add(container); cssClass = "active"; } else { mainContainer.Controls.Add(ul); cssClass = "S"; } foreach (Micajah.Common.Bll.Action item in this.Items) { if (item.ActionId == ActionProvider.StartPageActionId) { bool redirect = false; Micajah.Common.WebControls.AdminControls.StartControl.GetStartMenuCheckedItems(m_UserContext, out redirect); if (redirect) { continue; } } ul.Controls.Add(CreateLinkAsListItem(item, ((item.ActionId == mainMenuItemId) ? cssClass : null))); } if (theme != MasterPageTheme.Modern) { bar = new HtmlGenericControl("div"); bar.Attributes["class"] = "Mp_Mmb"; this.Controls.Add(bar); } break; case MasterPageTheme.Standard: controlList = new ControlList(); controlList.Delimiter = " | "; foreach (Micajah.Common.Bll.Action item in this.Items) { if (item.ActionId == ActionProvider.StartPageActionId) { bool redirect = false; Micajah.Common.WebControls.AdminControls.StartControl.GetStartMenuCheckedItems(m_UserContext, out redirect); if (redirect) { continue; } } itemLink = Submenu.CreateLink(item, ((item.ActionId == mainMenuItemId) ? "S" : null), false); controlList.Add(itemLink); } mainContainer.Controls.Add(controlList); break; } } finally { if (ul != null) { ul.Dispose(); } if (mainContainer != null) { mainContainer.Dispose(); } if (bar != null) { bar.Dispose(); } if (container != null) { container.Dispose(); } if (innerContainer != null) { innerContainer.Dispose(); } if (p != null) { p.Dispose(); } if (controlList != null) { controlList.Dispose(); } if (itemLink != null) { itemLink.Dispose(); } } }
private static void ComboBox_PreRender(object sender, EventArgs e) { RadComboBox radComboBox = (RadComboBox)sender; ComboBox comboBox = sender as ComboBox; MasterPageTheme theme = FrameworkConfiguration.Current.WebApplication.MasterPage.Theme; if (comboBox != null) { theme = comboBox.Theme; } if (theme != MasterPageTheme.Modern) { return; } radComboBox.EnableEmbeddedSkins = false; radComboBox.Skin = "Modern"; StringBuilder sb = new StringBuilder(); if ((!string.IsNullOrEmpty(radComboBox.OnClientBlur)) && (string.Compare(radComboBox.OnClientBlur, "ComboBox_Blur", StringComparison.Ordinal) != 0)) { if (!radComboBox.Page.IsPostBack) { radComboBox.Attributes["OnClientBlurOriginal"] = radComboBox.OnClientBlur; } string handler = string.Format(CultureInfo.InvariantCulture, "{0}_ClientBlur", radComboBox.ClientID); radComboBox.OnClientBlur = handler; sb.AppendFormat(CultureInfo.InvariantCulture , "function {0}(sender, eventArgs) {{ ComboBox_Blur(sender, eventArgs); {1}(sender, eventArgs); }}\r\n" , handler, radComboBox.Attributes["OnClientBlurOriginal"]); } else { radComboBox.OnClientBlur = "ComboBox_Blur"; } if ((!string.IsNullOrEmpty(radComboBox.OnClientFocus)) && (string.Compare(radComboBox.OnClientFocus, "ComboBox_Focus", StringComparison.Ordinal) != 0)) { if (!radComboBox.Page.IsPostBack) { radComboBox.Attributes["OnClientFocusOriginal"] = radComboBox.OnClientFocus; } string handler = string.Format(CultureInfo.InvariantCulture, "{0}_ClientFocus", radComboBox.ClientID); radComboBox.OnClientFocus = handler; sb.AppendFormat(CultureInfo.InvariantCulture , "function {0}(sender, eventArgs) {{ ComboBox_Focus(sender, eventArgs); {1}(sender, eventArgs); }}\r\n" , handler, radComboBox.Attributes["OnClientFocusOriginal"]); } else { radComboBox.OnClientFocus = "ComboBox_Focus"; } ResourceProvider.RegisterStyleSheetResource(radComboBox, ResourceProvider.ComboBoxModernStyleSheet, "ComboBoxModernStyleSheet", true); if (sb.Length > 0) { ScriptManager.RegisterClientScriptBlock(radComboBox, radComboBox.GetType(), radComboBox.ClientID + "_Handlers", sb.ToString(), true); } if (comboBox != null) { if (comboBox.Required) { return; } } ScriptManager.RegisterClientScriptInclude(radComboBox.Page, radComboBox.Page.GetType(), "ComboBoxClientScripts", ResourceProvider.GetResourceUrl("Scripts.ComboBox.js", true)); }
protected override void CreateChildControls() { base.CreateChildControls(); if (this.IsEmpty) { return; } this.CreateFormTable(); int columnIndex = 0; int columnsCount = this.RepeatColumns - 1; int rowIndex = 0; bool showRequiredTable = false; TableRow row = null; MasterPageTheme theme = this.Theme; foreach (EntityField field in m_Entity.CustomFields) { if (row == null) { row = new TableRow(); } TableCell cell = new TableCell(); Label lbl = new Label(); lbl.Text = field.Name; if (columnIndex > 0) { cell.CssClass = "Mf_HcPl"; } cell.Controls.Add(lbl); row.Cells.Add(cell); CustomField customField = new CustomField(); customField.Theme = theme; customField.Entity = this.Entity; customField.EntityField = field; customField.OrganizationId = this.OrganizationId; customField.InstanceId = this.InstanceId; customField.LocalEntityId = this.LocalEntityId; customField.ValidationGroup = this.ValidationGroup; customField.ID = "CustomField" + rowIndex.ToString(CultureInfo.InvariantCulture); this.CustomFields.Add(customField); cell = new TableCell(); cell.Controls.Add(customField); row.Cells.Add(cell); if (columnIndex == columnsCount) { m_FormTable.Rows.Add(row); columnIndex = 0; row = null; } else { columnIndex++; } rowIndex++; if (!field.AllowDBNull) { showRequiredTable = true; } } if (!this.IsInMagicForm) { m_FormTable.Rows.Add(this.GetFooterRow(showRequiredTable)); } MagicForm.ApplyStyle(m_FormTable, this.ColorScheme, this.IsInMagicForm, false); }