public ActionResult Index(string pageId, string pageContentId) { var principal = SecurityService.GetCurrentPrincipal(); var allRoles = new List <string>(RootModuleConstants.UserRoles.AllRoles); if (!string.IsNullOrEmpty(cmsConfiguration.Security.FullAccessRoles)) { allRoles.Add(cmsConfiguration.Security.FullAccessRoles); } GetPageToRenderRequest request = new GetPageToRenderRequest { PageId = pageId.ToGuidOrDefault(), PreviewPageContentId = pageContentId.ToGuidOrDefault(), IsPreview = true, HasContentAccess = SecurityService.IsAuthorized(principal, RootModuleConstants.UserRoles.MultipleRoles(allRoles.ToArray())) }; var model = GetCommand <GetPageToRenderCommand>().ExecuteCommand(request); if (model != null && model.RenderPage != null) { // Render page with hierarchical master pages var html = this.RenderPageToString(model.RenderPage); html = PageHtmlRenderer.ReplaceRegionRepresentationHtml(html, string.Empty); return(Content(html)); } return(HttpNotFound()); }
private void RegisterRenderingPageProperties() { PageHtmlRenderer.Register(new RenderingPageMainImageUrlProperty()); PageHtmlRenderer.Register(new RenderingPageSecondaryImageUrlProperty()); PageHtmlRenderer.Register(new RenderingPageFeaturedImageUrlProperty()); PageHtmlRenderer.Register(new RenderingPageCategoryProperty()); }
private void RegisterRenderingPageProperties() { PageHtmlRenderer.Register(new RenderingPageAuthorProperty()); PageHtmlRenderer.Register(new RenderingPageBlogExpirationDateProperty()); PageHtmlRenderer.Register(new RenderingPageBlogActivationDateProperty()); }
/// <summary> /// Gets the replaced HTML. /// </summary> /// <returns>HTML with replaced view model values</returns> private string GetReplacedHtml(string html, RenderPageViewModel model) { var helper = new PageHtmlRenderer(new StringBuilder(html), model); return(helper.GetReplacedHtml().ToString()); }