Exemplo n.º 1
0
        /// <summary>
        /// This method adds all the article info to the entry
        /// </summary>
        /// <param name="showEntryData">A flag that states whether or not to add the entry data to the XML</param>
        /// <param name="showPageAuthors">A flag to state whether or not to add the authors list to the XML</param>
        /// <param name="parentNode">The node that you want to insert the article info block</param>
        /// <returns>The node that represents the articleinfo block</returns>
        private XmlNode AddArticleInfo(bool showEntryData, bool showPageAuthors, XmlNode parentNode)
        {
            // Now add the article info block
            XmlNode articleInfoNode = AddElementTag(parentNode, "ARTICLEINFO");

            // Check to see if we are needed to add the entry data
            if (showEntryData)
            {
                AddEntryData(articleInfoNode);
            }

            AddIntElement(articleInfoNode, "FORUMID", _forumID);
            AddIntElement(articleInfoNode, "SITEID", _siteID);

            if (_hiddenStatus > 0)
            {
                AddIntElement(articleInfoNode, "HIDDEN", _hiddenStatus);
            }

            XmlNode modNode = AddIntElement(articleInfoNode, "MODERATIONSTATUS", _moderationStatus);
            AddAttribute(modNode, "ID", _h2g2ID);

            // Add the page authors if we've been asked to
            if (showPageAuthors)
            {
                // Create the authors list and add it to the page
                AuthorsList pageAuthors = new AuthorsList(InputContext, AuthorsList.ArticleType.ARTICLE, _h2g2ID, _editor);
                pageAuthors.CreateListForArticle();
                XmlNode authorsNode = AddElementTag(articleInfoNode, "PAGEAUTHOR");
                AddInside(authorsNode, pageAuthors, "//RESEARCHERS");
                AddInside(authorsNode, pageAuthors, "//EDITOR");
            }

            // Add the date created and last update
            XmlNode createdNode = AddElementTag(articleInfoNode, "DATECREATED");
            createdNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, _dateCreated, true));

            XmlNode updatedNode = AddElementTag(articleInfoNode, "LASTUPDATED");
            updatedNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, _lastUpdated, true));

            // Create the Article crumbtrail
            Category articleCrumbtrail = new Category(InputContext);
            articleCrumbtrail.CreateArticleCrumbtrail(_h2g2ID);
            AddInside(articleInfoNode, articleCrumbtrail, "//CRUMBTRAILS");

            // Insert a related member node and the preprocessed info
            XmlNode relatedMembersNode = AddElementTag(articleInfoNode, "RELATEDMEMBERS");
            AddIntElement(articleInfoNode, "PREPROCESSED", _preProcessed);

            // Create the related clubs
            Category relatedMembers = new Category(InputContext);
            relatedMembers.GetRelatedClubs(_h2g2ID);
            AddInside(relatedMembersNode, relatedMembers, "//RELATEDCLUBS");

            // Create the related articles
            relatedMembers.IncludeStrippedNames = true;
            relatedMembers.GetRelatedArticles(_h2g2ID);
            AddInside(relatedMembersNode, relatedMembers, "//RELATEDARTICLES");

            // Return the new article info node
            return articleInfoNode;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the crumbtrail XML
 /// </summary>
 public void SetCrumbTrail()
 {
     _crumbTrail = CreateElement("Crumbtrail");
     Category category = new Category(InputContext);
     category.CreateArticleCrumbtrail(_H2G2ID);
     _crumbTrail.AppendChild(ImportNode(category.RootElement.FirstChild));
 }