From 59116fc7fa47aebecb4112a6776cedf564359db5 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 30 Jun 2014 17:05:34 +1000 Subject: [PATCH] un-does the tag export/import, instead need to look at the internal of a simple publish (without save) to see if tags get written or not. --- src/Umbraco.Core/Services/PackagingService.cs | 20 ++-- .../PackageInstance/CreatedPackage.cs | 96 +++++++++---------- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 9c4b989dbf..bb3f703c73 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -270,17 +270,17 @@ namespace Umbraco.Core.Services //set value as per normal content.SetValue(propertyTypeAlias, propertyValue); } - else - { - //check if this exists in tagProperties - var hasTags = tagProperties.XPathSelectElement(string.Format("//TagProperty[@docId=\"{0}\" and @propertyAlias=\"{1}\"]", id, propertyType.Alias)); - if (hasTags != null) - { - var tags = JsonConvert.DeserializeObject(hasTags.Value); - content.SetTags(propertyTypeAlias, tags, true, hasTags.Attribute("group").Value); - } + //else + //{ + // //check if this exists in tagProperties + // var hasTags = tagProperties.XPathSelectElement(string.Format("//TagProperty[@docId=\"{0}\" and @propertyAlias=\"{1}\"]", id, propertyType.Alias)); + // if (hasTags != null) + // { + // var tags = JsonConvert.DeserializeObject(hasTags.Value); + // content.SetTags(propertyTypeAlias, tags, true, hasTags.Attribute("group").Value); + // } - } + //} } else diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs index 5bc792799a..29eaaf25ea 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs @@ -147,63 +147,63 @@ namespace umbraco.cms.businesslogic.packager AppendElement(documents); - //Create the TagProperties node - this is used to store a definition for all - // document properties that are tags, this ensures that we can re-import tags properly - XmlNode tagProps = _packageManifest.CreateElement("TagProperties"); + ////Create the TagProperties node - this is used to store a definition for all + //// document properties that are tags, this ensures that we can re-import tags properly + //XmlNode tagProps = _packageManifest.CreateElement("TagProperties"); - //before we try to populate this, we'll do a quick lookup to see if any of the documents - // being exported contain published tags. - var allExportedIds = documents.SelectNodes("//@id").Cast() - .Select(x => x.Value.TryConvertTo()) - .Where(x => x.Success) - .Select(x => x.Result) - .ToArray(); - var allContentTags = new List(); - foreach (var exportedId in allExportedIds) - { - allContentTags.AddRange( - ApplicationContext.Current.Services.TagService.GetTagsForEntity(exportedId)); - } + ////before we try to populate this, we'll do a quick lookup to see if any of the documents + //// being exported contain published tags. + //var allExportedIds = documents.SelectNodes("//@id").Cast() + // .Select(x => x.Value.TryConvertTo()) + // .Where(x => x.Success) + // .Select(x => x.Result) + // .ToArray(); + //var allContentTags = new List(); + //foreach (var exportedId in allExportedIds) + //{ + // allContentTags.AddRange( + // ApplicationContext.Current.Services.TagService.GetTagsForEntity(exportedId)); + //} - //This is pretty round-about but it works. Essentially we need to get the properties that are tagged - // but to do that we need to lookup by a tag (string) - var allTaggedEntities = new List(); - foreach (var group in allContentTags.Select(x => x.Group).Distinct()) - { - allTaggedEntities.AddRange( - ApplicationContext.Current.Services.TagService.GetTaggedContentByTagGroup(group)); - } + ////This is pretty round-about but it works. Essentially we need to get the properties that are tagged + //// but to do that we need to lookup by a tag (string) + //var allTaggedEntities = new List(); + //foreach (var group in allContentTags.Select(x => x.Group).Distinct()) + //{ + // allTaggedEntities.AddRange( + // ApplicationContext.Current.Services.TagService.GetTaggedContentByTagGroup(group)); + //} - //Now, we have all property Ids/Aliases and their referenced document Ids and tags - var allExportedTaggedEntities = allTaggedEntities.Where(x => allExportedIds.Contains(x.EntityId)) - .DistinctBy(x => x.EntityId) - .OrderBy(x => x.EntityId); + ////Now, we have all property Ids/Aliases and their referenced document Ids and tags + //var allExportedTaggedEntities = allTaggedEntities.Where(x => allExportedIds.Contains(x.EntityId)) + // .DistinctBy(x => x.EntityId) + // .OrderBy(x => x.EntityId); - foreach (var taggedEntity in allExportedTaggedEntities) - { - foreach (var taggedProperty in taggedEntity.TaggedProperties.Where(x => x.Tags.Any())) - { - XmlNode tagProp = _packageManifest.CreateElement("TagProperty"); - var docId = _packageManifest.CreateAttribute("docId", ""); - docId.Value = taggedEntity.EntityId.ToString(CultureInfo.InvariantCulture); - tagProp.Attributes.Append(docId); + //foreach (var taggedEntity in allExportedTaggedEntities) + //{ + // foreach (var taggedProperty in taggedEntity.TaggedProperties.Where(x => x.Tags.Any())) + // { + // XmlNode tagProp = _packageManifest.CreateElement("TagProperty"); + // var docId = _packageManifest.CreateAttribute("docId", ""); + // docId.Value = taggedEntity.EntityId.ToString(CultureInfo.InvariantCulture); + // tagProp.Attributes.Append(docId); - var propertyAlias = _packageManifest.CreateAttribute("propertyAlias", ""); - propertyAlias.Value = taggedProperty.PropertyTypeAlias; - tagProp.Attributes.Append(propertyAlias); + // var propertyAlias = _packageManifest.CreateAttribute("propertyAlias", ""); + // propertyAlias.Value = taggedProperty.PropertyTypeAlias; + // tagProp.Attributes.Append(propertyAlias); - var group = _packageManifest.CreateAttribute("group", ""); - group.Value = taggedProperty.Tags.First().Group; - tagProp.Attributes.Append(group); + // var group = _packageManifest.CreateAttribute("group", ""); + // group.Value = taggedProperty.Tags.First().Group; + // tagProp.Attributes.Append(group); - tagProp.AppendChild(_packageManifest.CreateCDataSection( - JsonConvert.SerializeObject(taggedProperty.Tags.Select(x => x.Text).ToArray()))); + // tagProp.AppendChild(_packageManifest.CreateCDataSection( + // JsonConvert.SerializeObject(taggedProperty.Tags.Select(x => x.Text).ToArray()))); - tagProps.AppendChild(tagProp); - } - } + // tagProps.AppendChild(tagProp); + // } + //} - AppendElement(tagProps); + //AppendElement(tagProps); } }