Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        /// <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);
        }