private ISitemapGenerationInfo GetInfo(Webpage webpage) { ISitemapGenerationInfo generationInfo = null; if (webpage == null) return null; var typeName = webpage.GetType().FullName; if (SitemapGenerationInfoTypes.ContainsKey(typeName)) { generationInfo = _kernel.Get(SitemapGenerationInfoTypes[typeName]) as ISitemapGenerationInfo; } return generationInfo ?? _kernel.Get<DefaultSitemapGenerationInfo>(); }
public void Process(ViewResult result, Webpage webpage) { if (string.IsNullOrWhiteSpace(result.ViewName)) { if (webpage.PageTemplate != null && !string.IsNullOrWhiteSpace(webpage.PageTemplate.PageTemplateName)) { result.ViewName = webpage.PageTemplate.PageTemplateName; } else { result.ViewName = webpage.GetType().Name; } } if (string.IsNullOrWhiteSpace(result.MasterName)) { Layout layout = _getCurrentLayout.Get(webpage); if (layout != null) { result.MasterName = layout.GetLayoutName(); } } }
private List<MobileFriendlyNavigationChildNode> GetChildNodeTransforms(Dictionary<Webpage, List<MobileFriendlyNavigationChildNode>> mobileFriendlyNavigationChildNodes, Webpage parent) { if (parent == null) return new List<MobileFriendlyNavigationChildNode>(); var nodes = mobileFriendlyNavigationChildNodes[parent]; if (nodes.Any() && !(parent is SitemapPlaceholder)) { foreach (var node in nodes) node.DisplayOrder = node.DisplayOrder + 1; nodes.Insert(0, new MobileFriendlyNavigationChildNode { ChildCount = 0, Id = parent.Id, Name = parent.Name, ParentId = parent.Id, PublishOn = parent.PublishOn, UrlSegment = parent.LiveUrlSegment, DocumentType = parent.GetType().FullName, DisplayOrder = 0 }); } return _processChildNodes.Process(nodes, parent).OrderBy(node => node.DisplayOrder).ToList(); }
public Controller GetController(RequestContext requestContext, Webpage webpage, string httpMethod) { string controllerName = GetControllerName(webpage, httpMethod); var controller = ControllerFactory.CreateController(requestContext, controllerName) as Controller; controller.ControllerContext = new ControllerContext(requestContext, controller) { RouteData = requestContext.RouteData }; var routeValueDictionary = new RouteValueDictionary(); routeValueDictionary["controller"] = controllerName; routeValueDictionary["action"] = GetActionName(webpage, httpMethod); routeValueDictionary["page"] = webpage; controller.RouteData.Values.Merge(routeValueDictionary); var type = webpage.GetType(); if (MrCMSApp.AppWebpages.ContainsKey(type)) { controller.RouteData.DataTokens["app"] = MrCMSApp.AppWebpages[type]; } return controller; }