public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken searchToken)
        {
            if (entityToken is SharedCodeFolderEntityToken)
            {
                return(GetSharedCodeElements(searchToken));
            }

            if ((entityToken is PageTemplateRootEntityToken) == false)
            {
                return new Element[] { }
            }
            ;

            bool sharedFilesExist = PageTemplateFacade.GetSharedFiles().Any();

            IEnumerable <Element> result = sharedFilesExist
                ? new [] { GetSharedCodeElement() }
                : new Element[0];

            var pageTemplates = PageTemplateFacade.GetPageTemplates();

            if (searchToken.IsValidKeyword())
            {
                string keyword = searchToken.Keyword.ToLowerInvariant();

                pageTemplates = pageTemplates
                                .Where(t => t.Title.IndexOf(keyword, StringComparison.InvariantCultureIgnoreCase) > 0);
            }

            pageTemplates = pageTemplates.OrderBy(template => template.Title).ToList();

            return(result.Concat(GetElements(pageTemplates)));
        }
        private void IsTitleUsed(object sender, ConditionalEventArgs e)
        {
            string title = this.GetBinding <string>(Binding_Title);

            e.Result = PageTemplateFacade.GetPageTemplates()
                       .Any(f => f.Title.Equals(title, StringComparison.InvariantCultureIgnoreCase));
        }
        private void IsTitleUsed(object sender, ConditionalEventArgs e)
        {
            IXmlPageTemplate newPageTemplate = this.GetBinding <IXmlPageTemplate>("NewPageTemplate");

            e.Result = PageTemplateFacade.GetPageTemplates()
                       .Any(f => f.Title.Equals(newPageTemplate.Title, StringComparison.InvariantCultureIgnoreCase));
        }
        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DataEntityToken token    = (DataEntityToken)this.EntityToken;
            IVisualFunction function = (IVisualFunction)token.Data;

            this.Bindings.Add("OriginalFullName", string.Format("{0}.{1}", function.Namespace, function.Name));
            this.Bindings.Add("Function", function);
            this.Bindings.Add("XhtmlBody", function.XhtmlTemplate);

            Type interfaceType = TypeManager.GetType(function.TypeManagerName);
            DataTypeDescriptor typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);

            this.Bindings.Add("EmbedableFieldsTypes", new List <Type> {
                interfaceType
            });
            this.Bindings.Add("SourceTypeFullName", interfaceType.FullName);

            this.Bindings.Add("FieldNameList", FieldNames(typeDescriptor).ToList());

            Dictionary <Guid, string> templateInfos = new Dictionary <Guid, string>();

            foreach (PageTemplateDescriptor pageTemplate in PageTemplateFacade.GetPageTemplates())
            {
                if (pageTemplate.PlaceholderDescriptions.Any())
                {
                    templateInfos.Add(pageTemplate.Id, pageTemplate.Title);
                }
            }

            this.Bindings.Add("PreviewTemplateId", templateInfos.First().Key);
            this.Bindings.Add("TemplateList", templateInfos);
        }
        private RazorPageTemplateDescriptor GetPageTemplateDescriptor()
        {
            Guid templateId = GetTemplateId();

            var template = PageTemplateFacade.GetPageTemplates().FirstOrDefault(t => t.Id == templateId);

            Verify.IsNotNull(template, "Faile to find page template by ID '{0}'", templateId);

            return((PageTemplates.Razor.RazorPageTemplateDescriptor)template);
        }
Пример #6
0
        private static Guid?ResolveTemplate(string template)
        {
            var templates = PageTemplateFacade.GetPageTemplates().OfType <MvcPageTemplateDescriptor>().ToList();

            Guid templateId;

            if (Guid.TryParse(template, out templateId) && templates.Any(t => t.Id == templateId))
            {
                return(templateId);
            }

            var c1Template = templates.FirstOrDefault(t => t.Title == template);

            return(c1Template == null ? (Guid?)null : c1Template.Id);
        }
