示例#1
0
 public PageContentProjection(IPageContent pageContent, IContent content, IContentAccessor contentAccessor, IEnumerable <ChildContentProjection> childProjections = null)
 {
     this.pageContent      = pageContent;
     this.content          = content;
     this.contentAccessor  = contentAccessor;
     this.childProjections = childProjections;
 }
示例#2
0
        public async Task SaveContent(IPageContent input)
        {
            var page        = _pageRepository.Get(input.PageId);
            var pageContent = _contentRepository.FirstOrDefault(a => a.PageId == input.PageId && a.Lang == input.Lang);

            if (pageContent != null)
            {
                pageContent.HtmlContent        = input.HtmlContent.Trim();
                pageContent.Lang               = input.Lang;
                pageContent.PageId             = input.PageId;
                pageContent.Page               = page;
                pageContent.Title              = input.Title;
                pageContent.Url                = input.Url;
                pageContent.TemplateUniqueName = input.TemplateUniqueName;
                pageContent.IsPartial          = input.IsPartial;
                pageContent.PreviewImage       = input.PreviewImage;
            }
            else
            {
                pageContent = new Content()
                {
                    HtmlContent        = input.HtmlContent.Trim(),
                    Lang               = input.Lang,
                    PageId             = input.PageId,
                    Page               = page,
                    Title              = input.Title,
                    Url                = input.Url,
                    TemplateUniqueName = input.TemplateUniqueName,
                    IsPartial          = input.IsPartial,
                    PreviewImage       = input.PreviewImage
                };
            }

            await _contentRepository.InsertOrUpdateAndGetIdAsync(pageContent);
        }
示例#3
0
        private static PageContentRenderer <IPageContent> ResolvePageContentRenderer(IPageContent pageContent)
        {
            Type genericType          = typeof(PageContentRenderer <>);
            Type genericTypeParameter = pageContent.GetType();
            var  pageContentRender    = (PageContentRenderer <IPageContent>)Kooboo.Common.ObjectContainer.EngineContext.Current.ResolveGeneric(genericType, genericTypeParameter);

            return(pageContentRender);
        }
 public PageContentProjection(IPageContent pageContent, IContent content, IContentAccessor contentAccessor,
     IEnumerable<ChildContentProjection> childProjections = null, IEnumerable<PageContentProjection> childRegionContentProjections = null)
 {
     this.pageContent = pageContent;
     this.content = content;
     this.contentAccessor = contentAccessor;
     this.childProjections = childProjections;
     this.childRegionContentProjections = childRegionContentProjections;
 }
示例#5
0
        private static IHtmlString RenderPageContent(IFrontHtmlHelper htmlHelper, IPageContent pageContent)
        {
            var renderer = ResolvePageContentRenderer(pageContent);

            if (renderer != null)
            {
                return(renderer.Render(htmlHelper, pageContent));
            }
            return(null);
        }
示例#6
0
        private static IHtmlString RenderPageContent(IFrontHtmlHelper htmlHelper, IPageContent pageContent)
        {
            var renderer = ResolvePageContentRenderer(pageContent);

            if (renderer != null)
            {
                return renderer.Render(htmlHelper, pageContent);
            }
            return null;
        }
示例#7
0
        public void FillContent()
        {
            Contents = new List <IPageContent>();
            Contents.AddRange(Paragraphs.Cast <IPageContent>().Union(Tables).OrderBy(_ => _.Y));

            var textObjectStatementsLines = Statements.Where(_ => _ is TextObjectStatement).Cast <TextObjectStatement>().SelectMany(_ => _.Lines)
                                            .Where(_ => !string.IsNullOrWhiteSpace(_.Content))
                                            .OrderBy(_ => _.Position.Y).ThenBy(_ => _.Position.X);

            foreach (var line in textObjectStatementsLines.Where(_ => _.Position.IsValid()))
            {
                IPageContent targetPageContent = Contents.First(_ => _.Contains(line.Position.Y));
                targetPageContent.AddText(line.Position, line.Content);
            }
        }
示例#8
0
        public static void RemoveSubContentReursive(this IPageContent pageContent, Func <CmsPageContent, bool> match)
        {
            var originalItems = pageContent.AllContent.ToList();

            foreach (var originalItem in originalItems)
            {
                if (match(originalItem))
                {
                    pageContent.AllContent.Remove(originalItem);
                }
            }

            foreach (var remainingSubContentItem in pageContent.AllContent)
            {
                RemoveSubContentReursive(remainingSubContentItem, match);
            }
        }
