Refactoring package installer to use the new PackagingService.
Refactoring ImportDocumentType dialog to import through the PackagingService. Making a few corrections to the ProppertyGroup and PropertyType classes to support bulk saving.
This commit is contained in:
@@ -381,7 +381,7 @@ namespace Umbraco.Core.Models
|
||||
oldPropertyGroup.PropertyTypes.RemoveItem(propertyTypeAlias);
|
||||
}
|
||||
|
||||
propertyType.PropertyGroupId = default(int);
|
||||
propertyType.PropertyGroupId = new Lazy<int>(() => default(int));
|
||||
propertyType.ResetDirtyProperties();
|
||||
|
||||
var propertyGroup = PropertyGroups.First(x => x.Name == propertyGroupName);
|
||||
|
||||
@@ -140,8 +140,8 @@ namespace Umbraco.Core.Models
|
||||
|
||||
if (CompositionPropertyGroups.Any(x => x.Name == groupName))
|
||||
{
|
||||
var first = CompositionPropertyGroups.First(x => x.Name == groupName && x.ParentId.HasValue == false);
|
||||
propertyGroup.ParentId = first.Id;
|
||||
var firstGroup = CompositionPropertyGroups.First(x => x.Name == groupName && x.ParentId.HasValue == false);
|
||||
propertyGroup.SetLazyParentId(new Lazy<int?>(() => firstGroup.Id));
|
||||
}
|
||||
|
||||
if (PropertyGroups.Any())
|
||||
@@ -166,7 +166,7 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
if (PropertyGroups.Contains(propertyGroupName))
|
||||
{
|
||||
propertyType.PropertyGroupId = PropertyGroups[propertyGroupName].Id;
|
||||
propertyType.PropertyGroupId = new Lazy<int>(() => PropertyGroups[propertyGroupName].Id);
|
||||
PropertyGroups[propertyGroupName].PropertyTypes.Add(propertyType);
|
||||
}
|
||||
else
|
||||
@@ -179,7 +179,8 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
var parentPropertyGroup = CompositionPropertyGroups.First(x => x.Name == propertyGroupName && x.ParentId.HasValue == false);
|
||||
propertyGroup.SortOrder = parentPropertyGroup.SortOrder;
|
||||
propertyGroup.ParentId = parentPropertyGroup.Id;
|
||||
//propertyGroup.ParentId = parentPropertyGroup.Id;
|
||||
propertyGroup.SetLazyParentId(new Lazy<int?>(() => parentPropertyGroup.Id));
|
||||
}
|
||||
|
||||
PropertyGroups.Add(propertyGroup);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Models
|
||||
public class PropertyGroup : Entity, IEquatable<PropertyGroup>
|
||||
{
|
||||
private string _name;
|
||||
private int? _parentId;
|
||||
private Lazy<int?> _parentId;
|
||||
private int _sortOrder;
|
||||
private PropertyTypeCollection _propertyTypes;
|
||||
|
||||
@@ -60,10 +60,15 @@ namespace Umbraco.Core.Models
|
||||
[DataMember]
|
||||
public int? ParentId
|
||||
{
|
||||
get { return _parentId; }
|
||||
get
|
||||
{
|
||||
if (_parentId == null)
|
||||
return default(int?);
|
||||
return _parentId.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_parentId = value;
|
||||
_parentId = new Lazy<int?>(() => value);
|
||||
OnPropertyChanged(ParentIdSelector);
|
||||
}
|
||||
}
|
||||
@@ -96,6 +101,15 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the ParentId from the lazy integer id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent</param>
|
||||
internal void SetLazyParentId(Lazy<int?> id)
|
||||
{
|
||||
_parentId = id;
|
||||
}
|
||||
|
||||
public bool Equals(PropertyGroup other)
|
||||
{
|
||||
//Check whether the compared object is null.
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Umbraco.Core.Models
|
||||
private string _alias;
|
||||
private string _description;
|
||||
private int _dataTypeDefinitionId;
|
||||
private int _propertyGroupId;
|
||||
private Lazy<int> _propertyGroupId;
|
||||
private Guid _dataTypeId;
|
||||
private DataTypeDatabaseType _dataTypeDatabaseType;
|
||||
private bool _mandatory;
|
||||
@@ -61,7 +61,7 @@ namespace Umbraco.Core.Models
|
||||
private static readonly PropertyInfo HelpTextSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.HelpText);
|
||||
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<PropertyType, int>(x => x.SortOrder);
|
||||
private static readonly PropertyInfo ValidationRegExpSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.ValidationRegExp);
|
||||
private static readonly PropertyInfo PropertyGroupIdSelector = ExpressionHelper.GetPropertyInfo<PropertyType, int>(x => x.PropertyGroupId);
|
||||
private static readonly PropertyInfo PropertyGroupIdSelector = ExpressionHelper.GetPropertyInfo<PropertyType, Lazy<int>>(x => x.PropertyGroupId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets of Sets the Name of the PropertyType
|
||||
@@ -153,7 +153,7 @@ namespace Umbraco.Core.Models
|
||||
/// Gets or Sets the PropertyGroup's Id for which this PropertyType belongs
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
internal int PropertyGroupId
|
||||
internal Lazy<int> PropertyGroupId
|
||||
{
|
||||
get { return _propertyGroupId; }
|
||||
set
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
@@ -44,6 +45,7 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
var typeDtos = groupDto.PropertyTypeDtos.Where(x => x.Id > 0);
|
||||
foreach (var typeDto in typeDtos)
|
||||
{
|
||||
var tempGroupDto = groupDto;
|
||||
var propertyType = new PropertyType(typeDto.DataTypeDto.ControlId,
|
||||
typeDto.DataTypeDto.DbType.EnumParse<DataTypeDatabaseType>(true))
|
||||
{
|
||||
@@ -56,7 +58,7 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
Mandatory = typeDto.Mandatory,
|
||||
SortOrder = typeDto.SortOrder,
|
||||
ValidationRegExp = typeDto.ValidationRegExp,
|
||||
PropertyGroupId = groupDto.Id
|
||||
PropertyGroupId = new Lazy<int>(() => tempGroupDto.Id)
|
||||
};
|
||||
|
||||
propertyType.ResetDirtyProperties();
|
||||
|
||||
@@ -108,7 +108,12 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
//Insert collection of allowed content types
|
||||
foreach (var allowedContentType in entity.AllowedContentTypes)
|
||||
{
|
||||
Database.Insert(new ContentTypeAllowedContentTypeDto { Id = entity.Id, AllowedId = allowedContentType.Id.Value, SortOrder = allowedContentType.SortOrder });
|
||||
Database.Insert(new ContentTypeAllowedContentTypeDto
|
||||
{
|
||||
Id = entity.Id,
|
||||
AllowedId = allowedContentType.Id.Value,
|
||||
SortOrder = allowedContentType.SortOrder
|
||||
});
|
||||
}
|
||||
|
||||
var propertyFactory = new PropertyGroupFactory(nodeDto.NodeId);
|
||||
@@ -125,14 +130,18 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
foreach (var propertyType in propertyGroup.PropertyTypes)
|
||||
{
|
||||
if (propertyType.IsPropertyDirty("PropertyGroupId") == false)
|
||||
propertyType.PropertyGroupId = propertyGroup.Id;
|
||||
{
|
||||
var tempGroup = propertyGroup;
|
||||
propertyType.PropertyGroupId = new Lazy<int>(() => tempGroup.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Insert PropertyTypes
|
||||
foreach (var propertyType in entity.PropertyTypes)
|
||||
{
|
||||
var propertyTypeDto = propertyFactory.BuildPropertyTypeDto(propertyType.PropertyGroupId, propertyType);
|
||||
var tabId = propertyType.PropertyGroupId != null ? propertyType.PropertyGroupId.Value : default(int);
|
||||
var propertyTypeDto = propertyFactory.BuildPropertyTypeDto(tabId, propertyType);
|
||||
int typePrimaryKey = Convert.ToInt32(Database.Insert(propertyTypeDto));
|
||||
propertyType.Id = typePrimaryKey; //Set Id on new PropertyType
|
||||
|
||||
@@ -272,15 +281,18 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
foreach (var propertyType in propertyGroup.PropertyTypes)
|
||||
{
|
||||
if (propertyType.IsPropertyDirty("PropertyGroupId") == false)
|
||||
propertyType.PropertyGroupId = propertyGroup.Id;
|
||||
{
|
||||
var tempGroup = propertyGroup;
|
||||
propertyType.PropertyGroupId = new Lazy<int>(() => tempGroup.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Run through all PropertyTypes to insert or update entries
|
||||
foreach (var propertyType in entity.PropertyTypes)
|
||||
{
|
||||
var propertyTypeDto = propertyGroupFactory.BuildPropertyTypeDto(propertyType.PropertyGroupId,
|
||||
propertyType);
|
||||
var tabId = propertyType.PropertyGroupId != null ? propertyType.PropertyGroupId.Value : default(int);
|
||||
var propertyTypeDto = propertyGroupFactory.BuildPropertyTypeDto(tabId, propertyType);
|
||||
int typePrimaryKey = propertyType.HasIdentity
|
||||
? Database.Update(propertyTypeDto)
|
||||
: Convert.ToInt32(Database.Insert(propertyTypeDto));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
@@ -47,9 +46,10 @@ namespace Umbraco.Core.Services
|
||||
/// Imports and saves package xml as <see cref="IContent"/>
|
||||
/// </summary>
|
||||
/// <param name="element">Xml to import</param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="parentId">Optional parent Id for the content being imported</param>
|
||||
/// <param name="userId">Optional Id of the user performing the import</param>
|
||||
/// <returns>An enumrable list of generated content</returns>
|
||||
public IEnumerable<IContent> ImportContent(XElement element, int userId = 0)
|
||||
public IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = 0)
|
||||
{
|
||||
var name = element.Name.LocalName;
|
||||
if (name.Equals("DocumentSet"))
|
||||
@@ -59,7 +59,7 @@ namespace Umbraco.Core.Services
|
||||
where (string)doc.Attribute("isDoc") == ""
|
||||
select doc;
|
||||
|
||||
var contents = ParseDocumentRootXml(roots);
|
||||
var contents = ParseDocumentRootXml(roots, parentId);
|
||||
_contentService.Save(contents, userId);
|
||||
|
||||
return contents;
|
||||
@@ -70,7 +70,7 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
//This is a single doc import
|
||||
var elements = new List<XElement> { element };
|
||||
var contents = ParseDocumentRootXml(elements);
|
||||
var contents = ParseDocumentRootXml(elements, parentId);
|
||||
_contentService.Save(contents, userId);
|
||||
|
||||
return contents;
|
||||
@@ -81,7 +81,7 @@ namespace Umbraco.Core.Services
|
||||
"'DocumentSet' (for structured imports) nor is the first element a Document (for single document import).");
|
||||
}
|
||||
|
||||
private IEnumerable<IContent> ParseDocumentRootXml(IEnumerable<XElement> roots)
|
||||
private IEnumerable<IContent> ParseDocumentRootXml(IEnumerable<XElement> roots, int parentId)
|
||||
{
|
||||
var contents = new List<IContent>();
|
||||
foreach (var root in roots)
|
||||
@@ -97,7 +97,7 @@ namespace Umbraco.Core.Services
|
||||
_importedContentTypes.Add(contentTypeAlias, contentType);
|
||||
}
|
||||
|
||||
var content = CreateContentFromXml(root, _importedContentTypes[contentTypeAlias], null, -1, isLegacySchema);
|
||||
var content = CreateContentFromXml(root, _importedContentTypes[contentTypeAlias], null, parentId, isLegacySchema);
|
||||
contents.Add(content);
|
||||
|
||||
var children = from child in root.Elements()
|
||||
@@ -264,6 +264,9 @@ namespace Umbraco.Core.Services
|
||||
Alias = infoElement.Element("Alias").Value
|
||||
};
|
||||
|
||||
if (parent != null)
|
||||
contentType.AddContentType(parent);
|
||||
|
||||
return UpdateContentTypeFromXml(documentType, contentType);
|
||||
}
|
||||
|
||||
@@ -311,17 +314,20 @@ namespace Umbraco.Core.Services
|
||||
contentType.AllowedTemplates = allowedTemplates;
|
||||
}
|
||||
|
||||
var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value);
|
||||
if (defaultTemplate != null)
|
||||
if (string.IsNullOrEmpty(defaultTemplateElement.Value) == false)
|
||||
{
|
||||
contentType.SetDefaultTemplate(defaultTemplate);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Warn<PackagingService>(
|
||||
string.Format(
|
||||
"Packager: Error handling default template. Default template with alias '{0}' could not be found.",
|
||||
defaultTemplateElement.Value));
|
||||
var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value);
|
||||
if (defaultTemplate != null)
|
||||
{
|
||||
contentType.SetDefaultTemplate(defaultTemplate);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Warn<PackagingService>(
|
||||
string.Format(
|
||||
"Packager: Error handling default template. Default template with alias '{0}' could not be found.",
|
||||
defaultTemplateElement.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,7 +567,7 @@ namespace Umbraco.Core.Services
|
||||
fields.Add(field);
|
||||
}
|
||||
//Sort templates by dependencies to a potential master template
|
||||
var sortedElements = TopologicalSorter.RetrieveMappedItems(fields);
|
||||
var sortedElements = TopologicalSorter.GetSortedItems(fields);
|
||||
foreach (var templateElement in sortedElements)
|
||||
{
|
||||
var templateName = templateElement.Element("Name").Value;
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Umbraco.Core
|
||||
#endregion
|
||||
|
||||
#region Internal Staic methods
|
||||
internal static IEnumerable<T> RetrieveMappedItems<T>(List<DependencyField<T>> fields) where T : class
|
||||
internal static IEnumerable<T> GetSortedItems<T>(List<DependencyField<T>> fields) where T : class
|
||||
{
|
||||
int[] sortOrder = GetTopologicalSortOrder(fields);
|
||||
var list = new List<T>();
|
||||
|
||||
@@ -707,7 +707,6 @@
|
||||
<Name>umbraco.interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
Assert.That(updated.PropertyGroups.Count(), Is.EqualTo(2));
|
||||
Assert.That(updated.PropertyTypes.Count(), Is.EqualTo(5));
|
||||
Assert.That(updated.PropertyTypes.Any(x => x.Alias == "urlAlias"), Is.True);
|
||||
Assert.AreEqual(updated.PropertyTypes.First(x => x.Alias == "urlAlias").PropertyGroupId, default(int));
|
||||
Assert.AreEqual(updated.PropertyTypes.First(x => x.Alias == "urlAlias").PropertyGroupId.Value, default(int));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -60,6 +60,31 @@ namespace Umbraco.Tests.Services.Importing {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
///<umbPackage>
|
||||
/// <files />
|
||||
/// <info>
|
||||
/// <package>
|
||||
/// <name>DocTypeError</name>
|
||||
/// <version>1</version>
|
||||
/// <license url="http://www.opensource.org/licenses/mit-license.php">Personal license</license>
|
||||
/// <url>http://www.iseli-webconsulting.de</url>
|
||||
/// <requirements>
|
||||
/// <major>3</major>
|
||||
/// <minor>0</minor>
|
||||
/// <patch>0</patch>
|
||||
/// </requirements>
|
||||
/// </package>
|
||||
/// <author>
|
||||
/// <name>Iseli Webconsulting</name> [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string InheritedDocTypes_Package {
|
||||
get {
|
||||
return ResourceManager.GetString("InheritedDocTypes_Package", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
///<umbPackage>
|
||||
@@ -81,9 +106,34 @@ namespace Umbraco.Tests.Services.Importing {
|
||||
/// </file>
|
||||
/// [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string package {
|
||||
internal static string StandardMvc_Package {
|
||||
get {
|
||||
return ResourceManager.GetString("package", resourceCulture);
|
||||
return ResourceManager.GetString("StandardMvc_Package", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
///<umbPackage>
|
||||
/// <files>
|
||||
/// <file>
|
||||
/// <guid>uBlogsy.BusinessLogic.dll</guid>
|
||||
/// <orgPath>/bin</orgPath>
|
||||
/// <orgName>uBlogsy.BusinessLogic.dll</orgName>
|
||||
/// </file>
|
||||
/// <file>
|
||||
/// <guid>uBlogsy.BusinessLogic.pdb</guid>
|
||||
/// <orgPath>/bin</orgPath>
|
||||
/// <orgName>uBlogsy.BusinessLogic.pdb</orgName>
|
||||
/// </file>
|
||||
/// <file>
|
||||
/// <guid>uBlogsy.Common.dll</guid>
|
||||
/// <orgPath>/bin</orgPath>
|
||||
/// <orgName>uBlogsy.Common.dll</orgNam [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string uBlogsy_Package {
|
||||
get {
|
||||
return ResourceManager.GetString("uBlogsy_Package", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,13 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="package" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>package.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
<data name="InheritedDocTypes_Package" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>inheriteddoctypes-package.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="StandardMvc_Package" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>standardmvc-package.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="uBlogsy_Package" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>ublogsy-package.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,445 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<umbPackage>
|
||||
<files />
|
||||
<info>
|
||||
<package>
|
||||
<name>DocTypeError</name>
|
||||
<version>1</version>
|
||||
<license url="http://www.opensource.org/licenses/mit-license.php">Personal license</license>
|
||||
<url>http://www.iseli-webconsulting.de</url>
|
||||
<requirements>
|
||||
<major>3</major>
|
||||
<minor>0</minor>
|
||||
<patch>0</patch>
|
||||
</requirements>
|
||||
</package>
|
||||
<author>
|
||||
<name>Iseli Webconsulting</name>
|
||||
<website>http://www.iseli-webconsulting.de</website>
|
||||
</author>
|
||||
<readme><![CDATA[Test package to reproduce the error for document type properties assigned to a tab inherited from a master document type.]]></readme>
|
||||
</info>
|
||||
<DocumentTypes>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>MR Basisseite</Name>
|
||||
<Alias>MRBasePage</Alias>
|
||||
<Icon>folder.gif</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description>Basistyp für alle Seiten der MR-Racing Website.</Description>
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<AllowedTemplates />
|
||||
<DefaultTemplate>
|
||||
</DefaultTemplate>
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Beschreibung</Name>
|
||||
<Alias>description</Alias>
|
||||
<Type>60b7dabf-99cd-41eb-b8e9-4d2e669bbde9</Type>
|
||||
<Definition>1251c96c-185c-4e9b-93f4-b48205573cbd</Definition>
|
||||
<Tab>Metadaten</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Eine kurze Beschreibung der aktuellen Seite für eine bessere Indexierung durch Suchmaschinen (max. 255 Zeichen).]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Keywords</Name>
|
||||
<Alias>keywords</Alias>
|
||||
<Type>60b7dabf-99cd-41eb-b8e9-4d2e669bbde9</Type>
|
||||
<Definition>1251c96c-185c-4e9b-93f4-b48205573cbd</Definition>
|
||||
<Tab>Metadaten</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Komma-separtierte Auflistung von Stichwörter für die Indexierung von Suchmaschinen. Beispiel: MR Racing, Tuning, Chiptuning, Autozubehör.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>In der Navigation ausblenden</Name>
|
||||
<Alias>hideInNavigation</Alias>
|
||||
<Type>38b352c1-e9f8-4fd8-9324-9a2eab06d97a</Type>
|
||||
<Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
|
||||
<Tab>
|
||||
</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Selektieren damit dieser Eintrag nicht in der Navigation erscheint.]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>6</Id>
|
||||
<Caption>Metadaten</Caption>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>MR Startseite</Name>
|
||||
<Alias>MRStartPage</Alias>
|
||||
<Icon>folder.gif</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description>Die Startseite des Internetauftritts von MR Racing.</Description>
|
||||
<AllowAtRoot>True</AllowAtRoot>
|
||||
<Master>MRBasePage</Master>
|
||||
<AllowedTemplates>
|
||||
<Template>MRStartPage</Template>
|
||||
</AllowedTemplates>
|
||||
<DefaultTemplate>MRStartPage</DefaultTemplate>
|
||||
</Info>
|
||||
<Structure>
|
||||
<DocumentType>MRContentPage</DocumentType>
|
||||
<DocumentType>MRNewsSummary</DocumentType>
|
||||
</Structure>
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Facebook App ID</Name>
|
||||
<Alias>facebookAppID</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Facebook</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Hier bitte die ID Ihrer Facebook App eingeben damit der "Gefällt mir" Link sowie die Kommentar Felder geladen werden können.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Facebook Like URL</Name>
|
||||
<Alias>facebookLikeUrl</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Facebook</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Hier bitte die URL angeben für welche der "Gefällt mir" Link von Facebook gilt.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Facebook Seite URL</Name>
|
||||
<Alias>facebookSiteUrl</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Facebook</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Hier bitte die URL der Facebook Seite von MR Racing angeben für den Link in den Fussnoten.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Titel der Webseite</Name>
|
||||
<Alias>websiteTitle</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Metadaten</Tab>
|
||||
<Mandatory>True</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Angabe des globalen Webseiten-Titels für die Suchmaschinen.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Autor</Name>
|
||||
<Alias>author</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Metadaten</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Angabe des Besitzers / des Autors der Webseiten-Inhalte.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Generator</Name>
|
||||
<Alias>generator</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Metadaten</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Angabe des Verwaltungssystem welches die Inhaltsausgabe erstellt. zB. Umbraco v6.0.2]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Web-Autor</Name>
|
||||
<Alias>webAuthor</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Metadaten</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Angabe des Erstellers / Programmierers der Webseite.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Titel</Name>
|
||||
<Alias>titleBoxRight</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Angebot Rechts</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Der Titel des Angebots.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Newstitel</Name>
|
||||
<Alias>newsTitle</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>News</Tab>
|
||||
<Mandatory>True</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Titel der Box welche die Neuigkeiten auflistet.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Anzanl News</Name>
|
||||
<Alias>numberOfNews</Alias>
|
||||
<Type>1413afcb-d19a-4173-8e9a-68288d2a73b8</Type>
|
||||
<Definition>2e6d3631-066e-44b8-aec4-96f09099b2b5</Definition>
|
||||
<Tab>News</Tab>
|
||||
<Mandatory>True</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Angabe wieviele News-Einträge inder News-Box visualisiert werden sollen. Standard sind 5.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Link</Name>
|
||||
<Alias>linkBoxRight</Alias>
|
||||
<Type>158aa029-24ed-4948-939e-c3da209e5fba</Type>
|
||||
<Definition>a6857c73-d6e9-480c-b6e6-f15f6ad11125</Definition>
|
||||
<Tab>Angebot Rechts</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Optionale Angabe eines Seite welcher als Link hinter die Box gelegt wird so dass ein Besucher per Klick zur passenden Seite weitergeleitet wird.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Bild</Name>
|
||||
<Alias>imageBoxRight</Alias>
|
||||
<Type>ead69342-f06d-4253-83ac-28000225583b</Type>
|
||||
<Definition>93929b9a-93a2-4e2a-b239-d99334440a59</Definition>
|
||||
<Tab>Angebot Rechts</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Optionales Bild für das Angebot.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Bildbreite</Name>
|
||||
<Alias>imageWidthBoxRight</Alias>
|
||||
<Type>1413afcb-d19a-4173-8e9a-68288d2a73b8</Type>
|
||||
<Definition>2e6d3631-066e-44b8-aec4-96f09099b2b5</Definition>
|
||||
<Tab>Angebot Rechts</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>^([6-9][0-9]|1[0-9]{2}|2[0-7][0-9]|280)$</Validation>
|
||||
<Description><![CDATA[Optionale Angabe der Bildbreite. Das Bild muss mindestens 60 breit sein. Das Maxium ist 280. Standard ist 120.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Inhalt</Name>
|
||||
<Alias>contentBoxRight</Alias>
|
||||
<Type>60b7dabf-99cd-41eb-b8e9-4d2e669bbde9</Type>
|
||||
<Definition>1251c96c-185c-4e9b-93f4-b48205573cbd</Definition>
|
||||
<Tab>Angebot Rechts</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Der Textinhalt des Angebots.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Titel</Name>
|
||||
<Alias>titleBoxMiddle</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Angebot Mitte</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Der Titel des Angebots.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Link</Name>
|
||||
<Alias>linkBoxMiddle</Alias>
|
||||
<Type>158aa029-24ed-4948-939e-c3da209e5fba</Type>
|
||||
<Definition>a6857c73-d6e9-480c-b6e6-f15f6ad11125</Definition>
|
||||
<Tab>Angebot Mitte</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Optionale Angabe eines Seite welcher als Link hinter die Box gelegt wird so dass ein Besucher per Klick zur passenden Seite weitergeleitet wird.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Bild</Name>
|
||||
<Alias>imageBoxMiddle</Alias>
|
||||
<Type>ead69342-f06d-4253-83ac-28000225583b</Type>
|
||||
<Definition>93929b9a-93a2-4e2a-b239-d99334440a59</Definition>
|
||||
<Tab>Angebot Mitte</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Optionales Bild für das Angebot.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Bildbreite</Name>
|
||||
<Alias>imageWidthBoxMiddle</Alias>
|
||||
<Type>1413afcb-d19a-4173-8e9a-68288d2a73b8</Type>
|
||||
<Definition>2e6d3631-066e-44b8-aec4-96f09099b2b5</Definition>
|
||||
<Tab>Angebot Mitte</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>^([6-9][0-9]|1[0-9]{2}|2[0-7][0-9]|280)$</Validation>
|
||||
<Description><![CDATA[Optionale Angabe der Bildbreite. Das Bild muss mindestens 60 breit sein. Das Maxium ist 280. Standard ist 120.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Inhalt</Name>
|
||||
<Alias>contentBoxMiddle</Alias>
|
||||
<Type>60b7dabf-99cd-41eb-b8e9-4d2e669bbde9</Type>
|
||||
<Definition>1251c96c-185c-4e9b-93f4-b48205573cbd</Definition>
|
||||
<Tab>Angebot Mitte</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Der Textinhalt des Angebots.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Titel</Name>
|
||||
<Alias>titleBoxLeft</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Angebot Links</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Der Titel des Angebots.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Link</Name>
|
||||
<Alias>linkBoxLeft</Alias>
|
||||
<Type>158aa029-24ed-4948-939e-c3da209e5fba</Type>
|
||||
<Definition>a6857c73-d6e9-480c-b6e6-f15f6ad11125</Definition>
|
||||
<Tab>Angebot Links</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Optionale Angabe eines Seite welcher als Link hinter die Box gelegt wird so dass ein Besucher per Klick zur passenden Seite weitergeleitet wird.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Bild</Name>
|
||||
<Alias>imageBoxLeft</Alias>
|
||||
<Type>ead69342-f06d-4253-83ac-28000225583b</Type>
|
||||
<Definition>93929b9a-93a2-4e2a-b239-d99334440a59</Definition>
|
||||
<Tab>Angebot Links</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Optionales Bild für das Angebot.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Bildbreite</Name>
|
||||
<Alias>imageWidthBoxLeft</Alias>
|
||||
<Type>1413afcb-d19a-4173-8e9a-68288d2a73b8</Type>
|
||||
<Definition>2e6d3631-066e-44b8-aec4-96f09099b2b5</Definition>
|
||||
<Tab>Angebot Links</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>^([6-9][0-9]|1[0-9]{2}|2[0-7][0-9]|280)$</Validation>
|
||||
<Description><![CDATA[Optionale Angabe der Bildbreite. Das Bild muss mindestens 60 breit sein. Das Maxium ist 280. Standard ist 120.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Inhalt</Name>
|
||||
<Alias>contentBoxLeft</Alias>
|
||||
<Type>60b7dabf-99cd-41eb-b8e9-4d2e669bbde9</Type>
|
||||
<Definition>1251c96c-185c-4e9b-93f4-b48205573cbd</Definition>
|
||||
<Tab>Angebot Links</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Der Textinhalt des Angebots.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Inhaltstitel</Name>
|
||||
<Alias>contentTitle</Alias>
|
||||
<Type>ec15c1e5-9d90-422a-aa52-4f7622c63bea</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Inhalt</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Der Titel des Inhaltsbereichs.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Inhaltstitel verbergen</Name>
|
||||
<Alias>hideContentTitle</Alias>
|
||||
<Type>38b352c1-e9f8-4fd8-9324-9a2eab06d97a</Type>
|
||||
<Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
|
||||
<Tab>Inhalt</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Selektieren um den Titelbalken für den Inhaltsbereich zu verbergen.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Inhaltspadding weglassen</Name>
|
||||
<Alias>hideContentPadding</Alias>
|
||||
<Type>38b352c1-e9f8-4fd8-9324-9a2eab06d97a</Type>
|
||||
<Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
|
||||
<Tab>Inhalt</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[Selektieren um das Padding zwischen Inhalt und Rahmen im Inhaltsbereich auszuschalten.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Inhalt</Name>
|
||||
<Alias>content</Alias>
|
||||
<Type>5e9b75ae-face-41c8-b47e-5f4b0fd82f83</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>Inhalt</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation>
|
||||
</Validation>
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>9</Id>
|
||||
<Caption>Inhalt</Caption>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>10</Id>
|
||||
<Caption>Angebot Links</Caption>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>11</Id>
|
||||
<Caption>Angebot Mitte</Caption>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>12</Id>
|
||||
<Caption>Angebot Rechts</Caption>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>13</Id>
|
||||
<Caption>News</Caption>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>14</Id>
|
||||
<Caption>Facebook</Caption>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>15</Id>
|
||||
<Caption>Metadaten</Caption>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
</DocumentTypes>
|
||||
<Templates />
|
||||
<Stylesheets />
|
||||
<Macros />
|
||||
<DictionaryItems />
|
||||
<Languages />
|
||||
<DataTypes />
|
||||
<Actions>
|
||||
<Action runat="install" undo="true" alias="AddServiceHostingEnvironment" multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
|
||||
</Actions>
|
||||
</umbPackage>
|
||||
@@ -19,11 +19,99 @@ namespace Umbraco.Tests.Services.Importing
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_uBlogsy_ContentTypes_And_Verify_Structure()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.uBlogsy_Package;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||
var templateElement = xml.Descendants("Templates").First();
|
||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||
var packagingService = ServiceContext.PackagingService;
|
||||
|
||||
// Act
|
||||
var dataTypes = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
||||
var templates = packagingService.ImportTemplates(templateElement);
|
||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
||||
|
||||
var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count();
|
||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||
|
||||
// Assert
|
||||
Assert.That(dataTypes.Any(), Is.True);
|
||||
Assert.That(templates.Any(), Is.True);
|
||||
Assert.That(templates.Count(), Is.EqualTo(numberOfTemplates));
|
||||
Assert.That(contentTypes.Any(), Is.True);
|
||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||
|
||||
var uBlogsyBaseDocType = contentTypes.First(x => x.Alias == "uBlogsyBaseDocType");
|
||||
Assert.That(uBlogsyBaseDocType.PropertyTypes.Count(), Is.EqualTo(5));
|
||||
Assert.That(uBlogsyBaseDocType.PropertyGroups.Any(), Is.False);
|
||||
|
||||
var uBlogsyBasePage = contentTypes.First(x => x.Alias == "uBlogsyBasePage");
|
||||
Assert.That(uBlogsyBasePage.ContentTypeCompositionExists("uBlogsyBaseDocType"), Is.True);
|
||||
Assert.That(uBlogsyBasePage.PropertyTypes.Count(), Is.EqualTo(7));
|
||||
Assert.That(uBlogsyBasePage.PropertyGroups.Count(), Is.EqualTo(3));
|
||||
Assert.That(uBlogsyBasePage.PropertyGroups["Content"].PropertyTypes.Count(), Is.EqualTo(3));
|
||||
Assert.That(uBlogsyBasePage.PropertyGroups["SEO"].PropertyTypes.Count(), Is.EqualTo(3));
|
||||
Assert.That(uBlogsyBasePage.PropertyGroups["Navigation"].PropertyTypes.Count(), Is.EqualTo(1));
|
||||
Assert.That(uBlogsyBasePage.CompositionPropertyTypes.Count(), Is.EqualTo(12));
|
||||
|
||||
var uBlogsyLanding = contentTypes.First(x => x.Alias == "uBlogsyLanding");
|
||||
Assert.That(uBlogsyLanding.ContentTypeCompositionExists("uBlogsyBasePage"), Is.True);
|
||||
Assert.That(uBlogsyLanding.ContentTypeCompositionExists("uBlogsyBaseDocType"), Is.True);
|
||||
Assert.That(uBlogsyLanding.PropertyTypes.Count(), Is.EqualTo(5));
|
||||
Assert.That(uBlogsyLanding.PropertyGroups.Count(), Is.EqualTo(2));
|
||||
Assert.That(uBlogsyLanding.CompositionPropertyTypes.Count(), Is.EqualTo(17));
|
||||
Assert.That(uBlogsyLanding.CompositionPropertyGroups.Count(), Is.EqualTo(5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_Inherited_ContentTypes_And_Verify_PropertyGroups_And_PropertyTypes()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.InheritedDocTypes_Package;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||
var templateElement = xml.Descendants("Templates").First();
|
||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||
var packagingService = ServiceContext.PackagingService;
|
||||
|
||||
// Act
|
||||
var dataTypes = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
||||
var templates = packagingService.ImportTemplates(templateElement);
|
||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
||||
|
||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||
|
||||
// Assert
|
||||
Assert.That(dataTypes.Any(), Is.False);
|
||||
Assert.That(templates.Any(), Is.False);
|
||||
Assert.That(contentTypes.Any(), Is.True);
|
||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||
|
||||
var mRBasePage = contentTypes.First(x => x.Alias == "MRBasePage");
|
||||
Assert.That(mRBasePage.PropertyTypes.Count(), Is.EqualTo(3));
|
||||
Assert.That(mRBasePage.PropertyGroups.Count(), Is.EqualTo(1));
|
||||
Assert.That(mRBasePage.PropertyGroups["Metadaten"].PropertyTypes.Count(), Is.EqualTo(2));
|
||||
|
||||
var mRStartPage = contentTypes.First(x => x.Alias == "MRStartPage");
|
||||
Assert.That(mRStartPage.ContentTypeCompositionExists("MRBasePage"), Is.True);
|
||||
Assert.That(mRStartPage.PropertyTypes.Count(), Is.EqualTo(28));
|
||||
Assert.That(mRStartPage.PropertyGroups.Count(), Is.EqualTo(7));
|
||||
|
||||
var propertyGroups = mRStartPage.CompositionPropertyGroups.Where(x => x.Name == "Metadaten");
|
||||
var propertyTypes = propertyGroups.SelectMany(x => x.PropertyTypes);
|
||||
Assert.That(propertyGroups.Count(), Is.EqualTo(2));
|
||||
Assert.That(propertyTypes.Count(), Is.EqualTo(6));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_Template_Package_Xml()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.package;
|
||||
string strXml = ImportResources.StandardMvc_Package;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var element = xml.Descendants("Templates").First();
|
||||
var packagingService = ServiceContext.PackagingService;
|
||||
@@ -39,34 +127,46 @@ namespace Umbraco.Tests.Services.Importing
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_ContentType_Package_Xml()
|
||||
public void PackagingService_Can_Import_StandardMvc_ContentTypes_Package_Xml()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.package;
|
||||
string strXml = ImportResources.StandardMvc_Package;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var element = xml.Descendants("DocumentTypes").First();
|
||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||
var templateElement = xml.Descendants("Templates").First();
|
||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||
var packagingService = ServiceContext.PackagingService;
|
||||
|
||||
// Act
|
||||
var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
||||
var contentTypes = packagingService.ImportContentTypes(element);
|
||||
var numberOfDocTypes = (from doc in element.Elements("DocumentType") select doc).Count();
|
||||
var templates = packagingService.ImportTemplates(templateElement);
|
||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||
|
||||
// Assert
|
||||
Assert.That(dataTypeDefinitions, Is.Not.Null);
|
||||
Assert.That(dataTypeDefinitions.Any(), Is.True);
|
||||
Assert.That(templates.Any(), Is.True);
|
||||
Assert.That(contentTypes, Is.Not.Null);
|
||||
Assert.That(contentTypes.Any(), Is.True);
|
||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||
Assert.That(contentTypes.Count(x => x.ParentId == -1), Is.EqualTo(1));
|
||||
|
||||
var contentMaster = contentTypes.First(x => x.Alias == "ContentMaster");
|
||||
Assert.That(contentMaster.PropertyTypes.Count(), Is.EqualTo(3));
|
||||
Assert.That(contentMaster.PropertyGroups.Count(), Is.EqualTo(1));
|
||||
Assert.That(contentMaster.PropertyGroups["SEO"].PropertyTypes.Count(), Is.EqualTo(3));
|
||||
Assert.That(contentMaster.ContentTypeCompositionExists("Base"), Is.True);
|
||||
|
||||
var propertyGroupId = contentMaster.PropertyGroups["SEO"].Id;
|
||||
Assert.That(contentMaster.PropertyGroups["SEO"].PropertyTypes.Any(x => x.PropertyGroupId.Value != propertyGroupId), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_Content_Package_Xml()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.package;
|
||||
string strXml = ImportResources.StandardMvc_Package;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||
var docTypesElement = xml.Descendants("DocumentTypes").First();
|
||||
|
||||
2163
src/Umbraco.Tests/Services/Importing/uBlogsy-Package.xml
Normal file
2163
src/Umbraco.Tests/Services/Importing/uBlogsy-Package.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -424,9 +424,11 @@
|
||||
<Content Include="Migrations\SqlScripts\SqlCe-SchemaAndData-4110.sql" />
|
||||
<Content Include="Migrations\SqlScripts\SqlCeTotal-480.sql" />
|
||||
<Content Include="Migrations\SqlScripts\SqlServerTotal-480.sql" />
|
||||
<Content Include="Services\Importing\package.xml">
|
||||
<Content Include="Services\Importing\InheritedDocTypes-Package.xml" />
|
||||
<Content Include="Services\Importing\StandardMvc-Package.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Services\Importing\uBlogsy-Package.xml" />
|
||||
<Content Include="TestHelpers\ExamineHelpers\media.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -2331,7 +2331,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>61637</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:61639/VirtualDir</IISUrl>
|
||||
<IISUrl>http://localhost:61639/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
|
||||
@@ -651,40 +651,26 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
propertyType.DataTypeDefinitionId = dataTypeDefinition.Id;
|
||||
propertyType.DataTypeId = dataTypeDefinition.ControlId;
|
||||
|
||||
if (propertyType.PropertyGroupId != gpw.GenricPropertyControl.Tab)
|
||||
if (propertyType.PropertyGroupId.Value != gpw.GenricPropertyControl.Tab)
|
||||
{
|
||||
if (gpw.GenricPropertyControl.Tab == 0)
|
||||
{
|
||||
propertyType.PropertyGroupId = 0;
|
||||
propertyType.PropertyGroupId = new Lazy<int>(() => 0);
|
||||
}
|
||||
else if (contentTypeItem.PropertyGroups.Any(x => x.Id == gpw.GenricPropertyControl.Tab))
|
||||
{
|
||||
propertyType.PropertyGroupId = gpw.GenricPropertyControl.Tab;
|
||||
propertyType.PropertyGroupId = new Lazy<int>(() => gpw.GenricPropertyControl.Tab);
|
||||
}
|
||||
else if (contentTypeItem.PropertyGroups.Any(x => x.ParentId == gpw.GenricPropertyControl.Tab))
|
||||
{
|
||||
var propertyGroup = contentTypeItem.PropertyGroups.First(x => x.ParentId == gpw.GenricPropertyControl.Tab);
|
||||
propertyType.PropertyGroupId = propertyGroup.Id;
|
||||
propertyType.PropertyGroupId = new Lazy<int>(() => propertyGroup.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
var propertyGroup = contentTypeItem.CompositionPropertyGroups.First(x => x.Id == gpw.GenricPropertyControl.Tab);
|
||||
contentTypeItem.AddPropertyGroup(propertyGroup.Name);
|
||||
contentTypeItem.MovePropertyType(propertyType.Alias, propertyGroup.Name);
|
||||
|
||||
//if (
|
||||
// contentTypeItem.CompositionPropertyGroups.Any(
|
||||
// x => x.ParentId == gpw.GenricPropertyControl.Tab))
|
||||
//{
|
||||
// var propertyGroups = contentTypeItem.CompositionPropertyGroups.Where(x => x.ParentId == gpw.GenricPropertyControl.Tab);
|
||||
// var propertyGroup = propertyGroups.First();
|
||||
// propertyType.PropertyGroupId = propertyGroup.Id;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// var propertyGroup = contentTypeItem.CompositionPropertyGroups.First(x => x.Id == gpw.GenricPropertyControl.Tab);
|
||||
// contentTypeItem.AddPropertyGroup(propertyGroup.Name);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.presentation.umbraco.dialogs
|
||||
@@ -27,22 +20,22 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
CurrentApp = BusinessLogic.DefaultApps.settings.ToString();
|
||||
|
||||
}
|
||||
protected System.Web.UI.WebControls.Literal FeedBackMessage;
|
||||
protected System.Web.UI.WebControls.Literal jsShowWindow;
|
||||
protected System.Web.UI.WebControls.Panel Wizard;
|
||||
protected System.Web.UI.HtmlControls.HtmlTable Table1;
|
||||
protected System.Web.UI.HtmlControls.HtmlInputHidden tempFile;
|
||||
protected System.Web.UI.HtmlControls.HtmlInputFile documentTypeFile;
|
||||
protected System.Web.UI.WebControls.Button submit;
|
||||
protected System.Web.UI.WebControls.Panel Confirm;
|
||||
protected System.Web.UI.WebControls.Literal dtName;
|
||||
protected System.Web.UI.WebControls.Literal dtAlias;
|
||||
protected System.Web.UI.WebControls.Button import;
|
||||
protected System.Web.UI.WebControls.Literal dtNameConfirm;
|
||||
protected System.Web.UI.WebControls.Panel done;
|
||||
protected Literal FeedBackMessage;
|
||||
protected Literal jsShowWindow;
|
||||
protected Panel Wizard;
|
||||
protected HtmlTable Table1;
|
||||
protected HtmlInputHidden tempFile;
|
||||
protected HtmlInputFile documentTypeFile;
|
||||
protected Button submit;
|
||||
protected Panel Confirm;
|
||||
protected Literal dtName;
|
||||
protected Literal dtAlias;
|
||||
protected Button import;
|
||||
protected Literal dtNameConfirm;
|
||||
protected Panel done;
|
||||
private string tempFileName = "";
|
||||
|
||||
private void Page_Load(object sender, System.EventArgs e)
|
||||
private void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
@@ -74,14 +67,20 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void import_Click(object sender, System.EventArgs e)
|
||||
private void import_Click(object sender, EventArgs e)
|
||||
{
|
||||
XmlDocument xd = new XmlDocument();
|
||||
/*XmlDocument xd = new XmlDocument();
|
||||
xd.Load(tempFile.Value);
|
||||
cms.businesslogic.packager.Installer.ImportDocumentType(xd.DocumentElement, base.getUser(), true);
|
||||
dtNameConfirm.Text = xd.DocumentElement.SelectSingleNode("/DocumentType/Info/Name").FirstChild.Value;
|
||||
dtNameConfirm.Text = xd.DocumentElement.SelectSingleNode("/DocumentType/Info/Name").FirstChild.Value;*/
|
||||
|
||||
Wizard.Visible = false;
|
||||
var element = XElement.Parse(tempFile.Value);
|
||||
var importContentTypes = ApplicationContext.Current.Services.PackagingService.ImportContentTypes(element);
|
||||
var contentType = importContentTypes.FirstOrDefault();
|
||||
if (contentType != null)
|
||||
dtNameConfirm.Text = contentType.Name;
|
||||
|
||||
Wizard.Visible = false;
|
||||
Confirm.Visible = false;
|
||||
done.Visible = true;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager {
|
||||
public class InstalledPackage {
|
||||
public class InstalledPackage
|
||||
{
|
||||
|
||||
private int _saveHitCount = 0;
|
||||
|
||||
public static InstalledPackage GetById(int id) {
|
||||
InstalledPackage pack = new InstalledPackage();
|
||||
@@ -27,7 +28,12 @@ namespace umbraco.cms.businesslogic.packager {
|
||||
return pack;
|
||||
}
|
||||
|
||||
public void Save() {
|
||||
public void Save()
|
||||
{
|
||||
#if DEBUG
|
||||
_saveHitCount++;
|
||||
LogHelper.Info<InstalledPackage>("The InstalledPackage class save method has been hit " + _saveHitCount + " times.");
|
||||
#endif
|
||||
this.FireBeforeSave(EventArgs.Empty);
|
||||
data.Save(this.Data, IOHelper.MapPath(Settings.InstalledPackagesSettings));
|
||||
this.FireAfterSave(EventArgs.Empty);
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
<Project>{511F6D8D-7717-440A-9A57-A507E9A8B27F}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
</ProjectReference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="TidyNet, Version=1.0.0.0, Culture=neutral">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Tidy.Net.1.0.0\lib\TidyNet.dll</HintPath>
|
||||
|
||||
Reference in New Issue
Block a user