Пример #7
0
        private bool AnyTemplatesContainingPlaceholderId()
        {
            IPageTypeDefaultPageContent defaultPageContent = this.GetBinding <IPageTypeDefaultPageContent>("DefaultPageContent");

            foreach (var templateDescriptor in PageTemplateFacade.GetPageTemplates())
            {
                if (templateDescriptor.PlaceholderDescriptions
                    .Any(placholder => placholder.Id == defaultPageContent.PlaceHolderId))
                {
                    return(true);
                }
            }

            return(false);
        }
        public IEnumerable <Element> GetRoots(SearchToken searchToken)
        {
            Element element = new Element(_context.CreateElementHandle(new PageTemplateRootEntityToken()));

            bool hasChildren = PageTemplateFacade.GetPageTemplates().Any();

            element.VisualData = new ElementVisualizedData
            {
                Label       = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.RootLabel"),
                ToolTip     = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.RootLabelToolTip"),
                HasChildren = hasChildren,
                Icon        = PageTemplateElementProvider.RootClosed,
                OpenedIcon  = PageTemplateElementProvider.RootOpen
            };

            const string addTemplateWorkflowType = "Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.AddNewPageTemplateWorkflow";

            element.AddWorkflowAction(addTemplateWorkflowType, new[] { PermissionType.Add },
                                      new ActionVisualizedData
            {
                Label          = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.AddTemplate"),
                ToolTip        = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.AddTemplateToolTip"),
                Icon           = PageTemplateElementProvider.AddTemplate,
                Disabled       = false,
                ActionLocation = new ActionLocation
                {
                    ActionType  = ActionType.Add,
                    IsInFolder  = false,
                    IsInToolbar = true,
                    ActionGroup = PrimaryActionGroup
                }
            });

            foreach (var pageTemplateProviderName in PageTemplateProviderRegistry.ProviderNames)
            {
                var provider = PageTemplateProviderPluginFacade.GetProvider(pageTemplateProviderName);

                Verify.IsNotNull(provider, "Failed to get provider by name '{0}'", pageTemplateProviderName);

                IEnumerable <ElementAction> actions = provider.GetRootActions();

                element.AddAction(actions);
            }

            return(new [] { element });
        }
        private void codeActivity1_ExecuteCode(object sender, EventArgs e)
        {
            this.Bindings.Add(Binding_Title, string.Empty);

            List <KeyValuePair <Guid, string> > templatesOptions =
                (from template in PageTemplateFacade.GetPageTemplates().OfType <RazorPageTemplateDescriptor>()
                 where template.IsValid
                 orderby template.Title
                 select new KeyValuePair <Guid, string>(template.Id, template.Title)).ToList();

            templatesOptions.Insert(0, new KeyValuePair <Guid, string>(
                                        Guid.Empty, GetText("AddNewRazorPageTemplate.LabelCopyFromEmptyOption")));

            Guid mostUsedTemplate = PageTemplateHelper.GetTheMostUsedTemplate(templatesOptions.Select(p => p.Key));

            this.Bindings.Add("CopyOfOptions", templatesOptions);
            this.Bindings.Add("CopyOfId", mostUsedTemplate);
        }
Пример #10
0
        private List <KeyValuePair <Guid, string> > GetSelectablePageTemplates()
        {
            var selectedPage = GetBinding <IPage>("SelectedPage");

            var allPageTemplates = PageTemplateFacade.GetPageTemplates().ToList();

            var templateRestrictions =
                DataFacade.GetData <IPageTypePageTemplateRestriction>()
                .Where(f => f.PageTypeId == selectedPage.PageTypeId)
                .Select(restriction => restriction.PageTemplateId)
                .ToList();

            IEnumerable <PageTemplateDescriptor> result;

            if (templateRestrictions.Any())
            {
                var allowedTemplatesHash = new HashSet <Guid>(templateRestrictions);

                var allowedTemplates =
                    allPageTemplates
                    .Where(template => allowedTemplatesHash.Contains(template.Id))
                    .ToList();

                var selectedTemplateId = selectedPage.TemplateId;
                var selectedTemplate   = allPageTemplates.FirstOrDefault(t => t.Id == selectedTemplateId);
                if (selectedTemplate != null
                    & !allowedTemplates.Any(t => t.Id == selectedTemplateId))
                {
                    allowedTemplates.Add(selectedTemplate);
                }

                result = allowedTemplates;
            }
            else
            {
                result = allPageTemplates;
            }

            return(result
                   .OrderBy(template => template.Title)
                   .Select(f => new KeyValuePair <Guid, string>(f.Id, f.Title)).ToList());
        }
        static TeaserElementAttachingProvider()
        {
            TemplateTeaserPositions = new Dictionary <Guid, IList <Tuple <string, string> > >();

            var config    = TeasersSection.GetSection();
            var positions = config.Positions.Cast <TeasersPositionElement>().ToDictionary(e => e.Name, e => e.Label);
            var templates = PageTemplateFacade.GetPageTemplates();

            foreach (var template in templates)
            {
                var templatePositions = config.Templates.Cast <TeasersTemplateElement>().SingleOrDefault(e => e.Guid == template.Id);
                if (templatePositions == null)
                {
                    continue;
                }

                var tupleList = templatePositions.Positions.Cast <TeasersTemplatePositionElement>().Select(e => Tuple.Create(e.Name, positions[e.Name])).ToList();

                TemplateTeaserPositions.Add(template.Id, tupleList);
            }
        }
