Skip to content

Commit 8400984

Browse files
author
Claus
authored
Merge pull request #37 from umbraco/v2/bugfix/dtge-not-storing-correctly
updating DTGE connector to make use of mockContentGrid being introduc…
2 parents 7982334 + 3fb1a4e commit 8400984

File tree

3 files changed

+321
-30
lines changed

3 files changed

+321
-30
lines changed

src/Umbraco.Deploy.Contrib.Connectors/GridCellValueConnectors/DocTypeGridEditorCellValueConnector.cs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -139,36 +139,37 @@ public override void SetValue(GridValue.GridControl control, Property property)
139139
var propValueConnector = ValueConnectors.Get(propertyType);
140140

141141
var mockProperty = new Property(propertyType);
142-
var mockContent = new Content("mockContent", -1, new ContentType(-1),
143-
new PropertyCollection(new List<Property> { mockProperty }));
142+
var mockContent = new Content("mockContentGrid", -1, new ContentType(-1),
143+
new PropertyCollection(new List<Property> {mockProperty}));
144144

145+
propValueConnector.SetValue(mockContent, mockProperty.Alias, value.ToString());
146+
var convertedValue = mockContent.GetValue(mockProperty.Alias);
147+
148+
// integers needs to be converted into strings for DTGE to work
149+
if (convertedValue is int)
145150
{
146-
propValueConnector.SetValue(mockContent, mockProperty.Alias, value.ToString());
147-
var convertedValue = mockContent.GetValue(mockProperty.Alias);
148-
// integers needs to be converted into strings for DTGE to work
149-
if (convertedValue is int)
150-
{
151-
docTypeGridEditorContent.Value[propertyType.Alias] = convertedValue.ToString();
152-
}
153-
else if (convertedValue is null)
151+
docTypeGridEditorContent.Value[propertyType.Alias] = convertedValue.ToString();
152+
}
153+
else if (convertedValue == null)
154+
{
155+
//Assign the null back - otherwise the check for JSON will fail as we cant convert a null to a string
156+
//NOTE: LinkPicker2 for example if no link set is returning a null as opposed to empty string
157+
docTypeGridEditorContent.Value[propertyType.Alias] = null;
158+
}
159+
else
160+
{
161+
// test if the value is a json object (thus could be a nested complex editor)
162+
// if that's the case we'll need to add it as a json object instead of string to avoid it being escaped
163+
var jtokenValue = convertedValue.ToString().DetectIsJson()
164+
? JToken.Parse(convertedValue.ToString())
165+
: null;
166+
if (jtokenValue != null)
154167
{
155-
//Assign the null back - otherwise the check for JSON will fail as we cant convert a null to a string
156-
//NOTE: LinkPicker2 for example if no link set is returning a null as opposed to empty string
157-
docTypeGridEditorContent.Value[propertyType.Alias] = convertedValue;
168+
docTypeGridEditorContent.Value[propertyType.Alias] = jtokenValue;
158169
}
159170
else
160171
{
161-
// test if the value is a json object (thus could be a nested complex editor)
162-
// if that's the case we'll need to add it as a json object instead of string to avoid it being escaped
163-
var jtokenValue = convertedValue.ToString().DetectIsJson() ? JToken.Parse(convertedValue.ToString()) : null;
164-
if (jtokenValue != null)
165-
{
166-
docTypeGridEditorContent.Value[propertyType.Alias] = jtokenValue;
167-
}
168-
else
169-
{
170-
docTypeGridEditorContent.Value[propertyType.Alias] = convertedValue;
171-
}
172+
docTypeGridEditorContent.Value[propertyType.Alias] = convertedValue;
172173
}
173174
}
174175
}

src/Umbraco.Deploy.Contrib.Connectors/Umbraco.Deploy.Contrib.Connectors.csproj

