コード例 #1
0
ファイル: PageList.ascx.cs プロジェクト: priaonehaha/HnD
        /// <summary>
        /// Event handler for the ItemDataBound event for the repeater control for the pagelist in the Messages page. In here the decision is made
        /// if the current item will be a link (we're not on this page) or not (thus a label)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rptPageListMessages_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            int maxAmountMessagesPerPage = SessionAdapter.GetUserDefaultNumberOfMessagesPerPage();

            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
                int currentPage = (_startMessageNo / maxAmountMessagesPerPage) + 1;
                if ((currentPage) == (int)(e.Item.DataItem))
                {
                    // the current number emitted by the repeater is the page number we're on at the moment.
                    Label lblMessagePage = (Label)e.Item.FindControl("lblMessagesPage");
                    lblMessagePage.Visible = true;
                }
                else
                {
                    HyperLink lnkMessagePage = (HyperLink)e.Item.FindControl("lnkMessagesPage");
                    lnkMessagePage.NavigateUrl += "?ThreadID=" + _threadID + "&StartAtMessage=" +
                                                  (((int)(e.Item.DataItem) - 1) * maxAmountMessagesPerPage);
                    if (_highLight)
                    {
                        lnkMessagePage.NavigateUrl += "&HighLight=1";
                    }
                    lnkMessagePage.Visible = true;
                }
                break;
            }
        }
コード例 #2
0
ファイル: PageList.ascx.cs プロジェクト: priaonehaha/HnD
        /// <summary>
        /// Event handler for the ItemDataBound event for the repeater control for the pagelist in the Threads page. In here the decision is made
        /// if the current item will be a link (we're not on this page) or not (thus a label)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rptPageListThreads_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            int maxAmountMessagesPerPage = SessionAdapter.GetUserDefaultNumberOfMessagesPerPage();

            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
                int       currentPage    = (_startMessageNo / maxAmountMessagesPerPage) + 1;
                HyperLink lnkMessagePage = (HyperLink)e.Item.FindControl("lnkMessagesPage");
                lnkMessagePage.NavigateUrl += "?ThreadID=" + _threadID + "&StartAtMessage=" +
                                              (((int)(e.Item.DataItem) - 1) * maxAmountMessagesPerPage);
                if (_highLight)
                {
                    lnkMessagePage.NavigateUrl += "&HighLight=1";
                }
                break;
            }
        }
コード例 #3
0
ファイル: Bookmarks.aspx.cs プロジェクト: priaonehaha/HnD
        /// <summary>
        /// Event handler which will be called every time a row in the Repeater rpThreads is bound to a row in the view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rpThreads_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            int maxAmountMessagesPerPage = SessionAdapter.GetUserDefaultNumberOfMessagesPerPage();

            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
                // Thread has always a last posting date: a thread has at least 1 posting.
                DateTime threadLastPostingDate = (DateTime)(((DataRowView)e.Item.DataItem)["ThreadLastPostingDate"]);
                DateTime lastVisitDate         = SessionAdapter.GetLastVisitDate();
                bool     isSticky      = (bool)(((DataRowView)e.Item.DataItem)["IsSticky"]);
                bool     isClosed      = (bool)(((DataRowView)e.Item.DataItem)["IsClosed"]);
                bool     bMarkedAsDone = (bool)(((DataRowView)e.Item.DataItem)["MarkedAsDone"]);

                // date is not 0, check if the date is > than the date in the session variable. If so, the posting is newer and we
                // should visualize the New Messages image, otherwise the No new Messages image. Also take into account
                // the type of the thread: sticky, closed or normal.
                System.Web.UI.WebControls.Image imgIconPosts;

                if (threadLastPostingDate > lastVisitDate)
                {
                    // there are new messages since last visit
                    if (isSticky)
                    {
                        imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNewPostsSticky");
                    }
                    else
                    {
                        if (isClosed)
                        {
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNewPostsClosed");
                        }
                        else
                        {
                            // is normal
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNewPosts");
                        }
                    }
                }
                else
                {
                    // no new messages
                    if (isSticky)
                    {
                        imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNoNewPostsSticky");
                    }
                    else
                    {
                        if (isClosed)
                        {
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNoNewPostsClosed");
                        }
                        else
                        {
                            // is normal
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNoNewPosts");
                        }
                    }
                }
                imgIconPosts.Visible = true;
                break;
            }
        }