Пример #12
0
        public void Pack(PackageCreator creator)
        {
            var pageTemplate = PageTemplateFacade.GetPageTemplates().FirstOrDefault(t => t.Title == Id);

            if (pageTemplate == null)
            {
                throw new InvalidOperationException(string.Format("Template '{0}' does not exists", Id));
            }

            if (pageTemplate.GetType().Name.Contains("MasterPagePageTemplateDescriptor"))
            {
                var codeBehindFilePath = pageTemplate.GetProperty("CodeBehindFilePath");
                var filePath           = pageTemplate.GetProperty("FilePath");
                creator.AddFile("~" + PathUtil.GetWebsitePath(codeBehindFilePath));
                creator.AddFile("~" + PathUtil.GetWebsitePath(filePath));
            }
            else if (pageTemplate.GetType().Name.Contains("RazorPageTemplateDescriptor"))
            {
                var virtualPath = pageTemplate.GetProperty("VirtualPath");
                creator.AddFile(virtualPath);
            }
        }
        private void codeActivity1_ExecuteCode(object sender, EventArgs e)
        {
            IXmlPageTemplate newPageTemplate = DataFacade.BuildNew <IXmlPageTemplate>();

            newPageTemplate.Id    = Guid.NewGuid();
            newPageTemplate.Title = "";

            this.Bindings.Add("NewPageTemplate", newPageTemplate);

            List <KeyValuePair <Guid, string> > templatesOptions =
                (from template in PageTemplateFacade.GetPageTemplates()
                 where template is XmlPageTemplateDescriptor && template.IsValid
                 orderby template.Title
                 select new KeyValuePair <Guid, string>(template.Id, template.Title)).ToList();

            templatesOptions.Insert(0, new KeyValuePair <Guid, string>(
                                        Guid.Empty, GetText("AddNewXmlPageTemplate.LabelCopyFromEmptyOption")));

            Guid mostUsedTemplate = PageTemplateHelper.GetTheMostUsedTemplate(templatesOptions.Select(p => p.Key));

            this.Bindings.Add("CopyOfOptions", templatesOptions);
            this.Bindings.Add("CopyOfId", mostUsedTemplate);
        }
Пример #14
0
        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            var path = httpContext.Request.Path;

            var pageUrlData = PageUrls.ParseUrl(path);

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

            using (new DataScope(pageUrlData.PublicationScope, pageUrlData.LocalizationScope))
            {
                var page        = PageManager.GetPageById(pageUrlData.PageId);
                var templateIds = PageTemplateFacade.GetPageTemplates().OfType <MvcPageTemplateDescriptor>().Select(t => t.Id);

                if (!templateIds.Contains(page.TemplateId))
                {
                    return(null);
                }

                var template = PageTemplateFacade.GetPageTemplate(page.TemplateId) as MvcPageTemplateDescriptor;
                if (template == null)
                {
                    return(null);
                }
            }

            return(new RouteData(this, new MvcRouteHandler())
            {
                Values =
                {
                    { "controller", _controller.ControllerName },
                    { "action",     "Get"                      }
                }
            });
        }
