예제 #1
0
        public TemplateDefinition GetTemplate(string templateKey)
        {
            TemplateContainer templates = container.GetBelowRoot();

            if (templates == null)
            {
                return(null);
            }

            var template = templates.GetChild(templateKey);

            return(CreateTemplateInfo(template));
        }
예제 #2
0
        public virtual IEnumerable<MagicLocation> GetLocations()
        {
            var container = containers.GetBelowRoot();
            if (container == null)
                yield break;

            foreach (ContentItem child in container.GetChildren())
            {
                yield return child as MagicLocation;
            }
        }
예제 #3
0
        public TrashContainerItem GetTrashContainer(bool create)
        {
            if (!create)
            {
                container.GetBelowRoot();
            }

            return(container.GetOrCreateBelowRoot((trashContainer) =>
            {
                trashContainer.Name = TrashContainerName;
                trashContainer.Title = TrashContainerName;
                trashContainer.Visible = false;
                trashContainer.AuthorizedRoles.Add(new AuthorizedRole(trashContainer, "admin"));
                trashContainer.AuthorizedRoles.Add(new AuthorizedRole(trashContainer, "Editors"));
                trashContainer.AuthorizedRoles.Add(new AuthorizedRole(trashContainer, "Administrators"));
                trashContainer.SortOrder = int.MaxValue - 1000000;
            }));
        }
예제 #4
0
        public virtual IEnumerable <MagicLocation> GetLocations()
        {
            var container = containers.GetBelowRoot();

            if (container == null)
            {
                yield break;
            }

            foreach (var child in container.Children.WhereAccessible().OfType <MagicLocation>())
            {
                if (child.Location == null || child.Location.State == ContentState.Deleted)
                {
                    continue;
                }
                yield return(child as MagicLocation);
            }
        }