示例#9
0
        public static IReadOnlyCollection <FoundSubContent> FindSubContentReursive(this IPageContent pageContent, Func <CmsPageContent, bool> match)
        {
            List <FoundSubContent> foundContents = new List <FoundSubContent>();

            foreach (var originalItem in pageContent.AllContent)
            {
                if (match(originalItem))
                {
                    foundContents.Add(new FoundSubContent {
                        ParentContent = pageContent, LocatedContent = originalItem
                    });
                }

                var additionalResults = FindSubContentReursive(originalItem, match);
                foundContents.AddRange(additionalResults);
            }
            return(foundContents);
        }
        public virtual TProjection Create <TProjection>(IPageContent pageContent, IContent content, IList <IOptionValue> options,
                                                        IEnumerable <ChildContentProjection> childContentProjections, IEnumerable <PageContentProjection> childRegionContentProjections,
                                                        Func <IPageContent, IContent, IContentAccessor, IEnumerable <ChildContentProjection>, IEnumerable <PageContentProjection>, TProjection> createProjectionDelegate)
            where TProjection : PageContentProjection
        {
            IContentAccessor contentAccessor = GetAccessorForType(content, options);

            if (contentAccessor == null)
            {
                Log.Error(string.Format("A content accessor was not found for the content type {0} with id={1}.", content.GetType().FullName, content.Id));

                contentAccessor = new EmptyContentAccessor(string.Format("<i style=\"color:red;\">{0}</i>", RootGlobalization.Message_FailedToRenderContent));
            }

            TProjection pageContentProjection = createProjectionDelegate.Invoke(pageContent, content, contentAccessor, childContentProjections, childRegionContentProjections);

            return(pageContentProjection);
        }
示例#11
0
        public TProjection Create <TProjection>(IPageContent pageContent, IContent content, IList <IOptionValue> options,
                                                IEnumerable <ChildContentProjection> childContentProjections,
                                                Func <IPageContent, IContent, IContentAccessor, IEnumerable <ChildContentProjection>, TProjection> createProjectionDelegate)
            where TProjection : PageContentProjection
        {
            IContentAccessor contentAccessor = null;
            Type             contentType;

            if (content is IProxy)
            {
                contentType = content.GetType().BaseType;
            }
            else
            {
                contentType = content.GetType();
            }

            string key = "CONTENTRENDERER-" + contentType.Name.ToUpperInvariant();

            if (containerProvider.CurrentScope.IsRegisteredWithKey <IContentAccessor>(key))
            {
                contentAccessor = containerProvider.CurrentScope
                                  .ResolveKeyed <IContentAccessor>(key, new Parameter[]
                {
                    new PositionalParameter(0, content),
                    new PositionalParameter(1, options)
                });
            }

            if (contentAccessor == null)
            {
                Log.Error(string.Format("A content accessor was not found for the content type {0} with id={1}.", content.GetType().FullName, content.Id));

                contentAccessor = new EmptyContentAccessor(string.Format("<i style=\"color:red;\">{0}</i>", RootGlobalization.Message_FailedToRenderContent));
            }

            TProjection pageContentProjection = createProjectionDelegate.Invoke(pageContent, content, contentAccessor, childContentProjections);

            return(pageContentProjection);
        }
        public PageContentProjection Create(IPageContent pageContent, IContent content, IList<IOption> options)
        {
            IContentAccessor contentAccessor = null;
            Type contentType;

            if (content is IProxy)
            {
                contentType = content.GetType().BaseType;
            }
            else
            {
                contentType = content.GetType();
            }

            string key = "CONTENTRENDERER-" + contentType.Name.ToUpperInvariant();

            if (containerProvider.CurrentScope.IsRegisteredWithKey<IContentAccessor>(key))
            {
                contentAccessor = containerProvider.CurrentScope
                    .ResolveKeyed<IContentAccessor>(key, new Parameter[]
                                                             {
                                                                 new PositionalParameter(0, content),
                                                                 new PositionalParameter(1, options)
                                                             });
            }

            if (contentAccessor == null)
            {
                Log.Error(string.Format("A content accessor was not found for the content type {0} with id={1}.", content.GetType().FullName, content.Id));

                contentAccessor = new EmptyContentAccessor(string.Format("<i style=\"color:red;\">{0}</i>", RootGlobalization.Message_FailedToRenderContent));
            }

            PageContentProjection pageContentProjection = new PageContentProjection(pageContent, content, contentAccessor);

            return pageContentProjection;
        }
示例#13
0
        public AddContent(IPageContent editor)
        {
            InitializeComponent();
            ShowPage(1);


            //action btn close
            BTNClose.MouseDown += (s, e) =>
            {
                ShowPage(0, () =>
                {
                    Visibility = Visibility.Collapsed;
                });
            };


            //action btn add contents
            BTNAddContent.Worker += () =>
            {
                if (TextName.Text.Length >= 1)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageContent.AddContent(TextName.Text, result =>
                    {
                        if (result)
                        {
                            editor.Init();
                        }
                        else
                        {
                            Debug.WriteLine("Faild Add");
                        }
                        Debug.WriteLine(result);
                    });
                }
            };
        }
 public static string GetPageTitle(IPageContent that) => that.Value <string>("pageTitle");
