public static void cssInclude(string cssPath, bool useImport, System.Web.UI.MasterPage masterPage) { if (useImport) { using (System.Web.UI.HtmlControls.HtmlGenericControl control = new System.Web.UI.HtmlControls.HtmlGenericControl()) { control.TagName = "style"; control.Attributes.Add("type", "text/css"); control.InnerHtml = "@import \"" + cssPath + "\";"; masterPage.Page.Header.Controls.Add(control); } } else { using (System.Web.UI.HtmlControls.HtmlLink control = new System.Web.UI.HtmlControls.HtmlLink()) { control.Attributes.Add("rel", "Stylesheet"); control.Attributes.Add("type", "text/css"); control.Attributes.Add("href", cssPath); masterPage.Page.Header.Controls.Add(control); } } }
public static void cssInclude(string cssPath, string mediaType, bool useImport, System.Web.UI.MasterPage masterPage) { using (System.Web.UI.HtmlControls.HtmlGenericControl control = new System.Web.UI.HtmlControls.HtmlGenericControl()) { if (useImport) { control.TagName = "style"; control.Attributes.Add("type", "text/css"); control.InnerHtml = "@import \"" + cssPath + "\";"; } else { control.TagName = "link"; control.Attributes.Add("rel", "Stylesheet"); control.Attributes.Add("type", "text/css"); control.Attributes.Add("href", cssPath); if (!string.IsNullOrEmpty(mediaType)) { control.Attributes.Add("media", mediaType); } } masterPage.Page.Header.Controls.Add(control); } }
///// <summary> ///// ///// </summary> ///// <param name="message"></param> ///// <param name="title"></param> //public static void ProcessErrorHandler(string message, string title) //{ // MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Error); //} //// //public static void ProcessInfoHandler(string message, string title) //{ // MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Information); //} // /// <summary> // /// // /// </summary> // public static string LoadDefaultOfficeCode() // { // string code = string.Empty; // try // { // RegistryUtil regUtil = new RegistryUtil(); // if (regUtil.ValidateKey(@"HKLM\Software\NMS\Verve.DashboardManager")) // { // code = regUtil.GetValueData(@"HKLM\Software\NMS\Verve.DashboardManager", "OfficeCode"); // } // } // // ReSharper disable EmptyGeneralCatchClause // catch (Exception) // // ReSharper restore EmptyGeneralCatchClause // { // //Do nothing // } // return code; // } //public static void EnableLastSelected() //{ // if (scf != null) // { // scf.Enabled = true; // } //} public static void ExceptionHandler(Exception ex, System.Web.UI.MasterPage page) { if (ex.Message.Contains("InvalidUserTokenException")) { //MessageBox.Show("Your session does not have the appropriate authorisation", "Authentication Error", // MessageBoxButtons.OK, // MessageBoxIcon.Error); BounceToLogin(); } else if (ex.Message.Contains("ExpiredUserTokenException")) { //MessageBox.Show("Your session authorisation has expired", "Authentication Error", // MessageBoxButtons.OK, // MessageBoxIcon.Error); BounceToLoginExpire(page.Response); } else if (ex.Message.Contains("OperationFailedException")) { //MessageBox.Show("Data processing error occurred.", "Data Access Error", // MessageBoxButtons.OK, // MessageBoxIcon.Error); // BounceToLogin(); } else { //MessageBox.Show(ex.Message, "Operations Services Error", MessageBoxButtons.OK, // MessageBoxIcon.Error); //BounceToLogin(); } }
public static CompositionBatch BuildUpMaster(CompositionBatch batch, MasterPage master) { if (master != null) batch = BuildUpMaster(ComposeWebPartsUtils.BuildUp(batch, master), master.Master); return batch; }
/// <summary> /// A constructor. /// </summary> /// <param name="_xmlData">Source XML document</param> public LabelGame(MasterPage Master, XmlDocument _xmlData) : base(Master, _xmlData) { imageUrl = base.processXPathExpressionToList<LabelImage>(xmlData, "//qlist/img")[0].imageUrl; wordsAreas = base.processXPathExpressionToList<WordsArea>(xmlData, "//qlist/q"); wordsAreasJSON = JsonConvert.SerializeObject(wordsAreas); }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (Master != null) { System.Web.UI.MasterPage master = Master; while (master.Master != null) { master = master.Master; } if (!(master is Atomo.Web.MasterPage)) { throw new Exception("A Master Page tem que herdar de Atomo.Web.MasterPage!"); } this.jsContainer = ((Atomo.Web.MasterPage)master).JsContainer; this.cssContainer = ((Atomo.Web.MasterPage)master).CssContainer; } else { this.jsContainer = new JsContainer(); this.cssContainer = new CssContainer(); } this.Create(); }
internal static void UppdateMiniCart(MasterPage master, ShopingCart shopingCart) { var activeCart = shopingCart.CartItems.Take(shopingCart.ItemsInMiniCartToShow); Repeater shopingBasketRepeater = (Repeater)master.FindControl("repBasket"); HyperLink linkToRegisterSmallCart = (HyperLink) master.FindControl("linkToRegisterSmallCart"); Label lblMiniCartCount = (Label)master.FindControl("lblMiniCartCount"); Label lblMiniCartSum = (Label)master.FindControl("lblMiniCartSum"); Literal liMiniCartContentEmpty = (Literal)master.FindControl("liMiniCartContentEmpty"); Label lblMoreThanFiveItemsInCart = (Label) master.FindControl("lblMoreThanFiveItemsInCart"); lblMiniCartCount.Text = $"Articles: {shopingCart.NumberOfItems}"; ; lblMiniCartSum.Text = $"Sum: {shopingCart.SumTotal:N2} kr"; shopingBasketRepeater.DataSource = activeCart; shopingBasketRepeater.DataBind(); if (shopingCart.CartItems.Count > 0) { linkToRegisterSmallCart.Visible = true; liMiniCartContentEmpty.Visible = false; } else { linkToRegisterSmallCart.Visible = false; liMiniCartContentEmpty.Visible = true; } if (shopingCart.CartItems.Count > shopingCart.ItemsInMiniCartToShow) lblMoreThanFiveItemsInCart.Visible = true; else { lblMoreThanFiveItemsInCart.Visible = false; } }
public static bool AlertRedirectWindowMaster(System.Web.UI.MasterPage masterPage, string strMessage, string RedirectPage) { string strScript = @"alert( '" + strMessage + "' ); window.location.href='" + RedirectPage + "';"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(masterPage, masterPage.GetType(), "Key1", strScript, true); return(false); }
// Load data from database into UI controls. // Modify LoadData in Section 1 above to customize. Or override DataBind() in // the individual table and record controls to customize. public void LoadData_Base() { try { if ((!this.IsPostBack) || (this.Request["__EVENTTARGET"] == "ChildWindowPostBack") || (this.Request["__EVENTTARGET"] == "isd_geo_location")) { // Must start a transaction before performing database operations DbUtils.StartTransaction(); } this.DataBind(); SetUsersTabContainer(); // Load and bind data for each record and table UI control. SetUsersRecordControl(); SetGroupsTableControl(); SetRoles1TableControl(); // Load data for chart. // initialize aspx controls SetEditButton(); SetOKButton(); //Set the corresponding menu item to be highlighted for this page System.Web.UI.MasterPage pageMaster = this.Master; if (!(pageMaster == null)) { IMenuComponent menuComponent = ((IMenuComponent)(this.Master.FindControl("_Menu"))); if (!(menuComponent == null)) { menuComponent.HiliteSettings = "UsersMenuItem"; } } } catch (Exception ex) { // An error has occured so display an error message. BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "Page_Load_Error_Message", ex.Message); } finally { if ((!this.IsPostBack) || (this.Request["__EVENTTARGET"] == "ChildWindowPostBack") || (this.Request["__EVENTTARGET"] == "isd_geo_location")) { // End database transaction DbUtils.EndTransaction(); } } }
/// <summary> /// /// </summary> /// <param name="title"></param> public static void SetMasterPageTitle(MasterPage master, string title) { Site1 site1 = master as Site1; if (site1 != null) { site1.TitleLabelText = title; } }
/// <summary> /// A constructor. /// </summary> /// <param name="_xmlData">Source XML document</param> public MemoryGame(MasterPage Master, XmlDocument _xmlData) : base(Master, _xmlData) { gameCardsInner = base.processXPathExpressionToList<MemoryGameCard>(xmlData, "//qlist/q"); numberOfCards = gameCardsInner.Count * 2; gameCards = doubleAndShuffle(gameCardsInner); gameCardsJSON = JsonConvert.SerializeObject(gameCards); }
/// <summary> /// Init Breadcrumb /// </summary> /// <param name="levelMasterPage">Cấp của master page chính</param> /// <param name="controlId">Tên của control Breadcrumb tren main master page</param> public void Init(int levelMasterPage, string controlId) { _levelMasterPage = levelMasterPage; _controlId = controlId; _masterpage = _page.Master; for (int i = 1; i <= levelMasterPage - 1; i++) _masterpage = _masterpage.Master as MasterPage; _control = _masterpage.FindControl(controlId); }
private bool PageProvidesMatchingContent(MasterPage masterPage) { if (masterPage != null && masterPage.ContentTemplates != null && masterPage.ContentTemplates.Contains(_contentPlaceHolderID)) { return true; } return false; }
public static void metaInclude(string key, string value, System.Web.UI.MasterPage masterPage) { using (System.Web.UI.HtmlControls.HtmlMeta meta_tag = new System.Web.UI.HtmlControls.HtmlMeta()) { meta_tag.Attributes.Add(key, value); masterPage.Page.Header.Controls.Add(meta_tag); } }
public static void jsInclude(string jsPath, System.Web.UI.MasterPage masterPage) { using (System.Web.UI.HtmlControls.HtmlGenericControl js = new System.Web.UI.HtmlControls.HtmlGenericControl()) { js.TagName = "script"; js.Attributes.Add("type", "text/javascript"); js.Attributes.Add("src", jsPath); masterPage.Page.Header.Controls.Add(js); } }
public static void cssInclude(string cssPath, System.Web.UI.MasterPage masterPage) { using (System.Web.UI.HtmlControls.HtmlGenericControl css = new System.Web.UI.HtmlControls.HtmlGenericControl()) { css.TagName = "style"; css.Attributes.Add("type", "text/css"); css.InnerHtml = "@import \"" + cssPath + "\";"; masterPage.Page.Header.Controls.Add(css); } }
public static void faviconInclude(string faviconPath, System.Web.UI.MasterPage masterPage) { using (System.Web.UI.HtmlControls.HtmlLink favicon = new System.Web.UI.HtmlControls.HtmlLink()) { favicon.Attributes.Add("rel", "shortcut icon"); favicon.Attributes.Add("type", "image/x-icon"); favicon.Attributes.Add("href", faviconPath); masterPage.Page.Header.Controls.Add(favicon); } }
public static string strGetCookie(System.Web.UI.MasterPage objPage, string strName, string strDefaultValue) { try { return(objPage.Server.UrlDecode(objPage.Request.Cookies.Get(objPage.Server.UrlDecode(strName)).Value)); } catch { } return(strDefaultValue); }
public object FindNoticeMenuControl() { System.Web.UI.MasterPage master = Page.Master; object notice = null; while (notice == null && master != null) { notice = master.FindControl("noticeMenu"); master = master.Master; } return(notice); }
public static Control GetPageControl(MasterPage masterPage) { Control control = GetControl(masterPage, ControlType.Page); // if there is no control defined, select the default one if (control == null) { HtmlGenericControl div = new HtmlGenericControl("div"); control = div; } return control; }
internal static void ApplyMasterRecursive(MasterPage master, IList appliedMasterFilePaths) { if (master.Master != null) { string str = master._masterPageFile.VirtualPathString.ToLower(CultureInfo.InvariantCulture); if (appliedMasterFilePaths.Contains(str)) { throw new InvalidOperationException(System.Web.SR.GetString("MasterPage_Circular_Master_Not_Allowed", new object[] { master._masterPageFile })); } appliedMasterFilePaths.Add(str); ApplyMasterRecursive(master.Master, appliedMasterFilePaths); } master._masterPageApplied = true; }
protected override void OnPreInit(EventArgs e) { System.Web.UI.MasterPage master = Master; while (master != null) { if (master is MasterPage) { ((MasterPage)master).OnPagePreInit(e); } master = master.Master; } base.OnPreInit(e); }
public static void setPageMessage(string message, severity level, System.Web.UI.MasterPage master) { Label messageLabel = (Label)master.FindControl("lblMessage"); messageLabel.Text = message; if (level == severity.error) { messageLabel.ForeColor = System.Drawing.Color.Red; } else { messageLabel.ForeColor = System.Drawing.Color.Green; } }
/// <summary> /// A constructor. /// </summary> /// <param name="masterValue">A value of inherited dynamically generated class.</param> public MasterProxy(MasterPage masterValue) { _Master = masterValue; _MasterPageType = masterValue.GetType(); _imagePathField = _MasterPageType.GetField("imagePath"); _commonStyleHrefField = _MasterPageType.GetField("commonStyleHref"); _gameCommonStyleHrefField = _MasterPageType.GetField("gameCommonStyleHref"); _gameSpecificStyleHrefField = _MasterPageType.GetField("gameSpecificStyleHref"); _gameJavaScriptSrcField = _MasterPageType.GetField("gameJavaScriptSrc"); _versionField = _MasterPageType.GetField("version"); _titleField = _MasterPageType.GetField("title"); _JSONStringField = _MasterPageType.GetField("JSONString"); _userSessionID = _MasterPageType.GetField("userSessionID"); _gameSessionID = _MasterPageType.GetField("gameSessionID"); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); System.Web.UI.MasterPage m = Master; Control control = GetPostBackControl(this); if (control != null) { if ((control.ClientID == (lbAddAndCondtion.ClientID) || createAgain) || control.ID.Contains("options")) { createAgain = true; CreateUserControls(true); } if ((control.ClientID == (lbOrCondition.ClientID) || createAgain) || control.ID.Contains("orConditions")) { createAgain = true; CreateUserControls(false); } } }
public SessionManager(System.Web.UI.MasterPage page) : this(page.Cache, page.Request, page.Response) { }
public static void metaInclude(System.Collections.Specialized.NameValueCollection metaAttributes, System.Web.UI.MasterPage masterPage) { using (System.Web.UI.HtmlControls.HtmlMeta meta_tag = new System.Web.UI.HtmlControls.HtmlMeta()) { foreach (string key in metaAttributes.AllKeys) { meta_tag.Attributes.Add(key, metaAttributes.Get(key)); } masterPage.Page.Header.Controls.Add(meta_tag); } }
private void BuildUpMasterPage(MasterPage master) { if (master == null) return; var masterContainer = Container.GetNestedContainer(); masterContainer.BuildUp(master); BuildUpMasterPage(master.Master); }
/// <summary> /// A constructor. /// </summary> /// <param name="_xmlData">Source XML document</param> public LineMatching(MasterPage Master, XmlDocument _xmlData) : base(Master, _xmlData) { matchPairs = base.processXPathExpressionToList<MatchPair>(xmlData, "//qlist/q"); matchPairsJSON = JsonConvert.SerializeObject(matchPairs); }
internal static void ApplyMasterPageRecursive (MasterPage master, IList appliedMasterPageFiles) { /* XXX need to use virtual paths here? */ if (master.MasterPageFile != null) { if (appliedMasterPageFiles.Contains (master.MasterPageFile)) throw new HttpException ("circular dependency in master page files detected"); if (master.Master != null) { master.Controls.Clear (); master.Controls.Add (master.Master); appliedMasterPageFiles.Add (master.MasterPageFile); MasterPage.ApplyMasterPageRecursive (master.Master, appliedMasterPageFiles); } } }
public void RegisterMPGet(MasterPage mp) { List<string> lstCph = new List<string>(); lstCph.Add(mp.ClientID); searchContentPlaceHolder(mp.Page.Form, lstCph); StringBuilder sb = new StringBuilder(); sb.Append(@" <script type=""text/javascript""> function ConvertID(objId) { var inpObj = document.getElementById(objId); "); foreach (string cphId in lstCph) { sb.AppendFormat( " if (!inpObj) inp = \"{0}_\" + objId;\n", cphId); } sb.Append("return inp;\n}\n</script>"); Literal js = new Literal(); js.Text = sb.ToString(); mp.Page.Header.Controls.AddAt(0, js); }
internal static MasterPage CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) { Debug.Assert(owner is MasterPage || owner is Page); MasterPage master = null; if (masterPageFile == null) { if (contentTemplateCollection != null && contentTemplateCollection.Count > 0) { throw new HttpException(SR.GetString(SR.Content_only_allowed_in_content_page)); } return(null); } // If it's relative, make it *app* relative. Treat is as relative to this // user control (ASURT 55513) VirtualPath virtualPath = VirtualPathProvider.CombineVirtualPathsInternal( owner.TemplateControlVirtualPath, masterPageFile); // Compile the declarative control and get its Type ITypedWebObjectFactory result = (ITypedWebObjectFactory)BuildManager.GetVPathBuildResult( context, virtualPath); // Make sure it has the correct base type if (!typeof(MasterPage).IsAssignableFrom(result.InstantiatedType)) { throw new HttpException(SR.GetString(SR.Invalid_master_base, masterPageFile)); } master = (MasterPage)result.CreateInstance(); master.TemplateControlVirtualPath = virtualPath; if (owner.HasControls()) { foreach (Control control in owner.Controls) { LiteralControl literal = control as LiteralControl; if (literal == null || Util.FirstNonWhiteSpaceIndex(literal.Text) >= 0) { throw new HttpException(SR.GetString(SR.Content_allowed_in_top_level_only)); } } // Remove existing controls. owner.Controls.Clear(); } // Make sure the control collection is writable. if (owner.Controls.IsReadOnly) { throw new HttpException(SR.GetString(SR.MasterPage_Cannot_ApplyTo_ReadOnly_Collection)); } if (contentTemplateCollection != null) { foreach (String contentName in contentTemplateCollection.Keys) { if (!master.ContentPlaceHolders.Contains(contentName.ToLower(CultureInfo.InvariantCulture))) { throw new HttpException(SR.GetString(SR.MasterPage_doesnt_have_contentplaceholder, contentName, masterPageFile)); } } master._contentTemplates = contentTemplateCollection; } master._ownerControl = owner; master.InitializeAsUserControl(owner.Page); owner.Controls.Add(master); return(master); }
public void InstantiateInContentPlaceHolder () { var mp = new MasterPage (); ITemplate template = new MyTemplate (); AssertExtensions.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (null, template); }, "#A1-1"); Control container = new Control (); AssertExtensions.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (container, null); }, "#A1-2"); #if DOTNET // TODO: why does it throw? Unchecked 'as' type cast? AssertExtensions.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (container, template); }, "#B1-1"); #endif // TODO: Still throws a NREX, probably needs a full web request context, as it works below in the // InstantiateInContentPlaceHolder_WithPage test // //template = new MyContentTemplate (); //mp.InstantiateInContentPlaceHolder (container, template); }
public static void OcultarItem(MasterPage Master, string Item) { Control control = (Control)Master.FindControl(Item); if (control != null) { control.Visible = false; } }
public string RightColumnGet5JoinedGroups() { GroupsDAL groupsDal = new GroupsDAL(); List<Group> groupList = new List<Group>(); groupList = groupsDal.GetAllMembersGroups(aMember); int groupCount = groupList.Count; StringBuilder groups = new StringBuilder(); if (groupCount > 5) { for (int i = 0; i < 5; ++i) { groups.Append("<li><a class = 'btnGoToGroupPage' id='"); groups.Append(groupList[i].GroupId); groups.Append("' >"); groups.Append(groupList[i].GroupDescription); groups.Append("</a></li>"); } MasterPage master = new MasterPage(); HiddenField h = (HiddenField)master.FindControl("StayExpanded"); // try { if (h.Value != null) { if (h.Value == "expanded") { for (int i = 5; i < groupList.Count; ++i) { groups.Append("<li class='groupsToHihe'><a class = 'btnGoToGroupPage' id='"); groups.Append(groupList[i].GroupId); groups.Append("' >"); groups.Append(groupList[i].GroupDescription); groups.Append("</a></li>"); } } } else { for (int i = 5; i < groupList.Count; ++i) { groups.Append("<li style='display: none;' class='groupsToHihe'><a class = 'btnGoToGroupPage' id='"); groups.Append(groupList[i].GroupId); groups.Append("' >"); groups.Append(groupList[i].GroupDescription); groups.Append("</a></li>"); } } } catch { for (int i = 5; i < groupList.Count; ++i) { groups.Append("<li style='display: none;' class='groupsToHihe'><a class = 'btnGoToGroupPage' id='"); groups.Append(groupList[i].GroupId); groups.Append("' >"); groups.Append(groupList[i].GroupDescription); groups.Append("</a></li>"); } } } else { for (int i = 0; i < groupCount; ++i) { groups.Append("<li><a class = 'btnGoToGroupPage' id='"); groups.Append(groupList[i].GroupId); groups.Append("' >"); groups.Append(groupList[i].GroupDescription); groups.Append("</a></li>"); //richTextBox6.Text += groupList[i].GroupId + "\t"; //richTextBox6.Text += groupList[i].GroupDescription + "\n"; } } return groups.ToString(); }
/// <summary> /// Sets the session state if the text in the AdminKeyTextBox is correct /// when compared to the app setting "AdminKey" in the Web.Config file. /// Reads the state of the AdminKey in the http session. /// </summary> /// <param name="master">The site master page containing the AdminKeyTextBox control.</param> /// <param name="session">The http session state object for getting or setting the AdminKey variable.</param> /// <returns>True if either the AdminKeyTextBox text is correct from within the master page, /// or the session variable AdminKey is set.</returns> public static bool IsAdmin(MasterPage master, HttpSessionState session) { TextBox adminKeyTextBox = (TextBox)master.FindControl("AdminKeyTextBox"); return IsAdmin(adminKeyTextBox, session); }
internal static void ApplyMasterPageRecursive(string currentFilePath, VirtualPathProvider vpp, MasterPage master, Dictionary <string, bool> appliedMasterPageFiles) { /* XXX need to use virtual paths here? */ string mpFile = master.MasterPageFile; if (!String.IsNullOrEmpty(mpFile)) { mpFile = vpp.CombineVirtualPaths(currentFilePath, mpFile); if (appliedMasterPageFiles.ContainsKey(mpFile)) { throw new HttpException("circular dependency in master page files detected"); } MasterPage innerMaster = master.Master; if (innerMaster != null) { master.Controls.Clear(); master.Controls.Add(innerMaster); appliedMasterPageFiles.Add(mpFile, true); MasterPage.ApplyMasterPageRecursive(currentFilePath, vpp, innerMaster, appliedMasterPageFiles); } } }
/// <summary> /// Gets the base master page. /// </summary> /// <param name="page">The page.</param> /// <returns></returns> private static Base GetBaseMasterPage(MasterPage page) { Base basePage = page as Base; if (basePage != null) { return basePage; } if (page.Master != null) { return GetBaseMasterPage(page.Master); } return null; }
/// <summary> /// A constructor. /// </summary> /// <param name="_xmlData">Source XML document</param> public WordScramble(MasterPage Master, XmlDocument _xmlData) : base(Master, _xmlData) { words = base.processXPathExpressionToList<ScrambleGameWord>(xmlData, "//qlist/q"); wordsJSON = JsonConvert.SerializeObject(words); }
/// <summary> /// A constructor. /// </summary> /// <param name="_xmlData">Source XML document</param> public FillInTheBlanks(MasterPage Master, XmlDocument _xmlData) : base(Master, _xmlData) { words = base.processXPathExpressionToList<BlankWord>(xmlData, "//qlist/q"); storyText = base.processXPathExpressionToList<StoryText>(xmlData, "//qlist/t")[0].text.Replace("\r\n", " "); wordsJSON = JsonConvert.SerializeObject(words); storyTextWords = storyText.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select<string, storyWords>(delegate (string s) { return new storyWords(s); }).ToList(); indexes = words.Select<BlankWord, Int32>(delegate(BlankWord blank) { return blank.index; }).ToList(); storyTextWords.ForEach(delegate(storyWords word) { int i = storyTextWords.IndexOf(word); if (indexes.IndexOf(i) != -1) { word.isBlank = true; word.index = indexes.IndexOf(i); } else { word.index = -1; } }); }
public static void EnableAllandClearControl(System.Web.UI.MasterPage ms, bool isEnabled = false, bool IsClear = false, string ContentPageName = "maincontent") { foreach (Control ctrl in ms.Controls) { if (ctrl.HasControls()) { foreach (Control item in ctrl.Controls) { if (item.HasControls()) { if (item.GetType().ToString().ToLower() == "system.web.ui.webcontrols.contentplaceholder" && item.ClientID.ToLower() == ContentPageName) { foreach (Control lst in item.Controls) { if (lst.HasControls()) { foreach (Control child in lst.Controls) { if (child is TextBox) { ((TextBox)child).Enabled = isEnabled; if (IsClear) { ((TextBox)child).Text = ""; } } if (child is DropDownList) { ((DropDownList)child).Enabled = isEnabled; if (IsClear) { ((DropDownList)child).SelectedIndex = -1; } } if (child is CheckBoxList) { CheckBoxList chk = (CheckBoxList)child; foreach (ListItem items in chk.Items) { items.Selected = false; } } if (child is UpdatePanel) { if (child.HasControls()) { foreach (Control ddl in child.Controls) { if (ddl.HasControls()) { foreach (Control d in ddl.Controls) { if (d is DropDownList) { ((DropDownList)d).Enabled = isEnabled; if (IsClear) { ((DropDownList)d).SelectedIndex = -1; } } if (d is TextBox) { ((TextBox)d).Enabled = isEnabled; if (IsClear) { ((TextBox)d).Text = ""; } } } } } } } } } } } } } } } }
public SessionManager(System.Web.UI.MasterPage page) : base(page) { CacheAuthCookie(); }
public static void PersonalizarControlesMaster(MasterPage Master, bool RefrescaDatosUsuario, CondecoEntidades.Sesion Sesion) { if (RefrescaDatosUsuario) CondecoRN.Sesion.RefrescarDatosUsuario(Sesion.Usuario, Sesion); if (Sesion.Ambiente != "PROD") { //ContentPlaceHolder cedeiraContentPlaceHolder = ((ContentPlaceHolder)Master.FindControl("CedeiraContentPlaceHolder")); Label ambienteLabel = ((Label)Master.FindControl("AmbienteLabel")); ambienteLabel.Text = Sesion.Ambiente; Label baseDeDatos = ((Label)Master.FindControl("BaseDeDatosLabel")); baseDeDatos.Text = Sesion.BaseDeDatos; } Control btnUsuarioLogin = (Control)Master.FindControl("btnUsuarioLogin"); btnUsuarioLogin.Visible = false; Control btnAdmin = (Control)Master.FindControl("btnAdmin"); btnAdmin.Visible = false; Control btnCerrarLogin = (Control)Master.FindControl("btnCerrarLogin"); btnCerrarLogin.Visible = false; Control btnUsuario = (Control)Master.FindControl("btnUsuario"); btnUsuario.Visible = false; //ImageButton usuarioImageButton = ((ImageButton)Master.FindControl("UsuarioImageButton")); //ContentPlaceHolder usuarioContentPlaceHolder = ((ContentPlaceHolder)Master.FindControl("UsuarioCPH")); //Label usuarioLabel = ((Label)usuarioContentPlaceHolder.FindControl("UsuarioLabel")); //HyperLink usuarioHyperLink = ((HyperLink)usuarioContentPlaceHolder.FindControl("UsuarioHyperLink")); List<CondecoEntidades.Permiso> permisoAdminSITEActive = Sesion.Usuario.Permisos.FindAll(delegate(CondecoEntidades.Permiso p) { return p.TipoPermiso.Id == "AdminSITE" && p.Estado == "Vigente"; }); if (permisoAdminSITEActive.Count != 0) { btnAdmin.Visible = true; } //mItem = new MenuItem("Close session", "Close session"); //menu.Items.Add(mItem); //menu.Items[menu.Items.Count - 1].Selectable = false; if (Sesion != null) { foreach (string s in Sesion.OpcionesHabilitadas) { Control c = (Control)Master.FindControl("btn" + s); if (c != null) { c.Visible = true; } } if (Sesion.Usuario.Id != null) { Control c = (Control)Master.FindControl("btnUsuario"); if (c != null) { c.Visible = true; } c = (Control)Master.FindControl("btnCerrarLogin"); if (c != null) { c.Visible = true; } Label usrNombre = (Label)Master.FindControl("lblUsuario"); if (usrNombre != null) { usrNombre.Text = Sesion.Usuario.Id + " - " + Sesion.Usuario.Nombre; } //String path = Master.Server.MapPath("~/ImagenesSubidas/"); //string[] archivos = System.IO.Directory.GetFiles(path, Sesion.Usuario.Id + ".*", System.IO.SearchOption.TopDirectoryOnly); //if (archivos.Length > 0) //{ // usuarioImageButton.ImageUrl = "~/ImagenesSubidas/" + archivos[0].Replace(Master.Server.MapPath("~/ImagenesSubidas/"), String.Empty); //} //else //{ // usuarioImageButton.ImageUrl = "~/Imagenes/SiluetaHombre.jpg"; //} //usuarioImageButton.Visible = true; //usuarioContentPlaceHolder.Visible = true; //usuarioHyperLink.Text = Sesion.Usuario.Nombre.Replace(" ", " "); //usuarioLabel.Text = "User: "******"btnUsuarioLogin"); if (c != null) { c.Visible = true; } } }
private AppX.Reporting.Web.Blank GetBlankMaster(MasterPage master) { if (master != null) { AppX.Reporting.Web.Blank blank = master as AppX.Reporting.Web.Blank; if (null != blank) return blank; return this.GetBlankMaster(master.Master); } return master as AppX.Reporting.Web.Blank; }
public void RegisterTxtBox(MasterPage mp) { StringBuilder sb = new StringBuilder(); sb.Append(@" <script type=""text/javascript""> window.onload = function() { $('input[type=text][isvalid!=false]').keydown(function(event) { // Allow: backspace, delete, tab, escape, and enter if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || // Allow: Ctrl+A (event.keyCode == 65 && event.ctrlKey === true) || // Allow: home, end, left, right (event.keyCode >= 35 && event.keyCode <= 39)) { // let it happen, don't do anything return; } else { // Ensure that it is a number and stop the keypress if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 ) && (event.keyCode < 65|| event.keyCode > 90)) { event.preventDefault(); } } });}; </script>"); Literal js = new Literal(); js.Text = sb.ToString(); mp.Page.Header.Controls.AddAt(0, js); }
internal override void AddContentTemplate(object obj, string templateName, ITemplate template) { MasterPage master = (MasterPage)obj; master.AddContentTemplate(templateName, template); }
private static MasterPage getSecondLevelMaster( MasterPage master ) { return master.Master.Master == null ? master : getSecondLevelMaster( master.Master ); }
private bool Validate(MasterPage masterPage, out EntityToken newEntityToken) { newEntityToken = null; if(!(this.EntityToken is PageTemplateEntityToken)) { return true; } var pageTemplate = GetPageTemplate(); var templateDefinition = masterPage as MasterPagePageTemplate; if(templateDefinition == null) { if(!pageTemplate.IsValid) { return true; } ShowWarning(GetText("EditTemplate.Validation.IncorrectBaseClass") .FormatWith(typeof(MasterPagePageTemplate).FullName)); return false; } Guid templateId; try { templateId = templateDefinition.TemplateId; } catch (Exception ex) { ShowPropertyError("TemplateId", ex); return false; } try { string newTitle = templateDefinition.TemplateTitle; } catch (Exception ex) { ShowPropertyError("TemplateTitle", ex); return false; } if(pageTemplate.IsValid) { if (templateId != pageTemplate.Id) { ShowWarning(GetText("EditTemplate.Validation.TemplateIdChanged").FormatWith(pageTemplate.Id)); return false; } } else { newEntityToken = new PageTemplateEntityToken(templateId); } return true; }
public HostedSessionManager(MasterPage page) : this(page.Cache, page.Request, page.Response) { }
internal static void ApplyMasterRecursive(MasterPage master, IList appliedMasterFilePaths) { Debug.Assert(appliedMasterFilePaths != null); // Recursively apply master pages to the nested masterpages. if (master.Master != null) { string pageFile = master._masterPageFile.VirtualPathString.ToLower(CultureInfo.InvariantCulture); if (appliedMasterFilePaths.Contains(pageFile)) { throw new InvalidOperationException(SR.GetString(SR.MasterPage_Circular_Master_Not_Allowed, master._masterPageFile)); } appliedMasterFilePaths.Add(pageFile); ApplyMasterRecursive(master.Master, appliedMasterFilePaths); } master._masterPageApplied = true; }
/// <summary> /// PageInfo class constructor. /// </summary> /// <param name="e_game_type">Game type enum value.</param> /// <param name="style_name">A color name.</param> /// <param name="Master">An instance of Game.master page class.</param> /// <param name="Session">User State Session object.</param> public PageInfo(MasterPage Master, EGameType e_game_type, string style_name, string queryString, string userSessionID, string gameSessionID, HttpSessionState Session) { /** * Create new instance of GameServiceProxy class to provide access to web service methods. **/ _GSP = new GameServiceProxy(e_game_type, queryString, userSessionID, gameSessionID, Session); /** * Get gameSessionID from web service. **/ this.gameSessionID = _GSP.createGameSession(); /** * Set Session parameters. */ this.userSessionID = userSessionID; /** * Get XML data from service. **/ _GSP.getXMLdata(); /** * Setting private Game.master instance variable. **/ _Master = new MasterProxy(Master); /** * Receive XmlDocument instance from GameServiceProxy. **/ XMLDoc = _GSP.xmlData; /** * Convert XML to JSON string. **/ JSONString = JsonConvert.SerializeXmlNode(XMLDoc); /** * Setting version string variable. */ version = _getVersion(); /** * Color postfixes for file names. **/ string colorPostfix = "", pathPostfix = ""; /** * Setting color postfixes in depend on style_name value. **/ switch (style_name) { case "orange": colorPostfix = "orange"; pathPostfix = "-orange"; break; case "blue": colorPostfix = "blue"; pathPostfix = "-blue"; break; case "cyan": colorPostfix = "cyan"; pathPostfix = "-cyan"; break; case "purple": colorPostfix = "purple"; pathPostfix = "-purple"; break; default: colorPostfix = "default"; pathPostfix = ""; break; } /** * Launching private method to set public field values. **/ setColorValues("css/css-game-" + colorPostfix + ".css", "images" + pathPostfix); /** * Launching private method to set field value in depend on e_game_type value. **/ switch (e_game_type) { case EGameType.GT_FILL_IN_THE_BLANKS: setGameTypeValues("Fill in the blanks", "css/fill_intheblank_style.css", "css/fill-" + colorPostfix + ".css", "js-games/FillInTheBlanks.js"); break; case EGameType.GT_QUIZ_MAKER: setGameTypeValues("Quiz Game", "css/quiz-game-style.css", "css/quiz-" + colorPostfix + ".css", "js-games/QuizGame.js"); break; case EGameType.GT_MEMORY_GAME: setGameTypeValues("Memory Game", "css/memory-game-style.css", "css/memory-" + colorPostfix + ".css", "js-games/MemoryGame.js"); break; case EGameType.GT_WORD_SCRAMBLE: setGameTypeValues("Word Scramble", "css/word-scramble-style.css", "css/wordscramble-" + colorPostfix + ".css", "js-games/WordScramble.js"); break; case EGameType.GT_LABEL_GAME: setGameTypeValues("Label Game", "css/label-game-style.css", "css/label-" + colorPostfix + ".css", "js-games/LabelGame.js"); break; case EGameType.GT_LINE_MATCHING: setGameTypeValues("Line Matching", "css/line-matching-style.css", "css/line-" + colorPostfix + ".css", "js-games/LineMatching.js"); break; case EGameType.GT_SUPER_TYPER: setGameTypeValues("Fast Typing Game", "css/fast-typing-style.css", "css/fast-typing-" + colorPostfix + ".css", "js-games/SuperTyper.js"); break; } }
public static Control GetPhotoControl(MasterPage masterPage) { Control control = null; RatnaMasterPage master = masterPage as RatnaMasterPage; if (master != null) { IPageStyle pageStyle = master.PageStyle; if (pageStyle != null) { // check for photo control string photoControl = pageStyle.PhotoControl; if (!string.IsNullOrEmpty(photoControl)) { // check the file exists try { string controlPath = string.Format("{0}/{1}", master.AppRelativeTemplateSourceDirectory, photoControl); control = master.LoadControl(master.ResolveUrl(photoControl)); } catch (Exception exception) { // unable to load the control. logger.Log(LogLevel.Warn, "Unable to load the control at : [{0}], error message : {1}", photoControl, exception); } } } } return control; }