private void SetupGenericPreviewPropertyControl(Property propertyControl, IEnumerable<BlockData> contents)
        {
            var contentArea = new ContentArea();
            foreach (var content in contents)
            {
                contentArea.Items.Add(new ContentAreaItem { ContentLink = (content as IContent).ContentLink });
            }

            var previewProperty = new PropertyContentArea { Value = contentArea, Name = "PreviewPropertyData", IsLanguageSpecific = true };

            propertyControl.InnerProperty = previewProperty;
            propertyControl.DataBind();

        }
Пример #2
0
        private void SetupPreviewPropertyControl(Property propertyControl, IContent contents)
        {
            var contentArea = new ContentArea();

            contentArea.Items.Add(new ContentAreaItem {
                ContentLink = (contents).ContentLink
            });

            var previewProperty = new PropertyContentArea {
                Value = contentArea, Name = "PreviewPropertyData", IsLanguageSpecific = true
            };

            propertyControl.InnerProperty = previewProperty;
            propertyControl.DataBind();
        }
        private void SetupPreviewPropertyControl(Property propertyControl, IEnumerable <IContent> contents)
        {
            var contentArea = new ContentArea();

            foreach (var content in contents)
            {
                contentArea.Items.Add(new ContentAreaItem {
                    ContentLink = content.ContentLink
                });
            }

            var previewProperty = new PropertyContentArea {
                Value = contentArea, Name = "PreviewPropertyData", IsLanguageSpecific = true
            };

            propertyControl.InnerProperty = previewProperty;
        }
Пример #4
0
        /// <summary>
        /// Sets up a Property control to render contents using temporary property data
        /// </summary>
        /// <param name="propertyControl"></param>
        /// <param name="contents"></param>
        private void SetupPreviewPropertyControl(Property propertyControl, IEnumerable <IContent> contents)
        {
            // Define a content area
            var contentArea = new ContentArea();

            // Add the blocks to preview
            foreach (var content in contents)
            {
                contentArea.Add(content);
            }

            // Create a temporary property for the content area
            var previewProperty = new PropertyContentArea {
                Value = contentArea, Name = "PreviewPropertyData"
            };

            // Render the temporary property using the Property control in the web form
            propertyControl.InnerProperty = previewProperty;
        }