コード例 #4
0
ファイル: SupportQueues.aspx.cs プロジェクト: priaonehaha/HnD
        /// <summary>
        /// Event handler which will be called every time a row in the Repeater rpThreads is bound to a row in the view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rpThreads_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            int maxAmountMessagesPerPage = SessionAdapter.GetUserDefaultNumberOfMessagesPerPage();

            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
                // Thread has always a last posting date: a thread has at least 1 posting.
                DateTime threadLastPostingDate = (DateTime)(((DataRowView)e.Item.DataItem)["ThreadLastPostingDate"]);
                DateTime lastVisitDate         = SessionAdapter.GetLastVisitDate();
                bool     isSticky = (bool)(((DataRowView)e.Item.DataItem)["IsSticky"]);
                bool     isClosed = (bool)(((DataRowView)e.Item.DataItem)["IsClosed"]);

                // date is not 0, check if the date is > than the date in the session variable. If so, the posting is newer and we
                // should visualize the New Messages image, otherwise the No new Messages image. Also take into account
                // the type of the thread: sticky, closed or normal.
                System.Web.UI.WebControls.Image imgIconPosts;

                if (threadLastPostingDate > lastVisitDate)
                {
                    // there are new messages since last visit
                    if (isSticky)
                    {
                        imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNewPostsSticky");
                    }
                    else
                    {
                        if (isClosed)
                        {
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNewPostsClosed");
                        }
                        else
                        {
                            // is normal
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNewPosts");
                        }
                    }
                }
                else
                {
                    // no new messages
                    if (isSticky)
                    {
                        imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNoNewPostsSticky");
                    }
                    else
                    {
                        if (isClosed)
                        {
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNoNewPostsClosed");
                        }
                        else
                        {
                            // is normal
                            imgIconPosts = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgIconNoNewPosts");
                        }
                    }
                }
                imgIconPosts.Visible = true;
                if (((DataRowView)e.Item.DataItem)["ClaimedByUserID"] != DBNull.Value)
                {
                    // thread is claimed by someone
                    HyperLink lnkClaimerThread = (HyperLink)e.Item.FindControl("lnkClaimerThread");
                    lnkClaimerThread.NavigateUrl += ((DataRowView)e.Item.DataItem)["ClaimedByUserID"].ToString();
                    lnkClaimerThread.Text         = HttpUtility.HtmlEncode((string)((DataRowView)e.Item.DataItem)["NickNameClaimedThread"]);
                    Label lblClaimDate = (Label)e.Item.FindControl("lblClaimDate");
                    lblClaimDate.Text = ((DateTime)((DataRowView)e.Item.DataItem)["ClaimedOn"]).ToString("dd-MMM-yyyy HH:mm.ss", DateTimeFormatInfo.InvariantInfo);
                }
                break;
            }
        }
コード例 #5
0
ファイル: CloseThread.aspx.cs プロジェクト: priaonehaha/HnD
        protected void PostMessageHandler(object sender, System.EventArgs e)
        {
            string mailTemplate = ApplicationAdapter.GetEmailTemplate(EmailTemplate.ThreadUpdatedNotification);
            // store the new message in the given thread and close it directly.
            int messageID = ThreadManager.CreateNewMessageInThreadAndCloseThread(_thread.ThreadID, SessionAdapter.GetUserID(), meMessageEditor.MessageText,
                                                                                 meMessageEditor.MessageTextHTML, Request.UserHostAddress.ToString(), meMessageEditor.MessageTextXML,
                                                                                 mailTemplate, ApplicationAdapter.GetEmailData(), CacheManager.GetSystemData().SendReplyNotifications);

            // all ok, redirect to message list
            int startAtMessageID = ThreadGuiHelper.GetStartAtMessageForGivenMessageAndThread(_thread.ThreadID, messageID, SessionAdapter.GetUserDefaultNumberOfMessagesPerPage());

            Response.Redirect("Messages.aspx?ThreadID=" + _thread.ThreadID + "&StartAtMessage=" + startAtMessageID + "&#" + messageID, true);
        }
