Skip to content

Commit 079fe9d

Browse files
committed
PR updates
1 parent 4c7e1df commit 079fe9d

File tree

7 files changed

+66
-145
lines changed

7 files changed

+66
-145
lines changed

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/Render/DynamicsForm.cshtml

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,37 @@
77
var id = Guid.NewGuid();
88
}
99

10-
@if (Model.Module == DynamicsModule.Outbound)
10+
@if (Model != null)
1111
{
12-
@if (Model.IframeEmbedded)
12+
@if (Model.Module.HasFlag(DynamicsModule.Outbound))
1313
{
14-
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id></iframe>
15-
<script>
16-
var sandboxSrc = "https://@(Model.Hostname)/t/formsandbox/@(Model.WebsiteId)/@(Model.FormBlockId)?ad="
17-
+ encodeURIComponent(document.location.toString()); document.getElementById('@id').setAttribute('src', sandboxSrc);
18-
</script>
14+
@if (Model.IframeEmbedded)
15+
{
16+
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id></iframe>
17+
<script>
18+
var sandboxSrc = "https://@(Model.Hostname)/t/formsandbox/@(Model.WebsiteId)/@(Model.FormBlockId)?ad="
19+
+ encodeURIComponent(document.location.toString()); document.getElementById('@id').setAttribute('src', sandboxSrc);
20+
</script>
21+
}
22+
else
23+
{
24+
<div data-form-block-id="@Model.FormBlockId"></div>
25+
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.84.2007"></script>
26+
<div id="@Model.ContainerId"></div>
27+
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/ws-tracking.js?v=1.84.2007"></script>
28+
<div class="@Model.ContainerClass" style="display:none"
29+
data-website-id="@Model.WebsiteId" data-hostname="@Model.Hostname"></div>
30+
}
1931
}
2032
else
2133
{
22-
<div data-form-block-id="@Model.FormBlockId"></div>
23-
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.84.2007"></script>
24-
<div id="@Model.ContainerId"></div>
25-
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/ws-tracking.js?v=1.84.2007"></script>
26-
<div class="@Model.ContainerClass" style="display:none"
27-
data-website-id="@Model.WebsiteId" data-hostname="@Model.Hostname"></div>
28-
}
29-
}
30-
else
31-
{
32-
@if (Model.IframeEmbedded)
33-
{
34-
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id src="@Model.StandaloneUrl"></iframe>
35-
}
36-
else
37-
{
38-
@Html.Raw(Model.Html)
34+
@if (Model.IframeEmbedded)
35+
{
36+
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id src="@Model.StandaloneUrl"></iframe>
37+
}
38+
else
39+
{
40+
@Html.Raw(Model.Html)
41+
}
3942
}
4043
}
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
@using Umbraco.Cms.Integrations.Crm.Dynamics.Models.ViewModels;
2-
@using Umbraco.Cms.Integrations.Crm.Dynamics.Models;
32

43
@inherits Umbraco.Web.Mvc.UmbracoViewPage<FormViewModel>
54

65
@{
76
var id = Guid.NewGuid();
87
}
98