Пример #15
0
        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)
        {
            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;

            CleanDeadLinks(pageType.Id);

            this.Bindings.Add("PageType", pageType);

            List <KeyValuePair <Guid, string> > pageTypes =
                DataFacade.GetData <IPageType>().
                OrderBy(f => f.Name).
                ToList(f => new KeyValuePair <Guid, string>(f.Id, f.Name));

            var defaultPageTypeOptions = new List <KeyValuePair <Guid, string> >
            {
                new KeyValuePair <Guid, string>(Guid.Empty,
                                                Texts.PageType_EditPageTypeWorkflow_DefaultChildPageTypeKeySelector_NoneSelectedLabel)
            };

            defaultPageTypeOptions.AddRange(pageTypes);

            this.Bindings.Add("DefaultChildPageTypeOptions", defaultPageTypeOptions);


            Func <PageTypeHomepageRelation, KeyValuePair <string, string> > getOption =
                relation =>
                new KeyValuePair <string, string>(
                    relation.ToString(),
                    GetText($"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.{relation}Label"));

            this.Bindings.Add("HomepageRelationOptions", new List <KeyValuePair <string, string> > {
                getOption(PageTypeHomepageRelation.NoRestriction),
                getOption(PageTypeHomepageRelation.OnlyHomePages),
                getOption(PageTypeHomepageRelation.OnlySubPages),
            });


            List <KeyValuePair <Guid, string> > pageTemplates =
                PageTemplateFacade.GetPageTemplates().
                OrderBy(f => f.Title).
                ToList(f => new KeyValuePair <Guid, string>(f.Id, f.Title));

            var defaultPageTemplateOptions = new List <KeyValuePair <Guid, string> >
            {
                new KeyValuePair <Guid, string>(Guid.Empty,
                                                Texts.PageType_EditPageTypeWorkflow_DefaultPageTemplateKeySelector_NoneSelectedLabel)
            };

            defaultPageTemplateOptions.AddRange(pageTemplates);

            this.Bindings.Add("DefaultTemplateOptions", defaultPageTemplateOptions);


            this.Bindings.Add("TemplateRestrictionOptions", pageTemplates);


            List <Guid> selectedPageTemplateIds =
                DataFacade.GetData <IPageTypePageTemplateRestriction>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.PageTemplateId).
                ToList();

            this.Bindings.Add("TemplateRestrictionSelected", selectedPageTemplateIds);


            List <KeyValuePair <Guid, string> > parentRestrictingPageTypes =
                DataFacade.GetData <IPageType>().
                OrderBy(f => f.Name).
                ToList(f => new KeyValuePair <Guid, string>(f.Id, f.Name));

            this.Bindings.Add("PageTypeChildRestrictionOptions", parentRestrictingPageTypes);


            List <Guid> selectedPageTypeParentRestrictions =
                DataFacade.GetData <IPageTypeParentRestriction>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.AllowedParentPageTypeId).
                ToList();

            this.Bindings.Add("PageTypeChildRestrictionSelected", selectedPageTypeParentRestrictions);


            List <KeyValuePair <Guid, string> > dataFolderTypes =
                PageFolderFacade.GetAllFolderTypes().
                OrderBy(f => f.FullName).
                ToList(f => new KeyValuePair <Guid, string>(f.GetImmutableTypeId(), f.GetTypeTitle()));

            this.Bindings.Add("DataFolderOptions", dataFolderTypes);


            List <Guid> selectedDataFolderTypes =
                DataFacade.GetData <IPageTypeDataFolderTypeLink>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.DataTypeId).
                ToList();

            this.Bindings.Add("DataFolderSelected", selectedDataFolderTypes);


            List <KeyValuePair <string, string> > applications =
                TreeFacade.AllTrees.
                Where(f => !string.IsNullOrEmpty(f.AllowedAttachmentApplicationName)).
                OrderBy(f => f.TreeId).
                ToList(f => new KeyValuePair <string, string>(f.TreeId, f.AllowedAttachmentApplicationName));

            this.Bindings.Add("ApplicationOptions", applications);


            List <string> selectedApplications =
                DataFacade.GetData <IPageTypeTreeLink>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.TreeId).
                ToList();

            this.Bindings.Add("ApplicationSelected", selectedApplications);
        }