コード例 #6
0
        protected void PostMessageHandler(object sender, System.EventArgs e)
        {
            int userID = SessionAdapter.GetUserID();

            // store the new message in the given thread
            string mailTemplate = ApplicationAdapter.GetEmailTemplate(EmailTemplate.ThreadUpdatedNotification);
            int    messageID    = ThreadManager.CreateNewMessageInThread(_thread.ThreadID, userID, meMessageEditor.MessageText, meMessageEditor.MessageTextHTML,
                                                                         Request.UserHostAddress.ToString(), meMessageEditor.MessageTextXML, meMessageEditor.SubscribeToThread,
                                                                         mailTemplate, ApplicationAdapter.GetEmailData(), CacheManager.GetSystemData().SendReplyNotifications);

            // invalidate forum RSS in cache
            ApplicationAdapter.InvalidateCachedForumRSS(_thread.ForumID);

            // if auditing is required, we've to do this now.
            if (SessionAdapter.CheckIfNeedsAuditing(AuditActions.AuditNewMessage))
            {
                SecurityManager.AuditNewMessage(userID, messageID);
            }

            // invalidate forum in asp.net cache
            CacheManager.InvalidateCachedItem(CacheManager.ProduceCacheKey(CacheKeys.SingleForum, _thread.ForumID));

            // all ok, redirect to message list
            int startAtMessageIndex = ThreadGuiHelper.GetStartAtMessageForGivenMessageAndThread(_thread.ThreadID, messageID, SessionAdapter.GetUserDefaultNumberOfMessagesPerPage());

            if (meMessageEditor.AddAttachment)
            {
                // redirect to manage attachment form for this message
                Response.Redirect(string.Format("Attachments.aspx?SourceType=1&MessageID={0}", messageID), true);
            }
            else
            {
                Response.Redirect(string.Format("Messages.aspx?ThreadID={0}&StartAtMessage={1}&#{2}", _thread.ThreadID, startAtMessageIndex, messageID), true);
            }
        }
コード例 #7
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            int threadID       = HnDGeneralUtils.TryConvertToInt(Request.QueryString["ThreadID"]);
            int messageID      = HnDGeneralUtils.TryConvertToInt(Request.QueryString["MessageID"]);
            int startAtMessage = ThreadGuiHelper.GetStartAtMessageForGivenMessageAndThread(threadID, messageID, SessionAdapter.GetUserDefaultNumberOfMessagesPerPage());

            Response.Redirect("Messages.aspx?ThreadID=" + threadID + "&StartAtMessage=" + startAtMessage + "&#" + messageID, true);
        }
