예제 #1
0
        private bool PostCanBePinned()
        {
            if (!Page.User.IsInRole("ForumAdmin"))
            {
                return(false);
            }

            if (_action == "new")
            {
                return(true);
            }

            if (_action == "edit" && _postID == ForumDB.GetThreadFromPost(_postID))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        public override void OnPreRender()
        {
            // Determine whether we are in flat view or tree view mode.  This setting is
            // stored in a cookie, but should probably be moved in to the user's profile
            // which is stored in the database.
            if (!_viewDropDownSelected)
            {
                _forumView = ForumUtils.GetForumView(Page);
            }
            ListItem listItem = _viewDropDownList.Items.FindByValue(_forumView.ToString());

            if (listItem != null)
            {
                listItem.Selected = true;
            }

            // _threadID identifies the thread we are currently viewing.  _postID identifies
            // the post within the thread that is currently being shown. (i.e. in tree view,
            // only one post can be viewed at a time).  _threadID can be obtained from the value
            // of _postID.  We will also determine what page we are looking at.
            _threadID   = ForumDB.GetThreadFromPost(_postID);
            _threadPage = ForumDB.GetSortOrderFromPost(_postID, _forumView) / ForumUtils.GetPostsPerPage();

            // If looking at the first post in a thread, then increment the thread view count
            if (_threadID == _postID)
            {
                ForumDB.IncrementThreadViews(_threadID);
            }

            // Get page of posts that will be rendered
            _forumPostCollection = ForumDB.GetThread(_threadID, _threadPage, ForumUtils.GetPostsPerPage(), _forumView);

            // Register javascript for dynamically showing threads in tree view
            if (_forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                RegisterJavascript();
            }
        }