
K2 Merge Road Bike cc
10103
EUR 103,81
InStock
197
In stock
• 2-3 days delivery
Error compiling template "Designs/Swift/Navigation/Navigation.cshtml" Line 211: 'User.GetCurrentSecondaryUser()' is obsolete: 'Use UserContext.Current.ImpersonatingUser instead.' Line 416: 'Order' does not contain a definition for 'GetParentOrderLineCount' and no accessible extension method 'GetParentOrderLineCount' accepting a first argument of type 'Order' could be found (are you missing a using directive or an assembly reference?)
1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb; 11 using System.Text.RegularExpressions; 12 internal class RazorEngine_4b5ed526e74f4a5589198b230c541106 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\r\n"); 18 19 string theme = !string.IsNullOrEmpty(Model.Parameters["Theme"].ToString()) ? Model.Parameters["Theme"].ToString() : string.Empty; 20 string navOrientation = !string.IsNullOrEmpty(Model.Parameters["NavOrientation"].ToString()) ? Model.Parameters["NavOrientation"].ToString() : string.Empty; 21 string navAlignment = !string.IsNullOrEmpty(Model.Parameters["NavAlignment"].ToString()) ? Model.Parameters["NavAlignment"].ToString() : string.Empty; 22 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 23 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 24 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 25 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 26 string iconSize = "icon-3"; 27 28 if (linkFontSize == "fs-7") 29 { 30 iconSize = "icon-2"; 31 } 32 if (linkFontSize == "fs-5") 33 { 34 iconSize = "icon-4"; 35 } 36 WriteLiteral("\r\n<nav"); 37 BeginWriteAttribute("class", " class=\"", 1373, "\"", 1422, 4); 38 WriteAttributeValue("", 1381, "d-flex", 1381, 6, true); 39 WriteAttributeValue(" ", 1387, "py-0", 1388, 5, true); 40 WriteAttributeValue(" ", 1392, navOrientation, 1393, 15, false); 41 WriteAttributeValue(" ", 1408, navAlignment, 1409, 13, false); 42 EndWriteAttribute(); 43 WriteLiteral(">\r\n"); 44 RenderFirstLevelNodes(Model.Nodes, theme, navOrientation, linkFontWeight, linkCasing, linkFontSize, iconSize, layout);WriteLiteral("</nav>\r\n\r\n"); 45 WriteLiteral("\r\n"); 46 WriteLiteral("\r\n"); 47 WriteLiteral("\r\n"); 48 } 49 #pragma warning restore 1998 50 51 void RenderFirstLevelNodes(IEnumerable<Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel> nodes, string theme, string navOrientation, string linkFontWeight, string linkCasing, string linkFontSize, string iconSize, string layout) 52 { 53 bool showOnlyFirstNavLevel = Model.Parameters.ContainsKey("ShowOnlyFirstNavLevel") ? Convert.ToBoolean(Model.Parameters["ShowOnlyFirstNavLevel"].ToString()) : false; 54 int currentParagraphId = Pageview.CurrentParagraph.ID; 55 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 56 57 WriteLiteral("\t<ul"); 58 BeginWriteAttribute("class", " class=\"", 2200, "\"", 2288, 3); 59 WriteAttributeValue("", 2208, "nav", 2208, 3, true); 60 WriteAttributeValue(" ", 2211, "flex-nowrap", 2212, 12, true); 61 WriteAttributeValue(" ", 2223, navOrientation == "vertical" ? "flex-column" : navOrientation, 2224, 64, false); 62 EndWriteAttribute(); 63 WriteLiteral(">\r\n\r\n"); 64 foreach (var node in nodes) 65 { 66 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 67 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 68 string pageIcon = string.Empty; 69 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 70 { 71 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 72 } 73 string preferencesLayout = page.Item?["PreferencesLayout"] != null ? page.Item["PreferencesLayout"].ToString() : ""; 74 string preferencesType = "language"; 75 bool countrySelector = page.Item?["CountrySelector"] != null ? Convert.ToBoolean(page.Item["CountrySelector"].ToString()) : false; 76 bool languageSelector = page.Item?["LanguageSelector"] != null ? Convert.ToBoolean(page.Item["LanguageSelector"].ToString()) : false; 77 bool currencySelector = page.Item?["CurrencySelector"] != null ? Convert.ToBoolean(page.Item["CurrencySelector"].ToString()) : false; 78 string dropdownAttributes = string.Empty; 79 string dropdownClasses = string.Empty; 80 81 var hasChildren = node.Nodes.Count() > 0 || pageType == "Swift_SignIn"; 82 83 if (hasChildren && !showOnlyFirstNavLevel) 84 { 85 dropdownAttributes = hasChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 86 } 87 88 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Navigation_" + node.GroupId + "_" + currentParagraphId : "Navigation_Page_Desktop_" + node.PageId.ToString() + "_" + currentParagraphId; 89 90 if (pageType != "Swift_Preferences") 91 { 92 WriteLiteral("\t\t\t\t<li"); 93 BeginWriteAttribute("class", " class=\"", 3927, "\"", 3976, 2); 94 WriteAttributeValue("", 3935, "nav-item", 3935, 8, true); 95 WriteAttributeValue("", 3943, hasChildren ? " dropdown" : "", 3943, 33, false); 96 EndWriteAttribute(); 97 WriteLiteral(">\r\n"); 98 if (node.IsClickable) 99 { 100 WriteLiteral("\t\t\t\t\t\t<a"); 101 BeginWriteAttribute("href", " href=\"", 4025, "\"", 4042, 1); 102 WriteAttributeValue("", 4032, node.Link, 4032, 10, false); 103 EndWriteAttribute(); 104 BeginWriteAttribute("class", " class=\"", 4043, "\"", 4222, 9); 105 WriteAttributeValue("", 4051, "p-2", 4051, 3, true); 106 WriteAttributeValue(" ", 4054, "nav-link", 4055, 9, true); 107 WriteAttributeValue(" ", 4063, "text-nowrap", 4064, 12, true); 108 WriteAttributeValue(" ", 4075, "text-decoration-underline-hover", 4076, 32, true); 109 WriteAttributeValue(" ", 4107, linkFontSize, 4108, 13, false); 110 WriteAttributeValue(" ", 4121, linkFontWeight, 4122, 15, false); 111 WriteAttributeValue(" ", 4137, linkCasing, 4138, 11, false); 112 WriteAttributeValue("", 4149, node.IsActive ? " active" : "", 4149, 33, false); 113 WriteAttributeValue("", 4182, hasChildren ? " dropdown-toggle" : "", 4182, 40, false); 114 EndWriteAttribute(); 115 WriteLiteral(" "); 116 Write(dropdownAttributes); 117 WriteLiteral(" "); 118 Write(node.IsActive ? " aria-current='page'" : ""); 119 WriteLiteral(" id=\""); 120 Write(nodeId); 121 WriteLiteral("\">\r\n"); 122 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);WriteLiteral("\t\t\t\t\t\t</a>\r\n"); 123 } 124 else 125 { 126 WriteLiteral("\t\t\t\t\t\t<span"); 127 BeginWriteAttribute("class", " class=\"", 4449, "\"", 4564, 7); 128 WriteAttributeValue("", 4457, "p-2", 4457, 3, true); 129 WriteAttributeValue(" ", 4460, "nav-link", 4461, 9, true); 130 WriteAttributeValue(" ", 4469, "text-nowrap", 4470, 12, true); 131 WriteAttributeValue(" ", 4481, linkFontSize, 4482, 13, false); 132 WriteAttributeValue(" ", 4495, linkFontWeight, 4496, 15, false); 133 WriteAttributeValue(" ", 4511, linkCasing, 4512, 11, false); 134 WriteAttributeValue("", 4523, hasChildren ? " dropdown-toggle " : "", 4523, 41, false); 135 EndWriteAttribute(); 136 WriteLiteral(" "); 137 Write(dropdownAttributes); 138 WriteLiteral(" id=\""); 139 Write(nodeId); 140 WriteLiteral("\">\r\n"); 141 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);WriteLiteral("\t\t\t\t\t\t</span>\r\n"); 142 } 143 WriteLiteral("\r\n"); 144 if (hasChildren) 145 { 146 if (!showOnlyFirstNavLevel) 147 { 148 WriteLiteral("\t\t\t\t\t\t\t<ul"); 149 BeginWriteAttribute("class", " class=\"", 4805, "\"", 4835, 2); 150 WriteAttributeValue("", 4813, "dropdown-menu", 4813, 13, true); 151 WriteAttributeValue(" ", 4826, theme, 4827, 8, false); 152 EndWriteAttribute(); 153 BeginWriteAttribute("aria-labelledby", " aria-labelledby=\"", 4836, "\"", 4861, 1); 154 WriteAttributeValue("", 4854, nodeId, 4854, 7, false); 155 EndWriteAttribute(); 156 WriteLiteral(">\r\n"); 157 foreach (var subnode in node.Nodes)//Standard pages 158 { 159 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Navigation_" + subnode.GroupId + "_" + currentParagraphId : "Navigation_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 160 161 WriteLiteral("\t\t\t\t\t\t\t\t\t<li>\r\n"); 162 if (subnode.IsClickable) 163 { 164 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<a"); 165 BeginWriteAttribute("href", " href=\"", 5214, "\"", 5234, 1); 166 WriteAttributeValue("", 5221, subnode.Link, 5221, 13, false); 167 EndWriteAttribute(); 168 BeginWriteAttribute("class", " class=\"", 5235, "\"", 5335, 6); 169 WriteAttributeValue("", 5243, "dropdown-item", 5243, 13, true); 170 WriteAttributeValue(" ", 5256, "py-2", 5257, 5, true); 171 WriteAttributeValue(" ", 5261, "text-decoration-underline-hover", 5262, 32, true); 172 WriteAttributeValue(" ", 5293, linkFontSize, 5294, 13, false); 173 WriteAttributeValue(" ", 5307, linkFontWeight, 5308, 15, false); 174 WriteAttributeValue(" ", 5323, linkCasing, 5324, 11, false); 175 EndWriteAttribute(); 176 WriteLiteral(" "); 177 Write(subnode.IsActive ? " aria-current='page'" : ""); 178 WriteLiteral(" id=\""); 179 Write(nodeId); 180 WriteLiteral("\">"); 181 Write(subnode.Name); 182 WriteLiteral("</a>\r\n"); 183 } 184 else 185 { 186 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<span"); 187 BeginWriteAttribute("class", " class=\"", 5477, "\"", 5545, 5); 188 WriteAttributeValue("", 5485, "dropdown-item", 5485, 13, true); 189 WriteAttributeValue(" ", 5498, "py-2", 5499, 5, true); 190 WriteAttributeValue(" ", 5503, linkFontSize, 5504, 13, false); 191 WriteAttributeValue(" ", 5517, linkFontWeight, 5518, 15, false); 192 WriteAttributeValue(" ", 5533, linkCasing, 5534, 11, false); 193 EndWriteAttribute(); 194 WriteLiteral(" "); 195 Write(subnode.IsActive ? " aria-current='page'" : ""); 196 WriteLiteral(" id=\""); 197 Write(nodeId); 198 WriteLiteral("\">"); 199 Write(subnode.Name); 200 WriteLiteral("</span>\r\n"); 201 } 202 WriteLiteral("\t\t\t\t\t\t\t\t\t</li>\r\n"); 203 } 204 if (pageType == "Swift_SignIn") //Sign out link 205 { 206 if (Pageview.User != null) 207 { 208 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 209 210 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<li><hr class=\"dropdown-divider\"></li>\r\n"); 211 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 212 { 213 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<a"); 214 BeginWriteAttribute("href", " href=\"", 6050, "\"", 6119, 3); 215 WriteAttributeValue("", 6057, "Default.aspx?ID=", 6057, 16, true); 216 WriteAttributeValue("", 6073, Pageview.ID, 6073, 14, false); 217 WriteAttributeValue("", 6087, "&DwExtranetRemoveSecondaryUser=1", 6087, 32, true); 218 EndWriteAttribute(); 219 BeginWriteAttribute("class", " class=\"", 6120, "\"", 6252, 7); 220 WriteAttributeValue("", 6128, "dropdown-item", 6128, 13, true); 221 WriteAttributeValue(" ", 6141, "py-2", 6142, 5, true); 222 WriteAttributeValue(" ", 6146, "text-decoration-underline-hover", 6147, 32, true); 223 WriteAttributeValue(" ", 6178, "swift_sign-out-as-customer-link", 6179, 32, true); 224 WriteAttributeValue(" ", 6210, linkFontSize, 6211, 13, false); 225 WriteAttributeValue(" ", 6224, linkFontWeight, 6225, 15, false); 226 WriteAttributeValue(" ", 6240, linkCasing, 6241, 11, false); 227 EndWriteAttribute(); 228 BeginWriteAttribute("id", " id=\"", 6253, "\"", 6290, 2); 229 WriteAttributeValue("", 6258, "SignInButton_", 6258, 13, true); 230 WriteAttributeValue("", 6271, currentParagraphId, 6271, 19, false); 231 EndWriteAttribute(); 232 WriteLiteral(">"); 233 Write(Translate("Sign out as a customer")); 234 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 235 } 236 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t<a"); 237 BeginWriteAttribute("href", " href=\"", 6394, "\"", 6406, 1); 238 WriteAttributeValue("", 6401, link, 6401, 5, false); 239 EndWriteAttribute(); 240 BeginWriteAttribute("class", " class=\"", 6407, "\"", 6527, 7); 241 WriteAttributeValue("", 6415, "dropdown-item", 6415, 13, true); 242 WriteAttributeValue(" ", 6428, "py-2", 6429, 5, true); 243 WriteAttributeValue(" ", 6433, "text-decoration-underline-hover", 6434, 32, true); 244 WriteAttributeValue(" ", 6465, "swift_sign-out-link", 6466, 20, true); 245 WriteAttributeValue(" ", 6485, linkFontSize, 6486, 13, false); 246 WriteAttributeValue(" ", 6499, linkFontWeight, 6500, 15, false); 247 WriteAttributeValue(" ", 6515, linkCasing, 6516, 11, false); 248 EndWriteAttribute(); 249 WriteLiteral(">"); 250 Write(Translate("Sign out")); 251 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 252 } 253 } 254 WriteLiteral("\t\t\t\t\t\t\t</ul>\r\n"); 255 } 256 } 257 WriteLiteral("\t\t\t\t</li>\r\n"); 258 } 259 else 260 { 261 if (preferencesLayout == "modal") 262 { 263 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 264 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 265 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 266 267 WriteLiteral("\t\t\t\t\t<li"); 268 BeginWriteAttribute("class", " class=\"", 7154, "\"", 7203, 2); 269 WriteAttributeValue("", 7162, "nav-item", 7162, 8, true); 270 WriteAttributeValue("", 7170, hasChildren ? " dropdown" : "", 7170, 33, false); 271 EndWriteAttribute(); 272 WriteLiteral(">\r\n\t\t\t\t\t\t<form"); 273 BeginWriteAttribute("action", " action=\"", 7218, "\"", 7256, 2); 274 WriteAttributeValue("", 7227, "/Default.aspx?ID=", 7227, 17, true); 275 WriteAttributeValue("", 7244, node.PageId, 7244, 12, false); 276 EndWriteAttribute(); 277 WriteLiteral(" data-response-target-element=\"PreferencesModalContent\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 278 BeginWriteAttribute("value", " value=\"", 7435, "\"", 7455, 1); 279 WriteAttributeValue("", 7443, Pageview.ID, 7443, 12, false); 280 EndWriteAttribute(); 281 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"GroupID\""); 282 BeginWriteAttribute("value", " value=\"", 7501, "\"", 7517, 1); 283 WriteAttributeValue("", 7509, groupId, 7509, 8, false); 284 EndWriteAttribute(); 285 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"ProductID\""); 286 BeginWriteAttribute("value", " value=\"", 7565, "\"", 7583, 1); 287 WriteAttributeValue("", 7573, productId, 7573, 10, false); 288 EndWriteAttribute(); 289 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"VariantID\""); 290 BeginWriteAttribute("value", " value=\"", 7631, "\"", 7649, 1); 291 WriteAttributeValue("", 7639, variantId, 7639, 10, false); 292 EndWriteAttribute(); 293 WriteLiteral(">\r\n\t\t\t\t\t\t\t<button type=\"button\" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 294 BeginWriteAttribute("class", " class=\"", 7769, "\"", 7885, 9); 295 WriteAttributeValue("", 7777, "btn", 7777, 3, true); 296 WriteAttributeValue(" ", 7780, "nav-link", 7781, 9, true); 297 WriteAttributeValue(" ", 7789, "p-2", 7790, 4, true); 298 WriteAttributeValue(" ", 7793, "text-nowrap", 7794, 12, true); 299 WriteAttributeValue(" ", 7805, "border-0", 7806, 9, true); 300 WriteAttributeValue(" ", 7814, "swift_open-preferences-modal", 7815, 29, true); 301 WriteAttributeValue(" ", 7843, linkFontSize, 7844, 13, false); 302 WriteAttributeValue(" ", 7857, linkFontWeight, 7858, 15, false); 303 WriteAttributeValue(" ", 7873, linkCasing, 7874, 11, false); 304 EndWriteAttribute(); 305 WriteLiteral(" data-bs-toggle=\"modal\" data-bs-target=\"#PreferencesModal\""); 306 BeginWriteAttribute("id", " id=\"", 7944, "\"", 7984, 2); 307 WriteAttributeValue("", 7949, "OpenPreferences_", 7949, 16, true); 308 WriteAttributeValue("", 7965, currentParagraphId, 7965, 19, false); 309 EndWriteAttribute(); 310 WriteLiteral(">\r\n"); 311 if (languageSelector) 312 { 313 { RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, "language"); } 314 } 315 else 316 { 317 { RenderNavigationItem(node, pageType, pageIcon, iconSize, layout); } 318 } 319 WriteLiteral("\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</li>\r\n"); 320 } 321 else 322 { 323 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries(); 324 var currencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies(); 325 326 if (languageSelector) 327 { 328 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); 329 330 if (Pageview.Page.Area.IsMaster) 331 { 332 languages.Add(Pageview.Page); 333 if (Pageview.Page.Languages != null) 334 { 335 foreach (var language in Pageview.Page.Languages) 336 { 337 if (language.Area.Active == true) 338 { 339 languages.Add(language); 340 } 341 } 342 } 343 } 344 else 345 { 346 languages.Add(Pageview.Page.MasterPage); 347 if (Pageview.Page.MasterPage != null) 348 { 349 if (Pageview.Page.MasterPage.Languages != null) 350 { 351 foreach (var language in Pageview.Page.MasterPage.Languages) 352 { 353 if (language.Area.Active == true) 354 { 355 languages.Add(language); 356 } 357 } 358 } 359 } 360 } 361 362 if (languages.Count > 1) 363 { 364 preferencesType = "language"; 365 366 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 367 } 368 } 369 if (countrySelector && ecomCountries.Count > 1) 370 { 371 preferencesType = "country"; 372 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 373 } 374 if (currencySelector && currencies.Count() > 1) 375 { 376 preferencesType = "currency"; 377 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 378 } 379 } 380 } 381 } 382 WriteLiteral("\t</ul>\r\n"); 383 } 384 385 void RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout, string preferencesType = "") 386 { 387 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 388 if (pageType == "Swift_Cart") //Mini cart 389 { 390 string cartId = ""; 391 if (page.Item["ContextCart"] != null) 392 { 393 cartId = !string.IsNullOrEmpty(page.Item["ContextCart"].ToString()) ? "ID=\"Cart_" + page.Item["ContextCart"].ToString() + "\"" : ""; 394 } 395 396 string jsCartClass = string.IsNullOrEmpty(cartId) ? "js-cart-qty" : ""; 397 double totalProducts = 0; 398 399 400 Dynamicweb.Ecommerce.Common.Context.CartContext = null; 401 if (page.Item["ContextCart"] != null) 402 { 403 var orderContext = Dynamicweb.Ecommerce.Services.OrderContexts.GetOrderContextById(page.Item["ContextCart"].ToString()); 404 Dynamicweb.Ecommerce.Common.Context.CartContext = orderContext; 405 } 406 407 if (Dynamicweb.Ecommerce.Common.Context.Cart != null) 408 { 409 bool renderOrderlineCountInsteadOfProductCount = page.Item["RenderOrderlineCountInsteadOfProductCount"] != null ? Convert.ToBoolean(page.Item["RenderOrderlineCountInsteadOfProductCount"]) : false; 410 if (!renderOrderlineCountInsteadOfProductCount) 411 { 412 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentProductLineQuantityCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 413 } 414 else 415 { 416 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentOrderLineCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 417 } 418 } 419 420 421 switch (layout) 422 { 423 case "linksOnly": 424 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 425 Write(node.Name); 426 WriteLiteral("</span>\r\n\t\t\t\t<span"); 427 BeginWriteAttribute("class", " class=\"", 11922, "\"", 11974, 3); 428 WriteAttributeValue("", 11930, jsCartClass, 11930, 12, false); 429 WriteAttributeValue(" ", 11942, "mini-cart-quantity", 11943, 19, true); 430 WriteAttributeValue(" ", 11961, "align-middle", 11962, 13, true); 431 EndWriteAttribute(); 432 WriteLiteral(" "); 433 Write(cartId); 434 WriteLiteral(">("); 435 Write(totalProducts); 436 WriteLiteral(")</span>\r\n"); 437 break; 438 439 case "iconsOnly": 440 { RenderIcon(pageIcon, iconSize); } 441 WriteLiteral("\t\t\t\t<span"); 442 BeginWriteAttribute("class", " class=\"", 12109, "\"", 12161, 3); 443 WriteAttributeValue("", 12117, jsCartClass, 12117, 12, false); 444 WriteAttributeValue(" ", 12129, "mini-cart-quantity", 12130, 19, true); 445 WriteAttributeValue(" ", 12148, "align-middle", 12149, 13, true); 446 EndWriteAttribute(); 447 WriteLiteral(" "); 448 Write(cartId); 449 WriteLiteral(">("); 450 Write(totalProducts); 451 WriteLiteral(")</span>\r\n"); 452 break; 453 case "iconsAndLinks": 454 { RenderIcon(pageIcon, iconSize); } 455 WriteLiteral("\t\t\t\t<span"); 456 BeginWriteAttribute("class", " class=\"", 12298, "\"", 12350, 3); 457 WriteAttributeValue("", 12306, jsCartClass, 12306, 12, false); 458 WriteAttributeValue(" ", 12318, "mini-cart-quantity", 12319, 19, true); 459 WriteAttributeValue(" ", 12337, "align-middle", 12338, 13, true); 460 EndWriteAttribute(); 461 WriteLiteral(" "); 462 Write(cartId); 463 WriteLiteral(">("); 464 Write(totalProducts); 465 WriteLiteral(")</span>\r\n\t\t\t\t<span class=\"align-middle\">"); 466 Write(node.Name); 467 WriteLiteral("</span>\r\n"); 468 break; 469 case "linksAndIcons": 470 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 471 Write(node.Name); 472 WriteLiteral("</span>\r\n\t\t\t\t<span"); 473 BeginWriteAttribute("class", " class=\"", 12532, "\"", 12584, 3); 474 WriteAttributeValue("", 12540, jsCartClass, 12540, 12, false); 475 WriteAttributeValue(" ", 12552, "mini-cart-quantity", 12553, 19, true); 476 WriteAttributeValue(" ", 12571, "align-middle", 12572, 13, true); 477 EndWriteAttribute(); 478 WriteLiteral(" "); 479 Write(cartId); 480 WriteLiteral(">("); 481 Write(totalProducts); 482 WriteLiteral(")</span>\r\n"); 483 { RenderIcon(pageIcon, iconSize); } 484 break; 485 } 486 } 487 else 488 { 489 string name = node.Name; 490 491 if (preferencesType == "country") 492 { //Country 493 name = Translate("Deliver to") + ": " + Dynamicweb.Ecommerce.Common.Context.Country.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID); 494 } 495 496 if (preferencesType == "language") 497 { //Languange 498 string iconFolder = "/Files/FlagIcons/"; 499 pageIcon = iconFolder + Pageview.Area.CultureInfo.Name.ToLower() + ".svg"; 500 Regex reg = new Regex(@"\(([^\)]+)\)"); 501 name = reg.Replace(Pageview.Area.CultureInfo.DisplayName, ""); 502 503 layout = layout == "linksOnly" ? "iconsAndLinks" : layout; 504 bool hideIcon = page.Item?["HideIcon"] != null ? Convert.ToBoolean(page.Item["HideIcon"].ToString()) : false; 505 bool hideName = page.Item?["HideName"] != null ? Convert.ToBoolean(page.Item["HideName"].ToString()) : false; 506 layout = hideIcon ? "linksOnly" : layout; 507 layout = hideName ? "iconsOnly" : layout; 508 } 509 510 if (preferencesType == "currency") 511 { //Country 512 name = Dynamicweb.Ecommerce.Common.Context.Currency.Code; 513 } 514 515 switch (layout) 516 { 517 case "linksOnly": 518 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 519 Write(name); 520 WriteLiteral("</span>\r\n"); 521 break; 522 523 case "iconsOnly": 524 WriteLiteral("\t\t\t\t<span class=\"visually-hidden\">"); 525 Write(name); 526 WriteLiteral("</span>\r\n"); 527 { RenderIcon(pageIcon, iconSize); } 528 break; 529 case "iconsAndLinks": 530 { RenderIcon(pageIcon, iconSize); } 531 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 532 Write(name); 533 WriteLiteral("</span>\r\n"); 534 break; 535 case "linksAndIcons": 536 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 537 Write(name); 538 WriteLiteral("</span>\r\n"); 539 { RenderIcon(pageIcon, iconSize); } 540 break; 541 } 542 } 543 } 544 545 void RenderPreferencesDropdown(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string preferencesType, string linkFontSize, string linkFontWeight, string linkCasing, string theme, string pageType, string pageIcon, string iconSize, string layout) 546 { 547 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 548 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 549 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 550 int currentParagraphId = Pageview.CurrentParagraph.ID; 551 552 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "PreferencesLink_" + node.GroupId + "_" + currentParagraphId : "PreferencesLink_" + node.PageId.ToString() + "_" + currentParagraphId; 553 554 WriteLiteral("\t<li class=\"nav-item dropdown\">\r\n\t\t<form class=\"d-none d-lg-block\""); 555 BeginWriteAttribute("action", " action=\"", 15306, "\"", 15344, 2); 556 WriteAttributeValue("", 15315, "/Default.aspx?ID=", 15315, 17, true); 557 WriteAttributeValue("", 15332, node.PageId, 15332, 12, false); 558 EndWriteAttribute(); 559 WriteLiteral(" data-response-target-element=\""); 560 Write(preferencesType); 561 WriteLiteral("Dropdown_"); 562 Write(currentParagraphId); 563 WriteLiteral("\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t<input type=\"hidden\" name=\"Type\""); 564 BeginWriteAttribute("value", " value=\"", 15533, "\"", 15557, 1); 565 WriteAttributeValue("", 15541, preferencesType, 15541, 16, false); 566 EndWriteAttribute(); 567 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 568 BeginWriteAttribute("value", " value=\"", 15605, "\"", 15625, 1); 569 WriteAttributeValue("", 15613, Pageview.ID, 15613, 12, false); 570 EndWriteAttribute(); 571 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"GroupID\""); 572 BeginWriteAttribute("value", " value=\"", 15667, "\"", 15683, 1); 573 WriteAttributeValue("", 15675, groupId, 15675, 8, false); 574 EndWriteAttribute(); 575 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"ProductID\""); 576 BeginWriteAttribute("value", " value=\"", 15727, "\"", 15745, 1); 577 WriteAttributeValue("", 15735, productId, 15735, 10, false); 578 EndWriteAttribute(); 579 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"VariantID\""); 580 BeginWriteAttribute("value", " value=\"", 15789, "\"", 15807, 1); 581 WriteAttributeValue("", 15797, variantId, 15797, 10, false); 582 EndWriteAttribute(); 583 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"FontSize\""); 584 BeginWriteAttribute("value", " value=\"", 15850, "\"", 15871, 1); 585 WriteAttributeValue("", 15858, linkFontSize, 15858, 13, false); 586 EndWriteAttribute(); 587 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"FontWeight\""); 588 BeginWriteAttribute("value", " value=\"", 15916, "\"", 15939, 1); 589 WriteAttributeValue("", 15924, linkFontWeight, 15924, 15, false); 590 EndWriteAttribute(); 591 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"Casing\""); 592 BeginWriteAttribute("value", " value=\"", 15980, "\"", 15999, 1); 593 WriteAttributeValue("", 15988, linkCasing, 15988, 11, false); 594 EndWriteAttribute(); 595 WriteLiteral(">\r\n\r\n\t\t\t<a"); 596 BeginWriteAttribute("id", " id=\"", 16010, "\"", 16022, 1); 597 WriteAttributeValue("", 16015, nodeId, 16015, 7, false); 598 EndWriteAttribute(); 599 WriteLiteral(" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 600 BeginWriteAttribute("class", " class=\"", 16111, "\"", 16266, 9); 601 WriteAttributeValue("", 16119, "nav-link", 16119, 8, true); 602 WriteAttributeValue(" ", 16127, "p-2", 16128, 4, true); 603 WriteAttributeValue(" ", 16131, "text-nowrap", 16132, 12, true); 604 WriteAttributeValue(" ", 16143, "text-decoration-underline-hover", 16144, 32, true); 605 WriteAttributeValue(" ", 16175, linkFontSize, 16176, 13, false); 606 WriteAttributeValue(" ", 16189, linkFontWeight, 16190, 15, false); 607 WriteAttributeValue(" ", 16205, linkCasing, 16206, 11, false); 608 WriteAttributeValue("", 16217, node.IsActive ? " active" : "", 16217, 33, false); 609 WriteAttributeValue(" ", 16250, "dropdown-toggle", 16251, 16, true); 610 EndWriteAttribute(); 611 WriteLiteral(" href=\"#\" role=\"button\" data-bs-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" "); 612 Write(node.IsActive ? " aria-current='page'" : ""); 613 WriteLiteral(">\r\n"); 614 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);WriteLiteral("\t\t\t</a>\r\n\r\n\t\t\t<ul"); 615 BeginWriteAttribute("class", " class=\"", 16533, "\"", 16563, 2); 616 WriteAttributeValue("", 16541, "dropdown-menu", 16541, 13, true); 617 WriteAttributeValue(" ", 16554, theme, 16555, 8, false); 618 EndWriteAttribute(); 619 BeginWriteAttribute("id", " id=\"", 16564, "\"", 16615, 3); 620 WriteAttributeValue("", 16569, preferencesType, 16569, 18, false); 621 WriteAttributeValue("", 16587, "Dropdown_", 16587, 9, true); 622 WriteAttributeValue("", 16596, currentParagraphId, 16596, 19, false); 623 EndWriteAttribute(); 624 WriteLiteral(">\r\n"); 625 WriteLiteral("\t\t\t</ul>\r\n\t\t</form>\r\n\r\n\t\t<form class=\"d-block d-lg-none\""); 626 BeginWriteAttribute("action", " action=\"", 16734, "\"", 16772, 2); 627 WriteAttributeValue("", 16743, "/Default.aspx?ID=", 16743, 17, true); 628 WriteAttributeValue("", 16760, node.PageId, 16760, 12, false); 629 EndWriteAttribute(); 630 WriteLiteral(" data-response-target-element=\"PreferencesModalContent\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t<input type=\"hidden\" name=\"Layout\" value=\"modal\">\r\n\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 631 BeginWriteAttribute("value", " value=\"", 17001, "\"", 17021, 1); 632 WriteAttributeValue("", 17009, Pageview.ID, 17009, 12, false); 633 EndWriteAttribute(); 634 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"GroupID\""); 635 BeginWriteAttribute("value", " value=\"", 17063, "\"", 17079, 1); 636 WriteAttributeValue("", 17071, groupId, 17071, 8, false); 637 EndWriteAttribute(); 638 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"ProductID\""); 639 BeginWriteAttribute("value", " value=\"", 17123, "\"", 17141, 1); 640 WriteAttributeValue("", 17131, productId, 17131, 10, false); 641 EndWriteAttribute(); 642 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"VariantID\""); 643 BeginWriteAttribute("value", " value=\"", 17185, "\"", 17203, 1); 644 WriteAttributeValue("", 17193, variantId, 17193, 10, false); 645 EndWriteAttribute(); 646 WriteLiteral(">\r\n\t\t\t<button type=\"button\" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 647 BeginWriteAttribute("class", " class=\"", 17319, "\"", 17435, 9); 648 WriteAttributeValue("", 17327, "btn", 17327, 3, true); 649 WriteAttributeValue(" ", 17330, "nav-link", 17331, 9, true); 650 WriteAttributeValue(" ", 17339, "p-2", 17340, 4, true); 651 WriteAttributeValue(" ", 17343, "text-nowrap", 17344, 12, true); 652 WriteAttributeValue(" ", 17355, "border-0", 17356, 9, true); 653 WriteAttributeValue(" ", 17364, "swift_open-preferences-modal", 17365, 29, true); 654 WriteAttributeValue(" ", 17393, linkFontSize, 17394, 13, false); 655 WriteAttributeValue(" ", 17407, linkFontWeight, 17408, 15, false); 656 WriteAttributeValue(" ", 17423, linkCasing, 17424, 11, false); 657 EndWriteAttribute(); 658 WriteLiteral(" data-bs-toggle=\"modal\" data-bs-target=\"#PreferencesModal\">\r\n"); 659 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);WriteLiteral("\t\t\t</button>\r\n\t\t</form>\r\n\t</li>\r\n"); 660 } 661 662 void RenderIcon(string pageIcon, string iconSize) 663 { 664 if (pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase)) 665 { 666 string iconPath = Dynamicweb.Context.Current.Server.MapPath(pageIcon); 667 668 WriteLiteral("\t\t<span"); 669 BeginWriteAttribute("class", " class=\"", 17941, "\"", 17958, 1); 670 WriteAttributeValue("", 17949, iconSize, 17949, 9, false); 671 EndWriteAttribute(); 672 WriteLiteral(">\r\n\t\t\t"); 673 Write(ReadFile(iconPath)); 674 WriteLiteral("\r\n\t\t</span>\r\n"); 675 } 676 } 677 } 678 } 679 #pragma warning restore 1591 680
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 2 @using Dynamicweb 3 @using System.Text.RegularExpressions 4 5 @{ 6 string theme = !string.IsNullOrEmpty(Model.Parameters["Theme"].ToString()) ? Model.Parameters["Theme"].ToString() : string.Empty; 7 string navOrientation = !string.IsNullOrEmpty(Model.Parameters["NavOrientation"].ToString()) ? Model.Parameters["NavOrientation"].ToString() : string.Empty; 8 string navAlignment = !string.IsNullOrEmpty(Model.Parameters["NavAlignment"].ToString()) ? Model.Parameters["NavAlignment"].ToString() : string.Empty; 9 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 10 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 11 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 12 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 13 string iconSize = "icon-3"; 14 15 if (linkFontSize == "fs-7") 16 { 17 iconSize = "icon-2"; 18 } 19 if (linkFontSize == "fs-5") 20 { 21 iconSize = "icon-4"; 22 } 23 } 24 25 <nav class="d-flex py-0 @navOrientation @navAlignment"> 26 @{<text>@{RenderFirstLevelNodes(Model.Nodes, theme, navOrientation, linkFontWeight, linkCasing, linkFontSize, iconSize, layout);}</text>} 27 </nav> 28 29 @functions { 30 void RenderFirstLevelNodes(IEnumerable<Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel> nodes, string theme, string navOrientation, string linkFontWeight, string linkCasing, string linkFontSize, string iconSize, string layout) 31 { 32 bool showOnlyFirstNavLevel = Model.Parameters.ContainsKey("ShowOnlyFirstNavLevel") ? Convert.ToBoolean(Model.Parameters["ShowOnlyFirstNavLevel"].ToString()) : false; 33 int currentParagraphId = Pageview.CurrentParagraph.ID; 34 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 35 36 <ul class="nav flex-nowrap @(navOrientation == "vertical" ? "flex-column" : navOrientation)"> 37 38 @foreach (var node in nodes) 39 { 40 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 41 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 42 string pageIcon = string.Empty; 43 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 44 { 45 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 46 } 47 string preferencesLayout = page.Item?["PreferencesLayout"] != null ? page.Item["PreferencesLayout"].ToString() : ""; 48 string preferencesType = "language"; 49 bool countrySelector = page.Item?["CountrySelector"] != null ? Convert.ToBoolean(page.Item["CountrySelector"].ToString()) : false; 50 bool languageSelector = page.Item?["LanguageSelector"] != null ? Convert.ToBoolean(page.Item["LanguageSelector"].ToString()) : false; 51 bool currencySelector = page.Item?["CurrencySelector"] != null ? Convert.ToBoolean(page.Item["CurrencySelector"].ToString()) : false; 52 string dropdownAttributes = string.Empty; 53 string dropdownClasses = string.Empty; 54 55 var hasChildren = node.Nodes.Count() > 0 || pageType == "Swift_SignIn"; 56 57 if (hasChildren && !showOnlyFirstNavLevel) 58 { 59 dropdownAttributes = hasChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 60 } 61 62 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Navigation_" + node.GroupId + "_" + currentParagraphId : "Navigation_Page_Desktop_" + node.PageId.ToString() + "_" + currentParagraphId; 63 64 if (pageType != "Swift_Preferences") 65 { 66 <li class="nav-item@(hasChildren ? " dropdown" : "")"> 67 @if (node.IsClickable) 68 { 69 <a href="@node.Link" class="p-2 nav-link text-nowrap text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing@(node.IsActive ? " active" : "")@(hasChildren ? " dropdown-toggle" : "")" @dropdownAttributes @(node.IsActive ? " aria-current='page'" : "") id="@nodeId"> 70 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 71 </a> 72 } 73 else 74 { 75 <span class="p-2 nav-link text-nowrap @linkFontSize @linkFontWeight @linkCasing@(hasChildren ? " dropdown-toggle " : "")" @dropdownAttributes id="@nodeId"> 76 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 77 </span> 78 } 79 80 @if (hasChildren) 81 { 82 if (!showOnlyFirstNavLevel) 83 { 84 <ul class="dropdown-menu @(theme)" aria-labelledby="@nodeId"> 85 @foreach (var subnode in node.Nodes)//Standard pages 86 { 87 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Navigation_" + subnode.GroupId + "_" + currentParagraphId : "Navigation_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 88 89 <li> 90 @if (subnode.IsClickable) 91 { 92 <a href="@subnode.Link" class="dropdown-item py-2 text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing" @(subnode.IsActive ? " aria-current='page'" : "") id="@nodeId">@subnode.Name</a> 93 } 94 else 95 { 96 <span class="dropdown-item py-2 @linkFontSize @linkFontWeight @linkCasing" @(subnode.IsActive ? " aria-current='page'" : "") id="@nodeId">@subnode.Name</span> 97 } 98 </li> 99 } 100 @if (pageType == "Swift_SignIn") //Sign out link 101 { 102 if (Pageview.User != null) 103 { 104 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 105 106 <li><hr class="dropdown-divider"></li> 107 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 108 { 109 <li> 110 <a href="Default.aspx?ID=@(Pageview.ID)&DwExtranetRemoveSecondaryUser=1" class="dropdown-item py-2 text-decoration-underline-hover swift_sign-out-as-customer-link @linkFontSize @linkFontWeight @linkCasing" id="SignInButton_@currentParagraphId">@Translate("Sign out as a customer")</a> 111 </li> 112 } 113 <li> 114 <a href="@link" class="dropdown-item py-2 text-decoration-underline-hover swift_sign-out-link @linkFontSize @linkFontWeight @linkCasing">@Translate("Sign out")</a> 115 </li> 116 } 117 } 118 </ul> 119 } 120 } 121 </li> 122 } 123 else 124 { 125 if (preferencesLayout == "modal") 126 { 127 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 128 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 129 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 130 131 <li class="nav-item@(hasChildren ? " dropdown" : "")"> 132 <form action="/Default.aspx?ID=@node.PageId" data-response-target-element="PreferencesModalContent" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 133 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 134 <input type="hidden" name="GroupID" value="@groupId"> 135 <input type="hidden" name="ProductID" value="@productId"> 136 <input type="hidden" name="VariantID" value="@variantId"> 137 <button type="button" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="btn nav-link p-2 text-nowrap border-0 swift_open-preferences-modal @linkFontSize @linkFontWeight @linkCasing" data-bs-toggle="modal" data-bs-target="#PreferencesModal" id="OpenPreferences_@currentParagraphId"> 138 @if (languageSelector) 139 { 140 {<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, "language");}</text>} 141 } 142 else 143 { 144 {<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 145 } 146 </button> 147 </form> 148 </li> 149 } 150 else 151 { 152 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries(); 153 var currencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies(); 154 155 if (languageSelector) 156 { 157 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); 158 159 if (Pageview.Page.Area.IsMaster) 160 { 161 languages.Add(Pageview.Page); 162 if (Pageview.Page.Languages != null) 163 { 164 foreach (var language in Pageview.Page.Languages) 165 { 166 if (language.Area.Active == true) 167 { 168 languages.Add(language); 169 } 170 } 171 } 172 } 173 else 174 { 175 languages.Add(Pageview.Page.MasterPage); 176 if (Pageview.Page.MasterPage != null) 177 { 178 if (Pageview.Page.MasterPage.Languages != null) 179 { 180 foreach (var language in Pageview.Page.MasterPage.Languages) 181 { 182 if (language.Area.Active == true) 183 { 184 languages.Add(language); 185 } 186 } 187 } 188 } 189 } 190 191 if (languages.Count > 1) 192 { 193 preferencesType = "language"; 194 195 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 196 } 197 } 198 if (countrySelector && ecomCountries.Count > 1) 199 { 200 preferencesType = "country"; 201 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 202 } 203 if (currencySelector && currencies.Count() > 1) 204 { 205 preferencesType = "currency"; 206 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 207 } 208 } 209 } 210 } 211 </ul> 212 } 213 } 214 215 @functions { 216 void RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout, string preferencesType = "") 217 { 218 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 219 if (pageType == "Swift_Cart") //Mini cart 220 { 221 string cartId = ""; 222 if (page.Item["ContextCart"] != null) 223 { 224 cartId = !string.IsNullOrEmpty(page.Item["ContextCart"].ToString()) ? "ID=\"Cart_" + page.Item["ContextCart"].ToString() + "\"" : ""; 225 } 226 227 string jsCartClass = string.IsNullOrEmpty(cartId) ? "js-cart-qty" : ""; 228 double totalProducts = 0; 229 230 231 Dynamicweb.Ecommerce.Common.Context.CartContext = null; 232 if (page.Item["ContextCart"] != null) 233 { 234 var orderContext = Dynamicweb.Ecommerce.Services.OrderContexts.GetOrderContextById(page.Item["ContextCart"].ToString()); 235 Dynamicweb.Ecommerce.Common.Context.CartContext = orderContext; 236 } 237 238 if (Dynamicweb.Ecommerce.Common.Context.Cart != null) 239 { 240 bool renderOrderlineCountInsteadOfProductCount = page.Item["RenderOrderlineCountInsteadOfProductCount"] != null ? Convert.ToBoolean(page.Item["RenderOrderlineCountInsteadOfProductCount"]) : false; 241 if (!renderOrderlineCountInsteadOfProductCount) 242 { 243 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentProductLineQuantityCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 244 } 245 else 246 { 247 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentOrderLineCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 248 } 249 } 250 251 252 switch (layout) 253 { 254 case "linksOnly": 255 <span class="align-middle">@node.Name</span> 256 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 257 break; 258 259 case "iconsOnly": 260 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 261 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 262 break; 263 case "iconsAndLinks": 264 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 265 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 266 <span class="align-middle">@node.Name</span> 267 break; 268 case "linksAndIcons": 269 <span class="align-middle">@node.Name</span> 270 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 271 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 272 break; 273 } 274 } 275 else 276 { 277 string name = node.Name; 278 279 if (preferencesType == "country") 280 { //Country 281 name = Translate("Deliver to") + ": " + Dynamicweb.Ecommerce.Common.Context.Country.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID); 282 } 283 284 if (preferencesType == "language") 285 { //Languange 286 string iconFolder = "/Files/FlagIcons/"; 287 pageIcon = iconFolder + Pageview.Area.CultureInfo.Name.ToLower() + ".svg"; 288 Regex reg = new Regex(@"\(([^\)]+)\)"); 289 name = reg.Replace(Pageview.Area.CultureInfo.DisplayName, ""); 290 291 layout = layout == "linksOnly" ? "iconsAndLinks" : layout; 292 bool hideIcon = page.Item?["HideIcon"] != null ? Convert.ToBoolean(page.Item["HideIcon"].ToString()) : false; 293 bool hideName = page.Item?["HideName"] != null ? Convert.ToBoolean(page.Item["HideName"].ToString()) : false; 294 layout = hideIcon ? "linksOnly" : layout; 295 layout = hideName ? "iconsOnly" : layout; 296 } 297 298 if (preferencesType == "currency") 299 { //Country 300 name = Dynamicweb.Ecommerce.Common.Context.Currency.Code; 301 } 302 303 switch (layout) 304 { 305 case "linksOnly": 306 <span class="align-middle">@name</span> 307 break; 308 309 case "iconsOnly": 310 <span class="visually-hidden">@name</span> 311 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 312 break; 313 case "iconsAndLinks": 314 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 315 <span class="align-middle">@name</span> 316 break; 317 case "linksAndIcons": 318 <span class="align-middle">@name</span> 319 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 320 break; 321 } 322 } 323 } 324 } 325 326 @functions { 327 void RenderPreferencesDropdown(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string preferencesType, string linkFontSize, string linkFontWeight, string linkCasing, string theme, string pageType, string pageIcon, string iconSize, string layout) 328 { 329 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 330 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 331 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 332 int currentParagraphId = Pageview.CurrentParagraph.ID; 333 334 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "PreferencesLink_" + node.GroupId + "_" + currentParagraphId : "PreferencesLink_" + node.PageId.ToString() + "_" + currentParagraphId; 335 336 <li class="nav-item dropdown"> 337 <form class="d-none d-lg-block" action="/Default.aspx?ID=@node.PageId" data-response-target-element="@(preferencesType)Dropdown_@currentParagraphId" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 338 <input type="hidden" name="Type" value="@preferencesType"> 339 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 340 <input type="hidden" name="GroupID" value="@groupId"> 341 <input type="hidden" name="ProductID" value="@productId"> 342 <input type="hidden" name="VariantID" value="@variantId"> 343 <input type="hidden" name="FontSize" value="@linkFontSize"> 344 <input type="hidden" name="FontWeight" value="@linkFontWeight"> 345 <input type="hidden" name="Casing" value="@linkCasing"> 346 347 <a id="@nodeId" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="nav-link p-2 text-nowrap text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing@(node.IsActive ? " active" : "") dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @(node.IsActive ? " aria-current='page'" : "")> 348 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);}</text>} 349 </a> 350 351 <ul class="dropdown-menu @(theme)" id="@(preferencesType)Dropdown_@currentParagraphId"> 352 @* The content here comes from an external request *@ 353 </ul> 354 </form> 355 356 <form class="d-block d-lg-none" action="/Default.aspx?ID=@node.PageId" data-response-target-element="PreferencesModalContent" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 357 <input type="hidden" name="Layout" value="modal"> 358 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 359 <input type="hidden" name="GroupID" value="@groupId"> 360 <input type="hidden" name="ProductID" value="@productId"> 361 <input type="hidden" name="VariantID" value="@variantId"> 362 <button type="button" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="btn nav-link p-2 text-nowrap border-0 swift_open-preferences-modal @linkFontSize @linkFontWeight @linkCasing" data-bs-toggle="modal" data-bs-target="#PreferencesModal"> 363 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);}</text>} 364 </button> 365 </form> 366 </li> 367 } 368 } 369 370 @functions { 371 void RenderIcon(string pageIcon, string iconSize) 372 { 373 if (pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase)) 374 { 375 string iconPath = Dynamicweb.Context.Current.Server.MapPath(pageIcon); 376 377 <span class="@iconSize"> 378 @ReadFile(iconPath) 379 </span> 380 } 381 } 382 } 383
Error compiling template "Designs/Swift/Navigation/Navigation.cshtml" Line 211: 'User.GetCurrentSecondaryUser()' is obsolete: 'Use UserContext.Current.ImpersonatingUser instead.' Line 416: 'Order' does not contain a definition for 'GetParentOrderLineCount' and no accessible extension method 'GetParentOrderLineCount' accepting a first argument of type 'Order' could be found (are you missing a using directive or an assembly reference?)
1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb; 11 using System.Text.RegularExpressions; 12 internal class RazorEngine_2a27cb6760494a1886f051b744ac4a5a : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\r\n"); 18 19 string theme = !string.IsNullOrEmpty(Model.Parameters["Theme"].ToString()) ? Model.Parameters["Theme"].ToString() : string.Empty; 20 string navOrientation = !string.IsNullOrEmpty(Model.Parameters["NavOrientation"].ToString()) ? Model.Parameters["NavOrientation"].ToString() : string.Empty; 21 string navAlignment = !string.IsNullOrEmpty(Model.Parameters["NavAlignment"].ToString()) ? Model.Parameters["NavAlignment"].ToString() : string.Empty; 22 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 23 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 24 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 25 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 26 string iconSize = "icon-3"; 27 28 if (linkFontSize == "fs-7") 29 { 30 iconSize = "icon-2"; 31 } 32 if (linkFontSize == "fs-5") 33 { 34 iconSize = "icon-4"; 35 } 36 WriteLiteral("\r\n<nav"); 37 BeginWriteAttribute("class", " class=\"", 1373, "\"", 1422, 4); 38 WriteAttributeValue("", 1381, "d-flex", 1381, 6, true); 39 WriteAttributeValue(" ", 1387, "py-0", 1388, 5, true); 40 WriteAttributeValue(" ", 1392, navOrientation, 1393, 15, false); 41 WriteAttributeValue(" ", 1408, navAlignment, 1409, 13, false); 42 EndWriteAttribute(); 43 WriteLiteral(">\r\n"); 44 RenderFirstLevelNodes(Model.Nodes, theme, navOrientation, linkFontWeight, linkCasing, linkFontSize, iconSize, layout);WriteLiteral("</nav>\r\n\r\n"); 45 WriteLiteral("\r\n"); 46 WriteLiteral("\r\n"); 47 WriteLiteral("\r\n"); 48 } 49 #pragma warning restore 1998 50 51 void RenderFirstLevelNodes(IEnumerable<Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel> nodes, string theme, string navOrientation, string linkFontWeight, string linkCasing, string linkFontSize, string iconSize, string layout) 52 { 53 bool showOnlyFirstNavLevel = Model.Parameters.ContainsKey("ShowOnlyFirstNavLevel") ? Convert.ToBoolean(Model.Parameters["ShowOnlyFirstNavLevel"].ToString()) : false; 54 int currentParagraphId = Pageview.CurrentParagraph.ID; 55 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 56 57 WriteLiteral("\t<ul"); 58 BeginWriteAttribute("class", " class=\"", 2200, "\"", 2288, 3); 59 WriteAttributeValue("", 2208, "nav", 2208, 3, true); 60 WriteAttributeValue(" ", 2211, "flex-nowrap", 2212, 12, true); 61 WriteAttributeValue(" ", 2223, navOrientation == "vertical" ? "flex-column" : navOrientation, 2224, 64, false); 62 EndWriteAttribute(); 63 WriteLiteral(">\r\n\r\n"); 64 foreach (var node in nodes) 65 { 66 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 67 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 68 string pageIcon = string.Empty; 69 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 70 { 71 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 72 } 73 string preferencesLayout = page.Item?["PreferencesLayout"] != null ? page.Item["PreferencesLayout"].ToString() : ""; 74 string preferencesType = "language"; 75 bool countrySelector = page.Item?["CountrySelector"] != null ? Convert.ToBoolean(page.Item["CountrySelector"].ToString()) : false; 76 bool languageSelector = page.Item?["LanguageSelector"] != null ? Convert.ToBoolean(page.Item["LanguageSelector"].ToString()) : false; 77 bool currencySelector = page.Item?["CurrencySelector"] != null ? Convert.ToBoolean(page.Item["CurrencySelector"].ToString()) : false; 78 string dropdownAttributes = string.Empty; 79 string dropdownClasses = string.Empty; 80 81 var hasChildren = node.Nodes.Count() > 0 || pageType == "Swift_SignIn"; 82 83 if (hasChildren && !showOnlyFirstNavLevel) 84 { 85 dropdownAttributes = hasChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 86 } 87 88 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Navigation_" + node.GroupId + "_" + currentParagraphId : "Navigation_Page_Desktop_" + node.PageId.ToString() + "_" + currentParagraphId; 89 90 if (pageType != "Swift_Preferences") 91 { 92 WriteLiteral("\t\t\t\t<li"); 93 BeginWriteAttribute("class", " class=\"", 3927, "\"", 3976, 2); 94 WriteAttributeValue("", 3935, "nav-item", 3935, 8, true); 95 WriteAttributeValue("", 3943, hasChildren ? " dropdown" : "", 3943, 33, false); 96 EndWriteAttribute(); 97 WriteLiteral(">\r\n"); 98 if (node.IsClickable) 99 { 100 WriteLiteral("\t\t\t\t\t\t<a"); 101 BeginWriteAttribute("href", " href=\"", 4025, "\"", 4042, 1); 102 WriteAttributeValue("", 4032, node.Link, 4032, 10, false); 103 EndWriteAttribute(); 104 BeginWriteAttribute("class", " class=\"", 4043, "\"", 4222, 9); 105 WriteAttributeValue("", 4051, "p-2", 4051, 3, true); 106 WriteAttributeValue(" ", 4054, "nav-link", 4055, 9, true); 107 WriteAttributeValue(" ", 4063, "text-nowrap", 4064, 12, true); 108 WriteAttributeValue(" ", 4075, "text-decoration-underline-hover", 4076, 32, true); 109 WriteAttributeValue(" ", 4107, linkFontSize, 4108, 13, false); 110 WriteAttributeValue(" ", 4121, linkFontWeight, 4122, 15, false); 111 WriteAttributeValue(" ", 4137, linkCasing, 4138, 11, false); 112 WriteAttributeValue("", 4149, node.IsActive ? " active" : "", 4149, 33, false); 113 WriteAttributeValue("", 4182, hasChildren ? " dropdown-toggle" : "", 4182, 40, false); 114 EndWriteAttribute(); 115 WriteLiteral(" "); 116 Write(dropdownAttributes); 117 WriteLiteral(" "); 118 Write(node.IsActive ? " aria-current='page'" : ""); 119 WriteLiteral(" id=\""); 120 Write(nodeId); 121 WriteLiteral("\">\r\n"); 122 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);WriteLiteral("\t\t\t\t\t\t</a>\r\n"); 123 } 124 else 125 { 126 WriteLiteral("\t\t\t\t\t\t<span"); 127 BeginWriteAttribute("class", " class=\"", 4449, "\"", 4564, 7); 128 WriteAttributeValue("", 4457, "p-2", 4457, 3, true); 129 WriteAttributeValue(" ", 4460, "nav-link", 4461, 9, true); 130 WriteAttributeValue(" ", 4469, "text-nowrap", 4470, 12, true); 131 WriteAttributeValue(" ", 4481, linkFontSize, 4482, 13, false); 132 WriteAttributeValue(" ", 4495, linkFontWeight, 4496, 15, false); 133 WriteAttributeValue(" ", 4511, linkCasing, 4512, 11, false); 134 WriteAttributeValue("", 4523, hasChildren ? " dropdown-toggle " : "", 4523, 41, false); 135 EndWriteAttribute(); 136 WriteLiteral(" "); 137 Write(dropdownAttributes); 138 WriteLiteral(" id=\""); 139 Write(nodeId); 140 WriteLiteral("\">\r\n"); 141 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);WriteLiteral("\t\t\t\t\t\t</span>\r\n"); 142 } 143 WriteLiteral("\r\n"); 144 if (hasChildren) 145 { 146 if (!showOnlyFirstNavLevel) 147 { 148 WriteLiteral("\t\t\t\t\t\t\t<ul"); 149 BeginWriteAttribute("class", " class=\"", 4805, "\"", 4835, 2); 150 WriteAttributeValue("", 4813, "dropdown-menu", 4813, 13, true); 151 WriteAttributeValue(" ", 4826, theme, 4827, 8, false); 152 EndWriteAttribute(); 153 BeginWriteAttribute("aria-labelledby", " aria-labelledby=\"", 4836, "\"", 4861, 1); 154 WriteAttributeValue("", 4854, nodeId, 4854, 7, false); 155 EndWriteAttribute(); 156 WriteLiteral(">\r\n"); 157 foreach (var subnode in node.Nodes)//Standard pages 158 { 159 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Navigation_" + subnode.GroupId + "_" + currentParagraphId : "Navigation_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 160 161 WriteLiteral("\t\t\t\t\t\t\t\t\t<li>\r\n"); 162 if (subnode.IsClickable) 163 { 164 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<a"); 165 BeginWriteAttribute("href", " href=\"", 5214, "\"", 5234, 1); 166 WriteAttributeValue("", 5221, subnode.Link, 5221, 13, false); 167 EndWriteAttribute(); 168 BeginWriteAttribute("class", " class=\"", 5235, "\"", 5335, 6); 169 WriteAttributeValue("", 5243, "dropdown-item", 5243, 13, true); 170 WriteAttributeValue(" ", 5256, "py-2", 5257, 5, true); 171 WriteAttributeValue(" ", 5261, "text-decoration-underline-hover", 5262, 32, true); 172 WriteAttributeValue(" ", 5293, linkFontSize, 5294, 13, false); 173 WriteAttributeValue(" ", 5307, linkFontWeight, 5308, 15, false); 174 WriteAttributeValue(" ", 5323, linkCasing, 5324, 11, false); 175 EndWriteAttribute(); 176 WriteLiteral(" "); 177 Write(subnode.IsActive ? " aria-current='page'" : ""); 178 WriteLiteral(" id=\""); 179 Write(nodeId); 180 WriteLiteral("\">"); 181 Write(subnode.Name); 182 WriteLiteral("</a>\r\n"); 183 } 184 else 185 { 186 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<span"); 187 BeginWriteAttribute("class", " class=\"", 5477, "\"", 5545, 5); 188 WriteAttributeValue("", 5485, "dropdown-item", 5485, 13, true); 189 WriteAttributeValue(" ", 5498, "py-2", 5499, 5, true); 190 WriteAttributeValue(" ", 5503, linkFontSize, 5504, 13, false); 191 WriteAttributeValue(" ", 5517, linkFontWeight, 5518, 15, false); 192 WriteAttributeValue(" ", 5533, linkCasing, 5534, 11, false); 193 EndWriteAttribute(); 194 WriteLiteral(" "); 195 Write(subnode.IsActive ? " aria-current='page'" : ""); 196 WriteLiteral(" id=\""); 197 Write(nodeId); 198 WriteLiteral("\">"); 199 Write(subnode.Name); 200 WriteLiteral("</span>\r\n"); 201 } 202 WriteLiteral("\t\t\t\t\t\t\t\t\t</li>\r\n"); 203 } 204 if (pageType == "Swift_SignIn") //Sign out link 205 { 206 if (Pageview.User != null) 207 { 208 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 209 210 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<li><hr class=\"dropdown-divider\"></li>\r\n"); 211 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 212 { 213 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<a"); 214 BeginWriteAttribute("href", " href=\"", 6050, "\"", 6119, 3); 215 WriteAttributeValue("", 6057, "Default.aspx?ID=", 6057, 16, true); 216 WriteAttributeValue("", 6073, Pageview.ID, 6073, 14, false); 217 WriteAttributeValue("", 6087, "&DwExtranetRemoveSecondaryUser=1", 6087, 32, true); 218 EndWriteAttribute(); 219 BeginWriteAttribute("class", " class=\"", 6120, "\"", 6252, 7); 220 WriteAttributeValue("", 6128, "dropdown-item", 6128, 13, true); 221 WriteAttributeValue(" ", 6141, "py-2", 6142, 5, true); 222 WriteAttributeValue(" ", 6146, "text-decoration-underline-hover", 6147, 32, true); 223 WriteAttributeValue(" ", 6178, "swift_sign-out-as-customer-link", 6179, 32, true); 224 WriteAttributeValue(" ", 6210, linkFontSize, 6211, 13, false); 225 WriteAttributeValue(" ", 6224, linkFontWeight, 6225, 15, false); 226 WriteAttributeValue(" ", 6240, linkCasing, 6241, 11, false); 227 EndWriteAttribute(); 228 BeginWriteAttribute("id", " id=\"", 6253, "\"", 6290, 2); 229 WriteAttributeValue("", 6258, "SignInButton_", 6258, 13, true); 230 WriteAttributeValue("", 6271, currentParagraphId, 6271, 19, false); 231 EndWriteAttribute(); 232 WriteLiteral(">"); 233 Write(Translate("Sign out as a customer")); 234 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 235 } 236 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t<a"); 237 BeginWriteAttribute("href", " href=\"", 6394, "\"", 6406, 1); 238 WriteAttributeValue("", 6401, link, 6401, 5, false); 239 EndWriteAttribute(); 240 BeginWriteAttribute("class", " class=\"", 6407, "\"", 6527, 7); 241 WriteAttributeValue("", 6415, "dropdown-item", 6415, 13, true); 242 WriteAttributeValue(" ", 6428, "py-2", 6429, 5, true); 243 WriteAttributeValue(" ", 6433, "text-decoration-underline-hover", 6434, 32, true); 244 WriteAttributeValue(" ", 6465, "swift_sign-out-link", 6466, 20, true); 245 WriteAttributeValue(" ", 6485, linkFontSize, 6486, 13, false); 246 WriteAttributeValue(" ", 6499, linkFontWeight, 6500, 15, false); 247 WriteAttributeValue(" ", 6515, linkCasing, 6516, 11, false); 248 EndWriteAttribute(); 249 WriteLiteral(">"); 250 Write(Translate("Sign out")); 251 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 252 } 253 } 254 WriteLiteral("\t\t\t\t\t\t\t</ul>\r\n"); 255 } 256 } 257 WriteLiteral("\t\t\t\t</li>\r\n"); 258 } 259 else 260 { 261 if (preferencesLayout == "modal") 262 { 263 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 264 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 265 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 266 267 WriteLiteral("\t\t\t\t\t<li"); 268 BeginWriteAttribute("class", " class=\"", 7154, "\"", 7203, 2); 269 WriteAttributeValue("", 7162, "nav-item", 7162, 8, true); 270 WriteAttributeValue("", 7170, hasChildren ? " dropdown" : "", 7170, 33, false); 271 EndWriteAttribute(); 272 WriteLiteral(">\r\n\t\t\t\t\t\t<form"); 273 BeginWriteAttribute("action", " action=\"", 7218, "\"", 7256, 2); 274 WriteAttributeValue("", 7227, "/Default.aspx?ID=", 7227, 17, true); 275 WriteAttributeValue("", 7244, node.PageId, 7244, 12, false); 276 EndWriteAttribute(); 277 WriteLiteral(" data-response-target-element=\"PreferencesModalContent\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 278 BeginWriteAttribute("value", " value=\"", 7435, "\"", 7455, 1); 279 WriteAttributeValue("", 7443, Pageview.ID, 7443, 12, false); 280 EndWriteAttribute(); 281 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"GroupID\""); 282 BeginWriteAttribute("value", " value=\"", 7501, "\"", 7517, 1); 283 WriteAttributeValue("", 7509, groupId, 7509, 8, false); 284 EndWriteAttribute(); 285 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"ProductID\""); 286 BeginWriteAttribute("value", " value=\"", 7565, "\"", 7583, 1); 287 WriteAttributeValue("", 7573, productId, 7573, 10, false); 288 EndWriteAttribute(); 289 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"VariantID\""); 290 BeginWriteAttribute("value", " value=\"", 7631, "\"", 7649, 1); 291 WriteAttributeValue("", 7639, variantId, 7639, 10, false); 292 EndWriteAttribute(); 293 WriteLiteral(">\r\n\t\t\t\t\t\t\t<button type=\"button\" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 294 BeginWriteAttribute("class", " class=\"", 7769, "\"", 7885, 9); 295 WriteAttributeValue("", 7777, "btn", 7777, 3, true); 296 WriteAttributeValue(" ", 7780, "nav-link", 7781, 9, true); 297 WriteAttributeValue(" ", 7789, "p-2", 7790, 4, true); 298 WriteAttributeValue(" ", 7793, "text-nowrap", 7794, 12, true); 299 WriteAttributeValue(" ", 7805, "border-0", 7806, 9, true); 300 WriteAttributeValue(" ", 7814, "swift_open-preferences-modal", 7815, 29, true); 301 WriteAttributeValue(" ", 7843, linkFontSize, 7844, 13, false); 302 WriteAttributeValue(" ", 7857, linkFontWeight, 7858, 15, false); 303 WriteAttributeValue(" ", 7873, linkCasing, 7874, 11, false); 304 EndWriteAttribute(); 305 WriteLiteral(" data-bs-toggle=\"modal\" data-bs-target=\"#PreferencesModal\""); 306 BeginWriteAttribute("id", " id=\"", 7944, "\"", 7984, 2); 307 WriteAttributeValue("", 7949, "OpenPreferences_", 7949, 16, true); 308 WriteAttributeValue("", 7965, currentParagraphId, 7965, 19, false); 309 EndWriteAttribute(); 310 WriteLiteral(">\r\n"); 311 if (languageSelector) 312 { 313 { RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, "language"); } 314 } 315 else 316 { 317 { RenderNavigationItem(node, pageType, pageIcon, iconSize, layout); } 318 } 319 WriteLiteral("\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</li>\r\n"); 320 } 321 else 322 { 323 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries(); 324 var currencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies(); 325 326 if (languageSelector) 327 { 328 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); 329 330 if (Pageview.Page.Area.IsMaster) 331 { 332 languages.Add(Pageview.Page); 333 if (Pageview.Page.Languages != null) 334 { 335 foreach (var language in Pageview.Page.Languages) 336 { 337 if (language.Area.Active == true) 338 { 339 languages.Add(language); 340 } 341 } 342 } 343 } 344 else 345 { 346 languages.Add(Pageview.Page.MasterPage); 347 if (Pageview.Page.MasterPage != null) 348 { 349 if (Pageview.Page.MasterPage.Languages != null) 350 { 351 foreach (var language in Pageview.Page.MasterPage.Languages) 352 { 353 if (language.Area.Active == true) 354 { 355 languages.Add(language); 356 } 357 } 358 } 359 } 360 } 361 362 if (languages.Count > 1) 363 { 364 preferencesType = "language"; 365 366 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 367 } 368 } 369 if (countrySelector && ecomCountries.Count > 1) 370 { 371 preferencesType = "country"; 372 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 373 } 374 if (currencySelector && currencies.Count() > 1) 375 { 376 preferencesType = "currency"; 377 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 378 } 379 } 380 } 381 } 382 WriteLiteral("\t</ul>\r\n"); 383 } 384 385 void RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout, string preferencesType = "") 386 { 387 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 388 if (pageType == "Swift_Cart") //Mini cart 389 { 390 string cartId = ""; 391 if (page.Item["ContextCart"] != null) 392 { 393 cartId = !string.IsNullOrEmpty(page.Item["ContextCart"].ToString()) ? "ID=\"Cart_" + page.Item["ContextCart"].ToString() + "\"" : ""; 394 } 395 396 string jsCartClass = string.IsNullOrEmpty(cartId) ? "js-cart-qty" : ""; 397 double totalProducts = 0; 398 399 400 Dynamicweb.Ecommerce.Common.Context.CartContext = null; 401 if (page.Item["ContextCart"] != null) 402 { 403 var orderContext = Dynamicweb.Ecommerce.Services.OrderContexts.GetOrderContextById(page.Item["ContextCart"].ToString()); 404 Dynamicweb.Ecommerce.Common.Context.CartContext = orderContext; 405 } 406 407 if (Dynamicweb.Ecommerce.Common.Context.Cart != null) 408 { 409 bool renderOrderlineCountInsteadOfProductCount = page.Item["RenderOrderlineCountInsteadOfProductCount"] != null ? Convert.ToBoolean(page.Item["RenderOrderlineCountInsteadOfProductCount"]) : false; 410 if (!renderOrderlineCountInsteadOfProductCount) 411 { 412 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentProductLineQuantityCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 413 } 414 else 415 { 416 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentOrderLineCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 417 } 418 } 419 420 421 switch (layout) 422 { 423 case "linksOnly": 424 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 425 Write(node.Name); 426 WriteLiteral("</span>\r\n\t\t\t\t<span"); 427 BeginWriteAttribute("class", " class=\"", 11922, "\"", 11974, 3); 428 WriteAttributeValue("", 11930, jsCartClass, 11930, 12, false); 429 WriteAttributeValue(" ", 11942, "mini-cart-quantity", 11943, 19, true); 430 WriteAttributeValue(" ", 11961, "align-middle", 11962, 13, true); 431 EndWriteAttribute(); 432 WriteLiteral(" "); 433 Write(cartId); 434 WriteLiteral(">("); 435 Write(totalProducts); 436 WriteLiteral(")</span>\r\n"); 437 break; 438 439 case "iconsOnly": 440 { RenderIcon(pageIcon, iconSize); } 441 WriteLiteral("\t\t\t\t<span"); 442 BeginWriteAttribute("class", " class=\"", 12109, "\"", 12161, 3); 443 WriteAttributeValue("", 12117, jsCartClass, 12117, 12, false); 444 WriteAttributeValue(" ", 12129, "mini-cart-quantity", 12130, 19, true); 445 WriteAttributeValue(" ", 12148, "align-middle", 12149, 13, true); 446 EndWriteAttribute(); 447 WriteLiteral(" "); 448 Write(cartId); 449 WriteLiteral(">("); 450 Write(totalProducts); 451 WriteLiteral(")</span>\r\n"); 452 break; 453 case "iconsAndLinks": 454 { RenderIcon(pageIcon, iconSize); } 455 WriteLiteral("\t\t\t\t<span"); 456 BeginWriteAttribute("class", " class=\"", 12298, "\"", 12350, 3); 457 WriteAttributeValue("", 12306, jsCartClass, 12306, 12, false); 458 WriteAttributeValue(" ", 12318, "mini-cart-quantity", 12319, 19, true); 459 WriteAttributeValue(" ", 12337, "align-middle", 12338, 13, true); 460 EndWriteAttribute(); 461 WriteLiteral(" "); 462 Write(cartId); 463 WriteLiteral(">("); 464 Write(totalProducts); 465 WriteLiteral(")</span>\r\n\t\t\t\t<span class=\"align-middle\">"); 466 Write(node.Name); 467 WriteLiteral("</span>\r\n"); 468 break; 469 case "linksAndIcons": 470 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 471 Write(node.Name); 472 WriteLiteral("</span>\r\n\t\t\t\t<span"); 473 BeginWriteAttribute("class", " class=\"", 12532, "\"", 12584, 3); 474 WriteAttributeValue("", 12540, jsCartClass, 12540, 12, false); 475 WriteAttributeValue(" ", 12552, "mini-cart-quantity", 12553, 19, true); 476 WriteAttributeValue(" ", 12571, "align-middle", 12572, 13, true); 477 EndWriteAttribute(); 478 WriteLiteral(" "); 479 Write(cartId); 480 WriteLiteral(">("); 481 Write(totalProducts); 482 WriteLiteral(")</span>\r\n"); 483 { RenderIcon(pageIcon, iconSize); } 484 break; 485 } 486 } 487 else 488 { 489 string name = node.Name; 490 491 if (preferencesType == "country") 492 { //Country 493 name = Translate("Deliver to") + ": " + Dynamicweb.Ecommerce.Common.Context.Country.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID); 494 } 495 496 if (preferencesType == "language") 497 { //Languange 498 string iconFolder = "/Files/FlagIcons/"; 499 pageIcon = iconFolder + Pageview.Area.CultureInfo.Name.ToLower() + ".svg"; 500 Regex reg = new Regex(@"\(([^\)]+)\)"); 501 name = reg.Replace(Pageview.Area.CultureInfo.DisplayName, ""); 502 503 layout = layout == "linksOnly" ? "iconsAndLinks" : layout; 504 bool hideIcon = page.Item?["HideIcon"] != null ? Convert.ToBoolean(page.Item["HideIcon"].ToString()) : false; 505 bool hideName = page.Item?["HideName"] != null ? Convert.ToBoolean(page.Item["HideName"].ToString()) : false; 506 layout = hideIcon ? "linksOnly" : layout; 507 layout = hideName ? "iconsOnly" : layout; 508 } 509 510 if (preferencesType == "currency") 511 { //Country 512 name = Dynamicweb.Ecommerce.Common.Context.Currency.Code; 513 } 514 515 switch (layout) 516 { 517 case "linksOnly": 518 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 519 Write(name); 520 WriteLiteral("</span>\r\n"); 521 break; 522 523 case "iconsOnly": 524 WriteLiteral("\t\t\t\t<span class=\"visually-hidden\">"); 525 Write(name); 526 WriteLiteral("</span>\r\n"); 527 { RenderIcon(pageIcon, iconSize); } 528 break; 529 case "iconsAndLinks": 530 { RenderIcon(pageIcon, iconSize); } 531 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 532 Write(name); 533 WriteLiteral("</span>\r\n"); 534 break; 535 case "linksAndIcons": 536 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 537 Write(name); 538 WriteLiteral("</span>\r\n"); 539 { RenderIcon(pageIcon, iconSize); } 540 break; 541 } 542 } 543 } 544 545 void RenderPreferencesDropdown(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string preferencesType, string linkFontSize, string linkFontWeight, string linkCasing, string theme, string pageType, string pageIcon, string iconSize, string layout) 546 { 547 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 548 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 549 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 550 int currentParagraphId = Pageview.CurrentParagraph.ID; 551 552 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "PreferencesLink_" + node.GroupId + "_" + currentParagraphId : "PreferencesLink_" + node.PageId.ToString() + "_" + currentParagraphId; 553 554 WriteLiteral("\t<li class=\"nav-item dropdown\">\r\n\t\t<form class=\"d-none d-lg-block\""); 555 BeginWriteAttribute("action", " action=\"", 15306, "\"", 15344, 2); 556 WriteAttributeValue("", 15315, "/Default.aspx?ID=", 15315, 17, true); 557 WriteAttributeValue("", 15332, node.PageId, 15332, 12, false); 558 EndWriteAttribute(); 559 WriteLiteral(" data-response-target-element=\""); 560 Write(preferencesType); 561 WriteLiteral("Dropdown_"); 562 Write(currentParagraphId); 563 WriteLiteral("\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t<input type=\"hidden\" name=\"Type\""); 564 BeginWriteAttribute("value", " value=\"", 15533, "\"", 15557, 1); 565 WriteAttributeValue("", 15541, preferencesType, 15541, 16, false); 566 EndWriteAttribute(); 567 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 568 BeginWriteAttribute("value", " value=\"", 15605, "\"", 15625, 1); 569 WriteAttributeValue("", 15613, Pageview.ID, 15613, 12, false); 570 EndWriteAttribute(); 571 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"GroupID\""); 572 BeginWriteAttribute("value", " value=\"", 15667, "\"", 15683, 1); 573 WriteAttributeValue("", 15675, groupId, 15675, 8, false); 574 EndWriteAttribute(); 575 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"ProductID\""); 576 BeginWriteAttribute("value", " value=\"", 15727, "\"", 15745, 1); 577 WriteAttributeValue("", 15735, productId, 15735, 10, false); 578 EndWriteAttribute(); 579 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"VariantID\""); 580 BeginWriteAttribute("value", " value=\"", 15789, "\"", 15807, 1); 581 WriteAttributeValue("", 15797, variantId, 15797, 10, false); 582 EndWriteAttribute(); 583 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"FontSize\""); 584 BeginWriteAttribute("value", " value=\"", 15850, "\"", 15871, 1); 585 WriteAttributeValue("", 15858, linkFontSize, 15858, 13, false); 586 EndWriteAttribute(); 587 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"FontWeight\""); 588 BeginWriteAttribute("value", " value=\"", 15916, "\"", 15939, 1); 589 WriteAttributeValue("", 15924, linkFontWeight, 15924, 15, false); 590 EndWriteAttribute(); 591 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"Casing\""); 592 BeginWriteAttribute("value", " value=\"", 15980, "\"", 15999, 1); 593 WriteAttributeValue("", 15988, linkCasing, 15988, 11, false); 594 EndWriteAttribute(); 595 WriteLiteral(">\r\n\r\n\t\t\t<a"); 596 BeginWriteAttribute("id", " id=\"", 16010, "\"", 16022, 1); 597 WriteAttributeValue("", 16015, nodeId, 16015, 7, false); 598 EndWriteAttribute(); 599 WriteLiteral(" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 600 BeginWriteAttribute("class", " class=\"", 16111, "\"", 16266, 9); 601 WriteAttributeValue("", 16119, "nav-link", 16119, 8, true); 602 WriteAttributeValue(" ", 16127, "p-2", 16128, 4, true); 603 WriteAttributeValue(" ", 16131, "text-nowrap", 16132, 12, true); 604 WriteAttributeValue(" ", 16143, "text-decoration-underline-hover", 16144, 32, true); 605 WriteAttributeValue(" ", 16175, linkFontSize, 16176, 13, false); 606 WriteAttributeValue(" ", 16189, linkFontWeight, 16190, 15, false); 607 WriteAttributeValue(" ", 16205, linkCasing, 16206, 11, false); 608 WriteAttributeValue("", 16217, node.IsActive ? " active" : "", 16217, 33, false); 609 WriteAttributeValue(" ", 16250, "dropdown-toggle", 16251, 16, true); 610 EndWriteAttribute(); 611 WriteLiteral(" href=\"#\" role=\"button\" data-bs-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" "); 612 Write(node.IsActive ? " aria-current='page'" : ""); 613 WriteLiteral(">\r\n"); 614 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);WriteLiteral("\t\t\t</a>\r\n\r\n\t\t\t<ul"); 615 BeginWriteAttribute("class", " class=\"", 16533, "\"", 16563, 2); 616 WriteAttributeValue("", 16541, "dropdown-menu", 16541, 13, true); 617 WriteAttributeValue(" ", 16554, theme, 16555, 8, false); 618 EndWriteAttribute(); 619 BeginWriteAttribute("id", " id=\"", 16564, "\"", 16615, 3); 620 WriteAttributeValue("", 16569, preferencesType, 16569, 18, false); 621 WriteAttributeValue("", 16587, "Dropdown_", 16587, 9, true); 622 WriteAttributeValue("", 16596, currentParagraphId, 16596, 19, false); 623 EndWriteAttribute(); 624 WriteLiteral(">\r\n"); 625 WriteLiteral("\t\t\t</ul>\r\n\t\t</form>\r\n\r\n\t\t<form class=\"d-block d-lg-none\""); 626 BeginWriteAttribute("action", " action=\"", 16734, "\"", 16772, 2); 627 WriteAttributeValue("", 16743, "/Default.aspx?ID=", 16743, 17, true); 628 WriteAttributeValue("", 16760, node.PageId, 16760, 12, false); 629 EndWriteAttribute(); 630 WriteLiteral(" data-response-target-element=\"PreferencesModalContent\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t<input type=\"hidden\" name=\"Layout\" value=\"modal\">\r\n\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 631 BeginWriteAttribute("value", " value=\"", 17001, "\"", 17021, 1); 632 WriteAttributeValue("", 17009, Pageview.ID, 17009, 12, false); 633 EndWriteAttribute(); 634 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"GroupID\""); 635 BeginWriteAttribute("value", " value=\"", 17063, "\"", 17079, 1); 636 WriteAttributeValue("", 17071, groupId, 17071, 8, false); 637 EndWriteAttribute(); 638 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"ProductID\""); 639 BeginWriteAttribute("value", " value=\"", 17123, "\"", 17141, 1); 640 WriteAttributeValue("", 17131, productId, 17131, 10, false); 641 EndWriteAttribute(); 642 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"VariantID\""); 643 BeginWriteAttribute("value", " value=\"", 17185, "\"", 17203, 1); 644 WriteAttributeValue("", 17193, variantId, 17193, 10, false); 645 EndWriteAttribute(); 646 WriteLiteral(">\r\n\t\t\t<button type=\"button\" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 647 BeginWriteAttribute("class", " class=\"", 17319, "\"", 17435, 9); 648 WriteAttributeValue("", 17327, "btn", 17327, 3, true); 649 WriteAttributeValue(" ", 17330, "nav-link", 17331, 9, true); 650 WriteAttributeValue(" ", 17339, "p-2", 17340, 4, true); 651 WriteAttributeValue(" ", 17343, "text-nowrap", 17344, 12, true); 652 WriteAttributeValue(" ", 17355, "border-0", 17356, 9, true); 653 WriteAttributeValue(" ", 17364, "swift_open-preferences-modal", 17365, 29, true); 654 WriteAttributeValue(" ", 17393, linkFontSize, 17394, 13, false); 655 WriteAttributeValue(" ", 17407, linkFontWeight, 17408, 15, false); 656 WriteAttributeValue(" ", 17423, linkCasing, 17424, 11, false); 657 EndWriteAttribute(); 658 WriteLiteral(" data-bs-toggle=\"modal\" data-bs-target=\"#PreferencesModal\">\r\n"); 659 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);WriteLiteral("\t\t\t</button>\r\n\t\t</form>\r\n\t</li>\r\n"); 660 } 661 662 void RenderIcon(string pageIcon, string iconSize) 663 { 664 if (pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase)) 665 { 666 string iconPath = Dynamicweb.Context.Current.Server.MapPath(pageIcon); 667 668 WriteLiteral("\t\t<span"); 669 BeginWriteAttribute("class", " class=\"", 17941, "\"", 17958, 1); 670 WriteAttributeValue("", 17949, iconSize, 17949, 9, false); 671 EndWriteAttribute(); 672 WriteLiteral(">\r\n\t\t\t"); 673 Write(ReadFile(iconPath)); 674 WriteLiteral("\r\n\t\t</span>\r\n"); 675 } 676 } 677 } 678 } 679 #pragma warning restore 1591 680
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 2 @using Dynamicweb 3 @using System.Text.RegularExpressions 4 5 @{ 6 string theme = !string.IsNullOrEmpty(Model.Parameters["Theme"].ToString()) ? Model.Parameters["Theme"].ToString() : string.Empty; 7 string navOrientation = !string.IsNullOrEmpty(Model.Parameters["NavOrientation"].ToString()) ? Model.Parameters["NavOrientation"].ToString() : string.Empty; 8 string navAlignment = !string.IsNullOrEmpty(Model.Parameters["NavAlignment"].ToString()) ? Model.Parameters["NavAlignment"].ToString() : string.Empty; 9 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 10 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 11 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 12 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 13 string iconSize = "icon-3"; 14 15 if (linkFontSize == "fs-7") 16 { 17 iconSize = "icon-2"; 18 } 19 if (linkFontSize == "fs-5") 20 { 21 iconSize = "icon-4"; 22 } 23 } 24 25 <nav class="d-flex py-0 @navOrientation @navAlignment"> 26 @{<text>@{RenderFirstLevelNodes(Model.Nodes, theme, navOrientation, linkFontWeight, linkCasing, linkFontSize, iconSize, layout);}</text>} 27 </nav> 28 29 @functions { 30 void RenderFirstLevelNodes(IEnumerable<Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel> nodes, string theme, string navOrientation, string linkFontWeight, string linkCasing, string linkFontSize, string iconSize, string layout) 31 { 32 bool showOnlyFirstNavLevel = Model.Parameters.ContainsKey("ShowOnlyFirstNavLevel") ? Convert.ToBoolean(Model.Parameters["ShowOnlyFirstNavLevel"].ToString()) : false; 33 int currentParagraphId = Pageview.CurrentParagraph.ID; 34 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 35 36 <ul class="nav flex-nowrap @(navOrientation == "vertical" ? "flex-column" : navOrientation)"> 37 38 @foreach (var node in nodes) 39 { 40 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 41 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 42 string pageIcon = string.Empty; 43 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 44 { 45 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 46 } 47 string preferencesLayout = page.Item?["PreferencesLayout"] != null ? page.Item["PreferencesLayout"].ToString() : ""; 48 string preferencesType = "language"; 49 bool countrySelector = page.Item?["CountrySelector"] != null ? Convert.ToBoolean(page.Item["CountrySelector"].ToString()) : false; 50 bool languageSelector = page.Item?["LanguageSelector"] != null ? Convert.ToBoolean(page.Item["LanguageSelector"].ToString()) : false; 51 bool currencySelector = page.Item?["CurrencySelector"] != null ? Convert.ToBoolean(page.Item["CurrencySelector"].ToString()) : false; 52 string dropdownAttributes = string.Empty; 53 string dropdownClasses = string.Empty; 54 55 var hasChildren = node.Nodes.Count() > 0 || pageType == "Swift_SignIn"; 56 57 if (hasChildren && !showOnlyFirstNavLevel) 58 { 59 dropdownAttributes = hasChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 60 } 61 62 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Navigation_" + node.GroupId + "_" + currentParagraphId : "Navigation_Page_Desktop_" + node.PageId.ToString() + "_" + currentParagraphId; 63 64 if (pageType != "Swift_Preferences") 65 { 66 <li class="nav-item@(hasChildren ? " dropdown" : "")"> 67 @if (node.IsClickable) 68 { 69 <a href="@node.Link" class="p-2 nav-link text-nowrap text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing@(node.IsActive ? " active" : "")@(hasChildren ? " dropdown-toggle" : "")" @dropdownAttributes @(node.IsActive ? " aria-current='page'" : "") id="@nodeId"> 70 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 71 </a> 72 } 73 else 74 { 75 <span class="p-2 nav-link text-nowrap @linkFontSize @linkFontWeight @linkCasing@(hasChildren ? " dropdown-toggle " : "")" @dropdownAttributes id="@nodeId"> 76 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 77 </span> 78 } 79 80 @if (hasChildren) 81 { 82 if (!showOnlyFirstNavLevel) 83 { 84 <ul class="dropdown-menu @(theme)" aria-labelledby="@nodeId"> 85 @foreach (var subnode in node.Nodes)//Standard pages 86 { 87 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Navigation_" + subnode.GroupId + "_" + currentParagraphId : "Navigation_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 88 89 <li> 90 @if (subnode.IsClickable) 91 { 92 <a href="@subnode.Link" class="dropdown-item py-2 text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing" @(subnode.IsActive ? " aria-current='page'" : "") id="@nodeId">@subnode.Name</a> 93 } 94 else 95 { 96 <span class="dropdown-item py-2 @linkFontSize @linkFontWeight @linkCasing" @(subnode.IsActive ? " aria-current='page'" : "") id="@nodeId">@subnode.Name</span> 97 } 98 </li> 99 } 100 @if (pageType == "Swift_SignIn") //Sign out link 101 { 102 if (Pageview.User != null) 103 { 104 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 105 106 <li><hr class="dropdown-divider"></li> 107 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 108 { 109 <li> 110 <a href="Default.aspx?ID=@(Pageview.ID)&DwExtranetRemoveSecondaryUser=1" class="dropdown-item py-2 text-decoration-underline-hover swift_sign-out-as-customer-link @linkFontSize @linkFontWeight @linkCasing" id="SignInButton_@currentParagraphId">@Translate("Sign out as a customer")</a> 111 </li> 112 } 113 <li> 114 <a href="@link" class="dropdown-item py-2 text-decoration-underline-hover swift_sign-out-link @linkFontSize @linkFontWeight @linkCasing">@Translate("Sign out")</a> 115 </li> 116 } 117 } 118 </ul> 119 } 120 } 121 </li> 122 } 123 else 124 { 125 if (preferencesLayout == "modal") 126 { 127 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 128 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 129 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 130 131 <li class="nav-item@(hasChildren ? " dropdown" : "")"> 132 <form action="/Default.aspx?ID=@node.PageId" data-response-target-element="PreferencesModalContent" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 133 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 134 <input type="hidden" name="GroupID" value="@groupId"> 135 <input type="hidden" name="ProductID" value="@productId"> 136 <input type="hidden" name="VariantID" value="@variantId"> 137 <button type="button" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="btn nav-link p-2 text-nowrap border-0 swift_open-preferences-modal @linkFontSize @linkFontWeight @linkCasing" data-bs-toggle="modal" data-bs-target="#PreferencesModal" id="OpenPreferences_@currentParagraphId"> 138 @if (languageSelector) 139 { 140 {<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, "language");}</text>} 141 } 142 else 143 { 144 {<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 145 } 146 </button> 147 </form> 148 </li> 149 } 150 else 151 { 152 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries(); 153 var currencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies(); 154 155 if (languageSelector) 156 { 157 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); 158 159 if (Pageview.Page.Area.IsMaster) 160 { 161 languages.Add(Pageview.Page); 162 if (Pageview.Page.Languages != null) 163 { 164 foreach (var language in Pageview.Page.Languages) 165 { 166 if (language.Area.Active == true) 167 { 168 languages.Add(language); 169 } 170 } 171 } 172 } 173 else 174 { 175 languages.Add(Pageview.Page.MasterPage); 176 if (Pageview.Page.MasterPage != null) 177 { 178 if (Pageview.Page.MasterPage.Languages != null) 179 { 180 foreach (var language in Pageview.Page.MasterPage.Languages) 181 { 182 if (language.Area.Active == true) 183 { 184 languages.Add(language); 185 } 186 } 187 } 188 } 189 } 190 191 if (languages.Count > 1) 192 { 193 preferencesType = "language"; 194 195 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 196 } 197 } 198 if (countrySelector && ecomCountries.Count > 1) 199 { 200 preferencesType = "country"; 201 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 202 } 203 if (currencySelector && currencies.Count() > 1) 204 { 205 preferencesType = "currency"; 206 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 207 } 208 } 209 } 210 } 211 </ul> 212 } 213 } 214 215 @functions { 216 void RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout, string preferencesType = "") 217 { 218 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 219 if (pageType == "Swift_Cart") //Mini cart 220 { 221 string cartId = ""; 222 if (page.Item["ContextCart"] != null) 223 { 224 cartId = !string.IsNullOrEmpty(page.Item["ContextCart"].ToString()) ? "ID=\"Cart_" + page.Item["ContextCart"].ToString() + "\"" : ""; 225 } 226 227 string jsCartClass = string.IsNullOrEmpty(cartId) ? "js-cart-qty" : ""; 228 double totalProducts = 0; 229 230 231 Dynamicweb.Ecommerce.Common.Context.CartContext = null; 232 if (page.Item["ContextCart"] != null) 233 { 234 var orderContext = Dynamicweb.Ecommerce.Services.OrderContexts.GetOrderContextById(page.Item["ContextCart"].ToString()); 235 Dynamicweb.Ecommerce.Common.Context.CartContext = orderContext; 236 } 237 238 if (Dynamicweb.Ecommerce.Common.Context.Cart != null) 239 { 240 bool renderOrderlineCountInsteadOfProductCount = page.Item["RenderOrderlineCountInsteadOfProductCount"] != null ? Convert.ToBoolean(page.Item["RenderOrderlineCountInsteadOfProductCount"]) : false; 241 if (!renderOrderlineCountInsteadOfProductCount) 242 { 243 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentProductLineQuantityCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 244 } 245 else 246 { 247 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentOrderLineCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 248 } 249 } 250 251 252 switch (layout) 253 { 254 case "linksOnly": 255 <span class="align-middle">@node.Name</span> 256 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 257 break; 258 259 case "iconsOnly": 260 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 261 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 262 break; 263 case "iconsAndLinks": 264 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 265 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 266 <span class="align-middle">@node.Name</span> 267 break; 268 case "linksAndIcons": 269 <span class="align-middle">@node.Name</span> 270 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 271 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 272 break; 273 } 274 } 275 else 276 { 277 string name = node.Name; 278 279 if (preferencesType == "country") 280 { //Country 281 name = Translate("Deliver to") + ": " + Dynamicweb.Ecommerce.Common.Context.Country.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID); 282 } 283 284 if (preferencesType == "language") 285 { //Languange 286 string iconFolder = "/Files/FlagIcons/"; 287 pageIcon = iconFolder + Pageview.Area.CultureInfo.Name.ToLower() + ".svg"; 288 Regex reg = new Regex(@"\(([^\)]+)\)"); 289 name = reg.Replace(Pageview.Area.CultureInfo.DisplayName, ""); 290 291 layout = layout == "linksOnly" ? "iconsAndLinks" : layout; 292 bool hideIcon = page.Item?["HideIcon"] != null ? Convert.ToBoolean(page.Item["HideIcon"].ToString()) : false; 293 bool hideName = page.Item?["HideName"] != null ? Convert.ToBoolean(page.Item["HideName"].ToString()) : false; 294 layout = hideIcon ? "linksOnly" : layout; 295 layout = hideName ? "iconsOnly" : layout; 296 } 297 298 if (preferencesType == "currency") 299 { //Country 300 name = Dynamicweb.Ecommerce.Common.Context.Currency.Code; 301 } 302 303 switch (layout) 304 { 305 case "linksOnly": 306 <span class="align-middle">@name</span> 307 break; 308 309 case "iconsOnly": 310 <span class="visually-hidden">@name</span> 311 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 312 break; 313 case "iconsAndLinks": 314 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 315 <span class="align-middle">@name</span> 316 break; 317 case "linksAndIcons": 318 <span class="align-middle">@name</span> 319 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 320 break; 321 } 322 } 323 } 324 } 325 326 @functions { 327 void RenderPreferencesDropdown(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string preferencesType, string linkFontSize, string linkFontWeight, string linkCasing, string theme, string pageType, string pageIcon, string iconSize, string layout) 328 { 329 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 330 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 331 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 332 int currentParagraphId = Pageview.CurrentParagraph.ID; 333 334 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "PreferencesLink_" + node.GroupId + "_" + currentParagraphId : "PreferencesLink_" + node.PageId.ToString() + "_" + currentParagraphId; 335 336 <li class="nav-item dropdown"> 337 <form class="d-none d-lg-block" action="/Default.aspx?ID=@node.PageId" data-response-target-element="@(preferencesType)Dropdown_@currentParagraphId" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 338 <input type="hidden" name="Type" value="@preferencesType"> 339 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 340 <input type="hidden" name="GroupID" value="@groupId"> 341 <input type="hidden" name="ProductID" value="@productId"> 342 <input type="hidden" name="VariantID" value="@variantId"> 343 <input type="hidden" name="FontSize" value="@linkFontSize"> 344 <input type="hidden" name="FontWeight" value="@linkFontWeight"> 345 <input type="hidden" name="Casing" value="@linkCasing"> 346 347 <a id="@nodeId" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="nav-link p-2 text-nowrap text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing@(node.IsActive ? " active" : "") dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @(node.IsActive ? " aria-current='page'" : "")> 348 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);}</text>} 349 </a> 350 351 <ul class="dropdown-menu @(theme)" id="@(preferencesType)Dropdown_@currentParagraphId"> 352 @* The content here comes from an external request *@ 353 </ul> 354 </form> 355 356 <form class="d-block d-lg-none" action="/Default.aspx?ID=@node.PageId" data-response-target-element="PreferencesModalContent" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 357 <input type="hidden" name="Layout" value="modal"> 358 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 359 <input type="hidden" name="GroupID" value="@groupId"> 360 <input type="hidden" name="ProductID" value="@productId"> 361 <input type="hidden" name="VariantID" value="@variantId"> 362 <button type="button" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="btn nav-link p-2 text-nowrap border-0 swift_open-preferences-modal @linkFontSize @linkFontWeight @linkCasing" data-bs-toggle="modal" data-bs-target="#PreferencesModal"> 363 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);}</text>} 364 </button> 365 </form> 366 </li> 367 } 368 } 369 370 @functions { 371 void RenderIcon(string pageIcon, string iconSize) 372 { 373 if (pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase)) 374 { 375 string iconPath = Dynamicweb.Context.Current.Server.MapPath(pageIcon); 376 377 <span class="@iconSize"> 378 @ReadFile(iconPath) 379 </span> 380 } 381 } 382 } 383
Error executing template "Designs/Swift/Paragraph/Swift_Accordion.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_7b29793cd8474ce7b1b5f57d3ec07a5d.ExecuteAsync() at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader) at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 100 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 747
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 3 4 @{ 5 string title = Model.Item.GetString("Title"); 6 var accordionItems = Model.Item?.GetItems("Accordion_Items") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); 7 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 8 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 9 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 10 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 11 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 12 } 13 14 <div class="accordion@(theme) @(contentPadding) h-100 item_@Model.Item.SystemName.ToLower()" id="accordion-@Pageview.CurrentParagraph.ID"> 15 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 16 @{ <text>@{RenderTitle();}</text> } 17 @foreach (var item in accordionItems) 18 { 19 <div class="accordion-item"> 20 <h2 class="accordion-header" id="heading-@Pageview.CurrentParagraph.ID-@item.Id"> 21 <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-@Pageview.CurrentParagraph.ID-@item.Id" aria-expanded="false" aria-controls="collapse-@Pageview.CurrentParagraph.ID-@item.Id"> 22 @item.GetString("Title") 23 </button> 24 </h2> 25 <div id="collapse-@Pageview.CurrentParagraph.ID-@item.Id" class="accordion-collapse collapse" aria-labelledby="heading-@Pageview.CurrentParagraph.ID-@item.Id" data-bs-parent="#accordion-@Pageview.CurrentParagraph.ID"> 26 <div class="accordion-body mb-0-last-child opacity-75"> 27 @item.GetRawValueString("Content") 28 </div> 29 </div> 30 </div> 31 } 32 </div> 33 34 @functions { 35 void RenderTitle() 36 { 37 if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 38 { 39 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h2"); 40 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 41 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} mb-4\">"; 42 string headingLevelStop = $"</{headingLevel}>"; 43 44 @headingLevelStart 45 @Model.Item.GetString("Title") 46 @headingLevelStop 47 } 48 } 49 } 50
Error compiling template "Designs/Swift/Navigation/Navigation.cshtml" Line 211: 'User.GetCurrentSecondaryUser()' is obsolete: 'Use UserContext.Current.ImpersonatingUser instead.' Line 416: 'Order' does not contain a definition for 'GetParentOrderLineCount' and no accessible extension method 'GetParentOrderLineCount' accepting a first argument of type 'Order' could be found (are you missing a using directive or an assembly reference?)
1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb; 11 using System.Text.RegularExpressions; 12 internal class RazorEngine_4fba592d73f64892b70b88ca2f57d919 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\r\n"); 18 19 string theme = !string.IsNullOrEmpty(Model.Parameters["Theme"].ToString()) ? Model.Parameters["Theme"].ToString() : string.Empty; 20 string navOrientation = !string.IsNullOrEmpty(Model.Parameters["NavOrientation"].ToString()) ? Model.Parameters["NavOrientation"].ToString() : string.Empty; 21 string navAlignment = !string.IsNullOrEmpty(Model.Parameters["NavAlignment"].ToString()) ? Model.Parameters["NavAlignment"].ToString() : string.Empty; 22 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 23 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 24 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 25 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 26 string iconSize = "icon-3"; 27 28 if (linkFontSize == "fs-7") 29 { 30 iconSize = "icon-2"; 31 } 32 if (linkFontSize == "fs-5") 33 { 34 iconSize = "icon-4"; 35 } 36 WriteLiteral("\r\n<nav"); 37 BeginWriteAttribute("class", " class=\"", 1373, "\"", 1422, 4); 38 WriteAttributeValue("", 1381, "d-flex", 1381, 6, true); 39 WriteAttributeValue(" ", 1387, "py-0", 1388, 5, true); 40 WriteAttributeValue(" ", 1392, navOrientation, 1393, 15, false); 41 WriteAttributeValue(" ", 1408, navAlignment, 1409, 13, false); 42 EndWriteAttribute(); 43 WriteLiteral(">\r\n"); 44 RenderFirstLevelNodes(Model.Nodes, theme, navOrientation, linkFontWeight, linkCasing, linkFontSize, iconSize, layout);WriteLiteral("</nav>\r\n\r\n"); 45 WriteLiteral("\r\n"); 46 WriteLiteral("\r\n"); 47 WriteLiteral("\r\n"); 48 } 49 #pragma warning restore 1998 50 51 void RenderFirstLevelNodes(IEnumerable<Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel> nodes, string theme, string navOrientation, string linkFontWeight, string linkCasing, string linkFontSize, string iconSize, string layout) 52 { 53 bool showOnlyFirstNavLevel = Model.Parameters.ContainsKey("ShowOnlyFirstNavLevel") ? Convert.ToBoolean(Model.Parameters["ShowOnlyFirstNavLevel"].ToString()) : false; 54 int currentParagraphId = Pageview.CurrentParagraph.ID; 55 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 56 57 WriteLiteral("\t<ul"); 58 BeginWriteAttribute("class", " class=\"", 2200, "\"", 2288, 3); 59 WriteAttributeValue("", 2208, "nav", 2208, 3, true); 60 WriteAttributeValue(" ", 2211, "flex-nowrap", 2212, 12, true); 61 WriteAttributeValue(" ", 2223, navOrientation == "vertical" ? "flex-column" : navOrientation, 2224, 64, false); 62 EndWriteAttribute(); 63 WriteLiteral(">\r\n\r\n"); 64 foreach (var node in nodes) 65 { 66 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 67 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 68 string pageIcon = string.Empty; 69 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 70 { 71 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 72 } 73 string preferencesLayout = page.Item?["PreferencesLayout"] != null ? page.Item["PreferencesLayout"].ToString() : ""; 74 string preferencesType = "language"; 75 bool countrySelector = page.Item?["CountrySelector"] != null ? Convert.ToBoolean(page.Item["CountrySelector"].ToString()) : false; 76 bool languageSelector = page.Item?["LanguageSelector"] != null ? Convert.ToBoolean(page.Item["LanguageSelector"].ToString()) : false; 77 bool currencySelector = page.Item?["CurrencySelector"] != null ? Convert.ToBoolean(page.Item["CurrencySelector"].ToString()) : false; 78 string dropdownAttributes = string.Empty; 79 string dropdownClasses = string.Empty; 80 81 var hasChildren = node.Nodes.Count() > 0 || pageType == "Swift_SignIn"; 82 83 if (hasChildren && !showOnlyFirstNavLevel) 84 { 85 dropdownAttributes = hasChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 86 } 87 88 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Navigation_" + node.GroupId + "_" + currentParagraphId : "Navigation_Page_Desktop_" + node.PageId.ToString() + "_" + currentParagraphId; 89 90 if (pageType != "Swift_Preferences") 91 { 92 WriteLiteral("\t\t\t\t<li"); 93 BeginWriteAttribute("class", " class=\"", 3927, "\"", 3976, 2); 94 WriteAttributeValue("", 3935, "nav-item", 3935, 8, true); 95 WriteAttributeValue("", 3943, hasChildren ? " dropdown" : "", 3943, 33, false); 96 EndWriteAttribute(); 97 WriteLiteral(">\r\n"); 98 if (node.IsClickable) 99 { 100 WriteLiteral("\t\t\t\t\t\t<a"); 101 BeginWriteAttribute("href", " href=\"", 4025, "\"", 4042, 1); 102 WriteAttributeValue("", 4032, node.Link, 4032, 10, false); 103 EndWriteAttribute(); 104 BeginWriteAttribute("class", " class=\"", 4043, "\"", 4222, 9); 105 WriteAttributeValue("", 4051, "p-2", 4051, 3, true); 106 WriteAttributeValue(" ", 4054, "nav-link", 4055, 9, true); 107 WriteAttributeValue(" ", 4063, "text-nowrap", 4064, 12, true); 108 WriteAttributeValue(" ", 4075, "text-decoration-underline-hover", 4076, 32, true); 109 WriteAttributeValue(" ", 4107, linkFontSize, 4108, 13, false); 110 WriteAttributeValue(" ", 4121, linkFontWeight, 4122, 15, false); 111 WriteAttributeValue(" ", 4137, linkCasing, 4138, 11, false); 112 WriteAttributeValue("", 4149, node.IsActive ? " active" : "", 4149, 33, false); 113 WriteAttributeValue("", 4182, hasChildren ? " dropdown-toggle" : "", 4182, 40, false); 114 EndWriteAttribute(); 115 WriteLiteral(" "); 116 Write(dropdownAttributes); 117 WriteLiteral(" "); 118 Write(node.IsActive ? " aria-current='page'" : ""); 119 WriteLiteral(" id=\""); 120 Write(nodeId); 121 WriteLiteral("\">\r\n"); 122 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);WriteLiteral("\t\t\t\t\t\t</a>\r\n"); 123 } 124 else 125 { 126 WriteLiteral("\t\t\t\t\t\t<span"); 127 BeginWriteAttribute("class", " class=\"", 4449, "\"", 4564, 7); 128 WriteAttributeValue("", 4457, "p-2", 4457, 3, true); 129 WriteAttributeValue(" ", 4460, "nav-link", 4461, 9, true); 130 WriteAttributeValue(" ", 4469, "text-nowrap", 4470, 12, true); 131 WriteAttributeValue(" ", 4481, linkFontSize, 4482, 13, false); 132 WriteAttributeValue(" ", 4495, linkFontWeight, 4496, 15, false); 133 WriteAttributeValue(" ", 4511, linkCasing, 4512, 11, false); 134 WriteAttributeValue("", 4523, hasChildren ? " dropdown-toggle " : "", 4523, 41, false); 135 EndWriteAttribute(); 136 WriteLiteral(" "); 137 Write(dropdownAttributes); 138 WriteLiteral(" id=\""); 139 Write(nodeId); 140 WriteLiteral("\">\r\n"); 141 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);WriteLiteral("\t\t\t\t\t\t</span>\r\n"); 142 } 143 WriteLiteral("\r\n"); 144 if (hasChildren) 145 { 146 if (!showOnlyFirstNavLevel) 147 { 148 WriteLiteral("\t\t\t\t\t\t\t<ul"); 149 BeginWriteAttribute("class", " class=\"", 4805, "\"", 4835, 2); 150 WriteAttributeValue("", 4813, "dropdown-menu", 4813, 13, true); 151 WriteAttributeValue(" ", 4826, theme, 4827, 8, false); 152 EndWriteAttribute(); 153 BeginWriteAttribute("aria-labelledby", " aria-labelledby=\"", 4836, "\"", 4861, 1); 154 WriteAttributeValue("", 4854, nodeId, 4854, 7, false); 155 EndWriteAttribute(); 156 WriteLiteral(">\r\n"); 157 foreach (var subnode in node.Nodes)//Standard pages 158 { 159 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Navigation_" + subnode.GroupId + "_" + currentParagraphId : "Navigation_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 160 161 WriteLiteral("\t\t\t\t\t\t\t\t\t<li>\r\n"); 162 if (subnode.IsClickable) 163 { 164 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<a"); 165 BeginWriteAttribute("href", " href=\"", 5214, "\"", 5234, 1); 166 WriteAttributeValue("", 5221, subnode.Link, 5221, 13, false); 167 EndWriteAttribute(); 168 BeginWriteAttribute("class", " class=\"", 5235, "\"", 5335, 6); 169 WriteAttributeValue("", 5243, "dropdown-item", 5243, 13, true); 170 WriteAttributeValue(" ", 5256, "py-2", 5257, 5, true); 171 WriteAttributeValue(" ", 5261, "text-decoration-underline-hover", 5262, 32, true); 172 WriteAttributeValue(" ", 5293, linkFontSize, 5294, 13, false); 173 WriteAttributeValue(" ", 5307, linkFontWeight, 5308, 15, false); 174 WriteAttributeValue(" ", 5323, linkCasing, 5324, 11, false); 175 EndWriteAttribute(); 176 WriteLiteral(" "); 177 Write(subnode.IsActive ? " aria-current='page'" : ""); 178 WriteLiteral(" id=\""); 179 Write(nodeId); 180 WriteLiteral("\">"); 181 Write(subnode.Name); 182 WriteLiteral("</a>\r\n"); 183 } 184 else 185 { 186 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<span"); 187 BeginWriteAttribute("class", " class=\"", 5477, "\"", 5545, 5); 188 WriteAttributeValue("", 5485, "dropdown-item", 5485, 13, true); 189 WriteAttributeValue(" ", 5498, "py-2", 5499, 5, true); 190 WriteAttributeValue(" ", 5503, linkFontSize, 5504, 13, false); 191 WriteAttributeValue(" ", 5517, linkFontWeight, 5518, 15, false); 192 WriteAttributeValue(" ", 5533, linkCasing, 5534, 11, false); 193 EndWriteAttribute(); 194 WriteLiteral(" "); 195 Write(subnode.IsActive ? " aria-current='page'" : ""); 196 WriteLiteral(" id=\""); 197 Write(nodeId); 198 WriteLiteral("\">"); 199 Write(subnode.Name); 200 WriteLiteral("</span>\r\n"); 201 } 202 WriteLiteral("\t\t\t\t\t\t\t\t\t</li>\r\n"); 203 } 204 if (pageType == "Swift_SignIn") //Sign out link 205 { 206 if (Pageview.User != null) 207 { 208 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 209 210 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<li><hr class=\"dropdown-divider\"></li>\r\n"); 211 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 212 { 213 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<a"); 214 BeginWriteAttribute("href", " href=\"", 6050, "\"", 6119, 3); 215 WriteAttributeValue("", 6057, "Default.aspx?ID=", 6057, 16, true); 216 WriteAttributeValue("", 6073, Pageview.ID, 6073, 14, false); 217 WriteAttributeValue("", 6087, "&DwExtranetRemoveSecondaryUser=1", 6087, 32, true); 218 EndWriteAttribute(); 219 BeginWriteAttribute("class", " class=\"", 6120, "\"", 6252, 7); 220 WriteAttributeValue("", 6128, "dropdown-item", 6128, 13, true); 221 WriteAttributeValue(" ", 6141, "py-2", 6142, 5, true); 222 WriteAttributeValue(" ", 6146, "text-decoration-underline-hover", 6147, 32, true); 223 WriteAttributeValue(" ", 6178, "swift_sign-out-as-customer-link", 6179, 32, true); 224 WriteAttributeValue(" ", 6210, linkFontSize, 6211, 13, false); 225 WriteAttributeValue(" ", 6224, linkFontWeight, 6225, 15, false); 226 WriteAttributeValue(" ", 6240, linkCasing, 6241, 11, false); 227 EndWriteAttribute(); 228 BeginWriteAttribute("id", " id=\"", 6253, "\"", 6290, 2); 229 WriteAttributeValue("", 6258, "SignInButton_", 6258, 13, true); 230 WriteAttributeValue("", 6271, currentParagraphId, 6271, 19, false); 231 EndWriteAttribute(); 232 WriteLiteral(">"); 233 Write(Translate("Sign out as a customer")); 234 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 235 } 236 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t<a"); 237 BeginWriteAttribute("href", " href=\"", 6394, "\"", 6406, 1); 238 WriteAttributeValue("", 6401, link, 6401, 5, false); 239 EndWriteAttribute(); 240 BeginWriteAttribute("class", " class=\"", 6407, "\"", 6527, 7); 241 WriteAttributeValue("", 6415, "dropdown-item", 6415, 13, true); 242 WriteAttributeValue(" ", 6428, "py-2", 6429, 5, true); 243 WriteAttributeValue(" ", 6433, "text-decoration-underline-hover", 6434, 32, true); 244 WriteAttributeValue(" ", 6465, "swift_sign-out-link", 6466, 20, true); 245 WriteAttributeValue(" ", 6485, linkFontSize, 6486, 13, false); 246 WriteAttributeValue(" ", 6499, linkFontWeight, 6500, 15, false); 247 WriteAttributeValue(" ", 6515, linkCasing, 6516, 11, false); 248 EndWriteAttribute(); 249 WriteLiteral(">"); 250 Write(Translate("Sign out")); 251 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 252 } 253 } 254 WriteLiteral("\t\t\t\t\t\t\t</ul>\r\n"); 255 } 256 } 257 WriteLiteral("\t\t\t\t</li>\r\n"); 258 } 259 else 260 { 261 if (preferencesLayout == "modal") 262 { 263 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 264 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 265 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 266 267 WriteLiteral("\t\t\t\t\t<li"); 268 BeginWriteAttribute("class", " class=\"", 7154, "\"", 7203, 2); 269 WriteAttributeValue("", 7162, "nav-item", 7162, 8, true); 270 WriteAttributeValue("", 7170, hasChildren ? " dropdown" : "", 7170, 33, false); 271 EndWriteAttribute(); 272 WriteLiteral(">\r\n\t\t\t\t\t\t<form"); 273 BeginWriteAttribute("action", " action=\"", 7218, "\"", 7256, 2); 274 WriteAttributeValue("", 7227, "/Default.aspx?ID=", 7227, 17, true); 275 WriteAttributeValue("", 7244, node.PageId, 7244, 12, false); 276 EndWriteAttribute(); 277 WriteLiteral(" data-response-target-element=\"PreferencesModalContent\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 278 BeginWriteAttribute("value", " value=\"", 7435, "\"", 7455, 1); 279 WriteAttributeValue("", 7443, Pageview.ID, 7443, 12, false); 280 EndWriteAttribute(); 281 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"GroupID\""); 282 BeginWriteAttribute("value", " value=\"", 7501, "\"", 7517, 1); 283 WriteAttributeValue("", 7509, groupId, 7509, 8, false); 284 EndWriteAttribute(); 285 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"ProductID\""); 286 BeginWriteAttribute("value", " value=\"", 7565, "\"", 7583, 1); 287 WriteAttributeValue("", 7573, productId, 7573, 10, false); 288 EndWriteAttribute(); 289 WriteLiteral(">\r\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"VariantID\""); 290 BeginWriteAttribute("value", " value=\"", 7631, "\"", 7649, 1); 291 WriteAttributeValue("", 7639, variantId, 7639, 10, false); 292 EndWriteAttribute(); 293 WriteLiteral(">\r\n\t\t\t\t\t\t\t<button type=\"button\" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 294 BeginWriteAttribute("class", " class=\"", 7769, "\"", 7885, 9); 295 WriteAttributeValue("", 7777, "btn", 7777, 3, true); 296 WriteAttributeValue(" ", 7780, "nav-link", 7781, 9, true); 297 WriteAttributeValue(" ", 7789, "p-2", 7790, 4, true); 298 WriteAttributeValue(" ", 7793, "text-nowrap", 7794, 12, true); 299 WriteAttributeValue(" ", 7805, "border-0", 7806, 9, true); 300 WriteAttributeValue(" ", 7814, "swift_open-preferences-modal", 7815, 29, true); 301 WriteAttributeValue(" ", 7843, linkFontSize, 7844, 13, false); 302 WriteAttributeValue(" ", 7857, linkFontWeight, 7858, 15, false); 303 WriteAttributeValue(" ", 7873, linkCasing, 7874, 11, false); 304 EndWriteAttribute(); 305 WriteLiteral(" data-bs-toggle=\"modal\" data-bs-target=\"#PreferencesModal\""); 306 BeginWriteAttribute("id", " id=\"", 7944, "\"", 7984, 2); 307 WriteAttributeValue("", 7949, "OpenPreferences_", 7949, 16, true); 308 WriteAttributeValue("", 7965, currentParagraphId, 7965, 19, false); 309 EndWriteAttribute(); 310 WriteLiteral(">\r\n"); 311 if (languageSelector) 312 { 313 { RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, "language"); } 314 } 315 else 316 { 317 { RenderNavigationItem(node, pageType, pageIcon, iconSize, layout); } 318 } 319 WriteLiteral("\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</li>\r\n"); 320 } 321 else 322 { 323 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries(); 324 var currencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies(); 325 326 if (languageSelector) 327 { 328 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); 329 330 if (Pageview.Page.Area.IsMaster) 331 { 332 languages.Add(Pageview.Page); 333 if (Pageview.Page.Languages != null) 334 { 335 foreach (var language in Pageview.Page.Languages) 336 { 337 if (language.Area.Active == true) 338 { 339 languages.Add(language); 340 } 341 } 342 } 343 } 344 else 345 { 346 languages.Add(Pageview.Page.MasterPage); 347 if (Pageview.Page.MasterPage != null) 348 { 349 if (Pageview.Page.MasterPage.Languages != null) 350 { 351 foreach (var language in Pageview.Page.MasterPage.Languages) 352 { 353 if (language.Area.Active == true) 354 { 355 languages.Add(language); 356 } 357 } 358 } 359 } 360 } 361 362 if (languages.Count > 1) 363 { 364 preferencesType = "language"; 365 366 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 367 } 368 } 369 if (countrySelector && ecomCountries.Count > 1) 370 { 371 preferencesType = "country"; 372 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 373 } 374 if (currencySelector && currencies.Count() > 1) 375 { 376 preferencesType = "currency"; 377 { RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout); } 378 } 379 } 380 } 381 } 382 WriteLiteral("\t</ul>\r\n"); 383 } 384 385 void RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout, string preferencesType = "") 386 { 387 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 388 if (pageType == "Swift_Cart") //Mini cart 389 { 390 string cartId = ""; 391 if (page.Item["ContextCart"] != null) 392 { 393 cartId = !string.IsNullOrEmpty(page.Item["ContextCart"].ToString()) ? "ID=\"Cart_" + page.Item["ContextCart"].ToString() + "\"" : ""; 394 } 395 396 string jsCartClass = string.IsNullOrEmpty(cartId) ? "js-cart-qty" : ""; 397 double totalProducts = 0; 398 399 400 Dynamicweb.Ecommerce.Common.Context.CartContext = null; 401 if (page.Item["ContextCart"] != null) 402 { 403 var orderContext = Dynamicweb.Ecommerce.Services.OrderContexts.GetOrderContextById(page.Item["ContextCart"].ToString()); 404 Dynamicweb.Ecommerce.Common.Context.CartContext = orderContext; 405 } 406 407 if (Dynamicweb.Ecommerce.Common.Context.Cart != null) 408 { 409 bool renderOrderlineCountInsteadOfProductCount = page.Item["RenderOrderlineCountInsteadOfProductCount"] != null ? Convert.ToBoolean(page.Item["RenderOrderlineCountInsteadOfProductCount"]) : false; 410 if (!renderOrderlineCountInsteadOfProductCount) 411 { 412 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentProductLineQuantityCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 413 } 414 else 415 { 416 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentOrderLineCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 417 } 418 } 419 420 421 switch (layout) 422 { 423 case "linksOnly": 424 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 425 Write(node.Name); 426 WriteLiteral("</span>\r\n\t\t\t\t<span"); 427 BeginWriteAttribute("class", " class=\"", 11922, "\"", 11974, 3); 428 WriteAttributeValue("", 11930, jsCartClass, 11930, 12, false); 429 WriteAttributeValue(" ", 11942, "mini-cart-quantity", 11943, 19, true); 430 WriteAttributeValue(" ", 11961, "align-middle", 11962, 13, true); 431 EndWriteAttribute(); 432 WriteLiteral(" "); 433 Write(cartId); 434 WriteLiteral(">("); 435 Write(totalProducts); 436 WriteLiteral(")</span>\r\n"); 437 break; 438 439 case "iconsOnly": 440 { RenderIcon(pageIcon, iconSize); } 441 WriteLiteral("\t\t\t\t<span"); 442 BeginWriteAttribute("class", " class=\"", 12109, "\"", 12161, 3); 443 WriteAttributeValue("", 12117, jsCartClass, 12117, 12, false); 444 WriteAttributeValue(" ", 12129, "mini-cart-quantity", 12130, 19, true); 445 WriteAttributeValue(" ", 12148, "align-middle", 12149, 13, true); 446 EndWriteAttribute(); 447 WriteLiteral(" "); 448 Write(cartId); 449 WriteLiteral(">("); 450 Write(totalProducts); 451 WriteLiteral(")</span>\r\n"); 452 break; 453 case "iconsAndLinks": 454 { RenderIcon(pageIcon, iconSize); } 455 WriteLiteral("\t\t\t\t<span"); 456 BeginWriteAttribute("class", " class=\"", 12298, "\"", 12350, 3); 457 WriteAttributeValue("", 12306, jsCartClass, 12306, 12, false); 458 WriteAttributeValue(" ", 12318, "mini-cart-quantity", 12319, 19, true); 459 WriteAttributeValue(" ", 12337, "align-middle", 12338, 13, true); 460 EndWriteAttribute(); 461 WriteLiteral(" "); 462 Write(cartId); 463 WriteLiteral(">("); 464 Write(totalProducts); 465 WriteLiteral(")</span>\r\n\t\t\t\t<span class=\"align-middle\">"); 466 Write(node.Name); 467 WriteLiteral("</span>\r\n"); 468 break; 469 case "linksAndIcons": 470 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 471 Write(node.Name); 472 WriteLiteral("</span>\r\n\t\t\t\t<span"); 473 BeginWriteAttribute("class", " class=\"", 12532, "\"", 12584, 3); 474 WriteAttributeValue("", 12540, jsCartClass, 12540, 12, false); 475 WriteAttributeValue(" ", 12552, "mini-cart-quantity", 12553, 19, true); 476 WriteAttributeValue(" ", 12571, "align-middle", 12572, 13, true); 477 EndWriteAttribute(); 478 WriteLiteral(" "); 479 Write(cartId); 480 WriteLiteral(">("); 481 Write(totalProducts); 482 WriteLiteral(")</span>\r\n"); 483 { RenderIcon(pageIcon, iconSize); } 484 break; 485 } 486 } 487 else 488 { 489 string name = node.Name; 490 491 if (preferencesType == "country") 492 { //Country 493 name = Translate("Deliver to") + ": " + Dynamicweb.Ecommerce.Common.Context.Country.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID); 494 } 495 496 if (preferencesType == "language") 497 { //Languange 498 string iconFolder = "/Files/FlagIcons/"; 499 pageIcon = iconFolder + Pageview.Area.CultureInfo.Name.ToLower() + ".svg"; 500 Regex reg = new Regex(@"\(([^\)]+)\)"); 501 name = reg.Replace(Pageview.Area.CultureInfo.DisplayName, ""); 502 503 layout = layout == "linksOnly" ? "iconsAndLinks" : layout; 504 bool hideIcon = page.Item?["HideIcon"] != null ? Convert.ToBoolean(page.Item["HideIcon"].ToString()) : false; 505 bool hideName = page.Item?["HideName"] != null ? Convert.ToBoolean(page.Item["HideName"].ToString()) : false; 506 layout = hideIcon ? "linksOnly" : layout; 507 layout = hideName ? "iconsOnly" : layout; 508 } 509 510 if (preferencesType == "currency") 511 { //Country 512 name = Dynamicweb.Ecommerce.Common.Context.Currency.Code; 513 } 514 515 switch (layout) 516 { 517 case "linksOnly": 518 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 519 Write(name); 520 WriteLiteral("</span>\r\n"); 521 break; 522 523 case "iconsOnly": 524 WriteLiteral("\t\t\t\t<span class=\"visually-hidden\">"); 525 Write(name); 526 WriteLiteral("</span>\r\n"); 527 { RenderIcon(pageIcon, iconSize); } 528 break; 529 case "iconsAndLinks": 530 { RenderIcon(pageIcon, iconSize); } 531 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 532 Write(name); 533 WriteLiteral("</span>\r\n"); 534 break; 535 case "linksAndIcons": 536 WriteLiteral("\t\t\t\t<span class=\"align-middle\">"); 537 Write(name); 538 WriteLiteral("</span>\r\n"); 539 { RenderIcon(pageIcon, iconSize); } 540 break; 541 } 542 } 543 } 544 545 void RenderPreferencesDropdown(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string preferencesType, string linkFontSize, string linkFontWeight, string linkCasing, string theme, string pageType, string pageIcon, string iconSize, string layout) 546 { 547 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 548 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 549 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 550 int currentParagraphId = Pageview.CurrentParagraph.ID; 551 552 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "PreferencesLink_" + node.GroupId + "_" + currentParagraphId : "PreferencesLink_" + node.PageId.ToString() + "_" + currentParagraphId; 553 554 WriteLiteral("\t<li class=\"nav-item dropdown\">\r\n\t\t<form class=\"d-none d-lg-block\""); 555 BeginWriteAttribute("action", " action=\"", 15306, "\"", 15344, 2); 556 WriteAttributeValue("", 15315, "/Default.aspx?ID=", 15315, 17, true); 557 WriteAttributeValue("", 15332, node.PageId, 15332, 12, false); 558 EndWriteAttribute(); 559 WriteLiteral(" data-response-target-element=\""); 560 Write(preferencesType); 561 WriteLiteral("Dropdown_"); 562 Write(currentParagraphId); 563 WriteLiteral("\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t<input type=\"hidden\" name=\"Type\""); 564 BeginWriteAttribute("value", " value=\"", 15533, "\"", 15557, 1); 565 WriteAttributeValue("", 15541, preferencesType, 15541, 16, false); 566 EndWriteAttribute(); 567 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 568 BeginWriteAttribute("value", " value=\"", 15605, "\"", 15625, 1); 569 WriteAttributeValue("", 15613, Pageview.ID, 15613, 12, false); 570 EndWriteAttribute(); 571 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"GroupID\""); 572 BeginWriteAttribute("value", " value=\"", 15667, "\"", 15683, 1); 573 WriteAttributeValue("", 15675, groupId, 15675, 8, false); 574 EndWriteAttribute(); 575 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"ProductID\""); 576 BeginWriteAttribute("value", " value=\"", 15727, "\"", 15745, 1); 577 WriteAttributeValue("", 15735, productId, 15735, 10, false); 578 EndWriteAttribute(); 579 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"VariantID\""); 580 BeginWriteAttribute("value", " value=\"", 15789, "\"", 15807, 1); 581 WriteAttributeValue("", 15797, variantId, 15797, 10, false); 582 EndWriteAttribute(); 583 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"FontSize\""); 584 BeginWriteAttribute("value", " value=\"", 15850, "\"", 15871, 1); 585 WriteAttributeValue("", 15858, linkFontSize, 15858, 13, false); 586 EndWriteAttribute(); 587 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"FontWeight\""); 588 BeginWriteAttribute("value", " value=\"", 15916, "\"", 15939, 1); 589 WriteAttributeValue("", 15924, linkFontWeight, 15924, 15, false); 590 EndWriteAttribute(); 591 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"Casing\""); 592 BeginWriteAttribute("value", " value=\"", 15980, "\"", 15999, 1); 593 WriteAttributeValue("", 15988, linkCasing, 15988, 11, false); 594 EndWriteAttribute(); 595 WriteLiteral(">\r\n\r\n\t\t\t<a"); 596 BeginWriteAttribute("id", " id=\"", 16010, "\"", 16022, 1); 597 WriteAttributeValue("", 16015, nodeId, 16015, 7, false); 598 EndWriteAttribute(); 599 WriteLiteral(" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 600 BeginWriteAttribute("class", " class=\"", 16111, "\"", 16266, 9); 601 WriteAttributeValue("", 16119, "nav-link", 16119, 8, true); 602 WriteAttributeValue(" ", 16127, "p-2", 16128, 4, true); 603 WriteAttributeValue(" ", 16131, "text-nowrap", 16132, 12, true); 604 WriteAttributeValue(" ", 16143, "text-decoration-underline-hover", 16144, 32, true); 605 WriteAttributeValue(" ", 16175, linkFontSize, 16176, 13, false); 606 WriteAttributeValue(" ", 16189, linkFontWeight, 16190, 15, false); 607 WriteAttributeValue(" ", 16205, linkCasing, 16206, 11, false); 608 WriteAttributeValue("", 16217, node.IsActive ? " active" : "", 16217, 33, false); 609 WriteAttributeValue(" ", 16250, "dropdown-toggle", 16251, 16, true); 610 EndWriteAttribute(); 611 WriteLiteral(" href=\"#\" role=\"button\" data-bs-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" "); 612 Write(node.IsActive ? " aria-current='page'" : ""); 613 WriteLiteral(">\r\n"); 614 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);WriteLiteral("\t\t\t</a>\r\n\r\n\t\t\t<ul"); 615 BeginWriteAttribute("class", " class=\"", 16533, "\"", 16563, 2); 616 WriteAttributeValue("", 16541, "dropdown-menu", 16541, 13, true); 617 WriteAttributeValue(" ", 16554, theme, 16555, 8, false); 618 EndWriteAttribute(); 619 BeginWriteAttribute("id", " id=\"", 16564, "\"", 16615, 3); 620 WriteAttributeValue("", 16569, preferencesType, 16569, 18, false); 621 WriteAttributeValue("", 16587, "Dropdown_", 16587, 9, true); 622 WriteAttributeValue("", 16596, currentParagraphId, 16596, 19, false); 623 EndWriteAttribute(); 624 WriteLiteral(">\r\n"); 625 WriteLiteral("\t\t\t</ul>\r\n\t\t</form>\r\n\r\n\t\t<form class=\"d-block d-lg-none\""); 626 BeginWriteAttribute("action", " action=\"", 16734, "\"", 16772, 2); 627 WriteAttributeValue("", 16743, "/Default.aspx?ID=", 16743, 17, true); 628 WriteAttributeValue("", 16760, node.PageId, 16760, 12, false); 629 EndWriteAttribute(); 630 WriteLiteral(" data-response-target-element=\"PreferencesModalContent\" data-layout-template=\"Swift_Preferences.cshtml\" data-preloader=\"inline\">\r\n\t\t\t<input type=\"hidden\" name=\"Layout\" value=\"modal\">\r\n\t\t\t<input type=\"hidden\" name=\"CurrentPageID\""); 631 BeginWriteAttribute("value", " value=\"", 17001, "\"", 17021, 1); 632 WriteAttributeValue("", 17009, Pageview.ID, 17009, 12, false); 633 EndWriteAttribute(); 634 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"GroupID\""); 635 BeginWriteAttribute("value", " value=\"", 17063, "\"", 17079, 1); 636 WriteAttributeValue("", 17071, groupId, 17071, 8, false); 637 EndWriteAttribute(); 638 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"ProductID\""); 639 BeginWriteAttribute("value", " value=\"", 17123, "\"", 17141, 1); 640 WriteAttributeValue("", 17131, productId, 17131, 10, false); 641 EndWriteAttribute(); 642 WriteLiteral(">\r\n\t\t\t<input type=\"hidden\" name=\"VariantID\""); 643 BeginWriteAttribute("value", " value=\"", 17185, "\"", 17203, 1); 644 WriteAttributeValue("", 17193, variantId, 17193, 10, false); 645 EndWriteAttribute(); 646 WriteLiteral(">\r\n\t\t\t<button type=\"button\" onmouseover=\"swift.PageUpdater.Update(event)\" onclick=\"swift.PageUpdater.Update(event)\""); 647 BeginWriteAttribute("class", " class=\"", 17319, "\"", 17435, 9); 648 WriteAttributeValue("", 17327, "btn", 17327, 3, true); 649 WriteAttributeValue(" ", 17330, "nav-link", 17331, 9, true); 650 WriteAttributeValue(" ", 17339, "p-2", 17340, 4, true); 651 WriteAttributeValue(" ", 17343, "text-nowrap", 17344, 12, true); 652 WriteAttributeValue(" ", 17355, "border-0", 17356, 9, true); 653 WriteAttributeValue(" ", 17364, "swift_open-preferences-modal", 17365, 29, true); 654 WriteAttributeValue(" ", 17393, linkFontSize, 17394, 13, false); 655 WriteAttributeValue(" ", 17407, linkFontWeight, 17408, 15, false); 656 WriteAttributeValue(" ", 17423, linkCasing, 17424, 11, false); 657 EndWriteAttribute(); 658 WriteLiteral(" data-bs-toggle=\"modal\" data-bs-target=\"#PreferencesModal\">\r\n"); 659 RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);WriteLiteral("\t\t\t</button>\r\n\t\t</form>\r\n\t</li>\r\n"); 660 } 661 662 void RenderIcon(string pageIcon, string iconSize) 663 { 664 if (pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase)) 665 { 666 string iconPath = Dynamicweb.Context.Current.Server.MapPath(pageIcon); 667 668 WriteLiteral("\t\t<span"); 669 BeginWriteAttribute("class", " class=\"", 17941, "\"", 17958, 1); 670 WriteAttributeValue("", 17949, iconSize, 17949, 9, false); 671 EndWriteAttribute(); 672 WriteLiteral(">\r\n\t\t\t"); 673 Write(ReadFile(iconPath)); 674 WriteLiteral("\r\n\t\t</span>\r\n"); 675 } 676 } 677 } 678 } 679 #pragma warning restore 1591 680
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 2 @using Dynamicweb 3 @using System.Text.RegularExpressions 4 5 @{ 6 string theme = !string.IsNullOrEmpty(Model.Parameters["Theme"].ToString()) ? Model.Parameters["Theme"].ToString() : string.Empty; 7 string navOrientation = !string.IsNullOrEmpty(Model.Parameters["NavOrientation"].ToString()) ? Model.Parameters["NavOrientation"].ToString() : string.Empty; 8 string navAlignment = !string.IsNullOrEmpty(Model.Parameters["NavAlignment"].ToString()) ? Model.Parameters["NavAlignment"].ToString() : string.Empty; 9 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 10 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 11 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 12 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 13 string iconSize = "icon-3"; 14 15 if (linkFontSize == "fs-7") 16 { 17 iconSize = "icon-2"; 18 } 19 if (linkFontSize == "fs-5") 20 { 21 iconSize = "icon-4"; 22 } 23 } 24 25 <nav class="d-flex py-0 @navOrientation @navAlignment"> 26 @{<text>@{RenderFirstLevelNodes(Model.Nodes, theme, navOrientation, linkFontWeight, linkCasing, linkFontSize, iconSize, layout);}</text>} 27 </nav> 28 29 @functions { 30 void RenderFirstLevelNodes(IEnumerable<Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel> nodes, string theme, string navOrientation, string linkFontWeight, string linkCasing, string linkFontSize, string iconSize, string layout) 31 { 32 bool showOnlyFirstNavLevel = Model.Parameters.ContainsKey("ShowOnlyFirstNavLevel") ? Convert.ToBoolean(Model.Parameters["ShowOnlyFirstNavLevel"].ToString()) : false; 33 int currentParagraphId = Pageview.CurrentParagraph.ID; 34 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 35 36 <ul class="nav flex-nowrap @(navOrientation == "vertical" ? "flex-column" : navOrientation)"> 37 38 @foreach (var node in nodes) 39 { 40 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 41 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 42 string pageIcon = string.Empty; 43 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 44 { 45 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 46 } 47 string preferencesLayout = page.Item?["PreferencesLayout"] != null ? page.Item["PreferencesLayout"].ToString() : ""; 48 string preferencesType = "language"; 49 bool countrySelector = page.Item?["CountrySelector"] != null ? Convert.ToBoolean(page.Item["CountrySelector"].ToString()) : false; 50 bool languageSelector = page.Item?["LanguageSelector"] != null ? Convert.ToBoolean(page.Item["LanguageSelector"].ToString()) : false; 51 bool currencySelector = page.Item?["CurrencySelector"] != null ? Convert.ToBoolean(page.Item["CurrencySelector"].ToString()) : false; 52 string dropdownAttributes = string.Empty; 53 string dropdownClasses = string.Empty; 54 55 var hasChildren = node.Nodes.Count() > 0 || pageType == "Swift_SignIn"; 56 57 if (hasChildren && !showOnlyFirstNavLevel) 58 { 59 dropdownAttributes = hasChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 60 } 61 62 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Navigation_" + node.GroupId + "_" + currentParagraphId : "Navigation_Page_Desktop_" + node.PageId.ToString() + "_" + currentParagraphId; 63 64 if (pageType != "Swift_Preferences") 65 { 66 <li class="nav-item@(hasChildren ? " dropdown" : "")"> 67 @if (node.IsClickable) 68 { 69 <a href="@node.Link" class="p-2 nav-link text-nowrap text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing@(node.IsActive ? " active" : "")@(hasChildren ? " dropdown-toggle" : "")" @dropdownAttributes @(node.IsActive ? " aria-current='page'" : "") id="@nodeId"> 70 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 71 </a> 72 } 73 else 74 { 75 <span class="p-2 nav-link text-nowrap @linkFontSize @linkFontWeight @linkCasing@(hasChildren ? " dropdown-toggle " : "")" @dropdownAttributes id="@nodeId"> 76 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 77 </span> 78 } 79 80 @if (hasChildren) 81 { 82 if (!showOnlyFirstNavLevel) 83 { 84 <ul class="dropdown-menu @(theme)" aria-labelledby="@nodeId"> 85 @foreach (var subnode in node.Nodes)//Standard pages 86 { 87 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Navigation_" + subnode.GroupId + "_" + currentParagraphId : "Navigation_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 88 89 <li> 90 @if (subnode.IsClickable) 91 { 92 <a href="@subnode.Link" class="dropdown-item py-2 text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing" @(subnode.IsActive ? " aria-current='page'" : "") id="@nodeId">@subnode.Name</a> 93 } 94 else 95 { 96 <span class="dropdown-item py-2 @linkFontSize @linkFontWeight @linkCasing" @(subnode.IsActive ? " aria-current='page'" : "") id="@nodeId">@subnode.Name</span> 97 } 98 </li> 99 } 100 @if (pageType == "Swift_SignIn") //Sign out link 101 { 102 if (Pageview.User != null) 103 { 104 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 105 106 <li><hr class="dropdown-divider"></li> 107 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 108 { 109 <li> 110 <a href="Default.aspx?ID=@(Pageview.ID)&DwExtranetRemoveSecondaryUser=1" class="dropdown-item py-2 text-decoration-underline-hover swift_sign-out-as-customer-link @linkFontSize @linkFontWeight @linkCasing" id="SignInButton_@currentParagraphId">@Translate("Sign out as a customer")</a> 111 </li> 112 } 113 <li> 114 <a href="@link" class="dropdown-item py-2 text-decoration-underline-hover swift_sign-out-link @linkFontSize @linkFontWeight @linkCasing">@Translate("Sign out")</a> 115 </li> 116 } 117 } 118 </ul> 119 } 120 } 121 </li> 122 } 123 else 124 { 125 if (preferencesLayout == "modal") 126 { 127 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 128 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 129 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 130 131 <li class="nav-item@(hasChildren ? " dropdown" : "")"> 132 <form action="/Default.aspx?ID=@node.PageId" data-response-target-element="PreferencesModalContent" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 133 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 134 <input type="hidden" name="GroupID" value="@groupId"> 135 <input type="hidden" name="ProductID" value="@productId"> 136 <input type="hidden" name="VariantID" value="@variantId"> 137 <button type="button" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="btn nav-link p-2 text-nowrap border-0 swift_open-preferences-modal @linkFontSize @linkFontWeight @linkCasing" data-bs-toggle="modal" data-bs-target="#PreferencesModal" id="OpenPreferences_@currentParagraphId"> 138 @if (languageSelector) 139 { 140 {<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, "language");}</text>} 141 } 142 else 143 { 144 {<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout);}</text>} 145 } 146 </button> 147 </form> 148 </li> 149 } 150 else 151 { 152 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries(); 153 var currencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies(); 154 155 if (languageSelector) 156 { 157 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); 158 159 if (Pageview.Page.Area.IsMaster) 160 { 161 languages.Add(Pageview.Page); 162 if (Pageview.Page.Languages != null) 163 { 164 foreach (var language in Pageview.Page.Languages) 165 { 166 if (language.Area.Active == true) 167 { 168 languages.Add(language); 169 } 170 } 171 } 172 } 173 else 174 { 175 languages.Add(Pageview.Page.MasterPage); 176 if (Pageview.Page.MasterPage != null) 177 { 178 if (Pageview.Page.MasterPage.Languages != null) 179 { 180 foreach (var language in Pageview.Page.MasterPage.Languages) 181 { 182 if (language.Area.Active == true) 183 { 184 languages.Add(language); 185 } 186 } 187 } 188 } 189 } 190 191 if (languages.Count > 1) 192 { 193 preferencesType = "language"; 194 195 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 196 } 197 } 198 if (countrySelector && ecomCountries.Count > 1) 199 { 200 preferencesType = "country"; 201 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 202 } 203 if (currencySelector && currencies.Count() > 1) 204 { 205 preferencesType = "currency"; 206 {<text>@{RenderPreferencesDropdown(node, preferencesType, linkFontSize, linkFontWeight, linkCasing, theme, pageType, pageIcon, iconSize, layout);}</text>} 207 } 208 } 209 } 210 } 211 </ul> 212 } 213 } 214 215 @functions { 216 void RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout, string preferencesType = "") 217 { 218 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 219 if (pageType == "Swift_Cart") //Mini cart 220 { 221 string cartId = ""; 222 if (page.Item["ContextCart"] != null) 223 { 224 cartId = !string.IsNullOrEmpty(page.Item["ContextCart"].ToString()) ? "ID=\"Cart_" + page.Item["ContextCart"].ToString() + "\"" : ""; 225 } 226 227 string jsCartClass = string.IsNullOrEmpty(cartId) ? "js-cart-qty" : ""; 228 double totalProducts = 0; 229 230 231 Dynamicweb.Ecommerce.Common.Context.CartContext = null; 232 if (page.Item["ContextCart"] != null) 233 { 234 var orderContext = Dynamicweb.Ecommerce.Services.OrderContexts.GetOrderContextById(page.Item["ContextCart"].ToString()); 235 Dynamicweb.Ecommerce.Common.Context.CartContext = orderContext; 236 } 237 238 if (Dynamicweb.Ecommerce.Common.Context.Cart != null) 239 { 240 bool renderOrderlineCountInsteadOfProductCount = page.Item["RenderOrderlineCountInsteadOfProductCount"] != null ? Convert.ToBoolean(page.Item["RenderOrderlineCountInsteadOfProductCount"]) : false; 241 if (!renderOrderlineCountInsteadOfProductCount) 242 { 243 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentProductLineQuantityCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 244 } 245 else 246 { 247 totalProducts = Dynamicweb.Ecommerce.Common.Context.Cart.GetParentOrderLineCount(Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines); 248 } 249 } 250 251 252 switch (layout) 253 { 254 case "linksOnly": 255 <span class="align-middle">@node.Name</span> 256 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 257 break; 258 259 case "iconsOnly": 260 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 261 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 262 break; 263 case "iconsAndLinks": 264 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 265 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 266 <span class="align-middle">@node.Name</span> 267 break; 268 case "linksAndIcons": 269 <span class="align-middle">@node.Name</span> 270 <span class="@jsCartClass mini-cart-quantity align-middle" @cartId>(@totalProducts)</span> 271 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 272 break; 273 } 274 } 275 else 276 { 277 string name = node.Name; 278 279 if (preferencesType == "country") 280 { //Country 281 name = Translate("Deliver to") + ": " + Dynamicweb.Ecommerce.Common.Context.Country.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID); 282 } 283 284 if (preferencesType == "language") 285 { //Languange 286 string iconFolder = "/Files/FlagIcons/"; 287 pageIcon = iconFolder + Pageview.Area.CultureInfo.Name.ToLower() + ".svg"; 288 Regex reg = new Regex(@"\(([^\)]+)\)"); 289 name = reg.Replace(Pageview.Area.CultureInfo.DisplayName, ""); 290 291 layout = layout == "linksOnly" ? "iconsAndLinks" : layout; 292 bool hideIcon = page.Item?["HideIcon"] != null ? Convert.ToBoolean(page.Item["HideIcon"].ToString()) : false; 293 bool hideName = page.Item?["HideName"] != null ? Convert.ToBoolean(page.Item["HideName"].ToString()) : false; 294 layout = hideIcon ? "linksOnly" : layout; 295 layout = hideName ? "iconsOnly" : layout; 296 } 297 298 if (preferencesType == "currency") 299 { //Country 300 name = Dynamicweb.Ecommerce.Common.Context.Currency.Code; 301 } 302 303 switch (layout) 304 { 305 case "linksOnly": 306 <span class="align-middle">@name</span> 307 break; 308 309 case "iconsOnly": 310 <span class="visually-hidden">@name</span> 311 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 312 break; 313 case "iconsAndLinks": 314 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 315 <span class="align-middle">@name</span> 316 break; 317 case "linksAndIcons": 318 <span class="align-middle">@name</span> 319 {<text>@{RenderIcon(pageIcon, iconSize);}</text>} 320 break; 321 } 322 } 323 } 324 } 325 326 @functions { 327 void RenderPreferencesDropdown(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string preferencesType, string linkFontSize, string linkFontWeight, string linkCasing, string theme, string pageType, string pageIcon, string iconSize, string layout) 328 { 329 string groupId = Dynamicweb.Context.Current.Request["GroupID"] != null ? Dynamicweb.Context.Current.Request["GroupID"].ToString() : ""; 330 string productId = Dynamicweb.Context.Current.Request["ProductID"] != null ? Dynamicweb.Context.Current.Request["ProductID"].ToString() : ""; 331 string variantId = Dynamicweb.Context.Current.Request["VariantID"] != null ? Dynamicweb.Context.Current.Request["VariantID"].ToString() : ""; 332 int currentParagraphId = Pageview.CurrentParagraph.ID; 333 334 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "PreferencesLink_" + node.GroupId + "_" + currentParagraphId : "PreferencesLink_" + node.PageId.ToString() + "_" + currentParagraphId; 335 336 <li class="nav-item dropdown"> 337 <form class="d-none d-lg-block" action="/Default.aspx?ID=@node.PageId" data-response-target-element="@(preferencesType)Dropdown_@currentParagraphId" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 338 <input type="hidden" name="Type" value="@preferencesType"> 339 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 340 <input type="hidden" name="GroupID" value="@groupId"> 341 <input type="hidden" name="ProductID" value="@productId"> 342 <input type="hidden" name="VariantID" value="@variantId"> 343 <input type="hidden" name="FontSize" value="@linkFontSize"> 344 <input type="hidden" name="FontWeight" value="@linkFontWeight"> 345 <input type="hidden" name="Casing" value="@linkCasing"> 346 347 <a id="@nodeId" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="nav-link p-2 text-nowrap text-decoration-underline-hover @linkFontSize @linkFontWeight @linkCasing@(node.IsActive ? " active" : "") dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @(node.IsActive ? " aria-current='page'" : "")> 348 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);}</text>} 349 </a> 350 351 <ul class="dropdown-menu @(theme)" id="@(preferencesType)Dropdown_@currentParagraphId"> 352 @* The content here comes from an external request *@ 353 </ul> 354 </form> 355 356 <form class="d-block d-lg-none" action="/Default.aspx?ID=@node.PageId" data-response-target-element="PreferencesModalContent" data-layout-template="Swift_Preferences.cshtml" data-preloader="inline"> 357 <input type="hidden" name="Layout" value="modal"> 358 <input type="hidden" name="CurrentPageID" value="@Pageview.ID"> 359 <input type="hidden" name="GroupID" value="@groupId"> 360 <input type="hidden" name="ProductID" value="@productId"> 361 <input type="hidden" name="VariantID" value="@variantId"> 362 <button type="button" onmouseover="swift.PageUpdater.Update(event)" onclick="swift.PageUpdater.Update(event)" class="btn nav-link p-2 text-nowrap border-0 swift_open-preferences-modal @linkFontSize @linkFontWeight @linkCasing" data-bs-toggle="modal" data-bs-target="#PreferencesModal"> 363 @{<text>@{RenderNavigationItem(node, pageType, pageIcon, iconSize, layout, preferencesType);}</text>} 364 </button> 365 </form> 366 </li> 367 } 368 } 369 370 @functions { 371 void RenderIcon(string pageIcon, string iconSize) 372 { 373 if (pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase)) 374 { 375 string iconPath = Dynamicweb.Context.Current.Server.MapPath(pageIcon); 376 377 <span class="@iconSize"> 378 @ReadFile(iconPath) 379 </span> 380 } 381 } 382 } 383
We and our partners use technologies, including cookies, to collect information about you for various purposes, including:
By clicking 'Accept All' you consent to all these purposes. You can also choose to indicate what purposes you will consent to using the custom selections and then click 'Accept selected'.
You can read more about our use of cookies and other technologies, as well as our collection and processing of personal data by clicking here:
Read more about Cookies Our privacy policy