Пример #16
0
        private void stepInitialize_codeActivity_ExecuteCode(object sender, EventArgs e)
        {
            Guid templateId;

            if (this.EntityToken is PageElementProviderEntityToken)
            {
                templateId = PageTemplateFacade.GetPageTemplates().Select(t => t.Id).FirstOrDefault();
            }
            else if (this.EntityToken is DataEntityToken)
            {
                DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;
                IPage           selectedPage    = (IPage)dataEntityToken.Data;

                templateId = selectedPage.TemplateId;
            }
            else
            {
                throw new NotImplementedException();
            }


            List <IPageType> selectablePageTypes = GetSelectablePageTypes();

            Guid?pageTypeId = GetDefaultPageTypeId(selectablePageTypes);

            Verify.That(pageTypeId.HasValue, "Failed to get a page type");

            Guid parentId = GetParentId();

            Dictionary <string, object> bindings = new Dictionary <string, object>();



            List <KeyValuePair <Guid, string> > pageTypeOptions =
                selectablePageTypes.
                Select(f => new KeyValuePair <Guid, string>(f.Id, f.Name)).
                ToList();

            bindings.Add("PageTypeOptions", pageTypeOptions);


            IPage newPage = DataFacade.BuildNew <IPage>();

            newPage.Id                = Guid.NewGuid();
            newPage.TemplateId        = templateId;
            newPage.PageTypeId        = pageTypeId.Value;
            newPage.Title             = "";
            newPage.MenuTitle         = "";
            newPage.UrlTitle          = "";
            newPage.FriendlyUrl       = "";
            newPage.PublicationStatus = GenericPublishProcessController.Draft;

            bindings.Add("NewPage", newPage);

            bindings.Add("UrlTitleIsRequired", true /* ThereAreOtherPages()*/);

            int existingPagesCount = PageServices.GetChildrenCount(parentId);
            Dictionary <string, string> sortOrder = new Dictionary <string, string>();

            sortOrder.Add("Bottom", GetText("AddNewPageStep1.LabelAddToBottom"));
            if (existingPagesCount > 0)
            {
                sortOrder.Add("Top", GetText("AddNewPageStep1.LabelAddToTop"));
                if (existingPagesCount > 1)
                {
                    sortOrder.Add("Relative", GetText("AddNewPageStep1.LabelAddBelowOtherPage"));
                }

                bool isAlpabeticOrdered = PageServices.IsChildrenAlphabeticOrdered(parentId);
                if (isAlpabeticOrdered)
                {
                    sortOrder.Add("Alphabetic", GetText("AddNewPageStep1.LabelAddAlphabetic"));
                }
            }
            bindings.Add("SortOrder", sortOrder);
            bindings.Add("SelectedSortOrder", sortOrder.Keys.First());

            if (parentId == Guid.Empty)
            {
                bindings.Add("ShowCulture", true);
                bindings.Add("Cultures", DataLocalizationFacade.WhiteListedLocales
                             .Select(f => new KeyValuePair <string, string>(f.Name, DataLocalizationFacade.GetCultureTitle(f))).ToList());
            }
            else
            {
                bindings.Add("ShowCulture", false);
            }

            this.Bindings = bindings;
        }
