protected void Page_Load(object sender, EventArgs e) { if (User == null || PageContext.IsGuest) { YafBuildLink.Redirect(ForumPages.login, "ReturnUrl={0}", General.GetSafeRawUrl()); } // check if this feature is disabled if (!PageContext.BoardSettings.AllowPrivateMessages) { YafBuildLink.Redirect(ForumPages.info, "i=5"); } if (!IsPostBack) { _View = PMViewConverter.FromQueryString(Request.QueryString ["v"]); if (_View == PMView.Inbox) { this.PMTabs.ActiveTab = this.InboxTab; } else if (_View == PMView.Outbox) { this.PMTabs.ActiveTab = this.OutboxTab; } else if (_View == PMView.Archive) { this.PMTabs.ActiveTab = this.ArchiveTab; } PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); PageLinks.AddLink(PageContext.PageUserName, YafBuildLink.GetLink(ForumPages.cp_profile)); PageLinks.AddLink(GetText("TITLE")); InboxTab.HeaderText = GetText("INBOX"); OutboxTab.HeaderText = GetText("SENTITEMS"); ArchiveTab.HeaderText = GetText("ARCHIVE"); NewPM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.pmessage); NewPM2.NavigateUrl = NewPM.NavigateUrl; // inbox tab ScriptManager.RegisterClientScriptBlock(InboxTabUpdatePanel, typeof(UpdatePanel), "InboxTabRefresh", String.Format("function InboxTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", InboxTabUpdatePanel.ClientID, '{', '}'), true); // sent tab ScriptManager.RegisterClientScriptBlock(SentTabUpdatePanel, typeof(UpdatePanel), "SentTabRefresh", String.Format("function SentTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", SentTabUpdatePanel.ClientID, '{', '}'), true); // archive tab ScriptManager.RegisterClientScriptBlock(ArchiveTabUpdatePanel, typeof(UpdatePanel), "ArchiveTabRefresh", String.Format("function ArchiveTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", ArchiveTabUpdatePanel.ClientID, '{', '}'), true); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { // check if this feature is disabled if (!this.Get <YafBoardSettings>().AllowPrivateMessages) { YafBuildLink.RedirectInfoPage(InfoMessage.Disabled); } if (this.IsPostBack) { return; } if (this.Request.QueryString.GetFirstOrDefault("v").IsSet()) { this._view = PMViewConverter.FromQueryString(this.Request.QueryString.GetFirstOrDefault("v")); this.hidLastTab.Value = ((int)this._view).ToString(); } // if (_view == PMView.Inbox) // this.PMTabs.ActiveTab = this.InboxTab; // else if (_view == PMView.Outbox) // this.PMTabs.ActiveTab = this.OutboxTab; // else if (_view == PMView.Archive) // this.PMTabs.ActiveTab = this.ArchiveTab; this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.Get <YafBoardSettings>().EnableDisplayName ? this.PageContext.CurrentUserData.DisplayName : this.PageContext.PageUserName, YafBuildLink.GetLink(ForumPages.cp_profile)); this.PageLinks.AddLink(this.GetText("TITLE")); // InboxTab.HeaderText = GetText("INBOX"); // OutboxTab.HeaderText = GetText("SENTITEMS"); // ArchiveTab.HeaderText = GetText("ARCHIVE"); this.NewPM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.pmessage); this.NewPM2.NavigateUrl = this.NewPM.NavigateUrl; // inbox tab // ScriptManager.RegisterClientScriptBlock(InboxTabUpdatePanel, typeof(UpdatePanel), "InboxTabRefresh", String.Format("function InboxTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", InboxTabUpdatePanel.ClientID, '{', '}'), true); // sent tab // ScriptManager.RegisterClientScriptBlock(SentTabUpdatePanel, typeof(UpdatePanel), "SentTabRefresh", String.Format("function SentTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", SentTabUpdatePanel.ClientID, '{', '}'), true); // archive tab // ScriptManager.RegisterClientScriptBlock(ArchiveTabUpdatePanel, typeof(UpdatePanel), "ArchiveTabRefresh", String.Format("function ArchiveTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", ArchiveTabUpdatePanel.ClientID, '{', '}'), true); }
/// <summary> /// Converts a <see cref="PMView"/> to a string representation appropriate for inclusion in a URL query string. /// </summary> /// <param name="view"> /// </param> /// <returns> /// The to query string param. /// </returns> public static string ToQueryStringParam(PMView view) { switch (view) { case PMView.Outbox: return("out"); case PMView.Inbox: return("in"); case PMView.Archive: return("arch"); default: return(null); } }
/// <summary> /// Converts a <see cref="PMView" /> to a string representation appropriate for inclusion in a URL query string. /// </summary> /// <param name="view"></param> /// <returns></returns> public static string ToQueryStringParam(PMView view) { if (view == PMView.Outbox) { return("out"); } else if (view == PMView.Inbox) { return("in"); } else if (view == PMView.Archive) { return("arch"); } else { return(null); } }
protected void Page_Load( object sender, EventArgs e ) { if ( User == null || PageContext.IsGuest ) YafBuildLink.Redirect( ForumPages.login, "ReturnUrl={0}", General.GetSafeRawUrl() ); // check if this feature is disabled if ( !PageContext.BoardSettings.AllowPrivateMessages ) YafBuildLink.Redirect( ForumPages.info, "i=5" ); if ( !IsPostBack ) { _View = PMViewConverter.FromQueryString( Request.QueryString ["v"] ); if ( _View == PMView.Inbox ) this.PMTabs.ActiveTab = this.InboxTab; else if ( _View == PMView.Outbox ) this.PMTabs.ActiveTab = this.OutboxTab; else if ( _View == PMView.Archive ) this.PMTabs.ActiveTab = this.ArchiveTab; PageLinks.AddLink( PageContext.BoardSettings.Name, YafBuildLink.GetLink( ForumPages.forum ) ); PageLinks.AddLink( PageContext.PageUserName, YafBuildLink.GetLink( ForumPages.cp_profile ) ); PageLinks.AddLink( GetText( "TITLE" ) ); InboxTab.HeaderText = GetText( "INBOX" ); OutboxTab.HeaderText = GetText( "SENTITEMS" ); ArchiveTab.HeaderText = GetText( "ARCHIVE" ); NewPM.NavigateUrl = YafBuildLink.GetLinkNotEscaped( ForumPages.pmessage ); NewPM2.NavigateUrl = NewPM.NavigateUrl; // inbox tab ScriptManager.RegisterClientScriptBlock( InboxTabUpdatePanel, typeof( UpdatePanel ), "InboxTabRefresh", String.Format( "function InboxTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", InboxTabUpdatePanel.ClientID, '{', '}' ), true ); // sent tab ScriptManager.RegisterClientScriptBlock( SentTabUpdatePanel, typeof( UpdatePanel ), "SentTabRefresh", String.Format( "function SentTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", SentTabUpdatePanel.ClientID, '{', '}' ), true ); // archive tab ScriptManager.RegisterClientScriptBlock( ArchiveTabUpdatePanel, typeof( UpdatePanel ), "ArchiveTabRefresh", String.Format( "function ArchiveTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", ArchiveTabUpdatePanel.ClientID, '{', '}' ), true ); } }
public static string ToQueryStringParam(PMView view) { switch (view) { case PMView.Outbox: return "out"; case PMView.Inbox: return "in"; case PMView.Archive: return "arch"; default: return null; } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { // check if this feature is disabled if (!this.Get<YafBoardSettings>().AllowPrivateMessages) { YafBuildLink.RedirectInfoPage(InfoMessage.Disabled); } if (this.IsPostBack) { return; } if (this.Request.QueryString.GetFirstOrDefault("v").IsSet()) { this._view = PMViewConverter.FromQueryString(this.Request.QueryString.GetFirstOrDefault("v")); this.hidLastTab.Value = ((int)this._view).ToString(); } // if (_view == PMView.Inbox) // this.PMTabs.ActiveTab = this.InboxTab; // else if (_view == PMView.Outbox) // this.PMTabs.ActiveTab = this.OutboxTab; // else if (_view == PMView.Archive) // this.PMTabs.ActiveTab = this.ArchiveTab; this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.Get<YafBoardSettings>().EnableDisplayName ? this.PageContext.CurrentUserData.DisplayName : this.PageContext.PageUserName, YafBuildLink.GetLink(ForumPages.cp_profile)); this.PageLinks.AddLink(this.GetText("TITLE")); // InboxTab.HeaderText = GetText("INBOX"); // OutboxTab.HeaderText = GetText("SENTITEMS"); // ArchiveTab.HeaderText = GetText("ARCHIVE"); this.NewPM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.pmessage); this.NewPM2.NavigateUrl = this.NewPM.NavigateUrl; // inbox tab // ScriptManager.RegisterClientScriptBlock(InboxTabUpdatePanel, typeof(UpdatePanel), "InboxTabRefresh", String.Format("function InboxTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", InboxTabUpdatePanel.ClientID, '{', '}'), true); // sent tab // ScriptManager.RegisterClientScriptBlock(SentTabUpdatePanel, typeof(UpdatePanel), "SentTabRefresh", String.Format("function SentTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", SentTabUpdatePanel.ClientID, '{', '}'), true); // archive tab // ScriptManager.RegisterClientScriptBlock(ArchiveTabUpdatePanel, typeof(UpdatePanel), "ArchiveTabRefresh", String.Format("function ArchiveTabRefresh() {1}\n__doPostBack('{0}', '');\n{2}", ArchiveTabUpdatePanel.ClientID, '{', '}'), true); }
/// <summary> /// Converts a <see cref="PMView" /> to a string representation appropriate for inclusion in a URL query string. /// </summary> /// <param name="view"></param> /// <returns></returns> public static string ToQueryStringParam( PMView view ) { if ( view == PMView.Outbox ) return "out"; else if ( view == PMView.Inbox ) return "in"; else if ( view == PMView.Archive ) return "arch"; else return null; }