Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): SHUTDOWN is in progress.
Login failed for user 'Acton_Prod'.
Cannot continue the execution because the session is in the kill state.
A severe error occurred on the current command. The results, if any, should be discarded.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at Dynamicweb.Data.Database.CreateDataReader(IDbCommand command, CommandBehavior behavior)
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, CommandBehavior behavior, Int32 commandTimeout)
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductById(String productId, String productVariantId, String productLanguageId)
at Dynamicweb.Ecommerce.Products.ProductService.FetchMissingProductsInternal(IProductRepository repo, IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, User user, Boolean showUntranslated)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, Boolean useAssortments)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId)
at CompiledRazorTemplates.Dynamic.RazorEngine_b24b85ea35cd40369e4bbe7ccd2b383d.Execute() in D:\Dynamicweb.net\Solutions\Easyflow\Acton-Prod\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 345
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
ClientConnectionId:2254bb65-6948-4a37-8fc6-8b7eca2f9c75
Error Number:6005,State:1,Class:14
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2 @using System
3 @using Dynamicweb
4 @using Dynamicweb.Environment
5 @using Dynamicweb.Frontend
6
7 @{
8 string swiftVersion = ReadFile("/Files/Templates/Designs/Swift/swift_version.txt");
9 bool renderAsResponsive = Model.Area.Item.GetString("DeviceRendering", "responsive").Equals("responsive", StringComparison.OrdinalIgnoreCase);
10 bool renderMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile || Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Tablet;
11 string responsiveClassDesktop = string.Empty;
12 string responsiveClassMobile = string.Empty;
13 if (renderAsResponsive)
14 {
15 responsiveClassDesktop = " d-none d-xl-block";
16 responsiveClassMobile = " d-block d-xl-none";
17 }
18
19 var disableWideBreakpoints = Model.Area?.Item?.GetRawValueString("DisableWideBreakpoints", "default");
20
21 var brandingPageId = Model.Area.Item.GetLink("BrandingPage") != null ? Model.Area.Item.GetLink("BrandingPage").PageId : 0;
22 var themePageId = Model.Area.Item.GetLink("ThemesPage") != null ? Model.Area.Item.GetLink("ThemesPage").PageId : 0;
23 string customHeaderInclude = Model.Area.Item.GetFile("CustomHeaderInclude") != null ? Model.Area.Item.GetFile("CustomHeaderInclude").Name : string.Empty;
24
25 var brandingPage = Dynamicweb.Content.Services.Pages?.GetPage(brandingPageId) ?? null;
26 var themesParagraphLastChanged = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(themePageId).OrderByDescending(p => p.Audit.LastModifiedAt).FirstOrDefault();
27
28 var cssLastModified = brandingPage.Audit.LastModifiedAt > themesParagraphLastChanged.Audit.LastModifiedAt ? brandingPage.Audit.LastModifiedAt : themesParagraphLastChanged.Audit.LastModifiedAt;
29 var cssThemeAndBrandingStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath($"/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css"));
30
31 // Schema.org details for PDP
32 string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : "";
33 bool isProductDetailsPage = !string.IsNullOrEmpty(productId);
34 bool isArticlePage = Model.ItemType == "Swift_Article";
35 string schemaOrgType = string.Empty;
36
37 if (isProductDetailsPage)
38 {
39 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Product\"";
40 }
41
42 if (isArticlePage)
43 {
44 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Article\"";
45 }
46
47 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < brandingPage.Audit.LastModifiedAt)
48 {
49 //Branding page has been saved or the file is missing. Rewrite the file to disc.
50 if (brandingPageId > 0)
51 {
52 var brandingPageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(brandingPageId);
53 brandingPageview.Redirect = false;
54 brandingPageview.Output();
55 }
56 }
57
58 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < themesParagraphLastChanged.Audit.LastModifiedAt)
59 {
60 //Branding page has been saved or the file is missing. Rewrite the file to disc.
61 if (themePageId > 0)
62 {
63 var themePageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(themePageId);
64 themePageview.Redirect = false;
65 themePageview.Output();
66 }
67 }
68
69 var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/css/styles.css"));
70 var jsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/js/scripts.js"));
71
72 string masterTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("Theme")) ? " theme " + Model.Area.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
73
74 string favicon = Model.Area.Item.GetFile("Favicon") != null ? Model.Area.Item.GetFile("Favicon").Path : "/Files/Templates/Designs/Swift/Assets/Images/favicon.png";
75
76 string headerCssClass = "sticky-top";
77 bool movePageBehind = false;
78
79 if (Pageview.Page.PropertyItem != null)
80 {
81 headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top";
82 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false;
83 }
84
85 headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass;
86 headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass;
87
88 string googleTagManagerID = Model.Area.Item.GetString("GoogleTagManagerID");
89 string googleAnalyticsMeasurementID = Model.Area.Item.GetString("GoogleAnalyticsMeasurementID");
90 var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
91 bool allowTracking = cookieOptInLevel == CookieOptInLevel.All || (cookieOptInLevel == CookieOptInLevel.Functional && CookieManager.GetCookieOptInCategories().Contains("Statistical"));
92
93 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/css/styles.css?{cssStyleFileInfo.LastWriteTime.Ticks}>; rel=preload; as=style;");
94 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css?{cssLastModified.Ticks}; rel=preload; as=style;");
95 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/aos.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
96 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/scripts.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
97 //Dynamicweb.Context.Current.Response.Flush(); //This sends the headers where we are now in the rendering making the TTFB faster
98
99 SetMetaTags();
100
101 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
102
103 if (Pageview.Area.IsMaster)
104 {
105 languages.Add(Pageview.Page);
106 if (Pageview.Page.Languages != null)
107 {
108 foreach (var language in Pageview.Page.Languages)
109 {
110 languages.Add(language);
111 }
112 }
113 }
114 else
115 {
116 languages.Add(Pageview.Page.MasterPage);
117 if (Pageview.Page.MasterPage != null)
118 {
119 if (Pageview.Page.MasterPage.Languages != null)
120 {
121 foreach (var language in Pageview.Page.MasterPage.Languages)
122 {
123 languages.Add(language);
124 }
125 }
126 }
127 }
128
129 string siteLanguage = Pageview.Area.CultureInfo.Name;
130 Uri url = Dynamicweb.Context.Current.Request.Url;
131 string hostName = url.Host; // domain.com/da-dk or domain.com/en-us
132
133 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries();
134 var ecomCurrencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies();
135 }
136 <!doctype html>
137 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
138 <head>
139 <!-- @swiftVersion -->
140 @* Required meta tags *@
141 <meta charset="utf-8">
142 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
143 <link rel="shortcut icon" href="@favicon">
144 <link rel="apple-touch-icon" href="/Files/Templates/Designs/Swift/Assets/Images/logo_transparent.png">
145
146 @Model.MetaTags
147
148 @{
149 @* Languages meta data *@
150 foreach (var language in languages)
151 {
152 if (language?.Area != null)
153 {
154 if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
155 {
156 if (!string.IsNullOrEmpty(language.Area.DomainLock))
157 {
158 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
159 }
160 string querystring = $"Default.aspx?ID={language.ID}";
161 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
162 {
163 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
164 }
165 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
166 {
167 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
168 }
169 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
170 {
171 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
172 }
173
174 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
175 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
176
177 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
178 }
179 }
180 }
181 }
182
183 <title>@Model.Title</title>
184 @* Bootstrap + Swift stylesheet *@
185 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
186
187 @if (disableWideBreakpoints != "disableBoth")
188 {
189 <style>
190 @@media ( min-width: 1600px ) {
191 .container-xxl,
192 .container-xl,
193 .container-lg,
194 .container-md,
195 .container-sm,
196 .container {
197 max-width: 1520px;
198 }
199 }
200 </style>
201
202
203
204 if (disableWideBreakpoints != "disableUltraWideOnly")
205 {
206 <style>
207 @@media ( min-width: 1920px ) {
208 .container-xxl,
209 .container-xl,
210 .container-lg,
211 .container-md,
212 .container-sm,
213 .container {
214 max-width: 1820px;
215 }
216 }
217 </style>
218 }
219 }
220
221 @* Branding and Themes min stylesheet *@
222 <link href="/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_@(Model.Area.ID).min.css?@cssLastModified.Ticks" rel="stylesheet" media="all" type="text/css" data-last-modified-content="@cssLastModified">
223 <link href="/Files/Templates/Designs/Swift/Assets/css/custom.css" rel="stylesheet" media="all">
224 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
225 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
226
227 @* Weply Chatbot *@
228 <script src="https://app.weply.chat/widget/f140e68600660494c797a48ba2d535ec" async></script>
229
230 <script type="module">
231 AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
232 swift.Scroll.hideHeadersOnScroll();
233 swift.Scroll.handleAlternativeTheme();
234 </script>
235
236 @* Google tag manager *@
237 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
238 {
239 <script>
240 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
241 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
242 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
243 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
244 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
245
246 function gtag() { dataLayer.push(arguments); }
247 </script>
248 }
249
250 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
251 {
252 var GoogleAnalyticsDebugMode = "";
253 bool isLoggedInBackendUser = false;
254
255 if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null)
256 {
257 isLoggedInBackendUser = true;
258 }
259
260 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser)
261 {
262 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
263 }
264
265 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
266 <script>
267 window.dataLayer = window.dataLayer || [];
268 function gtag() { dataLayer.push(arguments); }
269 gtag('js', new Date());
270 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
271 </script>
272 }
273
274 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
275 {
276 @RenderPartial($"Components/Custom/{customHeaderInclude}")
277 }
278 </head>
279 <body class="brand @(masterTheme)" id="page@(Model.ID)">
280
281 @* Google tag manager *@
282 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
283 {
284 <noscript>
285 <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)"
286 height="0" width="0" style="display:none;visibility:hidden"></iframe>
287 </noscript>
288 }
289
290 @if (renderAsResponsive || !renderMobile)
291 {
292 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
293 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
294 {
295 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
296 }
297 </header>
298 }
299
300 @if ((renderAsResponsive || renderMobile))
301 {
302 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
303 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
304 {
305 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
306 }
307 </header>
308 }
309
310 <main id="content" @(schemaOrgType)>
311 <div data-intersect></div>
312 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
313 @using System
314 @using Dynamicweb.Ecommerce.ProductCatalog
315
316
317 @{
318 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
319 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
320
321 bool isArticlePagePage = Model.ItemType == "Swift_Article";
322 bool isArticleListPage = Model.ItemType == "Swift_ArticleListPage";
323 string schemaOrgProp = string.Empty;
324 if(isArticlePagePage)
325 {
326 schemaOrgProp = "itemprop=\"articleBody\"";
327 }
328
329 string theme = "";
330 string gridContent = "";
331
332 if (Model.PropertyItem != null)
333 {
334 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? "theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
335 }
336
337 if (Model.Item != null || Pageview.IsVisualEditorMode)
338 {
339 if (!isProductDetail)
340 {
341 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
342 }
343 else
344 {
345 var productObject = Dynamicweb.Ecommerce.Services.Products.GetProductById(productIdFromUrl, "", Pageview.Area.EcomLanguageId);
346 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
347 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
348
349 @RenderGrid(detailPageId)
350 }
351 }
352
353 bool doNotRenderPage = false;
354
355 //Check if we are on the poduct detail page, and if there is data to render
356 ProductViewModel product = new ProductViewModel();
357 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
358 {
359 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
360 if (string.IsNullOrEmpty(product.Id)) {
361 doNotRenderPage = true;
362 }
363 }
364
365 //Render the page
366 if (!doNotRenderPage) {
367 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
368
369
370 <div class="@theme @itemIdentifier" @schemaOrgProp>
371 @if (isArticleListPage)
372 {
373 var hx = $"hx-get=\"{Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Model.ID)}\" hx-select=\"#content\" hx-target=\"#content\" hx-swap=\"outerHTML\" hx-trigger=\"change\" hx-headers='{{\"feed\": \"true\"}}' hx-push-url=\"true\" hx-indicator=\"#ArticleFacetForm\"";
374
375 <form @hx id="ArticleFacetForm">
376 @gridContent
377 </form>
378 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/htmx.js"></script>
379 <script type="module">
380 document.addEventListener('htmx:confirm', (event) => {
381 let filters = event.detail.elt.querySelectorAll('select');
382 for (var i = 0; i < filters.length; i++) {
383 let input = filters[i];
384 if (input.name && !input.value) {
385 input.name = '';
386 }
387 }
388 });
389
390 document.addEventListener('htmx:beforeOnLoad', (event) => {
391 swift.Scroll.stopIntersectionObserver();
392 });
393
394 document.addEventListener('htmx:afterOnLoad', () => {
395 swift.Scroll.hideHeadersOnScroll();
396 swift.Scroll.handleAlternativeTheme();
397 });
398 </script>
399 }
400 else
401 {
402 @gridContent
403 }
404 </div>
405
406 } else {
407 <div class="container">
408 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
409 </div>
410 }
411
412 if (!Model.IsCurrentUserAllowed)
413 {
414 int signInPage = GetPageIdByNavigationTag("SignInPage");
415 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
416
417 if (!Pageview.IsVisualEditorMode)
418 {
419 if (signInPage != 0)
420 {
421 if (signInPage != Model.ID) {
422 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
423 } else {
424 if (dashboardPage != 0) {
425 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
426 } else {
427 Dynamicweb.Context.Current.Response.Redirect("/");
428 }
429 }
430 }
431 else
432 {
433 <div class="alert alert-dark m-0" role="alert">
434 <span>@Translate("You do not have access to this page")</span>
435 </div>
436 }
437 }
438 else
439 {
440 <div class="alert alert-dark m-0" role="alert">
441 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
442 </div>
443 }
444 }
445 }
446
447 </main>
448
449 @if (renderAsResponsive || !renderMobile)
450 {
451 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
452 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
453 {
454 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
455 }
456 </footer>
457 }
458
459 @if (renderAsResponsive || renderMobile)
460 {
461 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
462 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
463 {
464 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
465 }
466 </footer>
467 }
468
469 @* Render any offcanvas menu here *@
470 @RenderSnippet("offcanvas")
471
472 @{
473 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
474 }
475
476 @* Language selector modal *@
477 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
478 {
479 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
480 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
481 @* The content here comes from an external request *@
482 </div>
483 </div>
484 }
485
486 @* Favorite toast *@
487 <div aria-live="polite" aria-atomic="true">
488 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
489 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
490 <div class="toast-header">
491 <strong class="me-auto">@Translate("Favorite list updated")</strong>
492 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
493 </div>
494 <div class="toast-body d-flex gap-3">
495 <div id="favoriteNotificationToast_Image"></div>
496 <div id="favoriteNotificationToast_Text"></div>
497 </div>
498 </div>
499 </div>
500 </div>
501
502 @* Modal for dynamic content *@
503 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
504 <div class="modal-dialog modal-dialog-centered modal-md">
505 <div class="modal-content theme light" id="DynamicModalContent">
506 @* The content here comes from an external request *@
507 </div>
508 </div>
509 </div>
510
511 @* Offcanvas for dynamic content *@
512 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
513 @* The content here comes from an external request *@
514 </div>
515
516 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
517 {
518 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
519
520 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
521 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
522 <div class="toast-header">
523 <strong class="me-auto">@Translate("Connection down")</strong>
524 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
525 </div>
526 <div class="toast-body">
527 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
528 </div>
529 </div>
530 </div>
531 }
532 </body>
533 </html>
534 @functions {
535 void SetMetaTags()
536 {
537 //Verification Tokens
538 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
539 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
540 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
541 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
542 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
543 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
544
545 //Generic Site Values
546 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
547 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
548 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
549
550 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
551
552 //Page specific values
553 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
554 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
555 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
556 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
557
558 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
559 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
560 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
561 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
562 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
563
564 if (!string.IsNullOrEmpty(siteVerificationGoogle))
565 {
566 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
567 }
568
569 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
570 {
571 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
572 }
573
574 if (!string.IsNullOrEmpty(openGraphType))
575 {
576 Pageview.Meta.AddTag("og:type", openGraphType);
577 }
578
579 if (!string.IsNullOrEmpty(openGraphSiteName))
580 {
581 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
582 }
583
584 if (!string.IsNullOrEmpty(Model.Title))
585 {
586 Pageview.Meta.AddTag("og:title", Model.Title);
587 }
588 else
589 {
590 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
591 }
592
593 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
594 {
595 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
596 }
597
598 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
599 {
600 if (!string.IsNullOrEmpty(Model.Description))
601 {
602 Pageview.Meta.AddTag("og:description", Model.Description);
603 }
604 else
605 {
606 Pageview.Meta.AddTag("og:description", openGraphDescription);
607 }
608 if (openGraphImage != null)
609 {
610 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
611 }
612
613 if (!string.IsNullOrEmpty(openGraphImageALT))
614 {
615 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
616 }
617 if (!string.IsNullOrEmpty(twitterCardDescription))
618 {
619 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
620 }
621
622 if (twitterCardImage != null)
623 {
624 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
625 }
626
627 if (!string.IsNullOrEmpty(twitterCardImageALT))
628 {
629 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
630 }
631 }
632
633 if (!string.IsNullOrEmpty(twitterCardSite))
634 {
635 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
636 }
637
638 if (!string.IsNullOrEmpty(twitterCardURL))
639 {
640 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
641 }
642
643 if (!string.IsNullOrEmpty(twitterCardTitle))
644 {
645 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
646 }
647 }
648 }