예제 #1
0
        private void CheckPageProperties(PageData page, IList <Tag> tags)
        {
            var pageType = _pageTypeRepository.Load(page.PageTypeID);

            foreach (var propertyDefinition in pageType.PropertyDefinitions)
            {
                if (!TagsHelper.IsTagProperty(propertyDefinition))
                {
                    continue;
                }

                var tagNames = page[propertyDefinition.Name] as string;

                IList <Tag> allTags = tags;

                if (tagNames == null)
                {
                    RemoveFromAllTags(page.PageGuid, allTags);
                    continue;
                }

                var addedTags = ParseTags(tagNames);

                // make sure the tags it has added has the pagereference
                ValidateTags(allTags, page.PageGuid, addedTags);

                // make sure there's no pagereference to this pagereference in the rest of the tags
                RemoveFromAllTags(page.PageGuid, allTags);
            }
        }
        public PageDefinition GetPageDefinition(string name, string pageTypeName)
        {
            var pageType = PageTypeRepository.Load(pageTypeName);

            return(PageDefinitionRepository.List(pageType.ID)
                   .Where(def => def.Name == name)
                   .FirstOrDefault());
        }
예제 #3
0
        private IEnumerable <string> GetPageTags(PageData page)
        {
            var pageType = _pageTypeRepository.Load(page.PageTypeID);

            return(pageType.PropertyDefinitions
                   .Where(TagsHelper.IsTagProperty)
                   .SelectMany(x => GetPropertyTags(page, x)));
        }