Пример #17
0
        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)
        {
            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;

            CleanDeadLinks(pageType.Id);

            this.Bindings.Add("PageType", pageType);

            List <KeyValuePair <Guid, string> > pageTypes =
                DataFacade.GetData <IPageType>().
                OrderBy(f => f.Name).
                ToList(f => new KeyValuePair <Guid, string>(f.Id, f.Name));

            List <KeyValuePair <Guid, string> > defaultPageTypeOptions = new List <KeyValuePair <Guid, string> >();

            defaultPageTypeOptions.Add(new KeyValuePair <Guid, string>(Guid.Empty, StringResourceSystemFacade.GetString("Composite.Plugins.PageTypeElementProvider", "PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.NoneSelectedLabel")));
            defaultPageTypeOptions.AddRange(pageTypes);

            this.Bindings.Add("DefaultChildPageTypeOptions", defaultPageTypeOptions);



            this.Bindings.Add("HomepageRelationOptions", new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>(PageTypeHomepageRelation.NoRestriction.ToPageTypeHomepageRelationString(), StringResourceSystemFacade.GetString("Composite.Plugins.PageTypeElementProvider", string.Format("PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.{0}Label", PageTypeHomepageRelation.NoRestriction))),
                new KeyValuePair <string, string>(PageTypeHomepageRelation.OnlyHomePages.ToPageTypeHomepageRelationString(), StringResourceSystemFacade.GetString("Composite.Plugins.PageTypeElementProvider", string.Format("PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.{0}Label", PageTypeHomepageRelation.OnlyHomePages))),
                new KeyValuePair <string, string>(PageTypeHomepageRelation.OnlySubPages.ToPageTypeHomepageRelationString(), StringResourceSystemFacade.GetString("Composite.Plugins.PageTypeElementProvider", string.Format("PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.{0}Label", PageTypeHomepageRelation.OnlySubPages))),
            });


            List <KeyValuePair <Guid, string> > pageTemplates =
                PageTemplateFacade.GetPageTemplates().
                OrderBy(f => f.Title).
                ToList(f => new KeyValuePair <Guid, string>(f.Id, f.Title));

            List <KeyValuePair <Guid, string> > defaultPageTempatesOptions = new List <KeyValuePair <Guid, string> >();

            defaultPageTempatesOptions.Add(new KeyValuePair <Guid, string>(Guid.Empty, StringResourceSystemFacade.GetString("Composite.Plugins.PageTypeElementProvider", "PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.NoneSelectedLabel")));
            defaultPageTempatesOptions.AddRange(pageTemplates);

            this.Bindings.Add("DefaultTemplateOptions", defaultPageTempatesOptions);


            this.Bindings.Add("TemplateRestrictionOptions", pageTemplates);


            List <Guid> selectedPageTemplateIds =
                DataFacade.GetData <IPageTypePageTemplateRestriction>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.PageTemplateId).
                ToList();

            this.Bindings.Add("TemplateRestrictionSelected", selectedPageTemplateIds);


            List <KeyValuePair <Guid, string> > parentRestrictingPageTypes =
                DataFacade.GetData <IPageType>().
                OrderBy(f => f.Name).
                ToList(f => new KeyValuePair <Guid, string>(f.Id, f.Name));

            this.Bindings.Add("PageTypeChildRestrictionOptions", parentRestrictingPageTypes);


            List <Guid> selectedPageTypeParentRestrictions =
                DataFacade.GetData <IPageTypeParentRestriction>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.AllowedParentPageTypeId).
                ToList();

            this.Bindings.Add("PageTypeChildRestrictionSelected", selectedPageTypeParentRestrictions);


            List <KeyValuePair <Guid, string> > dataFolderTypes =
                PageFolderFacade.GetAllFolderTypes().
                OrderBy(f => f.FullName).
                ToList(f => new KeyValuePair <Guid, string>(f.GetImmutableTypeId(), f.GetTypeTitle()));

            this.Bindings.Add("DataFolderOptions", dataFolderTypes);


            List <Guid> selectedDataFolderTypes =
                DataFacade.GetData <IPageTypeDataFolderTypeLink>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.DataTypeId).
                ToList();

            this.Bindings.Add("DataFolderSelected", selectedDataFolderTypes);


            List <KeyValuePair <string, string> > applications =
                TreeFacade.AllTrees.
                Where(f => string.IsNullOrEmpty(f.AllowedAttachmentApplicationName) == false).
                OrderBy(f => f.TreeId).
                ToList(f => new KeyValuePair <string, string>(f.TreeId, f.AllowedAttachmentApplicationName));

            this.Bindings.Add("ApplicationOptions", applications);


            List <string> selectedApplications =
                DataFacade.GetData <IPageTypeTreeLink>().
                Where(f => f.PageTypeId == pageType.Id).
                Select(f => f.TreeId).
                ToList();

            this.Bindings.Add("ApplicationSelected", selectedApplications);
        }
 private static IEnumerable <KeyValuePair <Guid, string> > PageTemplates()
 {
     return(PageTemplateFacade.GetPageTemplates()
            .OrderBy(p => p.Title)
            .Select(p => new KeyValuePair <Guid, string>(p.Id, p.Title)));
 }