예제 #1
0
        protected override void Importing(MenuPart part, ContentManagement.Handlers.ImportContentContext context)
        {
            var menuText = context.Attribute(part.PartDefinition.Name, "MenuText");

            if (menuText != null)
            {
                part.MenuText = menuText;
            }

            var position = context.Attribute(part.PartDefinition.Name, "MenuPosition");

            if (position != null)
            {
                part.MenuPosition = position;
            }

            var menuIdentity = context.Attribute(part.PartDefinition.Name, "Menu");

            if (menuIdentity != null)
            {
                var menu = context.GetItemFromSession(menuIdentity);
                if (menu != null)
                {
                    part.Menu = menu;
                }
            }
        }
예제 #2
0
        protected override void Importing(LocalizationPart part, ContentManagement.Handlers.ImportContentContext context)
        {
            var masterContentItem = context.Attribute(part.PartDefinition.Name, "MasterContentItem");

            if (masterContentItem != null)
            {
                var contentItem = context.GetItemFromSession(masterContentItem);
                if (contentItem != null)
                {
                    part.MasterContentItem = contentItem;
                }
            }

            var culture = context.Attribute(part.PartDefinition.Name, "Culture");

            if (culture != null)
            {
                var targetCulture = _cultureManager.GetCultureByName(culture);
                // Add Culture.
                if (targetCulture == null && _cultureManager.IsValidCulture(culture))
                {
                    _cultureManager.AddCulture(culture);
                    targetCulture = _cultureManager.GetCultureByName(culture);
                }
                part.Culture = targetCulture;
            }
        }
예제 #3
0
        protected override void Importing(LocalizationPart part, ContentManagement.Handlers.ImportContentContext context)
        {
            // Don't do anything if the tag is not specified.
            if (context.Data.Element(part.PartDefinition.Name) == null)
            {
                return;
            }

            context.ImportAttribute(part.PartDefinition.Name, "MasterContentItem", masterContentItem => {
                var contentItem = context.GetItemFromSession(masterContentItem);
                if (contentItem != null)
                {
                    part.MasterContentItem = contentItem;
                }
            });

            context.ImportAttribute(part.PartDefinition.Name, "Culture", culture => {
                var targetCulture = _cultureManager.GetCultureByName(culture);
                // Add Culture.
                if (targetCulture == null && _cultureManager.IsValidCulture(culture))
                {
                    _cultureManager.AddCulture(culture);
                    targetCulture = _cultureManager.GetCultureByName(culture);
                }
                part.Culture = targetCulture;
            });
        }