示例#15
0
 public PageContentProjection Create(IPageContent pageContent, IContent content, IList <IOptionValue> options,
                                     IEnumerable <ChildContentProjection> childContentProjections)
 {
     return(Create(pageContent, content, options, childContentProjections, (pc, c, a, ch) => new PageContentProjection(pc, c, a, ch)));
 }
示例#16
0
 public PageContentProjection Create(IPageContent pageContent, IContent content, IList <IOptionValue> options)
 {
     return(Create(pageContent, content, options, null, (pc, c, a, ch) => new PageContentProjection(pc, c, a, ch)));
 }
示例#17
0
 public ManagePageContentsController()
 {
     _PageContent = new PageContent();
     dropdown     = new DropdownBindController();
 }
示例#18
0
 public static bool GetPdfThisPage(IPageContent that) => that.Value <bool>("pdfThisPage");
 public static string GetPageContentText(IPageContent that) => that.Value <string>("pageContentText");
示例#20
0
 public PageContentProjection(IPageContent pageContent, IContent content, IContentAccessor contentAccessor)
 {
     this.pageContent     = pageContent;
     this.content         = content;
     this.contentAccessor = contentAccessor;
 }
示例#21
0
        private static PageContentRenderer<IPageContent> ResolvePageContentRenderer(IPageContent pageContent)
        {
            Type genericType = typeof(PageContentRenderer<>);
            Type genericTypeParameter = pageContent.GetType();
            var pageContentRender = (PageContentRenderer<IPageContent>)Kooboo.Common.ObjectContainer.EngineContext.Current.ResolveGeneric(genericType, genericTypeParameter);

            return pageContentRender;
        }
示例#22
0
 public PageContentProjection(IPageContent pageContent, IContent content, IContentAccessor contentAccessor)
 {
     this.pageContent = pageContent;
     this.content = content;
     this.contentAccessor = contentAccessor;
 }
示例#23
0
 public PageContentProjection(SerializationInfo info, StreamingContext context)
 {
     pageContent = (IPageContent)info.GetValue("pageContent", typeof(IPageContent));
     content = (IContent)info.GetValue("content", typeof(IContent));
     contentAccessor = (IContentAccessor)info.GetValue("contentAccessor", typeof(IContentAccessor));
 }
示例#24
0
 public ChildContentProjection(IPageContent pageContent, IChildContent content, IContentAccessor contentAccessor,
                               IEnumerable <ChildContentProjection> childProjections = null, IEnumerable <PageContentProjection> childRegionContentProjections = null)
     : base(pageContent, content.ChildContent, contentAccessor, childProjections, childRegionContentProjections)
 {
     assignmentIdentifier = content.AssignmentIdentifier;
 }
 public static bool GetBannerHeight(IPageContent that) => that.Value <bool>("bannerHeight");
示例#26
0
 public ChildContentProjection(IPageContent pageContent, IChildContent content, IContentAccessor contentAccessor,
     IEnumerable<ChildContentProjection> childProjections = null, IEnumerable<PageContentProjection> childRegionContentProjections = null)
     : base(pageContent, content.ChildContent, contentAccessor, childProjections, childRegionContentProjections)
 {
     assignmentIdentifier = content.AssignmentIdentifier;
 }
 public static global::System.Web.IHtmlString GetBannerSummary(IPageContent that) => that.Value <global::System.Web.IHtmlString>("bannerSummary");
示例#28
0
 public async void MoveToOtherPage(IPageContent page)
 {
     await Navigation.PushModalAsync(page as Page);
 }
 public static global::Umbraco.Core.Models.PublishedContent.IPublishedContent GetPageBanner(IPageContent that) => that.Value <global::Umbraco.Core.Models.PublishedContent.IPublishedContent>("pageBanner");
示例#30
0
 public void MoveToOtherPage(IPageContent page)
 {
     throw new NotImplementedException();
 }
 public static string GetBannerHeading(IPageContent that) => that.Value <string>("bannerHeading");
示例#32
0
 public static global::System.Collections.Generic.IEnumerable <global::Umbraco.Core.Models.PublishedContent.IPublishedElement> GetContentBlock(IPageContent that) => that.Value <global::System.Collections.Generic.IEnumerable <global::Umbraco.Core.Models.PublishedContent.IPublishedElement> >("contentBlock");
示例#33
0
 public Task SaveContent(IPageContent input)
 {
     throw new NotImplementedException();
 }
示例#34
0
 public PageContentProjection(SerializationInfo info, StreamingContext context)
 {
     pageContent     = (IPageContent)info.GetValue("pageContent", typeof(IPageContent));
     content         = (IContent)info.GetValue("content", typeof(IContent));
     contentAccessor = (IContentAccessor)info.GetValue("contentAccessor", typeof(IContentAccessor));
 }
示例#35
0
 public void MoveToOtherPage(IPageContent page)
 {
 }