Merge with 6.0.4

This commit is contained in:
Shannon Deminick
2013-04-04 05:46:25 +06:00
7 changed files with 94 additions and 15 deletions

View File

@@ -85,6 +85,34 @@ namespace Umbraco.Tests.Services.Importing {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
///&lt;DocumentType&gt;
/// &lt;Info&gt;
/// &lt;Name&gt;test&lt;/Name&gt;
/// &lt;Alias&gt;test&lt;/Alias&gt;
/// &lt;Icon&gt;folder.gif&lt;/Icon&gt;
/// &lt;Thumbnail&gt;folder.png&lt;/Thumbnail&gt;
/// &lt;Description&gt;
/// &lt;/Description&gt;
/// &lt;AllowAtRoot&gt;False&lt;/AllowAtRoot&gt;
/// &lt;AllowedTemplates&gt;
/// &lt;Template&gt;test&lt;/Template&gt;
/// &lt;/AllowedTemplates&gt;
/// &lt;DefaultTemplate&gt;test&lt;/DefaultTemplate&gt;
/// &lt;/Info&gt;
/// &lt;Structure&gt;
/// &lt;DocumentType&gt;test&lt;/DocumentType&gt;
/// &lt;/Structure&gt;
/// &lt;GenericProperties&gt;
/// &lt;GenericProperty&gt; [rest of string was truncated]&quot;;.
/// </summary>
internal static string SingleDocType {
get {
return ResourceManager.GetString("SingleDocType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;
///&lt;umbPackage&gt;

View File

@@ -130,4 +130,7 @@
<data name="XsltSearch_Package" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>xsltsearch-package.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="SingleDocType" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>singledoctype.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>

View File

@@ -206,5 +206,22 @@ namespace Umbraco.Tests.Services.Importing
Assert.That(templates.Any(), Is.True);
Assert.That(templates.Count(), Is.EqualTo(numberOfTemplates));
}
[Test]
public void PackagingService_Can_Import_Single_DocTypr()
{
// Arrange
string strXml = ImportResources.SingleDocType;
var docTypeElement = XElement.Parse(strXml);
var packagingService = ServiceContext.PackagingService;
// Act
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
// Assert
Assert.That(contentTypes.Any(), Is.True);
Assert.That(contentTypes.Any(x => x.HasIdentity == false), Is.False);
Assert.That(contentTypes.Count(), Is.EqualTo(1));
}
}
}

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<DocumentType>
<Info>
<Name>test</Name>
<Alias>test</Alias>
<Icon>folder.gif</Icon>
<Thumbnail>folder.png</Thumbnail>
<Description>
</Description>
<AllowAtRoot>False</AllowAtRoot>
<AllowedTemplates>
<Template>test</Template>
</AllowedTemplates>
<DefaultTemplate>test</DefaultTemplate>
</Info>
<Structure>
<DocumentType>test</DocumentType>
</Structure>
<GenericProperties>
<GenericProperty>
<Name>test</Name>
<Alias>test</Alias>
<Type>b4471851-82b6-4c75-afa4-39fa9c6a75e9</Type>
<Definition>fbaf13a8-4036-41f2-93a3-974f678c312a</Definition>
<Tab>
</Tab>
<Mandatory>False</Mandatory>
<Validation>
</Validation>
<Description><![CDATA[]]></Description>
</GenericProperty>
</GenericProperties>
<Tabs />
</DocumentType>

View File

@@ -490,6 +490,7 @@
<Content Include="Migrations\SqlScripts\SqlServerTotal-480.sql" />
<Content Include="UmbracoExamine\TestFiles\media.xml" />
<Content Include="Services\Importing\InheritedDocTypes-Package.xml" />
<Content Include="Services\Importing\SingleDocType.xml" />
<Content Include="Services\Importing\StandardMvc-Package.xml">
<SubType>Designer</SubType>
</Content>

View File

@@ -964,19 +964,6 @@ namespace umbraco
HttpContext.Current.Items.Remove(XmlContextContentItemKey);
}
/// <summary>
/// Invalidates the disk content cache file. Effectively just deletes it.
/// </summary>
[Obsolete("This method is obsolete in version 4.1 and above, please use DeleteXmlCache", true)]
private void ClearDiskCacheAsync()
{
// Queue file deletion
// We queue this function, because there can be a write process running at the same time
// and we don't want this method to block web request
ThreadPool.QueueUserWorkItem(
delegate { DeleteXmlCache(); });
}
/// <summary>
/// Load content from either disk or database
/// </summary>

View File

@@ -421,7 +421,12 @@ namespace umbraco.cms.businesslogic.packager
#endregion
#region DocumentTypes
var docTypeElement = rootElement.Descendants("DocumentTypes").FirstOrDefault();
//Check whether the root element is a doc type rather then a complete package
var docTypeElement = rootElement.Name.LocalName.Equals("DocumentType") ||
rootElement.Name.LocalName.Equals("DocumentTypes")
? rootElement
: rootElement.Descendants("DocumentTypes").FirstOrDefault();
if (docTypeElement != null)
{
var contentTypes = packagingService.ImportContentTypes(docTypeElement, currentUser.Id);
@@ -692,7 +697,11 @@ namespace umbraco.cms.businesslogic.packager
#endregion
#region Install DocumentTypes
var docTypeElement = rootElement.Descendants("DocumentTypes").FirstOrDefault();
//Check whether the root element is a doc type rather then a complete package
var docTypeElement = rootElement.Name.LocalName.Equals("DocumentType") ||
rootElement.Name.LocalName.Equals("DocumentTypes")
? rootElement
: rootElement.Descendants("DocumentTypes").FirstOrDefault();
if (docTypeElement != null)
{
var contentTypes = packagingService.ImportContentTypes(docTypeElement, currentUser.Id);