예제 #4
0
        protected override void Importing(MenuPart part, ContentManagement.Handlers.ImportContentContext context)
        {
            // Don't do anything if the tag is not specified.
            if (context.Data.Element(part.PartDefinition.Name) == null)
            {
                return;
            }

            context.ImportAttribute(part.PartDefinition.Name, "MenuText", menuText =>
                                    part.MenuText = menuText
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "MenuPosition", position =>
                                    part.MenuPosition = position
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "Menu", menuIdentity => {
                var menu = context.GetItemFromSession(menuIdentity);
                if (menu != null)
                {
                    part.Menu = menu;
                }
            });
        }
        protected override void Importing(CommentPart part, ContentManagement.Handlers.ImportContentContext context)
        {
            var author = context.Attribute(part.PartDefinition.Name, "Author");

            if (author != null)
            {
                part.Record.Author = author;
            }

            var siteName = context.Attribute(part.PartDefinition.Name, "SiteName");

            if (siteName != null)
            {
                part.Record.SiteName = siteName;
            }

            var userName = context.Attribute(part.PartDefinition.Name, "UserName");

            if (userName != null)
            {
                part.Record.UserName = userName;
            }

            var email = context.Attribute(part.PartDefinition.Name, "Email");

            if (email != null)
            {
                part.Record.Email = email;
            }

            var position = context.Attribute(part.PartDefinition.Name, "Position");

            if (position != null)
            {
                part.Record.Position = decimal.Parse(position, CultureInfo.InvariantCulture);
            }

            var status = context.Attribute(part.PartDefinition.Name, "Status");

            if (status != null)
            {
                part.Record.Status = (CommentStatus)Enum.Parse(typeof(CommentStatus), status);
            }

            var commentDate = context.Attribute(part.PartDefinition.Name, "CommentDateUtc");

            if (commentDate != null)
            {
                part.Record.CommentDateUtc = XmlConvert.ToDateTime(commentDate, XmlDateTimeSerializationMode.Utc);
            }

            var text = context.Attribute(part.PartDefinition.Name, "CommentText");

            if (text != null)
            {
                part.Record.CommentText = text;
            }

            var commentedOn = context.Attribute(part.PartDefinition.Name, "CommentedOn");

            if (commentedOn != null)
            {
                var contentItem = context.GetItemFromSession(commentedOn);
                if (contentItem != null)
                {
                    part.Record.CommentedOn = contentItem.Id;
                }

                contentItem.As <CommentsPart>().Record.CommentPartRecords.Add(part.Record);
            }

            var repliedOn = context.Attribute(part.PartDefinition.Name, "RepliedOn");

            if (repliedOn != null)
            {
                var contentItem = context.GetItemFromSession(repliedOn);
                if (contentItem != null)
                {
                    part.Record.RepliedOn = contentItem.Id;
                }

                contentItem.As <CommentsPart>().Record.CommentPartRecords.Add(part.Record);
            }

            var commentedOnContainer = context.Attribute(part.PartDefinition.Name, "CommentedOnContainer");

            if (commentedOnContainer != null)
            {
                var container = context.GetItemFromSession(commentedOnContainer);
                if (container != null)
                {
                    part.Record.CommentedOnContainer = container.Id;
                }
            }
        }
예제 #6
0
        protected override void Importing(CommentPart part, ContentManagement.Handlers.ImportContentContext context)
        {
            // Don't do anything if the tag is not specified.
            if (context.Data.Element(part.PartDefinition.Name) == null)
            {
                return;
            }

            context.ImportAttribute(part.PartDefinition.Name, "Author", author =>
                                    part.Record.Author = author
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "SiteName", siteName =>
                                    part.Record.SiteName = siteName
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "UserName", userName =>
                                    part.Record.UserName = userName
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "Email", email =>
                                    part.Record.Email = email
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "Position", position =>
                                    part.Record.Position = decimal.Parse(position, CultureInfo.InvariantCulture)
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "Status", status =>
                                    part.Record.Status = (CommentStatus)Enum.Parse(typeof(CommentStatus), status)
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "CommentDateUtc", commentDate =>
                                    part.Record.CommentDateUtc = XmlConvert.ToDateTime(commentDate, XmlDateTimeSerializationMode.Utc)
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "CommentText", text =>
                                    part.Record.CommentText = text
                                    );

            context.ImportAttribute(part.PartDefinition.Name, "CommentedOn", commentedOn => {
                var contentItem = context.GetItemFromSession(commentedOn);
                if (contentItem != null)
                {
                    part.Record.CommentedOn = contentItem.Id;
                }

                contentItem.As <CommentsPart>().Record.CommentPartRecords.Add(part.Record);
            });

            context.ImportAttribute(part.PartDefinition.Name, "RepliedOn", repliedOn => {
                var contentItem = context.GetItemFromSession(repliedOn);
                if (contentItem != null)
                {
                    part.Record.RepliedOn = contentItem.Id;
                }
            });

            context.ImportAttribute(part.PartDefinition.Name, "CommentedOnContainer", commentedOnContainer => {
                var container = context.GetItemFromSession(commentedOnContainer);
                if (container != null)
                {
                    part.Record.CommentedOnContainer = container.Id;
                }
            });
        }