I am having a frustrating first attempt at using Courier 2 Express and am hoping someone can help!
I have just tried trasferring a site which contains uComponents Multi node tree picker data types for most of the document types and therefore most content nodes.
The datatypes all seem to be copied over okay but the selected nodes in the tree pickers within the transferred content seem to have been corrupted in the transfer.
For some nodes in the copied site the multi node picker data types contain content nodes in the selection when the control (and of course the original content) is defined as being a media item. In most cases this just causes the familiar 'Error parsing XSLT file' on the site and could be fixed manually by editing the content.
However for some nodes it is not even possible to view or correct the content as clicking on the node in the content section produces an exception when Umbraco tries to display that node in the backend:
For nodes where no selections have been made in the multi node pickers the transfer appears to be okay.
Does anyone know of a fix to the problem? In the short term is there a way to prevent the data from certain node types being transferred? At least that way it would be possible to transfer a working site and then have a small manual process of updating the missing multi node selections for the relevent nodes.
I could not get the error to post without (ironically) giving an 'Error parsing XSLT' on this site! So this is a second try:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[NullReferenceException: Object reference not set to an instance of an object.]
uComponents.Core.DataTypes.MultiNodeTreePicker.MNTP_DataEditor.SelectedValues_ItemDataBound(Object sender, RepeaterItemEventArgs e) +744
System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +203
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +642
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +166
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3047
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Courier only supports the built in Umbraco data types out of the box and hence third party components like uComponents will not work without a provider written so that Courier understands the data types.
So in a nut shell you either need to write your own provider ( see the developer docs ) or hope that the uComponents team will soon release a provider for all their datatypes, I am sure a lot of people are also hoping the same :)
Wow that was quick!
Not the answer I was hoping to hear, most of my project use the uComponents data types which is going to make using Courier hard going in the meantime.
Thanks for the answer though!
I haven't tried this myself, but just from talking with other developers at CodeGarden 11, the issue with MultiNode Tree Picker and Courier is when you choose to store the data/value as XML. If you store it as CSV, then it "should" work fine.
Not sure how this effects other data-types in uComponents... yet! (I'm only just starting to use Courier 2 myself)
Many thanks for the answer.You are absolutely right I am storing the data as XML, it seemed the logical choice when using XSLT to create the output.
Do you know if there are any code examples for splitting and outputing CSV data using XSLT? If so changing how the data type stores the content and altering the macros might be my quickest solution on an ongoing basis.
As a short term work around, is there a simple change that I could apply to each of the Multi Node Picker data types that would result in the content nodes which have properties of that type losing their selection? (For example would changing the data type to CSV have the desired result) If so I could quickly force all the Multi node properties within all content nodes to have empty selections the Courier transfer should work and then I could do a manual tidy up of the other end.
From my understanding Courier needs you to write Providers for all third party datatypes so that it understands their structure and is able to replace node ID's with their Unique ID's ( GUID's ) and the reverse when restoring them on the target server.
Have a look at page 10 of the developer's guide for more information.
Slightly off topic but here's the code if you want to get the values from CSV:
<xsl:variable name="splitProperties" select="umbraco.library:Split($csvproperties, ',')" /> <xsl:for-each select="$splitProperties/value"><xsl:variable name="currentNode" select="umbraco.library:GetXmlNodeById(.)" /><xsl:value-of select="$currentNode/@nodeName"/></xsl:for-each>
I have let the topic start to wonder a little! Thanks for the code sample, that's really straight forward.
As Chris said, if you store Node Ids in a custom XML structure, you will need to write a provider to allow Courier 2 to understand that the xml structure contains IDs it should pick up.
work is in progress to have a generic xpath resolver, which can basicly work with any datatype which saves as xml, it just needs a xpath to resolve nodeIds, but for now, you have to write your own provider
The generic provider sounds like a great idea!