コード例 #8
0
ファイル: Messages.aspx.cs プロジェクト: priaonehaha/HnD
        /// <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="System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            int threadID = HnDGeneralUtils.TryConvertToInt(Request.QueryString["ThreadID"]);

            _thread = ThreadGuiHelper.GetThread(threadID);
            if (_thread == null)
            {
                // not found, return to start page
                Response.Redirect("default.aspx");
            }

            // Check credentials
            bool userHasAccess = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.AccessForum);

            if (!userHasAccess)
            {
                // doesn't have access to this forum. redirect
                Response.Redirect("default.aspx");
            }

            _startMessageNo = HnDGeneralUtils.TryConvertToInt(Request.QueryString["StartAtMessage"]);
            bool highLightSearchResults = (HnDGeneralUtils.TryConvertToInt(Request.QueryString["HighLight"]) == 1);

            if (!_thread.IsClosed)
            {
                if (_thread.IsSticky)
                {
                    _userMayAddNewMessages = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.AddAndEditMessageInSticky);
                }
                else
                {
                    _userMayAddNewMessages = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.AddAndEditMessage);
                }
                // set show*link class members. These have to be set despite the postback status, as they're used in the repeater. Only set
                // them to true if the thread isn't closed. They've been initialized to false already.
                _showEditMessageLink   = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.EditDeleteOtherUsersMessages);
                _showDeleteMessageLink = _showEditMessageLink;
                _showQuoteMessageLink  = _userMayAddNewMessages;
            }

            // show user IP addresses if the user has system admin rights, security admin rights or user admin rights.
            _showIPAddresses = (SessionAdapter.HasSystemActionRight(ActionRights.SystemManagement) ||
                                SessionAdapter.HasSystemActionRight(ActionRights.SecurityManagement) ||
                                SessionAdapter.HasSystemActionRight(ActionRights.UserManagement));
            // Get the forum entity related to the thread. Use BL class. We could have used Lazy loading, though for the sake of separation, we'll
            // call into the BL class.
            ForumEntity forum = CacheManager.GetForum(_thread.ForumID);

            if (forum == null)
            {
                // not found, orphaned thread, return to default page.
                Response.Redirect("default.aspx");
            }
            _forumAllowsAttachments = (forum.MaxNoOfAttachmentsPerMessage > 0);

            // check if the user can view this thread. If not, don't continue.
            if ((_thread.StartedByUserID != SessionAdapter.GetUserID()) &&
                !SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.ViewNormalThreadsStartedByOthers) &&
                !_thread.IsSticky)
            {
                // can't view this thread, it isn't visible to the user
                Response.Redirect("default.aspx", true);
            }

            _threadStartedByCurrentUser = (_thread.StartedByUserID == SessionAdapter.GetUserID());
            _userMayAddAttachments      = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.AddAttachment);
            _userCanCreateThreads       = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.AddNormalThread) ||
                                          SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.AddStickyThread);
            _userMayDoForumSpecificThreadManagement = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.ForumSpecificThreadManagement);
            _userMayDoSystemWideThreadManagement    = SessionAdapter.HasSystemActionRight(ActionRights.SystemWideThreadManagement);
            _userMayEditMemo                   = SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.EditThreadMemo);
            _userMayMarkThreadAsDone           = (SessionAdapter.CanPerformForumActionRight(_thread.ForumID, ActionRights.FlagThreadAsDone) || _threadStartedByCurrentUser);
            _userMayManageSupportQueueContents = SessionAdapter.HasSystemActionRight(ActionRights.QueueContentManagement);
            _userMayDoBasicThreadOperations    = (SessionAdapter.GetUserID() > 0);

            if (!Page.IsPostBack)
            {
                plPageListBottom.HighLight = highLightSearchResults;
                plPageListTop.HighLight    = highLightSearchResults;
                litHighLightLogic.Visible  = highLightSearchResults;

                if (highLightSearchResults)
                {
                    // make highlighting of search results possible
                    string searchTerms = SessionAdapter.GetSearchTerms();
                    if (searchTerms == null)
                    {
                        searchTerms = string.Empty;
                    }
                    this.ClientScript.RegisterHiddenField("searchTerms", searchTerms.Replace("AND", "").Replace("OR", "").Replace("and", "").Replace("or", "").Replace("\"", ""));
                }
                else
                {
                    // replace hightlighting scriptblock.
                    this.ClientScript.RegisterClientScriptBlock(this.GetType(), "onLoad", "<script language=\"javascript\"  type=\"text/javascript\">function SearchHighlight() {}</script>");
                }

                if (_userMayManageSupportQueueContents)
                {
                    // fill support queue management area with data.
                    SupportQueueCollection supportQueues = CacheManager.GetAllSupportQueues();
                    cbxSupportQueues.DataSource = supportQueues;
                    cbxSupportQueues.DataBind();

                    SupportQueueEntity containingQueue = SupportQueueGuiHelper.GetQueueOfThread(_thread.ThreadID);
                    if (containingQueue != null)
                    {
                        cbxSupportQueues.SelectedValue = containingQueue.QueueID.ToString();
                        // get claim info
                        SupportQueueThreadEntity supportQueueThreadInfo = SupportQueueGuiHelper.GetSupportQueueThreadInfo(_thread.ThreadID, true);
                        if ((supportQueueThreadInfo != null) && supportQueueThreadInfo.ClaimedByUserID.HasValue)
                        {
                            // claimed by someone
                            lblClaimDate.Text             = supportQueueThreadInfo.ClaimedOn.Value.ToString("dd-MMM-yyyy HH:mm.ss", DateTimeFormatInfo.InvariantInfo);
                            lnkClaimerThread.Visible      = true;
                            lblNotClaimed.Visible         = false;
                            lnkClaimerThread.Text         = supportQueueThreadInfo.ClaimedByUser.NickName;
                            lnkClaimerThread.NavigateUrl += supportQueueThreadInfo.ClaimedByUserID.ToString();
                            btnClaim.Visible              = false;
                            btnRelease.Visible            = true;
                        }
                        else
                        {
                            // not claimed
                            lblClaimDate.Text  = string.Empty;
                            btnClaim.Visible   = true;
                            btnRelease.Visible = false;
                        }
                    }
                }
                phSupportQueueManagement.Visible = _userMayManageSupportQueueContents;

                if ((_thread.Memo.Length > 0) && _userMayEditMemo)
                {
                    // convert memo contents to HTML so it's displayed above the thread.
                    string parserLog, messageTextXml;
                    bool   errorsOccured = false;
                    string memoAsHTML    = TextParser.TransformUBBMessageStringToHTML(_thread.Memo, ApplicationAdapter.GetParserData(), out parserLog, out errorsOccured, out messageTextXml);
                    lblMemo.Text = memoAsHTML;
                }
                phMemo.Visible = _userMayEditMemo;

                bool isBookmarked = UserGuiHelper.CheckIfThreadIsAlreadyBookmarked(SessionAdapter.GetUserID(), threadID);
                bool isSubscribed = UserGuiHelper.CheckIfThreadIsAlreadySubscribed(SessionAdapter.GetUserID(), threadID);
                btnBookmarkThread.Visible   = !isBookmarked && _userMayDoBasicThreadOperations;
                btnUnbookmarkThread.Visible = isBookmarked && _userMayDoBasicThreadOperations;
                bool sendReplyNotifications = CacheManager.GetSystemData().SendReplyNotifications;
                btnSubscribeToThread.Visible     = !isSubscribed && _userMayDoBasicThreadOperations && sendReplyNotifications;
                btnUnsubscribeFromThread.Visible = isSubscribed && _userMayDoBasicThreadOperations && sendReplyNotifications;

                // fill the page's content
                lnkThreads.Text          = HttpUtility.HtmlEncode(forum.ForumName);
                lnkThreads.NavigateUrl  += "?ForumID=" + _thread.ForumID;
                lblForumName_Header.Text = forum.ForumName;
                lblSectionName.Text      = CacheManager.GetSectionName(forum.SectionID);

                // Check if the current user is allowed to add new messages to the thread.

                // these controls are not visible by default, show them if necessary
                if (_userMayDoForumSpecificThreadManagement || _userMayDoSystemWideThreadManagement)
                {
                    if (!_thread.IsClosed && _userMayAddNewMessages)
                    {
                        lnkCloseThread.Visible      = true;
                        lnkCloseThread.NavigateUrl += "?ThreadID=" + threadID + "&StartAtMessage=" + _startMessageNo;
                    }
                    lnkEditThreadProperties.Visible      = true;
                    lnkEditThreadProperties.NavigateUrl += "?ThreadID=" + threadID;
                }

                if (_userMayDoSystemWideThreadManagement)
                {
                    lnkMoveThread.Visible        = true;
                    lnkMoveThread.NavigateUrl   += "?ThreadID=" + threadID;
                    lnkDeleteThread.Visible      = true;
                    lnkDeleteThread.NavigateUrl += "?ThreadID=" + threadID;
                }

                btnThreadDone.Visible    = _thread.MarkedAsDone;
                btnThreadNotDone.Visible = !_thread.MarkedAsDone;
                btnThreadDone.Enabled    = _userMayMarkThreadAsDone;
                btnThreadNotDone.Enabled = _userMayMarkThreadAsDone;

                if (_userMayEditMemo)
                {
                    lnkEditMemo.Visible      = true;
                    lnkEditMemo.NavigateUrl += "?ThreadID=" + threadID + "&StartAtMessage=" + _startMessageNo;
                }

                // These controls are visible by default. Hide them when the user can't create threads on this forum
                if (_userCanCreateThreads)
                {
                    lnkNewThreadBottom.NavigateUrl += "?ForumID=" + _thread.ForumID + "&StartAtMessage=" + _startMessageNo;
                    lnkNewThreadTop.NavigateUrl    += "?ForumID=" + _thread.ForumID + "&StartAtMessage=" + _startMessageNo;
                }
                else
                {
                    lnkNewThreadBottom.Visible = false;
                    lnkNewThreadTop.Visible    = false;
                }

                if (_userMayAddNewMessages)
                {
                    lnkNewMessageBottom.NavigateUrl += "?ThreadID=" + threadID + "&StartAtMessage=" + _startMessageNo;
                    lnkNewMessageTop.NavigateUrl    += "?ThreadID=" + threadID + "&StartAtMessage=" + _startMessageNo;
                }
                else
                {
                    lnkNewMessageBottom.Visible = false;
                    lnkNewMessageTop.Visible    = false;
                }
                lblSeparatorTop.Visible    = (_userMayAddNewMessages && _userCanCreateThreads);
                lblSeparatorBottom.Visible = (_userMayAddNewMessages && _userCanCreateThreads);

                // The amount of postings in this thread are in the dataview row, which should contain just 1 row.
                int maxAmountMessagesPerPage = SessionAdapter.GetUserDefaultNumberOfMessagesPerPage();
                int amountOfMessages         = ThreadGuiHelper.GetTotalNumberOfMessagesInThread(threadID);
                int amountOfPages            = ((amountOfMessages - 1) / maxAmountMessagesPerPage) + 1;
                int currentPageNo            = (_startMessageNo / maxAmountMessagesPerPage) + 1;
                lblCurrentPage.Text = currentPageNo.ToString();
                lblTotalPages.Text  = amountOfPages.ToString();

                lnkPrintThread.NavigateUrl += "?ThreadID=" + threadID;

                plPageListBottom.AmountMessages = amountOfMessages;
                plPageListBottom.StartMessageNo = _startMessageNo;
                plPageListBottom.ThreadID       = threadID;
                plPageListTop.AmountMessages    = amountOfMessages;
                plPageListTop.StartMessageNo    = _startMessageNo;
                plPageListTop.ThreadID          = threadID;

                // Get messages and bind it to the repeater control. Use the startmessage to get only the message visible on the current page.
                MessagesInThreadTypedList messages = ThreadGuiHelper.GetAllMessagesInThreadAsTypedList(threadID, currentPageNo, maxAmountMessagesPerPage);
                rptMessages.DataSource = messages;
                rptMessages.DataBind();
            }
        }
コード例 #9
0
ファイル: EditMessage.aspx.cs プロジェクト: priaonehaha/HnD
        protected void PostMessageHandler(object sender, System.EventArgs e)
        {
            int  userID = SessionAdapter.GetUserID();
            bool result = MessageManager.UpdateEditedMessage(userID, _editMessageID, meMessageEditor.MessageText, meMessageEditor.MessageTextHTML, Request.UserHostAddress, meMessageEditor.MessageTextXML);

            if (SessionAdapter.CheckIfNeedsAuditing(AuditActions.AuditAlteredMessage))
            {
                SecurityManager.AuditAlteredMessage(userID, _editMessageID);
            }

            // all ok, redirect to thread list
            int startAtMessageID = ThreadGuiHelper.GetStartAtMessageForGivenMessageAndThread(_thread.ThreadID, _editMessageID, SessionAdapter.GetUserDefaultNumberOfMessagesPerPage());

            Response.Redirect("Messages.aspx?ThreadID=" + _thread.ThreadID + "&StartAtMessage=" + startAtMessageID + "&#" + _editMessageID, false);
        }