Lines changed: 151 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,185 @@
3030
<WarningLevel>4</WarningLevel>
3131
</PropertyGroup>
3232
<ItemGroup>
33+
<Reference Include="AutoMapper, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
34+
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll</HintPath>
35+
</Reference>
36+
<Reference Include="AutoMapper.Net4, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
37+
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
38+
</Reference>
39+
<Reference Include="businesslogic, Version=1.0.6396.36624, Culture=neutral, processorArchitecture=MSIL">
40+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\businesslogic.dll</HintPath>
41+
</Reference>
42+
<Reference Include="ClientDependency.Core, Version=1.9.2.0, Culture=neutral, processorArchitecture=MSIL">
43+
<HintPath>..\packages\ClientDependency.1.9.2\lib\net45\ClientDependency.Core.dll</HintPath>
44+
</Reference>
45+
<Reference Include="ClientDependency.Core.Mvc, Version=1.8.0.0, Culture=neutral, processorArchitecture=MSIL">
46+
<HintPath>..\packages\ClientDependency-Mvc5.1.8.0.0\lib\net45\ClientDependency.Core.Mvc.dll</HintPath>
47+
</Reference>
48+
<Reference Include="cms, Version=1.0.6396.36625, Culture=neutral, processorArchitecture=MSIL">
49+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\cms.dll</HintPath>
50+
</Reference>
51+
<Reference Include="controls, Version=1.0.6396.36629, Culture=neutral, processorArchitecture=MSIL">
52+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\controls.dll</HintPath>
53+
</Reference>
54+
<Reference Include="CookComputing.XmlRpcV2, Version=2.5.0.0, Culture=neutral, PublicKeyToken=a7d6e17aa302004d, processorArchitecture=MSIL">
55+
<HintPath>..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll</HintPath>
56+
</Reference>
57+
<Reference Include="Examine, Version=0.1.83.0, Culture=neutral, processorArchitecture=MSIL">
58+
<HintPath>..\packages\Examine.0.1.83\lib\net45\Examine.dll</HintPath>
59+
</Reference>
60+
<Reference Include="HtmlAgilityPack, Version=1.4.9.5, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
61+
<HintPath>..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll</HintPath>
62+
</Reference>
63+
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
64+
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
65+
</Reference>
66+
<Reference Include="ImageProcessor, Version=2.5.3.0, Culture=neutral, processorArchitecture=MSIL">
67+
<HintPath>..\packages\ImageProcessor.2.5.3\lib\net45\ImageProcessor.dll</HintPath>
68+
</Reference>
69+
<Reference Include="ImageProcessor.Web, Version=4.8.3.0, Culture=neutral, processorArchitecture=MSIL">
70+
<HintPath>..\packages\ImageProcessor.Web.4.8.3\lib\net45\ImageProcessor.Web.dll</HintPath>
71+
</Reference>
3372
<Reference Include="interfaces, Version=1.0.6396.36619, Culture=neutral, processorArchitecture=MSIL">
3473
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\interfaces.dll</HintPath>
35-
<Private>False</Private>
3674
</Reference>
3775
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
3876
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\log4net.dll</HintPath>
39-
<Private>False</Private>
77+
</Reference>
78+
<Reference Include="Log4Net.Async, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
79+
<HintPath>..\packages\Log4Net.Async.2.0.4\lib\net40\Log4Net.Async.dll</HintPath>
80+
</Reference>
81+
<Reference Include="Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181, processorArchitecture=MSIL">
82+
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
83+
</Reference>
84+
<Reference Include="MarkdownSharp, Version=1.14.5.0, Culture=neutral, processorArchitecture=MSIL">
85+
<HintPath>..\packages\Markdown.1.14.7\lib\net45\MarkdownSharp.dll</HintPath>
86+
</Reference>
87+
<Reference Include="Microsoft.ApplicationBlocks.Data, Version=1.0.1559.20655, Culture=neutral">
88+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\Microsoft.ApplicationBlocks.Data.dll</HintPath>
89+
</Reference>
90+
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
91+
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
92+
</Reference>
93+
<Reference Include="Microsoft.AspNet.Identity.Owin, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
94+
<HintPath>..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
95+
</Reference>
96+
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
97+
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
98+
</Reference>
99+
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
100+
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
101+
</Reference>
102+
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
103+
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
104+
</Reference>
105+
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
106+
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
107+
</Reference>
108+
<Reference Include="Microsoft.Owin.Security, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
109+
<HintPath>..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll</HintPath>
110+
</Reference>
111+
<Reference Include="Microsoft.Owin.Security.Cookies, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
112+
<HintPath>..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
113+
</Reference>
114+
<Reference Include="Microsoft.Owin.Security.OAuth, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
115+
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
116+
</Reference>
117+
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
118+
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
119+
</Reference>
120+
<Reference Include="MiniProfiler, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
121+
<HintPath>..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll</HintPath>
122+
</Reference>
123+
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
124+
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
40125
</Reference>
41126
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
42127
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
43-
<Private>False</Private>
128+
</Reference>
129+
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
130+
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
44131
</Reference>
45132
<Reference Include="Semver, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
46133
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
47-
<Private>False</Private>
134+
</Reference>
135+
<Reference Include="SQLCE4Umbraco, Version=1.0.6396.36627, Culture=neutral, processorArchitecture=MSIL">
136+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\SQLCE4Umbraco.dll</HintPath>
48137
</Reference>
49138
<Reference Include="System" />
50139
<Reference Include="System.Core" />
140+
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
141+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\System.Data.SqlServerCe.dll</HintPath>
142+
</Reference>
143+
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
144+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\System.Data.SqlServerCe.Entity.dll</HintPath>
145+
</Reference>
146+
<Reference Include="System.Net.Http" />
147+
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
148+
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
149+
</Reference>
150+
<Reference Include="System.Threading.Tasks.Dataflow, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
151+
<HintPath>..\packages\System.Threading.Tasks.Dataflow.4.7.0\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll</HintPath>
152+
</Reference>
51153
<Reference Include="System.Web" />
154+
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
155+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
156+
</Reference>
157+
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
158+
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
159+
</Reference>
160+
<Reference Include="System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
161+
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
162+
</Reference>
163+
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
164+
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
165+
</Reference>
166+
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
167+
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
168+
</Reference>
169+
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
170+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
171+
</Reference>
172+
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
173+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
174+
</Reference>
175+
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
176+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
177+
</Reference>
52178
<Reference Include="System.Xml.Linq" />
53179
<Reference Include="Microsoft.CSharp" />
54180
<Reference Include="System.Xml" />
181+
<Reference Include="TidyNet, Version=1.0.0.0, Culture=neutral">
182+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\TidyNet.dll</HintPath>
183+
</Reference>
55184
<Reference Include="umbraco, Version=1.0.6396.36631, Culture=neutral, processorArchitecture=MSIL">
56185
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\umbraco.dll</HintPath>
57-
<Private>False</Private>
58186
</Reference>
59187
<Reference Include="Umbraco.Core, Version=1.0.6396.36621, Culture=neutral, processorArchitecture=MSIL">
60188
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\Umbraco.Core.dll</HintPath>
61-
<Private>False</Private>
189+
</Reference>
190+
<Reference Include="umbraco.DataLayer, Version=1.0.6396.36624, Culture=neutral, processorArchitecture=MSIL">
191+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\umbraco.DataLayer.dll</HintPath>
62192
</Reference>
63193
<Reference Include="Umbraco.Deploy, Version=1.0.17.0, Culture=neutral, processorArchitecture=MSIL">
64194
<HintPath>..\packages\UmbracoDeploy.1.0.17\lib\net45\Umbraco.Deploy.dll</HintPath>
65195
<Private>False</Private>
66196
</Reference>
197+
<Reference Include="umbraco.editorControls, Version=1.0.6396.36634, Culture=neutral, processorArchitecture=MSIL">
198+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\umbraco.editorControls.dll</HintPath>
199+
</Reference>
200+
<Reference Include="umbraco.MacroEngines, Version=1.0.6396.36635, Culture=neutral, processorArchitecture=MSIL">
201+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\umbraco.MacroEngines.dll</HintPath>
202+
</Reference>
203+
<Reference Include="umbraco.providers, Version=1.0.6396.36630, Culture=neutral, processorArchitecture=MSIL">
204+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\umbraco.providers.dll</HintPath>
205+
</Reference>
206+
<Reference Include="Umbraco.Web.UI, Version=1.0.6396.36637, Culture=neutral, processorArchitecture=MSIL">
207+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\Umbraco.Web.UI.dll</HintPath>
208+
</Reference>
209+
<Reference Include="UmbracoExamine, Version=0.7.0.36626, Culture=neutral, processorArchitecture=MSIL">
210+
<HintPath>..\packages\UmbracoCms.Core.7.6.4\lib\net45\UmbracoExamine.dll</HintPath>
211+
</Reference>
67212
</ItemGroup>
68213
<ItemGroup>
69214
<Compile Include="Caching\Comparers\StringArrayComparer.cs" />

0 commit comments

Comments
 (0)