Пример #5
0
        /// <summary>
        /// Sets up a Property control to render contents using temporary property data
        /// </summary>
        /// <param name="propertyControl"></param>
        /// <param name="contents"></param>
        private void SetupPreviewPropertyControl(Property propertyControl, IEnumerable <IContent> contents)
        {
            // Define a content area
            var contentArea = new ContentArea();

            // Add the blocks to preview
            foreach (var content in contents)
            {
                contentArea.Items.Add(new ContentAreaItem {
                    ContentLink = content.ContentLink
                });
            }

            // Create a temporary property for the content area
            var previewProperty = new PropertyContentArea {
                Value = contentArea, Name = "PreviewPropertyData", IsLanguageSpecific = true
            };

            // Render the temporary property using the Property control in the web form
            propertyControl.InnerProperty = previewProperty;
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageDataCollection relatedPages =
                EPiCode.Relations.Helpers.PageHelper.GetPagesRelated(CurrentPage.PageLink,
                                                                     CurrentBlock.Rule, Rule.Direction.Both);

            if (relatedPages.Count == 0)
            {
                this.Visible = false;
            }
            if (CurrentBlock.UsePartialTemplates)
            {
                var contentArea = new ContentArea();

                foreach (var content in relatedPages)
                {
                    contentArea.Items.Add(new ContentAreaItem {
                        ContentLink = (content as IContent).ContentLink
                    });
                }

                var previewProperty = new PropertyContentArea
                {
                    Value = contentArea,
                    Name  = "PreviewPropertyData",
                    IsLanguageSpecific = true
                };

                RelatedContentPlaceHolder.InnerProperty = previewProperty;
                RelatedContentPlaceHolder.DataBind();
                RelationsRepeater.Visible = false;
            }
            else
            {
                RelatedContentPlaceHolder.Visible = false;
                RelationsRepeater.DataSource      = relatedPages;
                RelationsRepeater.DataBind();
            }
        }
 internal static IEnumerable <PropertyData> GetSearchableProperties(this IContentData contentData, IPropertyDefinitionRepository propertyDefinitionRepository, IEnumerable <ContentReference> referenceChain)
 {
     if (contentData != null)
     {
         IContent contentDataAsIContent = contentData as IContent;
         if (contentDataAsIContent == null || !Enumerable.Any <ContentReference>(Enumerable.Where <ContentReference>(referenceChain, (Func <ContentReference, bool>)(x => x.CompareToIgnoreWorkID(contentDataAsIContent.ContentLink)))))
         {
             foreach (PropertyData propertyData1 in contentData.Property)
             {
                 if (propertyData1.IsPropertyData)
                 {
                     PropertyInfo typeProperty = RuntimeModelExtensions.GetOriginalType((object)contentData).GetProperty(propertyData1.Name);
                     if (!(typeProperty == (PropertyInfo)null) && CustomAttributeExtensions.GetCustomAttribute <JsonIgnoreAttribute>((MemberInfo)typeProperty) == null)
                     {
                         PropertyContentArea contentAreaProperty = propertyData1 as PropertyContentArea;
                         PropertyDefinition  propertyDefinition  = propertyDefinitionRepository.Load(propertyData1.PropertyDefinitionID);
                         if (propertyDefinition.Searchable && contentAreaProperty == null)
                         {
                             yield return(propertyData1);
                         }
                         IPropertyBlock blockProperty = propertyData1 as IPropertyBlock;
                         if (blockProperty != null)
                         {
                             BlockData block = blockProperty.Block;
                             IPropertyDefinitionRepository  propertyDefinitionRepository1 = propertyDefinitionRepository;
                             IEnumerable <ContentReference> referenceChain1;
                             if (contentDataAsIContent == null)
                             {
                                 referenceChain1 = referenceChain;
                             }
                             else
                             {
                                 referenceChain1 = Enumerable.Concat <ContentReference>(referenceChain, (IEnumerable <ContentReference>) new ContentReference[1]
                                 {
                                     contentDataAsIContent.ContentLink
                                 });
                             }
                             foreach (PropertyData propertyData2 in ContentExtensions.GetSearchableProperties((IContentData)block, propertyDefinitionRepository1, referenceChain1))
                             {
                                 yield return(propertyData2);
                             }
                         }
                         if (contentAreaProperty != null)
                         {
                             ContentArea contentArea = contentAreaProperty.Value as ContentArea;
                             if (contentArea != null)
                             {
                                 foreach (PropertyData propertyData2 in Enumerable.SelectMany <IContent, PropertyData>(Enumerable.Where <IContent>(contentArea.Contents, (Func <IContent, bool>)(x =>
                                 {
                                     return(true);
                                 })), (Func <IContent, IEnumerable <PropertyData> >)(x =>
                                 {
                                     IContent content = x;
                                     IPropertyDefinitionRepository propertyDefinitionRepository1 = propertyDefinitionRepository;
                                     IEnumerable <ContentReference> referenceChain1;
                                     if (contentDataAsIContent == null)
                                     {
                                         referenceChain1 = referenceChain;
                                     }
                                     else
                                     {
                                         referenceChain1 = Enumerable.Concat <ContentReference>(referenceChain, (IEnumerable <ContentReference>) new ContentReference[1]
                                         {
                                             contentDataAsIContent.ContentLink
                                         });
                                     }
                                     return(ContentExtensions.GetSearchableProperties((IContentData)content, propertyDefinitionRepository1, referenceChain1));
                                 })))
                                 {
                                     yield return(propertyData2);
                                 }
                                 if (!propertyDefinition.ExistsOnModel)
                                 {
                                     foreach (IContent content in Enumerable.Where <IContent>(contentArea.Contents, (Func <IContent, bool>)(x =>
                                     {
                                         return(true);
                                     })))
                                     {
                                         foreach (PropertyInfo propertyInfo in typeof(IContent).GetProperties(BindingFlags.Instance | BindingFlags.Public))
                                         {
                                             yield return((PropertyData) new PropertyString(propertyInfo.GetValue((object)content, (object[])null).ToString()));
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #8
0
        private void SetupPreviewPropertyControl(Property propertyControl, IContent contents)
        {
            var contentArea = new ContentArea();
           
                contentArea.Items.Add(new ContentAreaItem { ContentLink = (contents).ContentLink });
           
            var previewProperty = new PropertyContentArea { Value = contentArea, Name = "PreviewPropertyData", IsLanguageSpecific = true };

            propertyControl.InnerProperty = previewProperty;
            propertyControl.DataBind();

        }