コード例 #1
0
 private static TabDefinition GetExistingTabDefinition(ITabDefinitionRepository tabDefinitionRepository, TabDefinition definition)
 {
     return tabDefinitionRepository.List()
                                   .FirstOrDefault(
                                   t =>
                                   t.Name.Equals(definition.Name, StringComparison.InvariantCultureIgnoreCase));
 }
コード例 #2
0
        protected virtual void UpdatePageDefinitionTab(PageDefinition pageDefinition, PageTypePropertyAttribute propertyAttribute)
        {
            var tab = tabDefinitionRepository.List().First();

            if (propertyAttribute.Tab != null)
            {
                Tab definedTab = (Tab)Activator.CreateInstance(propertyAttribute.Tab);
                tab = tabDefinitionRepository.GetTabDefinition(definedTab.Name);
            }
            pageDefinition.Tab = tab;
        }
コード例 #3
0
        public Stream ExportContent(ContentExport contentExport, ContentReference root)
        {
            var exporter             = _dataExporterAccessor();
            var exportedContentTypes = new HashSet <int>();
            var sources = new List <ExportSource>();

            if ((contentExport & ContentExport.ExportContentTypes) == ContentExport.ExportContentTypes)
            {
                _contentTypeRepository.List().ForEach(x =>
                {
                    exporter.AddContentType(x);
                    exportedContentTypes.Add(x.ID);
                });
            }

            if ((contentExport & ContentExport.ExportFrames) == ContentExport.ExportFrames)
            {
                _frameRepository().List().ForEach(exporter.AddFrame);
            }

            if ((contentExport & ContentExport.ExportTabDefinitions) == ContentExport.ExportTabDefinitions)
            {
                _tabDefinitionRepository.List().ForEach(exporter.AddTabDefinition);
            }

            if ((contentExport & ContentExport.ExportDynamicPropertyDefinitions) == ContentExport.ExportDynamicPropertyDefinitions)
            {
                _propertyDefinitionRepository.ListDynamic().ForEach(exporter.AddDynamicProperty);
            }

            if ((contentExport & ContentExport.ExportCategories) == ContentExport.ExportCategories)
            {
                ExportCategories(exporter, _categoryRepository.GetRoot());
            }

            if ((contentExport & ContentExport.ExportPages) == ContentExport.ExportPages)
            {
                sources.Add(new ExportSource(root, ExportSource.RecursiveLevelInfinity));
            }

            if ((contentExport & ContentExport.ExportVisitorGroups) == ContentExport.ExportVisitorGroups)
            {
                _visitorGroupRepository.List().ForEach(exporter.AddVisitorGroup);
            }

            var options = new ExportOptions
            {
                IncludeReferencedContentTypes =
                    (contentExport & ContentExport.ExportContentTypeDependencies) == ContentExport.ExportContentTypeDependencies,
                ExportPropertySettings =
                    (contentExport & ContentExport.ExportPropertySettings) == ContentExport.ExportPropertySettings,
                ExcludeFiles    = false,
                AutoCloseStream = false
            };

            var stream = new MemoryStream();

            exporter.Export(stream, sources, options);
            ((DefaultDataExporter)exporter)?.Close();
            stream.Position = 0;
            return(stream);
        }