PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/admin/admin.master.cs

#
C# | 63 lines | 33 code | 9 blank | 21 comment | 1 complexity | 5b65797b2a6020d81b5adee6f76db6b4 MD5 | raw file
 1// --------------------------------------------------------------------------------------------------------------------
 2// <summary>
 3//   The AdminMasterPage.
 4// </summary>
 5// --------------------------------------------------------------------------------------------------------------------
 6
 7namespace Admin
 8{
 9    using System;
10    using System.Threading;
11    using System.Web.UI;
12
13    using BlogEngine.Core;
14
15    /// <summary>
16    /// The AdminMasterPage.
17    /// </summary>
18    public partial class AdminMasterPage : MasterPage
19    {
20        #region Public Methods
21
22        /// <summary>
23        /// Sets the status.
24        /// </summary>
25        /// <param name="status">
26        /// The status.
27        /// </param>
28        /// <param name="msg">
29        /// The message.
30        /// </param>
31        public void SetStatus(string status, string msg)
32        {
33            this.AdminStatus.Attributes.Clear();
34            this.AdminStatus.Attributes.Add("class", status);
35            this.AdminStatus.InnerHtml =
36                string.Format(
37                    "{0}<a href=\"javascript:HideStatus()\" style=\"width:20px;float:right\">X</a>", 
38                    this.Server.HtmlEncode(msg));
39        }
40
41        #endregion
42
43        #region Methods
44
45        /// <summary>
46        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
47        /// </summary>
48        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
49        protected override void OnInit(EventArgs e)
50        {
51            if (!Security.IsAuthenticated)
52            {
53                Security.RedirectForUnauthorizedRequest();
54                return;
55            }
56
57            Page.Header.DataBind();
58            base.OnInit(e);
59        }
60
61        #endregion
62    }
63}