Changed PublishedContentHelper to use 6.0 APIs instead of relying on the WebBootManager hack to set a delegate.

Fixed up a heap of failing unit tests.
This commit is contained in:
Shannon Deminick
2013-02-02 07:06:27 +06:00
parent 545a156942
commit 34975183d2
14 changed files with 766 additions and 55 deletions

View File

@@ -98,6 +98,8 @@ namespace Umbraco.Core
{
CanResolveBeforeFrozen = true
};
//dd custom types here that are internal
ApplicationEventsResolver.Current.AddType<PublishedContentHelper>();
}
/// <summary>

View File

@@ -1,27 +1,86 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Dynamics;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
namespace Umbraco.Core
{
internal class PublishedContentHelper
{
/// <summary>
/// This callback is used only so we can set it dynamically because in the "Core" project currently we don't have
/// access to the business logic layer.
/// TODO: Once 6.0 is released we need to change this to use the new business logic layer that we can access from
/// this proejct. Until then this will return a Guid.Empty but the callback will need to be set in the WebBootManager
/// to work in the website. if people use this in a non-web aspect without the WebBootManager, the the IPropertyEditorValueConverters
/// will not be executed.
/// </summary>
internal static Func<string, string, Guid> GetDataTypeCallback = (docTypeAlias, propertyAlias) => Guid.Empty;
internal static Guid GetDataType(string docTypeAlias, string propertyAlias)
{
return GetDataTypeCallback(docTypeAlias, propertyAlias);
/// <summary>
/// Utility class for dealing with data types and value conversions
/// </summary>
/// <remarks>
/// TODO: The logic for the GetDataType + cache should probably be moved to a service, no ?
///
/// We inherit from ApplicationEventHandler so we can bind to the ContentTypeService events to ensure that our local cache
/// object gets cleared when content types change.
/// </remarks>
internal class PublishedContentHelper : ApplicationEventHandler
{
#region event handlers to ensure that the cache is cleared when content types change
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentTypeService.SavedContentType += ContentTypeServiceSavedContentType;
ContentTypeService.SavedMediaType += ContentTypeServiceSavedMediaType;
ContentTypeService.DeletedContentType += ContentTypeServiceDeletedContentType;
ContentTypeService.DeletedMediaType += ContentTypeServiceDeletedMediaType;
}
static void ContentTypeServiceDeletedMediaType(IContentTypeService sender, Events.DeleteEventArgs<Models.IMediaType> e)
{
PropertyTypeCache.Clear();
}
static void ContentTypeServiceDeletedContentType(IContentTypeService sender, Events.DeleteEventArgs<Models.IContentType> e)
{
PropertyTypeCache.Clear();
}
static void ContentTypeServiceSavedMediaType(IContentTypeService sender, Events.SaveEventArgs<Models.IMediaType> e)
{
PropertyTypeCache.Clear();
}
static void ContentTypeServiceSavedContentType(IContentTypeService sender, Events.SaveEventArgs<Models.IContentType> e)
{
PropertyTypeCache.Clear();
}
#endregion
/// <summary>
/// This callback is used only for unit tests which enables us to return any data we want and not rely on having the data in a database
/// </summary>
internal static Func<string, string, Guid> GetDataTypeCallback = null;
private static readonly ConcurrentDictionary<Tuple<string, string>, Guid> PropertyTypeCache = new ConcurrentDictionary<Tuple<string, string>, Guid>();
/// <summary>
/// Return the GUID Id for the data type assigned to the document type with the property alias
/// </summary>
/// <param name="applicationContext"></param>
/// <param name="docTypeAlias"></param>
/// <param name="propertyAlias"></param>
/// <returns></returns>
internal static Guid GetDataType(ApplicationContext applicationContext, string docTypeAlias, string propertyAlias)
{
if (GetDataTypeCallback != null)
return GetDataTypeCallback(docTypeAlias, propertyAlias);
var key = new Tuple<string, string>(docTypeAlias, propertyAlias);
return PropertyTypeCache.GetOrAdd(key, tuple =>
{
var result = applicationContext.Services.ContentTypeService.GetContentType(docTypeAlias);
if (result == null) return Guid.Empty;
var property = result.PropertyTypes.FirstOrDefault(x => x.Alias.InvariantEquals(propertyAlias));
if (property == null) return Guid.Empty;
return property.DataTypeId;
});
}
/// <summary>

View File

@@ -18,11 +18,16 @@ namespace Umbraco.Tests.ContentStores
{
public override void Initialize()
{
base.Initialize();
//we're going to use the same initialization as the PublishedMediaTests
PublishedMediaTests.DoInitialization(GetUmbracoContext("/test", 1234));
base.Initialize();
}
protected override void OnFreezing()
{
base.OnFreezing();
//we're going to use the same initialization as the PublishedMediaTests
PublishedMediaTests.DoInitialization(GetUmbracoContext("/test", 1234));
}
public override void TearDown()
{
base.TearDown();

View File

@@ -14,30 +14,32 @@ namespace Umbraco.Tests.PublishedContent
{
public override void Initialize()
{
base.Initialize();
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
new[]
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
new[]
{
typeof(DatePickerPropertyEditorValueConverter),
typeof(TinyMcePropertyEditorValueConverter),
typeof(YesNoPropertyEditorValueConverter)
});
//need to specify a custom callback for unit tests
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
{
if (propertyAlias == "content")
{
//return the rte type id
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
}
return Guid.Empty;
};
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
//need to specify a custom callback for unit tests
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
{
if (propertyAlias == "content")
{
//return the rte type id
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
}
return Guid.Empty;
};
base.Initialize();
var rCtx = GetRoutingContext("/test", 1234);
UmbracoContext.Current = rCtx.UmbracoContext;
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
}
public override void TearDown()

View File

@@ -35,9 +35,16 @@ namespace Umbraco.Tests.PublishedContent
public override void Initialize()
{
base.Initialize();
DoInitialization(GetUmbracoContext("/test", 1234));
}
protected override void OnFreezing()
{
base.OnFreezing();
DoInitialization(GetUmbracoContext("/test", 1234));
}
/// <summary>
/// Shared with PublishMediaStoreTests
/// </summary>
@@ -206,7 +213,6 @@ namespace Umbraco.Tests.PublishedContent
}
}
[Ignore]
[Test]
public void Children_Without_Examine()
{
@@ -231,7 +237,6 @@ namespace Umbraco.Tests.PublishedContent
Assert.IsTrue(subChildren.Select(x => x.Id).ContainsAll(new[] { mSubChild1.Id, mSubChild2.Id, mSubChild3.Id }));
}
[Ignore]
[Test]
public void Descendants_Without_Examine()
{
@@ -256,7 +261,6 @@ namespace Umbraco.Tests.PublishedContent
Assert.IsTrue(subDescendants.Select(x => x.Id).ContainsAll(new[] { mSubChild1.Id, mSubChild2.Id, mSubChild3.Id }));
}
[Ignore]
[Test]
public void DescendantsOrSelf_Without_Examine()
{
@@ -283,7 +287,6 @@ namespace Umbraco.Tests.PublishedContent
new[] { mChild1.Id, mSubChild1.Id, mSubChild2.Id, mSubChild3.Id }));
}
[Ignore]
[Test]
public void Parent_Without_Examine()
{
@@ -309,7 +312,7 @@ namespace Umbraco.Tests.PublishedContent
Assert.AreEqual(mChild1.Id, publishedSubChild1.Parent.Id);
}
[Ignore]
[Test]
public void Ancestors_Without_Examine()
{
@@ -329,7 +332,6 @@ namespace Umbraco.Tests.PublishedContent
Assert.IsTrue(publishedSubChild1.Ancestors().Select(x => x.Id).ContainsAll(new[] {mChild1.Id, mRoot.Id}));
}
[Ignore]
[Test]
public void AncestorsOrSelf_Without_Examine()
{

View File

@@ -65,7 +65,6 @@ namespace Umbraco.Tests.TestHelpers
engine.CreateDatabase();
}
Resolution.Freeze();
ApplicationContext.Current = new ApplicationContext(
//assign the db context
new DatabaseContext(new DefaultDatabaseFactory()),
@@ -79,13 +78,22 @@ namespace Umbraco.Tests.TestHelpers
//Create the umbraco database and its base data
DatabaseContext.Database.CreateDatabaseSchema();
}
//called so that inheritors can do stuff before freezing.
OnFreezing();
Resolution.Freeze();
//if (RequiresDbSetup)
// TestHelper.InitializeDatabase();
}
protected virtual void OnFreezing()
{
}
[TearDown]
public virtual void TearDown()
{

View File

@@ -20,8 +20,7 @@ namespace Umbraco.Tests.UmbracoExamine
public TestContentService()
{
// TestFiles.umbraco was created by Shannon but the file is missing in Mercurial?
//_xDoc = XDocument.Parse(TestFiles.umbraco);
_xDoc = null;
_xDoc = XDocument.Parse(TestFiles.umbraco);
}
#region IContentService Members

View File

@@ -72,5 +72,28 @@ namespace Umbraco.Tests.UmbracoExamine {
return ResourceManager.GetString("media", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
///&lt;!DOCTYPE root[
///&lt;!ELEMENT CWS_Contact ANY&gt;
///&lt;!ATTLIST CWS_Contact id ID #REQUIRED&gt;
///&lt;!ELEMENT CWS_EmailAFriend ANY&gt;
///&lt;!ATTLIST CWS_EmailAFriend id ID #REQUIRED&gt;
///&lt;!ELEMENT CWS_EventItem ANY&gt;
///&lt;!ATTLIST CWS_EventItem id ID #REQUIRED&gt;
///&lt;!ELEMENT CWS_Galleries ANY&gt;
///&lt;!ATTLIST CWS_Galleries id ID #REQUIRED&gt;
///&lt;!ELEMENT CWS_Gallery ANY&gt;
///&lt;!ATTLIST CWS_Gallery id ID #REQUIRED&gt;
///&lt;!ELEMENT CWS_Home ANY&gt;
///&lt;!ATTLIST CWS_Home id ID #REQUIRED&gt;
///&lt;!ELEMENT CWS_NewsEventsList ANY&gt;
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string umbraco {
get {
return ResourceManager.GetString("umbraco", resourceCulture);
}
}
}

View File

@@ -121,10 +121,7 @@
<data name="media" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>testfiles\media.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<!-- FIXME following was added by Shannon but the corresponding file is missing in Mercurial? -->
<!--
<data name="umbraco" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>testfiles\umbraco.config;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
-->
</root>

View File

@@ -0,0 +1,616 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE root[
<!ELEMENT CWS_Contact ANY>
<!ATTLIST CWS_Contact id ID #REQUIRED>
<!ELEMENT CWS_EmailAFriend ANY>
<!ATTLIST CWS_EmailAFriend id ID #REQUIRED>
<!ELEMENT CWS_EventItem ANY>
<!ATTLIST CWS_EventItem id ID #REQUIRED>
<!ELEMENT CWS_Galleries ANY>
<!ATTLIST CWS_Galleries id ID #REQUIRED>
<!ELEMENT CWS_Gallery ANY>
<!ATTLIST CWS_Gallery id ID #REQUIRED>
<!ELEMENT CWS_Home ANY>
<!ATTLIST CWS_Home id ID #REQUIRED>
<!ELEMENT CWS_NewsEventsList ANY>
<!ATTLIST CWS_NewsEventsList id ID #REQUIRED>
<!ELEMENT CWS_NewsItem ANY>
<!ATTLIST CWS_NewsItem id ID #REQUIRED>
<!ELEMENT CWS_Photo ANY>
<!ATTLIST CWS_Photo id ID #REQUIRED>
<!ELEMENT CWS_Textpage ANY>
<!ATTLIST CWS_Textpage id ID #REQUIRED>
<!ELEMENT CWS_TextpageTwoCol ANY>
<!ATTLIST CWS_TextpageTwoCol id ID #REQUIRED>
]>
<root id="-1">
<CWS_Home id="1139" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1125" template="1110" sortOrder="2" createDate="2009-02-26T18:39:39" updateDate="2010-05-03T20:34:27" nodeName="Home" urlName="home" writerName="Administrator" creatorName="Administrator" path="-1,1139" isDoc="">
<CWS_Textpage id="1140" parentID="1139" level="2" writerID="0" creatorID="0" nodeType="1129" template="1117" sortOrder="1" createDate="2009-02-26T18:47:46" updateDate="2010-04-22T02:19:21" nodeName="About" urlName="about" writerName="Administrator" creatorName="Administrator" path="-1,1139,1140" isDoc="">
<CWS_Textpage id="1141" parentID="1140" level="3" writerID="0" creatorID="0" nodeType="1129" template="1117" sortOrder="1" createDate="2009-02-26T18:51:52" updateDate="2010-04-22T02:18:30" nodeName="About Umbraco" urlName="about-umbraco" writerName="Administrator" creatorName="Administrator" path="-1,1139,1140,1141" isDoc="">
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[
<p>It's the <strong>KING</strong> of all CMS's, what more do you
need to know about it?</p>
]]></headerText>
<articlePhoto>/media/171/umbraco_tshirt.jpg</articlePhoto>
<bodyText><![CDATA[
<h3>Umbraco CMS is free</h3>
<p>It means that you are not bound and locked to the licensing
rules about the number of content items / processors / web /
domains, etc. Many products are very expensive as the license cost
escalates with the number of websites. In many cases, one is soon
up in the 500' before one can even start to implement the
solution.</p>
<h3>Umbraco is Open Source</h3>
<p>In an Open Source product one has at any time full access to
source code. This provides insight and leads to better quality, as
"shortcuts" and bad code can easily be penetrated. Moreover, one
has the ability to influence and further develop the product.</p>
<p>Umbraco is based on open source and is therefore not
lisence-plated or subject to an enterprise's ownership. The Umbraco
publishing tool places great emphasis on simplicity, standards,
flexibility and integration. Umbraco was launched in 2005 and has
had a tremendous growth since that time. Umbraco is today among the
most popular systems based on open source for Microsoft. NET
platform.</p>
<h3>100% Microsoft .NET</h3>
<p>Umbraco is built 100% on the Microsoft. NET 2.0. This means that
you can use 3rd party .NET components directly in Umbraco.
Moreover, integration with other .NET-based solutions is well
adapted from Umbracos part. Umbraco won an award for the
Integration possibilities on BNP Awards 2006.</p>
<h3>Fast results</h3>
<p>Umbraco is a powerful tool with a focus on core functionality
and openness. This efficiently allows you to achieve exactly what
you want - rather than be restricted to a "finished" module, which
makes only half of what you really wanted.</p>
<h3>Easy-to-use</h3>
<p>Umbraco has a focus on content and facilitate rapid and
intuitive content management. The system strives to be elegant,
usable and effective.</p>
<h3>Based on standards</h3>
<p>Umbraco is based on standards from the W3C as XHTML, CSS, XML
and XSLT. This gives a greater flexibility and independence, which
in turn provides more value for the money.</p>
<h3>Integration</h3>
<p>Umbraco is known to be among the best CMS on integration. Much
of the reason for this is the way to expose Microsoft ASP.NET
components as elements of, or so-called "macro's" for use in
templates, as well as in the WYSIWYG editor that writers and
editors use. Elements is also possible to "cache" on several levels
and is based on standard Microsoft .NET technology. Below are some
examples:</p>
<ul>
<li>External XML sources (ex RSS) can be directly implemented via
XSLT elements (macros).</li>
<li>ASP.NET controls that retrieve data from external or internal
posterior systems via standard Web Services.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></bodyText>
</CWS_Textpage>
<CWS_TextpageTwoCol id="1142" parentID="1140" level="3" writerID="0" creatorID="0" nodeType="1130" template="1118" sortOrder="2" createDate="2009-02-26T18:56:06" updateDate="2010-04-22T02:18:30" nodeName="About this project" urlName="about-this-project" writerName="Administrator" creatorName="Administrator" path="-1,1139,1140,1142" isDoc="">
<articlePhotoColOne>/media/227/warren-buckley.jpg</articlePhotoColOne>
<articlePhotoColTwo>/media/228/sam-grady.jpg</articlePhotoColTwo>
<bodyTextColTwo><![CDATA[
<h3>Sam Grady</h3>
<p>Sam Grady, me, is a graphic designer. I loves graphic design.
Great graphic design and simple solutions makes this man very
happy. Photography is also very close to my heart and I'd like to
be better, so I practice a lot and annoy people with my
requests.<br />
<br />
I haven't got a blog, yet, don't Twitter and cancelled my Facebook
account as I felt uncomfortable with people knowing my business.
Anyone else feel that way? I do, however, have a Flickr account, so
go check it out: <a
href="http://www.flickr.com/photos/mrgrady">www.flickr.com/photos/mrgrady</a><br />
<br />
I also have my own business, G72, which has a website that
desperately needs updating. Also, as of today (03/03/09), it's
currently down due to inept web hosts. Hopefully it won't be if you
want to take a look: <a
href="http://www.g-72.co.uk">www.g-72.co.uk</a><br />
<br />
Regarding this project, Warren asked me if I wanted to design his
website starter package for the fantastic Umbraco CMS, which I
jumped at the chance to do. Hopefully you'll find the design
appropriate and the package very useful, as that's what we really
want from this project.<br />
<br />
Finally, Warren says the layout is work in progress and I have a,
typically fussy, list of designer layout requests that I've asked
Warren to do, but time being what it is, these changes won't be
made on version 2.0, so if you spot anything, do mail the man as
we'll be compiling a list of tweaks to be made.<br />
<br />
Enjoy.</p>
]]></bodyTextColTwo>
<bodyTextColOne><![CDATA[
<h3>Warren Buckley</h3>
<p>Warren Buckley is a web developer who specialises in using the
Umbraco CMS platform to build content managed websites for Xeed in
Norway. I run a blog called <a
href="http://www.creativewebspecialist.co.uk">Creative Web
Specialist</a>, where I mainly write tips and tutorial articles
around Umbraco.</p>
<p>I have teamed up with ex-collegue Sam Grady to help me design
the new version of CWS as he produces wonderfully sexy designs for
the web. If you have seen my previous version/s of CWS you will
know that my design skills are far from stunning.</p>
<p>I decided to create this website starter site nicknamed CWS
(Creative Website Starter site) as a learning tool to help you
understand how all the elements of a site work together in
Umbraco.</p>
<p>From this <strong>NEW</strong> CWS package comes the
following:</p>
<ul>
<li>Obviously a <strong>BRAND NEW</strong> spanking design from
ex-collegue Sam Grady of G-72</li>
<li>A focus for this site to be used to help teach new users to the
Umbraco CMS platform.</li>
<li>.NET usercontrols written in C#</li>
<li>XSLT &amp; .NET code heavily commented to help understand what
is going on.</li>
<li>With supporting documentation coming in the near future.</li>
</ul>
<p>Want to see where else you can find me on the net?<br />
Blog - <a
href="http://www.creativewebspecialist.co.uk">www.creativewebspecialist.co.uk</a><br />
Flickr - <a
href="http://www.flickr.com/photos/warrenbuckley">www.flickr.com/photos/warrenbuckley</a><br />
Last.FM - <a
href="http://www.last.fm/user/warrenbuckley">www.last.fm/user/warrenbuckley</a><br />
Twitter - <a
href="http://twitter.com/warrenbuckley">twitter.com/warrenbuckley</a></p>
]]></bodyTextColOne>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<xmlStorageTest>
<XmlStorage>
<Nodes>
<Node>1</Node>
<Node>2</Node>
<Node>3</Node>
<Node>4</Node>
<Node>5</Node>
</Nodes>
</XmlStorage>
</xmlStorageTest>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[
<p>This website has been produced to help you understand
Umbraco.</p>
]]></headerText>
</CWS_TextpageTwoCol>
<umbracoUrlName />
<umbracoUrlAlias />
<metaDescription><![CDATA[This is the META description for the about page.]]></metaDescription>
<metaKeywords><![CDATA[about, creative web specialist, umbraco, warren buckley, sam grady]]></metaKeywords>
<umbracoRedirect />
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[<p>This is a good place to put a service message or something to help define your site or company.</p>]]></headerText>
<articlePhoto />
<bodyText><![CDATA[<p><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ullamcorper condimentum lorem. Curabitur placerat nunc ut leo. Integer eros ligula, vestibulum at, eleifend id, dignissim vel, est.</strong></p>
<p>Fusce tristique. Cras faucibus porta nunc. Aliquam ultrices, arcu quis ornare sagittis, lectus augue ornare nulla, eu lobortis velit lectus id nibh. Aliquam condimentum aliquet purus. Quisque blandit ante non sapien. Sed justo libero, sollicitudin ac, pretium et, luctus nec, nisl. Nulla semper neque nec magna. Cras ut nibh ut urna bibendum sodales. Quisque venenatis euismod lacus. Pellentesque dapibus turpis at urna.</p>
<h3>Sub Header</h3>
<p>Sed scelerisque adipiscing mauris. Mauris egestas dapibus quam. Integer in libero eget eros dignissim pretium. Proin luctus sem nec lorem. Praesent lorem. Vivamus eget nunc quis sapien condimentum egestas. Maecenas facilisis, nunc at sodales facilisis, quam magna pretium nibh, vel ultrices lectus lorem quis neque. Nam sit amet leo ac lectus gravida convallis. Phasellus at enim vel dui porta porttitor. Morbi id dolor adipiscing erat egestas consequat.</p>
<p><a href="http://www.google.co.uk">Phasellus diam. Morbi dolor.</a> Donec consequat sodales nunc. Nam dapibus lectus id lectus. Sed ultrices metus sit amet est. Morbi porttitor. Proin vel risus. Phasellus sodales convallis justo. <em>Sed luctus hendrerit risus. Sed est lorem, feugiat et, rutrum quis, condimentum non, nunc.</em> Aenean urna leo, sagittis a, commodo eget, lobortis nec, eros. Vivamus pharetra, lectus eu ultrices pulvinar, nunc quam consectetur nibh, sed pulvinar leo dolor ut felis.</p>
<ol>
<li>Item one</li>
<li>Item two</li>
<li>Item three</li>
</ol>
<p>Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus, a elementum ligula dolor vitae sem. Suspendisse at quam. Praesent neque. Vestibulum at justo. Nulla rutrum velit et eros.</p>
<ul>
<li>Integer convallis augue in tellus</li>
<li>Magna quam sollicitudin mauris</li>
</ul>
<p>Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus, a elementum ligula dolor vitae sem. Suspendisse at quam.</p>]]></bodyText>
</CWS_Textpage>
<CWS_Galleries id="1143" parentID="1139" level="2" writerID="0" creatorID="0" nodeType="1123" template="1108" sortOrder="2" createDate="2009-02-27T09:39:54" updateDate="2010-04-22T02:34:59" nodeName="Gallery" urlName="gallery" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143" isDoc="">
<CWS_Gallery id="1144" parentID="1143" level="3" writerID="0" creatorID="0" nodeType="1124" template="1109" sortOrder="1" createDate="2009-03-02T17:58:22" updateDate="2010-04-22T02:18:30" nodeName="The Bookhouse Boys" urlName="the-bookhouse-boys" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1144" isDoc="">
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[I am the description]]></metaDescription>
<metaKeywords><![CDATA[keywords, here]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[
<p>The Bookhouse Boys. Live at the ICA, London.</p>
]]></headerText>
<sortBy><![CDATA[sortOrder]]></sortBy>
<sortOrder><![CDATA[ascending]]></sortOrder>
<galleryThumbnail>/media/1239/bookhouse-boys_gallery.jpg</galleryThumbnail>
<CWS_Photo id="1145" parentID="1144" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="1" createDate="2009-03-03T18:08:55" updateDate="2010-04-22T02:18:30" nodeName="Catherine Turner and Paul Van Oestren" urlName="catherine-turner-and-paul-van-oestren" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1144,1145" isDoc="">
<photoText>Credit: Sam Grady</photoText>
<photo>/media/1277/bookhouse-boys_3.jpg</photo>
<photoThumbnail>/media/1314/bookhouse-boys_3_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
<CWS_Photo id="1146" parentID="1144" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="2" createDate="2009-03-03T18:08:19" updateDate="2010-04-22T02:18:30" nodeName="J.P.Fellows" urlName="jpfellows" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1144,1146" isDoc="">
<photoText>Credit: Sam Grady</photoText>
<photo>/media/1250/bookhouse-boys_1.jpg</photo>
<photoThumbnail>/media/1296/bookhouse-boys_1_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
<CWS_Photo id="1147" parentID="1144" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="3" createDate="2009-03-03T18:08:48" updateDate="2010-04-22T02:18:30" nodeName="Catherine Turner" urlName="catherine-turner" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1144,1147" isDoc="">
<photoText>Credit: Sam Grady</photoText>
<photo>/media/1331/bookhouse-boys_2.jpg</photo>
<photoThumbnail>/media/1350/bookhouse-boys_2_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
</CWS_Gallery>
<CWS_Gallery id="1148" parentID="1143" level="3" writerID="0" creatorID="0" nodeType="1124" template="1109" sortOrder="2" createDate="2009-02-27T09:48:12" updateDate="2010-04-22T02:18:30" nodeName="Codegarden 08" urlName="codegarden-08" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1148" isDoc="">
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[
<p>Where all the great minds of umbraco meet!</p>
]]></headerText>
<sortBy><![CDATA[sortOrder]]></sortBy>
<sortOrder><![CDATA[ascending]]></sortOrder>
<galleryThumbnail>/media/993/codegarden-08_gallery.jpg</galleryThumbnail>
<CWS_Photo id="1149" parentID="1148" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="1" createDate="2009-03-02T15:40:01" updateDate="2010-04-22T02:18:30" nodeName="Darren and David have a chat" urlName="darren-and-david-have-a-chat" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1148,1149" isDoc="">
<photoText>Credit: Douglas Robar</photoText>
<photo>/media/825/darren-ferguson_david-conlisk.jpg</photo>
<photoThumbnail>/media/835/darren-ferguson_david-conlisk_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
<CWS_Photo id="1150" parentID="1148" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="2" createDate="2009-02-27T09:54:07" updateDate="2010-04-22T02:18:31" nodeName="Codegarden 08 T-Shirt" urlName="codegarden-08-t-shirt" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1148,1150" isDoc="">
<photoText>Credit: Warren Buckley</photoText>
<photo>/media/394/codegarden08-t-shirt.jpg</photo>
<photoThumbnail>/media/799/codegarden08-t-shirt_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
<CWS_Photo id="1151" parentID="1148" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="3" createDate="2009-03-02T15:43:43" updateDate="2010-04-22T02:18:31" nodeName="The Umbraco BINGO callers" urlName="the-umbraco-bingo-callers" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1148,1151" isDoc="">
<photoText>Credit: Douglas Robar</photoText>
<photo>/media/852/bingo-callers.jpg</photo>
<photoThumbnail>/media/871/bingo-callers_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
<CWS_Photo id="1152" parentID="1148" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="4" createDate="2009-03-02T15:59:24" updateDate="2010-04-22T02:18:31" nodeName="Christian Palm chatting" urlName="christian-palm-chatting" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1148,1152" isDoc="">
<photoText>Credit: Douglas Robar</photoText>
<photo>/media/879/christian-palm.jpg</photo>
<photoThumbnail>/media/889/christian-palm_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
</CWS_Gallery>
<CWS_Gallery id="1153" parentID="1143" level="3" writerID="0" creatorID="0" nodeType="1124" template="1109" sortOrder="3" createDate="2009-03-02T16:02:14" updateDate="2010-04-22T02:18:31" nodeName="Bath, UK" urlName="bath,-uk" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1153" isDoc="">
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[
<p>Photos from a trip to Bath in November 2008</p>
]]></headerText>
<sortBy><![CDATA[updateDate]]></sortBy>
<sortOrder><![CDATA[ascending]]></sortOrder>
<galleryThumbnail>/media/935/bath_gallery.jpg</galleryThumbnail>
<CWS_Photo id="1154" parentID="1153" level="4" writerID="0" creatorID="0" nodeType="1128" template="1114" sortOrder="1" createDate="2009-03-02T16:27:17" updateDate="2010-04-22T02:18:31" nodeName="Royal Crescent" urlName="royal-crescent" writerName="Administrator" creatorName="Administrator" path="-1,1139,1143,1153,1154" isDoc="">
<photoText>Credit: Warren Buckley</photoText>
<photo>/media/995/royal-crescent.jpg</photo>
<photoThumbnail>/media/1014/royal-crescent_thumb.jpg</photoThumbnail>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_Photo>
</CWS_Gallery>
<umbracoUrlName />
<umbracoUrlAlias />
<metaDescription><![CDATA[dfg]]></metaDescription>
<metaKeywords><![CDATA[dsfg]]></metaKeywords>
<umbracoRedirect />
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[<p>This first page displays all the albums featured within your site.<br /> Please have a browse through.</p>]]></headerText>
<sortBy><![CDATA[sortOrder]]></sortBy>
<sortOrder><![CDATA[ascending]]></sortOrder>
</CWS_Galleries>
<CWS_NewsEventsList id="1155" parentID="1139" level="2" writerID="0" creatorID="0" nodeType="1126" template="1112" sortOrder="3" createDate="2009-02-27T09:57:30" updateDate="2010-04-22T02:18:31" nodeName="News and Events" urlName="news-and-events" writerName="Administrator" creatorName="Administrator" path="-1,1139,1155" isDoc="">
<CWS_EventItem id="1156" parentID="1155" level="3" writerID="0" creatorID="0" nodeType="1122" template="1107" sortOrder="1" createDate="2009-02-27T10:00:53" updateDate="2010-04-22T02:18:31" nodeName="Codegarden 09" urlName="codegarden-09" writerName="Administrator" creatorName="Administrator" path="-1,1139,1155,1156" isDoc="">
<eventDate>2009-06-22T00:00:00</eventDate>
<bodyText><![CDATA[
<h3>Come join the annual umbraco developer conference in Wonderful
Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers,
great conversations and friendly people.</h3>
<p>The who's who of umbraco will be gathered and share their
knowledge through talks, tutorials and via un-conference formats
like open space or hacking sessions. We have booked a cool, old and
huge industrial venue in central Copenhagen where we'll have one
huge room, three rooms for breakout sessions and a Caf&eacute; that
serves your taste of espresso.</p>
<p>Come join the annual umbraco developer conference in Wonderful
Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers,
great conversations and friendly people.</p>
<p>We've planned a program that fits both experienced umbraco users
as well as new comers. The conference is kicked off with a Keynote
and after that we'll have two or three tracks of sessions and the
first day is rounded with an open Q/A session with the umbraco core
team.</p>
<p>The second day features an un-conference format called open
space, which we also used with great success at last year's
conference. It's a format where everybody can suggest a topic and
as we have plenty of break-out rooms rest assured that there'll be
room for your topic as well. Last year's more than 20 topics
covered Silverlight, High performance websites with umbraco,
building custom data types and much more.</p>
<p>But it doesn't ends there. We've ensured that we can stay at the
venue until midnight both days which means that when the first day
ends, the fun begins. With more than hundred people gathered at a
place with loads of umbraco knowledge, wifi, great food and plenty
of space, who knows what could happen. A BBQ, new packages,
improvised demos and talks, or...?</p>
<p>&nbsp;</p>
]]></bodyText>
<articlePhoto>/media/445/umbraco_tshirt.jpg</articlePhoto>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_EventItem>
<CWS_NewsItem id="1157" parentID="1155" level="3" writerID="0" creatorID="0" nodeType="1127" template="1113" sortOrder="2" createDate="2009-03-02T16:32:06" updateDate="2010-04-22T02:18:31" nodeName="CWS2 is released" urlName="cws2-is-released" writerName="Administrator" creatorName="Administrator" path="-1,1139,1155,1157" isDoc="">
<bodyText><![CDATA[
<h3>After Warren Buckley's success of the first Creative Website
Starter site package, with over 20K downloads he has decided to
work on CWS2.</h3>
<p>As of today Wednesday the 4th March 2009, the CWS2 package is
now available to download from the built in package repository
inside Umbraco.</p>
<p>With this new version comes the following:</p>
<ul>
<li>A <strong>BRAND NEW</strong> spanking design from ex-collegue
<a href="http://www.g-72.co.uk"
title="Designer Sam Grady of G72">Sam Grady of G-72</a></li>
<li>A focus for this site to be used to help teach new users to the
Umbraco CMS platform.</li>
<li>.NET usercontrols written in C#</li>
<li>XSLT &amp; .NET code heavily commented to help understand what
is going on.</li>
<li>With supporting documentation coming in the near future.</li>
</ul>
]]></bodyText>
<articlePhoto>
</articlePhoto>
<umbracoUrlName>
</umbracoUrlName>
<umbracoUrlAlias>
</umbracoUrlAlias>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect>
</umbracoRedirect>
<umbracoNaviHide>0</umbracoNaviHide>
</CWS_NewsItem>
<umbracoUrlName />
<umbracoUrlAlias />
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect />
<umbracoNaviHide>0</umbracoNaviHide>
<sortBy><![CDATA[sortOrder]]></sortBy>
<sortOrder><![CDATA[ascending]]></sortOrder>
<headerText><![CDATA[
<p>Please browse through our news archive and event listings
below.</p>
]]></headerText>
</CWS_NewsEventsList>
<CWS_Contact id="1158" parentID="1139" level="2" writerID="0" creatorID="0" nodeType="1120" template="1105" sortOrder="4" createDate="2009-02-27T10:03:12" updateDate="2010-04-22T02:18:31" nodeName="Contact" urlName="contact" writerName="Administrator" creatorName="Administrator" path="-1,1139,1158" isDoc="">
<emailTo>you@yourcompany.co.uk</emailTo>
<emailSubject>Email from Contact form on website</emailSubject>
<emailBody><![CDATA[Hello a user of your site has filled in your contact form on [Date] @ [Time]
Name: [Name]
Address: [AddressLine1], [AddressLine2]
Email: [Email]
Message: [Message]]]></emailBody>
<emailReplyFrom>you@yourcompany.co.uk</emailReplyFrom>
<emailReplySubject>Thank you for your message</emailReplySubject>
<emailReplyBody><![CDATA[Hello [Name]
Thanks for contacting us, we will reply shortly.
Your Company Name
www.yourcompany.co.uk]]></emailReplyBody>
<enableSSL>0</enableSSL>
<umbracoUrlName />
<umbracoUrlAlias />
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect />
<umbracoNaviHide>0</umbracoNaviHide>
<headerText><![CDATA[
<p>Everything you need to<br />
get in touch.</p>
]]></headerText>
<formText><![CDATA[
<h3>Enquiry Form</h3>
<p>If you have a particular enquiry, please fill out the form below
and provide as much information as you can, so that one of our
representatives can deal with your enquiry as effciently as
possible.</p>
]]></formText>
<thankYouHeaderText><![CDATA[
<p><strong>Thank you.</strong> We will be in touch shortly.</p>
]]></thankYouHeaderText>
<thankYouMessageText><![CDATA[
<p>Thanks for filling out our contact form we will get back to you
shortly.</p>
<p>Regards,<br />
My Company</p>
]]></thankYouMessageText>
</CWS_Contact>
<CWS_EmailAFriend id="1159" parentID="1139" level="2" writerID="0" creatorID="0" nodeType="1121" template="1106" sortOrder="5" createDate="2009-02-27T10:05:57" updateDate="2010-04-22T02:18:31" nodeName="Email a Friend" urlName="email-a-friend" writerName="Administrator" creatorName="Administrator" path="-1,1139,1159" isDoc="">
<emailFrom>you@yourcompany.co.uk</emailFrom>
<emailSubjectToFriend>[YourName] has sent you a link to read</emailSubjectToFriend>
<emailMessageToFriend><![CDATA[Hello [FriendName], [YourName] has sent you this link to read.
URL: [URL]
Message: [Message]
--------------------------------------------------------
Your Company Name
www.yourcompany.co.uk]]></emailMessageToFriend>
<enableSSL>0</enableSSL>
<umbracoUrlName />
<umbracoUrlAlias />
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoRedirect />
<umbracoNaviHide>1</umbracoNaviHide>
<headerText><![CDATA[<p>Send a page onto your friend.</p>]]></headerText>
<thankYouHeaderText><![CDATA[<p><strong>Thank you.</strong> We appreciate the love you are giving our site.</p>]]></thankYouHeaderText>
<thankYouMessageText><![CDATA[<p>Thanks for sending that link onto your friend, we really appreciate it here at My Company.</p>]]></thankYouMessageText>
</CWS_EmailAFriend>
<metaDescription><![CDATA[]]></metaDescription>
<metaKeywords><![CDATA[]]></metaKeywords>
<umbracoNaviHide>0</umbracoNaviHide>
<siteName>Your logo/name</siteName>
<headerText><![CDATA[<p><strong>Sam Grady designed this for Warren Buckley.</strong> "This" idea was first created by the incredible Robert Brownjohn and has been copied many times since.</p>]]></headerText>
<homepagePhoto><![CDATA[]]></homepagePhoto>
<bodyText><![CDATA[<p>Thank you for installing the umbraco website package created and developed by Warren Buckley. This should website package be used to help you understand how all the components of an Umbraco site works.</p>
<p><img src="/media/1670/clientdependencylogo.png" width="89" height="89" alt="test1"/></p>]]></bodyText>
<MediaPickerTest />
<umbracoUrlName />
<umbracoUrlAlias />
<umbracoRedirect>0</umbracoRedirect>
</CWS_Home>
</root>

