示例#1
0
        public virtual void AddPage(IComposerPage page)
        {
            var key = Tuple.Create(page.Guid, page.Language);

            _contentStorage[key]           = page;
            _normalizedContentStorage[key] = page;

            var descendentFunctions = GetDecendentFunctions(page).ToArray();

            foreach (var function in descendentFunctions)
            {
                // Set language on function
                function.Language = page.Language;

                // Add to normalized storage
                key = Tuple.Create(function.Guid, function.Language);
                _normalizedContentStorage[key] = function;

                // Add to reverse lookup
                _parentPages[function.Guid] = page;
            }

            if (page.ShadowGuid != Guid.Empty && descendentFunctions.Any())
            {
                // Add shadow containers to reverse lookup
                _parentPages.Add(page.ShadowGuid, page);
            }

            _isRestructured = false;
        }
示例#2
0
        public virtual void AddPage(IComposerPage page)
        {
            var key = Tuple.Create(page.Guid, page.Language);
            _contentStorage[key] = page;
            _normalizedContentStorage[key] = page;

            var descendentFunctions = GetDecendentFunctions(page).ToArray();

            foreach (var function in descendentFunctions)
            {
                // Set language on function
                function.Language = page.Language;

                // Add to normalized storage
                key = Tuple.Create(function.Guid, function.Language);
                _normalizedContentStorage[key] = function;

                // Add to reverse lookup
                _parentPages[function.Guid] = page;
            }

            if (page.ShadowGuid != Guid.Empty && descendentFunctions.Any())
            {
                // Add shadow containers to reverse lookup
                _parentPages[page.ShadowGuid] = page;
            }

            _isRestructured = false;
        }
        public virtual void TransformContainer(RawContent rawContent, IComposerPage parent)
        {
            if (rawContent == null)
                throw new ArgumentNullException("rawContent");

            rawContent.SetPropertyValue(MetaDataProperties.PageParentLink, _exportLinkResolver.GetExportableLink(new ContentReference(4))); // id of the SysContentAssets folder
            rawContent.SetPropertyValue(MetaDataProperties.PageContentOwnerID, parent.Guid.ToString());

            if (parent != null)
            {
                rawContent.PageName(parent.Name);
                rawContent.Language(parent.Language);
                rawContent.MasterLanguage(parent.Language);
            }
        }
        public virtual void TransformContainer(RawContent rawContent, IComposerPage parent)
        {
            if (rawContent == null)
            {
                throw new ArgumentNullException("rawContent");
            }

            rawContent.SetPropertyValue(MetaDataProperties.PageParentLink, _exportLinkResolver.GetExportableLink(ContentReference.GlobalBlockFolder));

            if (parent != null)
            {
                rawContent.PageName(parent.Name);
                rawContent.Language(parent.Language);
                rawContent.MasterLanguage(parent.Language);
            }
        }
        public bool TryMap(RawContent rawContent, out IComposerPage composerPage)
        {
            composerPage = null;
            var sourceProperty = rawContent.GetProperty(ComposerProperties.Page);
            if (sourceProperty == null || sourceProperty.IsNull)
            {
                return false;
            }

            // Deserialize the Extension pagestructure
            var specialized = _composerSerializer.Deserialize<ComposerPageInformation>(sourceProperty.Value);

            if (specialized == null || specialized.Page == null)
            {
                return false;
            }

            composerPage = specialized.Page;
            composerPage.Name = rawContent.PageName();
            composerPage.Language = rawContent.Language();
            return true;
        }
示例#6
0
        public bool TryMap(RawContent rawContent, out IComposerPage composerPage)
        {
            composerPage = null;
            var sourceProperty = rawContent.GetProperty(ComposerProperties.Page);

            if (sourceProperty == null || sourceProperty.IsNull)
            {
                return(false);
            }

            // Deserialize the Extension pagestructure
            var specialized = _composerSerializer.Deserialize <ComposerPageInformation>(sourceProperty.Value);

            if (specialized == null || specialized.Page == null)
            {
                return(false);
            }

            composerPage          = specialized.Page;
            composerPage.Name     = rawContent.PageName();
            composerPage.Language = rawContent.Language();
            return(true);
        }