예제 #1
0
 private bool CreateRecentApprovedArticles(IUser user, ref ArticleList recentApprovals)
 {
     return recentApprovals.CreateRecentApprovedArticlesList(user.UserID, InputContext.CurrentSite.SiteID, 0, 100, 0);
 }
예제 #2
0
        /// <summary>
        /// Implements generating the XML for the More Pages page
        /// </summary>
        /// <param name="skip">Number of articles to skip</param>
        /// <param name="show">Number of articles to show</param>
        /// <param name="userID">User ID of the page to return</param>
        /// <param name="type">type is either 1 (approved) 2 (normal) 3 (cancelled) or 4 (normal and approved)</param>
        /// <param name="guideType">See if we've been given a specified article type to search for</param>
        private void TryCreateMorePagesXML(int skip, int show, int userID, int type, int guideType)
        {
            //Clean any existing XML.
            RootElement.RemoveAll();

            if ((type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_CANCELLED) && ((InputContext.ViewingUser.UserLoggedIn == false) || (InputContext.ViewingUser.UserID != userID)))
	        {
		        throw new DnaException("MorePages - TryCreateMorePagesXML - You cannot view the cancelled entries of another user");
	        }

            _pageOwnerElement = AddElementTag(RootElement, "PAGE-OWNER");
            User pageOwner = new User(InputContext);
            pageOwner.CreateUser(userID);
            AddInside(_pageOwnerElement, pageOwner);

            XmlElement articles = AddElementTag(RootElement, "ARTICLES");
            AddAttribute(articles, "USERID", userID);
            AddAttribute(articles, "WHICHSET", type);

            ArticleList articleList = new ArticleList(InputContext);

            if (type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_APPROVED)
		    {
			    articleList.CreateRecentApprovedArticlesList(userID, 0, skip, show, guideType);
		    }
            else if (type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_NORMAL)
		    {
                articleList.CreateRecentArticleList(userID, 0, skip, show, guideType);
		    }
		    else if (type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_NORMALANDAPPROVED)
		    {
                articleList.CreateRecentNormalAndApprovedArticlesList(userID, 0, skip, show, guideType);
		    }
		    else
		    {
                articleList.CreateCancelledArticlesList(userID, 0, skip, show, guideType);
		    }
            AddInside(articles, articleList);

            AddInside(articles, pageOwner);

        }