Error compiling template "Designs/Swift-v2/Swift-v2_CPQPageClean.cshtml"
Line 15: The type or namespace name 'DW_CPQ_API' could not be found (are you missing a using directive or an assembly reference?)
Line 25: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 33: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 38: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 47: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 51: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 54: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 64: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 77: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 103: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 184: The type or namespace name 'ModelController' could not be found (are you missing a using directive or an assembly reference?)
Line 184: The type or namespace name 'ModelController' could not be found (are you missing a using directive or an assembly reference?)
Line 200: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
1 // <auto-generated/>
2 #pragma warning disable 1591
3 namespace CompiledRazorTemplates.Dynamic
4 {
5 #line hidden
6 using System.Threading.Tasks;
7 using System.Collections.Generic;
8 using System.Linq;
9 using System;
10 using Dynamicweb;
11 using Dynamicweb.Environment;
12 using Dynamicweb.Frontend;
13 using Dynamicweb.Frontend.Devices;
14 using Dynamicweb.Rendering;
15 using DW_CPQ_API;
16 internal class RazorEngine_b508e5d771cd4f16b782e971dd9e91ee : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
17 {
18 #pragma warning disable 1998
19 public async override global::System.Threading.Tasks.Task ExecuteAsync()
20 {
21 WriteLiteral("\n");
22
Pageview.Meta.AddTag("fb:app_id", Model.Area?.Item?.GetString("FacebookAppId"));
Pageview.Meta.AddTag("google-site-verification", Model.Area?.Item?.GetString("GoogleSiteVerification"));
Pageview.Meta.AddTag("site_name", Model.Area?.Item?.TryGetString("MetaSiteName", out string? siteName) is true ? siteName : Model.Area?.Name);
Pageview.Meta.AddTag("url", Pageview.Meta.Canonical?.ToString());
Pageview.Meta.AddTag("twitter:site", Model.Area?.Item?.GetString("TwitterSite"));
Pageview.Meta.AddOpenGraphTag("type", "website");
Pageview.Meta.AddOpenGraphTag("url", Pageview.Meta.Canonical?.ToString());
Pageview.Meta.AddOpenGraphTag("title", Model.Title);
Pageview.Meta.AddOpenGraphTag("description", Model.Description);
if (Model.Area?.Item?.TryGetImageFile("MetaImage", out ImageFileViewModel? image) ?? false) {
Pageview.Meta.AddOpenGraphTag("image", image.Path);
Pageview.Meta.AddOpenGraphTag("image:alt", Model.Area?.Item?.GetString("MetaImageALT"));
}
string? googleTagManagerID = string.Empty;
if (Model.Area?.Item?.TryGetString("GoogleTagManagerID", out googleTagManagerID) ?? false)
{
googleTagManagerID = googleTagManagerID.Trim();
}
AddStylesheet("/Files/Templates/Designs/Swift-v2/Assets/css/swift.css");
if (Model.TryGetColorSchemeStyle(out string? colorSchemeStyle))
{
AddStylesheet(colorSchemeStyle);
}
if (Model.TryGetButtonStyle(out string? buttonStyle)) {
AddStylesheet(buttonStyle);
}
if (Model.TryGetTypographyStyle(out string? typographyStyle)) {
AddStylesheet(typographyStyle);
}
AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/bootstrap/dist/js/bootstrap.bundle.min.js");
AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/htmx.org/dist/htmx.min.js");
AddScript("/Files/Templates/Designs/Swift-v2/Assets/js/swift.js");
if (Model.Area?.Item?.TryGetFile("CustomHeadInclude", out FileViewModel? customHeadInclude) ?? false)
{
Write(RenderPartial($"Designs/Swift-v2/Custom/{customHeadInclude?.Name}"));
23
}
WriteLiteral("\n<!doctype html>\n<html");
24 BeginWriteAttribute("lang", " lang=\"", 2546, "\"", 2604, 1);
25 WriteAttributeValue("", 2553, Pageview.Area.CultureInfo.TwoLetterISOLanguageName, 2553, 51, false);
26 EndWriteAttribute();
27 WriteLiteral(" data-swift-version=\"");
28 Write(ReadFile("/Files/Templates/Designs/Swift-v2/swift_version.txt")?.Trim());
29 WriteLiteral("\">\n <head>\n");
30 WriteLiteral(" <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"height=device-height, width=device-width, initial-scale=1.0\">\n\n");
31 if (Model.Area?.Item?.TryGetImageFile("Favicon", out ImageFileViewModel? faviconImage) ?? false)
{
WriteLiteral(" <link rel=\"shortcut icon\"");
32 BeginWriteAttribute("href", " href=\"", 3033, "\"", 3059, 1);
33 WriteAttributeValue("", 3040, faviconImage?.Path, 3040, 19, false);
34 EndWriteAttribute();
35 WriteLiteral(">\n");
36 }
if (Model.Area?.Item?.TryGetImageFile("AppleTouchIcon", out ImageFileViewModel? appleTouchIconImage) ?? false)
{
WriteLiteral(" <link rel=\"apple-touch-icon\"");
37 BeginWriteAttribute("href", " href=\"", 3242, "\"", 3275, 1);
38 WriteAttributeValue("", 3249, appleTouchIconImage?.Path, 3249, 26, false);
39 EndWriteAttribute();
40 WriteLiteral(">\n");
41 }
WriteLiteral(" <title>");
42 Write(Model.Title);
43 WriteLiteral("</title>\n \n");
44 WriteLiteral(" ");
45 Write(Model.MetaTags);
46 WriteLiteral("\n \n");
47 WriteLiteral(" ");
48 Write(Model.GetStylesheetsMarkup());
49 WriteLiteral("\n \n");
50 if(Model.Area?.Item?.TryGetString("MediaQueryLimit", out string? mediaQueryLimit) ?? false) {
WriteLiteral(" <style>\n ");
51 WriteLiteral("@media screen and (min-width: ");
52 Write(mediaQueryLimit);
53 WriteLiteral("px) {\n [data-swift-container] {\n --dw-container-limit: ");
54 Write(mediaQueryLimit);
55 WriteLiteral(@"px;
}
[data-swift-container],
[data-dw-container-width=""3""] {
--dw-container-width: calc(var(--dw-container-limit) * .8);
}
[data-dw-container-width=""1""] {
--dw-container-width: var(--swift-text-width);
}
[data-dw-container-width=""2""] {
--dw-container-width: calc(var(--dw-container-limit) * .65);
}
}
</style>
");
56 }
WriteLiteral(" ");
57 Write(Model.GetScriptsMarkup());
58 WriteLiteral("\n \n");
59 WriteLiteral(" <script>\n window.dataLayer = window.dataLayer || [];\n function gtag() { dataLayer.push(arguments); }\n </script>\n");
60 if (!string.IsNullOrWhiteSpace(googleTagManagerID))
{
WriteLiteral(@" <script>
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied'
});
</script>
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
}); var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '");
61 Write(googleTagManagerID);
62 WriteLiteral("\');\n </script>\n");
63 if (AllowTracking())
{
WriteLiteral(" <script>\n gtag(\'consent\', \'update\', {\n \'ad_storage\': \'");
64 Write(CookieManager.IsCookieOptInGranted("Marketing"));
65 WriteLiteral("\',\n \'ad_user_data\': \'");
66 Write(CookieManager.IsCookieOptInGranted("Marketing"));
67 WriteLiteral("\',\n \'ad_personalization\': \'");
68 Write(CookieManager.IsCookieOptInGranted("Marketing"));
69 WriteLiteral("\',\n \'analytics_storage\': \'");
70 Write(CookieManager.IsCookieOptInGranted("Statistical"));
71 WriteLiteral("\'\n });\n </script>\n");
72 }
}
WriteLiteral(" </head>\n <body data-dw-page-id=\"");
73 Write(Model.ID);
74 WriteLiteral("\" data-dw-itemtype=\"");
75 Write(Model.Item?.SystemName?.ToLower());
76 WriteLiteral("\">\n \n");
77 if (!string.IsNullOrWhiteSpace(googleTagManagerID) && AllowTracking())
{
WriteLiteral(" <noscript>\n <iframe");
78 BeginWriteAttribute("src", " src=\"", 6621, "\"", 6692, 2);
79 WriteAttributeValue("", 6627, "https://www.googletagmanager.com/ns.html?id=", 6627, 44, true);
80 WriteAttributeValue("", 6671, googleTagManagerID, 6671, 21, false);
81 EndWriteAttribute();
82 WriteLiteral(" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>\n </noscript>\n");
83 }
WriteLiteral("\n\n");
84 WriteLiteral("\n");
85
ModelController modelController = new ModelController(Pageview.Page.ID, Dynamicweb.Context.Current.Request.Params);
var jsontxt = System.Text.Json.JsonSerializer.Serialize(modelController.DocumentResult);
var model = modelController.DocumentResult;
string jsonTxt = System.Text.Json.JsonSerializer.Serialize(model);
string datakeyline = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form["itemdatakeyline"]) ? Dynamicweb.Context.Current.Request.Form["itemdatakeyline"] : "";
WriteLiteral(" <input type=\"hidden\" id=\"model_version_id\"");
86 BeginWriteAttribute("value", " value=\"", 7373, "\"", 7414, 1);
87 WriteAttributeValue("", 7381, modelController.ModelVersionId, 7381, 33, false);
88 EndWriteAttribute();
89 WriteLiteral(" />\n <input type=\"hidden\" id=\"itemdatakeyline\"");
90 BeginWriteAttribute("value", " value=\"", 7464, "\"", 7486, 1);
91 WriteAttributeValue("", 7472, datakeyline, 7472, 14, false);
92 EndWriteAttribute();
93 WriteLiteral(" />\n");
94 string? paragraphId = Dynamicweb.Context.Current?.Request?.QueryString.Get("ParagraphID") ?? null;
WriteLiteral(" \n");
95 if (paragraphId is not null) {
Write(RenderParagraphContent(Convert.ToInt32(paragraphId)));
96
}
else
{
Write(Model.Grid("Grid", "Grid", "default:true;sort:1", "Page"));
97 Write(Model.Placeholder("dwcontent", "content", "default:true;sort:1"));
98
}
WriteLiteral("\n\n");
99
string debugmode ="";
if( Dynamicweb.Context.Current.Request.QueryString.Get("debugmode") != null)
{
debugmode= Dynamicweb.Context.Current.Request.QueryString.Get("debugmode")!;
}
if( debugmode=="true" )
{
WriteLiteral(@" <table class=""table table-sm table-bordered table-striped"" id=""debug-table"" style=""border-color: white;font-size: 13px;"">
<tr>
<thead>
<th style=""background-color: #3498db; color:white;"" width=""50%"">Action Code</th>
<th style=""background-color: #3498db; color:white;"" width=""50%"">Debug Print</th>
</thead>
</tr>
<tr>
<td><textarea id=""actioncode"" class=""debugterminal""></textarea>
<br><button onclick=""runactioncode()"" class=""retro-btn"">Execute</button>
</td>
<td><pre class=""debugterminal"" id=""jsonViewer""></pre>
<button onclick=""cleardebug()"" class=""retro-btn"">Clear</button>
</td>
</tr>
</table>
");
100
}
WriteLiteral("\n<script>\n function runactioncode() {\n\t\n\t updateModelForm({rundebugaction:true});\n }\n\n\t\t\nconsole.log(");
101 Write(Raw(jsonTxt));
102 WriteLiteral(");\n</script>\n \n\t</body>\n\n</html>\n\n");
103 }
104 #pragma warning restore 1998
105
bool AllowTracking()
{
bool allowTracking = true;
if (CookieManager.IsCookieManagementActive)
{
var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
var cookieOptInCategories = CookieManager.GetCookieOptInCategories();
bool consentEither = (cookieOptInCategories.Contains("Statistical") || cookieOptInCategories.Contains("Marketing"));
bool consentFunctional = cookieOptInLevel == CookieOptInLevel.Functional;
bool consentAtLeastOne = cookieOptInLevel == CookieOptInLevel.All || (consentFunctional && consentEither);
allowTracking = consentAtLeastOne;
}
return allowTracking;
}
}
106 }
107 #pragma warning restore 1591
108
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
@using System
@using Dynamicweb
@using Dynamicweb.Environment
@using Dynamicweb.Frontend
@using Dynamicweb.Frontend.Devices
@using Dynamicweb.Rendering
@{
Pageview.Meta.AddTag("fb:app_id", Model.Area?.Item?.GetString("FacebookAppId"));
Pageview.Meta.AddTag("google-site-verification", Model.Area?.Item?.GetString("GoogleSiteVerification"));
Pageview.Meta.AddTag("site_name", Model.Area?.Item?.TryGetString("MetaSiteName", out string? siteName) is true ? siteName : Model.Area?.Name);
Pageview.Meta.AddTag("url", Pageview.Meta.Canonical?.ToString());
Pageview.Meta.AddTag("twitter:site", Model.Area?.Item?.GetString("TwitterSite"));
Pageview.Meta.AddOpenGraphTag("type", "website");
Pageview.Meta.AddOpenGraphTag("url", Pageview.Meta.Canonical?.ToString());
Pageview.Meta.AddOpenGraphTag("title", Model.Title);
Pageview.Meta.AddOpenGraphTag("description", Model.Description);
if (Model.Area?.Item?.TryGetImageFile("MetaImage", out ImageFileViewModel? image) ?? false) {
Pageview.Meta.AddOpenGraphTag("image", image.Path);
Pageview.Meta.AddOpenGraphTag("image:alt", Model.Area?.Item?.GetString("MetaImageALT"));
}
string? googleTagManagerID = string.Empty;
if (Model.Area?.Item?.TryGetString("GoogleTagManagerID", out googleTagManagerID) ?? false)
{
googleTagManagerID = googleTagManagerID.Trim();
}
@* Stylesheets *@
AddStylesheet("/Files/Templates/Designs/Swift-v2/Assets/css/swift.css");
@* Color schemes stylesheet *@
@if (Model.TryGetColorSchemeStyle(out string? colorSchemeStyle))
{
AddStylesheet(colorSchemeStyle);
}
@* Button stylesheet *@
@if (Model.TryGetButtonStyle(out string? buttonStyle)) {
AddStylesheet(buttonStyle);
}
@* Typography stylesheet *@
@if (Model.TryGetTypographyStyle(out string? typographyStyle)) {
AddStylesheet(typographyStyle);
}
@* Scripts *@
AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/bootstrap/dist/js/bootstrap.bundle.min.js");
AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/htmx.org/dist/htmx.min.js");
AddScript("/Files/Templates/Designs/Swift-v2/Assets/js/swift.js");
@* Custom <head> include *@
if (Model.Area?.Item?.TryGetFile("CustomHeadInclude", out FileViewModel? customHeadInclude) ?? false)
{
@RenderPartial($"Designs/Swift-v2/Custom/{customHeadInclude?.Name}")
}
}
<!doctype html>
<html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName" data-swift-version="@(ReadFile("/Files/Templates/Designs/Swift-v2/swift_version.txt")?.Trim())">
<head>
@* Required meta tags *@
<meta charset="utf-8">
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
@if (Model.Area?.Item?.TryGetImageFile("Favicon", out ImageFileViewModel? faviconImage) ?? false)
{
<link rel="shortcut icon" href="@faviconImage?.Path">
}
@if (Model.Area?.Item?.TryGetImageFile("AppleTouchIcon", out ImageFileViewModel? appleTouchIconImage) ?? false)
{
<link rel="apple-touch-icon" href="@appleTouchIconImage?.Path">
}
@* Pageview Meta *@
<title>@Model.Title</title>
@* MetaTags *@
@Model.MetaTags
@* Get stylesheets *@
@Model.GetStylesheetsMarkup()
@* Media Query Limit *@
@if(Model.Area?.Item?.TryGetString("MediaQueryLimit", out string? mediaQueryLimit) ?? false) {
<style>
@@media screen and (min-width: @(mediaQueryLimit)px) {
[data-swift-container] {
--dw-container-limit: @(mediaQueryLimit)px;
}
[data-swift-container],
[data-dw-container-width="3"] {
--dw-container-width: calc(var(--dw-container-limit) * .8);
}
[data-dw-container-width="1"] {
--dw-container-width: var(--swift-text-width);
}
[data-dw-container-width="2"] {
--dw-container-width: calc(var(--dw-container-limit) * .65);
}
}
</style>
}
@* Get scripts *@
@Model.GetScriptsMarkup()
@* Google gtag method - always include even if it is not used for anything *@
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
</script>
@* Google tag manager *@
@if (!string.IsNullOrWhiteSpace(googleTagManagerID))
{
<script>
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied'
});
</script>
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
}); var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
</script>
if (AllowTracking())
{
<script>
gtag('consent', 'update', {
'ad_storage': '@CookieManager.IsCookieOptInGranted("Marketing")',
'ad_user_data': '@CookieManager.IsCookieOptInGranted("Marketing")',
'ad_personalization': '@CookieManager.IsCookieOptInGranted("Marketing")',
'analytics_storage': '@CookieManager.IsCookieOptInGranted("Statistical")'
});
</script>
}
}
</head>
<body data-dw-page-id="@(Model.ID)" data-dw-itemtype="@Model.Item?.SystemName?.ToLower()">
@* Google tag manager *@
@if (!string.IsNullOrWhiteSpace(googleTagManagerID) && AllowTracking())
{
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
}
@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
@using DW_CPQ_API
@{
ModelController modelController = new ModelController(Pageview.Page.ID, Dynamicweb.Context.Current.Request.Params);
var jsontxt = System.Text.Json.JsonSerializer.Serialize(modelController.DocumentResult);
var model = modelController.DocumentResult;
string jsonTxt = System.Text.Json.JsonSerializer.Serialize(model);
string datakeyline = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form["itemdatakeyline"]) ? Dynamicweb.Context.Current.Request.Form["itemdatakeyline"] : "";
<input type="hidden" id="model_version_id" value="@(modelController.ModelVersionId)" />
<input type="hidden" id="itemdatakeyline" value="@(datakeyline)" />
string? paragraphId = Dynamicweb.Context.Current?.Request?.QueryString.Get("ParagraphID") ?? null;
}
@if (paragraphId is not null) {
@RenderParagraphContent(Convert.ToInt32(paragraphId))
}
else
{
@Model.Grid("Grid", "Grid", "default:true;sort:1", "Page")
@* Render classic content, if any *@
@Model.Placeholder("dwcontent", "content", "default:true;sort:1")
}
@{
string debugmode ="";
if( Dynamicweb.Context.Current.Request.QueryString.Get("debugmode") != null)
{
debugmode= Dynamicweb.Context.Current.Request.QueryString.Get("debugmode")!;
}
if( debugmode=="true" )
{
<table class="table table-sm table-bordered table-striped" id="debug-table" style="border-color: white;font-size: 13px;">
<tr>
<thead>
<th style="background-color: #3498db; color:white;" width="50%">Action Code</th>
<th style="background-color: #3498db; color:white;" width="50%">Debug Print</th>
</thead>
</tr>
<tr>
<td><textarea id="actioncode" class="debugterminal"></textarea>
<br><button onclick="runactioncode()" class="retro-btn">Execute</button>
</td>
<td><pre class="debugterminal" id="jsonViewer"></pre>
<button onclick="cleardebug()" class="retro-btn">Clear</button>
</td>
</tr>
</table>
}
}
<script>
function runactioncode() {
updateModelForm({rundebugaction:true});
}
console.log(@Raw(jsonTxt));
</script>
</body>
</html>
@functions {
bool AllowTracking()
{
bool allowTracking = true;
if (CookieManager.IsCookieManagementActive)
{
var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
var cookieOptInCategories = CookieManager.GetCookieOptInCategories();
bool consentEither = (cookieOptInCategories.Contains("Statistical") || cookieOptInCategories.Contains("Marketing"));
bool consentFunctional = cookieOptInLevel == CookieOptInLevel.Functional;
bool consentAtLeastOne = cookieOptInLevel == CookieOptInLevel.All || (consentFunctional && consentEither);
allowTracking = consentAtLeastOne;
}
return allowTracking;
}
}