10-
@if (Model.Module == DynamicsModule.Outbound)
9+
@if (Model != null)
1110
{
12-
@if (Model.IframeEmbedded)
11+
@if (Model.Module.HasFlag(DynamicsModule.Outbound))
1312
{
14-
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id></iframe>
15-
<script>
16-
var sandboxSrc = "https://@(Model.Hostname)/t/formsandbox/@(Model.WebsiteId)/@(Model.FormBlockId)?ad="
17-
+ encodeURIComponent(document.location.toString()); document.getElementById('@id').setAttribute('src', sandboxSrc);
18-
</script>
13+
@if (Model.IframeEmbedded)
14+
{
15+
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id></iframe>
16+
<script>
17+
var sandboxSrc = "https://@(Model.Hostname)/t/formsandbox/@(Model.WebsiteId)/@(Model.FormBlockId)?ad="
18+
+ encodeURIComponent(document.location.toString()); document.getElementById('@id').setAttribute('src', sandboxSrc);
19+
</script>
20+
}
21+
else
22+
{
23+
<div data-form-block-id="@Model.FormBlockId"></div>
24+
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.84.2007"></script>
25+
<div id="@Model.ContainerId"></div>
26+
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/ws-tracking.js?v=1.84.2007"></script>
27+
<div class="@Model.ContainerClass" style="display:none"
28+
data-website-id="@Model.WebsiteId" data-hostname="@Model.Hostname"></div>
29+
}
1930
}
2031
else
2132
{
22-
<div data-form-block-id="@Model.FormBlockId"></div>
23-
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.84.2007"></script>
24-
<div id="@Model.ContainerId"></div>
25-
<script src="https://mktdplp102cdn.azureedge.net/public/latest/js/ws-tracking.js?v=1.84.2007"></script>
26-
<div class="@Model.ContainerClass" style="display:none"
27-
data-website-id="@Model.WebsiteId" data-hostname="@Model.Hostname"></div>
33+
@if (Model.IframeEmbedded)
34+
{
35+
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id src="@Model.StandaloneUrl"></iframe>
36+
}
37+
else
38+
{
39+
@Html.Raw(Model.Html)
40+
}
2841
}
29-
}
30-
else
31-
{
32-
@if (Model.IframeEmbedded)
33-
{
34-
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id src="@Model.StandaloneUrl"></iframe>
35-
}
36-
else
37-
{
38-
@Html.Raw(Model.Html)
39-
}
40-
}
42+
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/js/formpicker.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
vm.saveForm = function (form) {
2121

22-
if (form.iframeEmbedded) {
22+
if (form.iframeEmbedded && form.module === "Outbound") {
2323
umbracoCmsIntegrationsCrmDynamicsResource.getEmbedCode(form.id).then(function (response) {
2424

2525
if (response.length == 0) {

src/Umbraco.Cms.Integrations.Crm.Dynamics/Editors/DynamicsFormPickerValueConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public override object ConvertSourceToIntermediate(IPublishedElement owner, IPub
5050

5151
vm.Module = module;
5252

53-
if (module == DynamicsModule.Outbound)
53+
if (module.HasFlag(DynamicsModule.Outbound))
5454
{
5555

5656
var embedCode = jObject["embedCode"].ToString();
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Models
1+
using System;
2+
3+
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Models
24
{
5+
[Flags]
36
public enum DynamicsModule
47
{
5-
Outbound,
6-
RealTime,
7-
Both
8+
Outbound = 1,
9+
RealTime = 2,
10+
Both = Outbound | RealTime
811
}
912
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/Services/DynamicsService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public async Task<IEnumerable<FormDto>> GetForms(DynamicsModule module)
130130

131131
var oauthConfiguration = _dynamicsConfigurationService.GetOAuthConfiguration();
132132

133-
if (module == DynamicsModule.Outbound || module == DynamicsModule.Both)
133+
if (module.HasFlag(DynamicsModule.Outbound))
134134
{
135135
var forms = await Get<OutboundFormDto>(oauthConfiguration.AccessToken, Constants.Modules.OutboundPath);
136136
list.AddRange(forms.Value.Select(p => new FormDto
@@ -141,7 +141,7 @@ public async Task<IEnumerable<FormDto>> GetForms(DynamicsModule module)
141141
}));
142142
}
143143

144-
if (module == DynamicsModule.RealTime || module == DynamicsModule.Both)
144+
if (module.HasFlag(DynamicsModule.RealTime))
145145
{
146146
var forms = await Get<RealTimeFormDto>(oauthConfiguration.AccessToken, Constants.Modules.RealTimePath);
147147
list.AddRange(forms.Value.Select(p => new FormDto

src/Umbraco.Cms.Integrations.Crm.Dynamics/Umbraco.Cms.Integrations.Crm.Dynamics.csproj

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,6 @@
6464
</Content>
6565
</ItemGroup>
6666

67-
<ItemGroup>
68-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\css\styles.css" />
69-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\configuration.controller.js" />
70-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\dynamics.resource.js" />
71-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\formpicker.controller.js" />
72-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\oauthConfiguration.directive.js" />
73-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\package.manifest" />
74-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\Render\DynamicsForm.cshtml" />
75-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\Render\DynamicsFormV8.cshtml" />
76-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\views\configuration.html" />
77-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\views\formpicker.html" />
78-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\views\formpickereditor.html" />
79-
<None Remove="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\views\module-configuration.html" />
80-
</ItemGroup>
81-
82-
<ItemGroup>
83-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\oauthconfiguration.directive.js">
84-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
85-
<Pack>true</Pack>
86-
</Content>
87-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\Render\DynamicsForm.cshtml">
88-
<SubType>Component</SubType>
89-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
90-
<Pack>true</Pack>
91-
</Content>
92-
</ItemGroup>
93-
9467
<ItemGroup>
9568
<Content Include="dynamics.png">
9669
<Pack>true</Pack>
@@ -102,66 +75,6 @@
10275
<None Include="docs\readme.md" Pack="true" PackagePath="\" />
10376
</ItemGroup>
10477

105-
<ItemGroup>
106-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\css\styles.css">
107-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
108-
<Pack>true</Pack>
109-
</Content>
110-
</ItemGroup>
111-
112-
<ItemGroup>
113-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\configuration.controller.js">
114-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
115-
<Pack>true</Pack>
116-
</Content>
117-
</ItemGroup>
118-
119-
<ItemGroup>
120-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\dynamics.resource.js">
121-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
122-
<Pack>true</Pack>
123-
</Content>
124-
</ItemGroup>
125-
126-
<ItemGroup>
127-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\js\formpicker.controller.js">
128-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
129-
<Pack>true</Pack>
130-
</Content>
131-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\Render\DynamicsFormV8.cshtml">
132-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
133-
<Pack>true</Pack>
134-
</Content>
135-
</ItemGroup>
136-
137-
<ItemGroup>
138-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\views\configuration.html">
139-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
140-
<Pack>true</Pack>
141-
</Content>
142-
</ItemGroup>
143-
144-
<ItemGroup>
145-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\views\formpicker.html">
146-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
147-
<Pack>true</Pack>
148-
</Content>
149-
</ItemGroup>
150-
151-
<ItemGroup>
152-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\views\formpickereditor.html">
153-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
154-
<Pack>true</Pack>
155-
</Content>
156-
</ItemGroup>
157-
158-
<ItemGroup>
159-
<Content Update="App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\package.manifest">
160-
<PackagePath>App_Plugins\UmbracoCms.Integrations\Crm\Dynamics\</PackagePath>
161-
<Pack>true</Pack>
162-
</Content>
163-
</ItemGroup>
164-
16578
<Target Name="RemoveLuceneAnalyzer" BeforeTargets="CoreCompile">
16679
<ItemGroup>
16780
<Analyzer Remove="@(Analyzer)" Condition="%(FileName) == 'Lucene.Net.CodeAnalysis.CSharp'" />

0 commit comments

Comments
 (0)