示例#1
0
        //-------------------------
        // BlogMostRecent:
        // Show the most recent blog entry.
        //-------------------------
        public ViewResult BlogMostRecent()
        {
            ContentNode          node  = contentManager.BlogEntryMostRecentGet();
            NodeDisplayViewModel model = NodeDisplayPrep(node, "Recent Blog Entry");

            return(View("NodeDisplay", model));
        }
示例#2
0
        public ActionResult Display(string nodePath)
        {
            if (nodePath == null)
            {
                return(RedirectToAction("Index"));
            }

            ContentNode          node  = contentManager.ContentGetByPath(nodePath);
            NodeDisplayViewModel model = NodeDisplayPrep(node, nodePath);

            return(View("NodeDisplay", model));
        }
示例#3
0
        //-------------------------
        //-------------------------
        private NodeDisplayViewModel NodeDisplayPrep(ContentNode node, string nodePath)
        {
            // Default property values, if node is null.
            string content = "";
            int    id      = 0;
            string title   = "Content at \"" + nodePath + "\" not found";

            if (node != null)
            {
                content = node.Content.Replace(System.Environment.NewLine, "<br/>");
                id      = node.NodeId;
                title   = node.Title;
            }

            // Get the list of links to children of this node.
            List <ContentLinkInfo> childLinks = contentManager.ContentChildLinksGet(node);

            // If the node has no children, the list of links to its siblings will be displayed.
            if (childLinks != null)
            {
                if (childLinks.Count == 0)
                {
                    childLinks = contentManager.ContentSiblingLinksGet(node);
                }
            }


            NodeDisplayViewModel model = new NodeDisplayViewModel
            {
                BlogTodayExists = contentManager.BlogEntryTodayExistsTest(),
                ChildLinks      = childLinks,
                PathLinks       = contentManager.ContentPathLinksGet(node),
                Content         = content,
                Id    = id,
                Title = title
            };

            return(model);
        }