View File

@@ -194,7 +194,10 @@ namespace Umbraco.Web.Models
}
//get the data type id for the current property
var dataType = Umbraco.Core.PublishedContentHelper.GetDataType(userProperty.DocumentTypeAlias, userProperty.Alias);
var dataType = Umbraco.Core.PublishedContentHelper.GetDataType(
ApplicationContext.Current,
userProperty.DocumentTypeAlias,
userProperty.Alias);
//convert the string value to a known type
var converted = Umbraco.Core.PublishedContentHelper.ConvertPropertyValue(result, dataType, userProperty.DocumentTypeAlias, userProperty.Alias);

View File

@@ -151,7 +151,7 @@ namespace Umbraco.Web
//Here we need to put the value through the IPropertyEditorValueConverter's
//get the data type id for the current property
var dataType = PublishedContentHelper.GetDataType(doc.DocumentTypeAlias, alias);
var dataType = PublishedContentHelper.GetDataType(ApplicationContext.Current, doc.DocumentTypeAlias, alias);
//convert the string value to a known type
var converted = PublishedContentHelper.ConvertPropertyValue(p.Value, dataType, doc.DocumentTypeAlias, alias);
return converted.Success
@@ -186,7 +186,7 @@ namespace Umbraco.Web
//before we try to convert it manually, lets see if the PropertyEditorValueConverter does this for us
//Here we need to put the value through the IPropertyEditorValueConverter's
//get the data type id for the current property
var dataType = PublishedContentHelper.GetDataType(prop.DocumentTypeAlias, alias);
var dataType = PublishedContentHelper.GetDataType(ApplicationContext.Current, prop.DocumentTypeAlias, alias);
//convert the value to a known type
var converted = PublishedContentHelper.ConvertPropertyValue(p.Value, dataType, prop.DocumentTypeAlias, alias);
object parsedLinksVal;

View File

@@ -39,7 +39,6 @@ namespace Umbraco.Web
/// </summary>
/// <param name="httpContext"></param>
/// <param name="applicationContext"> </param>
/// <param name="routesCache"> </param>
internal UmbracoContext(
HttpContextBase httpContext,
ApplicationContext applicationContext)

View File

@@ -169,11 +169,7 @@ namespace Umbraco.Web
protected override void InitializeResolvers()
{
base.InitializeResolvers();
//TODO: This needs to be removed in future versions (i.e. 6.0 when the PublishedContentHelper can access the business logic)
// see the TODO noted in the PublishedContentHelper.
PublishedContentHelper.GetDataTypeCallback = ContentType.GetDataType;
SurfaceControllerResolver.Current = new SurfaceControllerResolver(
PluginManager.Current.ResolveSurfaceControllers());