Error executing template "Designs/AgricoverCorporate/_parsed/ContentPage.parsed.cshtml"
System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\manifest.json' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<RenderMasterMetadata>b__222_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 9462
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 284
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 194
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<RenderMasterHead>b__221_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 9412
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 284
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 194
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 317
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 194
at CompiledRazorTemplates.Dynamic.RazorEngine_65dbc6481cf64fc3b18894d1166d1fbe.Execute() in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 9289
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2
3 @using System.Web;
4 @using Dynamicweb
5 @using Dynamicweb.Frontend
6 @using Dynamicweb.Frontend.Devices
7 @using Dynamicweb.Extensibility
8 @using Dynamicweb.Content
9 @using Dynamicweb.Security
10 @using Dynamicweb.Core
11 @using System
12 @using System.Web
13 @using System.IO
14 @using Dynamicweb.Rapido.Blocks
15 @using System.Net
16
17
18 @functions {
19 BlocksPage masterPage = BlocksPage.GetBlockPage("Master");
20
21 string getFontFamily(params string[] items)
22 {
23 var itemParent = Pageview.AreaSettings;
24 foreach (var item in items)
25 {
26 itemParent = itemParent.GetItem(item);
27 if (itemParent == null)
28 {
29 return null;
30 }
31 }
32
33 var googleFont = itemParent.GetGoogleFont("FontFamily");
34 if (googleFont == null)
35 {
36 return null;
37 }
38
39 return googleFont.Family.Replace(" ", "+");
40 }
41
42 }
43
44 @{
45 //set custom canonical
46 string host = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host;
47 string pageID = Pageview.Page.ID.ToString();
48 string canonicalURL = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + pageID);
49 var firstPageId = Model.Area.FirstActivePage.ID.ToString();
50 canonicalURL = firstPageId == pageID ? "" : canonicalURL;
51
52 @*if(HttpContext.Current.Request.QueryString.Get("GroupID") == null) {
53 Pageview.Meta.AddTag("customCan", "<link rel=\"canonical\" href=\"" + host + canonicalURL + "\">");
54 }*@
55
56
57 Block root = new Block
58 {
59 Id = "Root",
60 SortId = 10,
61 BlocksList = new List<Block>
62 {
63 new Block
64 {
65 Id = "Head",
66 SortId = 10,
67 SkipRenderBlocksList = true,
68 Template = RenderMasterHead(),
69 BlocksList = new List<Block>
70 {
71 new Block
72 {
73 Id = "HeadMetadata",
74 SortId = 10,
75 Template = RenderMasterMetadata(),
76 },
77 new Block
78 {
79 Id = "HeadCss",
80 SortId = 20,
81 Template = RenderMasterCss(),
82 },
83 new Block
84 {
85 Id = "HeadManifest",
86 SortId = 30,
87 Template = RenderMasterManifest(),
88 }
89 }
90 },
91 new Block
92 {
93 Id = "Body",
94 SortId = 20,
95 SkipRenderBlocksList = true,
96 Template = RenderMasterBody(),
97 BlocksList = new List<Block>
98 {
99 new Block()
100 {
101 Id = "Master",
102 SortId = 10,
103 BlocksList = new List<Block>
104 {
105 new Block
106 {
107 Id = "MasterTopSnippets",
108 SortId = 10
109 },
110 new Block
111 {
112 Id = "MasterMain",
113 SortId = 20,
114 Template = RenderMain(),
115 SkipRenderBlocksList = true,
116 BlocksList = new List<Block>
117 {
118 new Block
119 {
120 Id = "MasterHeader",
121 SortId = 10,
122 Template = RenderMasterHeader(),
123 SkipRenderBlocksList = true
124 },
125 new Block
126 {
127 Id = "MasterPageContent",
128 SortId = 20,
129 Template = RenderPageContent()
130 }
131 }
132 },
133 new Block
134 {
135 Id = "MasterFooter",
136 SortId = 30
137 },
138 new Block
139 {
140 Id = "MasterReferences",
141 SortId = 40
142 },
143 new Block
144 {
145 Id = "MasterBottomSnippets",
146 SortId = 50,
147 BlocksList = new List<Block>
148 {
149 new Block
150 {
151 Id = "iOsTabletFix",
152 SortId = 10,
153 Template = RenderIosTabletFix()
154 }
155 }
156 }
157 }
158 }
159 }
160 }
161 }
162 };
163
164 masterPage.Add(root);
165 }
166
167 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@
168 @using System.Text.RegularExpressions
169 @using System.Collections.Generic
170 @using System.Reflection
171 @using System.Web
172 @using System.Web.UI.HtmlControls
173 @using Dynamicweb.Rapido.Blocks.Components
174 @using Dynamicweb.Rapido.Blocks.Components.Articles
175 @using Dynamicweb.Rapido.Blocks.Components.Documentation
176 @using Dynamicweb.Rapido.Blocks
177
178
179 @*--- START: Base block renderers ---*@
180
181 @helper RenderBlockList(List<Block> blocks)
182 {
183 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
184 blocks = blocks.OrderBy(item => item.SortId).ToList();
185
186 foreach (Block item in blocks)
187 {
188 if (debug) {
189 <!-- Block START: @item.Id -->
190 }
191
192 if (item.Design == null)
193 {
194 @RenderBlock(item)
195 }
196 else if (item.Design.RenderType == RenderType.None) {
197 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
198
199 <div class="@cssClass dw-mod">
200 @RenderBlock(item)
201 </div>
202 }
203 else if (item.Design.RenderType != RenderType.Hide)
204 {
205 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
206
207 if (!item.SkipRenderBlocksList) {
208 if (item.Design.RenderType == RenderType.Row)
209 {
210 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">
211 @RenderBlock(item)
212 </div>
213 }
214
215 if (item.Design.RenderType == RenderType.Column)
216 {
217 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";
218 string size = item.Design.Size ?? "12";
219 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;
220
221 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id">
222 @RenderBlock(item)
223 </div>
224 }
225
226 if (item.Design.RenderType == RenderType.Table)
227 {
228 <table class="table @cssClass dw-mod" id="Block__@item.Id">
229 @RenderBlock(item)
230 </table>
231 }
232
233 if (item.Design.RenderType == RenderType.TableRow)
234 {
235 <tr class="@cssClass dw-mod" id="Block__@item.Id">
236 @RenderBlock(item)
237 </tr>
238 }
239
240 if (item.Design.RenderType == RenderType.TableColumn)
241 {
242 <td class="@cssClass dw-mod" id="Block__@item.Id">
243 @RenderBlock(item)
244 </td>
245 }
246
247 if (item.Design.RenderType == RenderType.CardHeader)
248 {
249 <div class="card-header @cssClass dw-mod">
250 @RenderBlock(item)
251 </div>
252 }
253
254 if (item.Design.RenderType == RenderType.CardBody)
255 {
256 <div class="card @cssClass dw-mod">
257 @RenderBlock(item)
258 </div>
259 }
260
261 if (item.Design.RenderType == RenderType.CardFooter)
262 {
263 <div class="card-footer @cssClass dw-mod">
264 @RenderBlock(item)
265 </div>
266 }
267 }
268 else
269 {
270 @RenderBlock(item)
271 }
272 }
273
274 if (debug) {
275 <!-- Block END: @item.Id -->
276 }
277 }
278 }
279
280 @helper RenderBlock(Block item)
281 {
282 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
283
284 if (item.Template != null)
285 {
286 @BlocksPage.RenderTemplate(item.Template)
287 }
288
289 if (item.Component != null)
290 {
291 string customSufix = "Custom";
292 string methodName = item.Component.HelperName;
293
294 ComponentBase[] methodParameters = new ComponentBase[1];
295 methodParameters[0] = item.Component;
296 Type methodType = this.GetType();
297
298 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix);
299 MethodInfo generalMethod = methodType.GetMethod(methodName);
300
301 try {
302 if (debug) {
303 <!-- Component: @methodName.Replace("Render", "") -->
304 }
305 @customMethod.Invoke(this, methodParameters).ToString();
306 } catch {
307 try {
308 @generalMethod.Invoke(this, methodParameters).ToString();
309 } catch(Exception ex) {
310 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex);
311 }
312 }
313 }
314
315 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
316 {
317 @RenderBlockList(item.BlocksList)
318 }
319 }
320
321 @*--- END: Base block renderers ---*@
322
323
324 @* Include the components *@
325 @using Dynamicweb.Rapido.Blocks.Components
326 @using Dynamicweb.Rapido.Blocks.Components.General
327 @using Dynamicweb.Rapido.Blocks
328 @using System.IO
329
330 @* Required *@
331 @using Dynamicweb.Rapido.Blocks.Components
332 @using Dynamicweb.Rapido.Blocks.Components.General
333 @using Dynamicweb.Rapido.Blocks
334
335
336 @helper Render(ComponentBase component)
337 {
338 if (component != null)
339 {
340 @component.Render(this)
341 }
342 }
343
344 @* Components *@
345 @using System.Reflection
346 @using Dynamicweb.Rapido.Blocks.Components.General
347
348
349 @* Component *@
350
351 @helper RenderIcon(Icon settings)
352 {
353 if (settings != null)
354 {
355 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
356
357 if (settings.Name != null)
358 {
359 if (string.IsNullOrEmpty(settings.Label))
360 {
361 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>
362 }
363 else
364 {
365 if (settings.LabelPosition == IconLabelPosition.Before)
366 {
367 <div class="u-flex u-flex--align-items-center @settings.CssClass">@settings.Label <i class="@settings.Prefix @settings.Name u-margin-left" @color></i></div>
368 }
369 else
370 {
371 <div class="u-flex u-flex--align-items-center @settings.CssClass"><i class="@settings.Prefix @settings.Name u-margin-right--lg u-w20px" @color></i>@settings.Label</div>
372 }
373 }
374 }
375 else if (!string.IsNullOrEmpty(settings.Label))
376 {
377 @settings.Label
378 }
379 }
380 }
381 @using System.Reflection
382 @using Dynamicweb.Rapido.Blocks.Components.General
383 @using Dynamicweb.Rapido.Blocks.Components
384 @using Dynamicweb.Core
385
386 @* Component *@
387
388 @helper RenderButton(Button settings)
389 {
390 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
391 {
392 Dictionary<string, string> attributes = new Dictionary<string, string>();
393 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
394 if (settings.Disabled) {
395 attributes.Add("disabled", "true");
396 classList.Add("disabled");
397 }
398
399 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle))
400 {
401 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
402 @RenderConfirmDialog(settings);
403 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true";
404 }
405
406 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
407 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
408 if (!string.IsNullOrEmpty(settings.AltText))
409 {
410 attributes.Add("title", settings.AltText);
411 }
412 else if (!string.IsNullOrEmpty(settings.Title))
413 {
414 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty);
415 cleanTitle = cleanTitle.Replace(" ", " ");
416 attributes.Add("title", cleanTitle);
417 }
418
419 var onClickEvents = new List<string>();
420 if (!string.IsNullOrEmpty(settings.OnClick))
421 {
422 onClickEvents.Add(settings.OnClick);
423 }
424 if (!string.IsNullOrEmpty(settings.Href))
425 {
426 onClickEvents.Add("location.href='" + settings.Href + "'");
427 }
428 if (onClickEvents.Count > 0)
429 {
430 attributes.Add("onClick", string.Join(";", onClickEvents));
431 }
432
433 if (settings.ButtonLayout != ButtonLayout.None)
434 {
435 classList.Add("btn");
436 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
437 if (btnLayout == "linkclean")
438 {
439 btnLayout = "link-clean"; //fix
440 }
441 classList.Add("btn--" + btnLayout);
442 }
443
444 if (settings.Icon == null)
445 {
446 settings.Icon = new Icon();
447 }
448
449 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : "";
450 settings.Icon.Label = settings.Title;
451
452 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower());
453
454 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button>
455 }
456 }
457
458 @helper RenderConfirmDialog(Button settings)
459 {
460 Modal confirmDialog = new Modal {
461 Id = settings.Id,
462 Width = ModalWidth.Sm,
463 Heading = new Heading
464 {
465 Level = 2,
466 Title = settings.ConfirmTitle
467 },
468 BodyText = settings.ConfirmText
469 };
470
471 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"});
472 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick });
473
474 @Render(confirmDialog)
475 }
476 @using Dynamicweb.Rapido.Blocks.Components.General
477 @using Dynamicweb.Rapido.Blocks.Components
478 @using Dynamicweb.Core
479
480 @helper RenderDashboard(Dashboard settings)
481 {
482 var widgets = settings.GetWidgets();
483
484 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor))
485 {
486 //set bg color for them
487
488 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor);
489 int r = Convert.ToInt16(color.R);
490 int g = Convert.ToInt16(color.G);
491 int b = Convert.ToInt16(color.B);
492
493 var count = widgets.Length;
494 var max = Math.Max(r, Math.Max(g, b));
495 double step = 255.0 / (max * count);
496 var i = 0;
497 foreach (var widget in widgets)
498 {
499 i++;
500
501 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")";
502 widget.BackgroundColor = shade;
503 }
504 }
505
506 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
507 @foreach (var widget in widgets)
508 {
509 <div class="dashboard__widget">
510 @Render(widget)
511 </div>
512 }
513 </div>
514 }
515 @using Dynamicweb.Rapido.Blocks.Components.General
516 @using Dynamicweb.Rapido.Blocks.Components
517
518 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings)
519 {
520 if (!string.IsNullOrEmpty(settings.Link))
521 {
522 var backgroundStyles = "";
523 if (!string.IsNullOrEmpty(settings.BackgroundColor))
524 {
525 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\"";
526 }
527
528 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
529 <div class="u-center-middle u-color-light">
530 @if (settings.Icon != null)
531 {
532 settings.Icon.CssClass += "widget__icon";
533 @Render(settings.Icon)
534 }
535 <div class="widget__title">@settings.Title</div>
536 </div>
537 </a>
538 }
539 }
540 @using Dynamicweb.Rapido.Blocks.Components.General
541 @using Dynamicweb.Rapido.Blocks.Components
542
543 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings)
544 {
545 var backgroundStyles = "";
546 if (!string.IsNullOrEmpty(settings.BackgroundColor))
547 {
548 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'";
549 }
550
551 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
552 <div class="u-center-middle u-color-light">
553 @if (settings.Icon != null)
554 {
555 settings.Icon.CssClass += "widget__icon";
556 @Render(settings.Icon)
557 }
558 <div class="widget__counter">@settings.Count</div>
559 <div class="widget__title">@settings.Title</div>
560 </div>
561 </div>
562 }
563 @using System.Reflection
564 @using Dynamicweb.Rapido.Blocks.Components.General
565 @using Dynamicweb.Rapido.Blocks.Components
566 @using Dynamicweb.Core
567
568 @* Component *@
569
570 @helper RenderLink(Link settings)
571 {
572 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
573 {
574 Dictionary<string, string> attributes = new Dictionary<string, string>();
575 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
576 if (settings.Disabled)
577 {
578 attributes.Add("disabled", "true");
579 classList.Add("disabled");
580 }
581
582 if (!string.IsNullOrEmpty(settings.AltText))
583 {
584 attributes.Add("title", settings.AltText);
585 }
586 else if (!string.IsNullOrEmpty(settings.Title))
587 {
588 attributes.Add("title", settings.Title);
589 }
590
591 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
592 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
593 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); }
594 attributes.Add("href", settings.Href);
595
596 if (settings.ButtonLayout != ButtonLayout.None)
597 {
598 classList.Add("btn");
599 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
600 if (btnLayout == "linkclean")
601 {
602 btnLayout = "link-clean"; //fix
603 }
604 classList.Add("btn--" + btnLayout);
605 }
606
607 if (settings.Icon == null)
608 {
609 settings.Icon = new Icon();
610 }
611 settings.Icon.Label = settings.Title;
612
613 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None)
614 {
615 settings.Rel = LinkRelType.Noopener;
616 }
617 if (settings.Target != LinkTargetType.None)
618 {
619 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower());
620 }
621 if (settings.Download)
622 {
623 attributes.Add("download", "true");
624 }
625 if (settings.Rel != LinkRelType.None)
626 {
627 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower());
628 }
629
630 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a>
631 }
632 }
633 @using System.Reflection
634 @using Dynamicweb.Rapido.Blocks.Components
635 @using Dynamicweb.Rapido.Blocks.Components.General
636 @using Dynamicweb.Rapido.Blocks
637
638
639 @* Component *@
640
641 @helper RenderRating(Rating settings)
642 {
643 if (settings.Score > 0)
644 {
645 int rating = settings.Score;
646 string iconType = "fa-star";
647
648 switch (settings.Type.ToString()) {
649 case "Stars":
650 iconType = "fa-star";
651 break;
652 case "Hearts":
653 iconType = "fa-heart";
654 break;
655 case "Lemons":
656 iconType = "fa-lemon";
657 break;
658 case "Bombs":
659 iconType = "fa-bomb";
660 break;
661 }
662
663 <div class="u-ta-right">
664 @for (int i = 0; i < settings.OutOf; i++)
665 {
666 <i class="@(rating > i ? "fas" : "far") @iconType"></i>
667 }
668 </div>
669 }
670 }
671 @using System.Reflection
672 @using Dynamicweb.Rapido.Blocks.Components.General
673 @using Dynamicweb.Rapido.Blocks.Components
674
675
676 @* Component *@
677
678 @helper RenderSelectFieldOption(SelectFieldOption settings)
679 {
680 Dictionary<string, string> attributes = new Dictionary<string, string>();
681 if (settings.Checked) { attributes.Add("selected", "true"); }
682 if (settings.Disabled) { attributes.Add("disabled", "true"); }
683 if (settings.Value != null) { attributes.Add("value", settings.Value); }
684 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
685
686 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option>
687 }
688 @using System.Reflection
689 @using Dynamicweb.Rapido.Blocks.Components.General
690 @using Dynamicweb.Rapido.Blocks.Components
691
692
693 @* Component *@
694
695 @helper RenderNavigation(Navigation settings) {
696 @RenderNavigation(new
697 {
698 id = settings.Id,
699 cssclass = settings.CssClass,
700 startLevel = settings.StartLevel,
701 endlevel = settings.EndLevel,
702 expandmode = settings.Expandmode,
703 sitemapmode = settings.SitemapMode,
704 template = settings.Template
705 })
706 }
707 @using Dynamicweb.Rapido.Blocks.Components.General
708 @using Dynamicweb.Rapido.Blocks.Components
709
710
711 @* Component *@
712
713 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {
714 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
715 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
716 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
717 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
718 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
719 settings.SitemapMode = false;
720
721 @RenderNavigation(settings)
722 }
723 @using Dynamicweb.Rapido.Blocks.Components.General
724 @using Dynamicweb.Rapido.Blocks.Components
725
726
727 @* Component *@
728
729 @helper RenderLeftNavigation(LeftNavigation settings) {
730 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
731 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
732 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
733 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
734 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
735
736 <div class="grid__cell">
737 @RenderNavigation(settings)
738 </div>
739 }
740 @using System.Reflection
741 @using Dynamicweb.Rapido.Blocks.Components.General
742 @using Dynamicweb.Core
743
744 @* Component *@
745
746 @helper RenderHeading(Heading settings)
747 {
748 if (settings != null && !string.IsNullOrEmpty(settings.Title))
749 {
750 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
751 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div";
752
753 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">")
754 if (!string.IsNullOrEmpty(settings.Link))
755 {
756 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None })
757 }
758 else
759 {
760 if (settings.Icon == null)
761 {
762 settings.Icon = new Icon();
763 }
764 settings.Icon.Label = settings.Title;
765 @Render(settings.Icon)
766 }
767 @("</" + tagName + ">");
768 }
769 }
770 @using Dynamicweb.Rapido.Blocks.Components
771 @using Dynamicweb.Rapido.Blocks.Components.General
772 @using Dynamicweb.Rapido.Blocks
773
774
775 @* Component *@
776
777 @helper RenderImage(Image settings)
778 {
779 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)
780 {
781 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
782 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }
783
784 if (settings.Caption != null)
785 {
786 @:<div>
787 }
788
789 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower();
790 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower();
791
792 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>
793 <div class="image-filter image-filter--@secondaryFilterClass dw-mod">
794 @if (settings.Link != null)
795 {
796 <a href="@settings.Link">
797 @RenderTheImage(settings)
798 </a>
799 }
800 else
801 {
802 @RenderTheImage(settings)
803 }
804 </div>
805 </div>
806
807 if (settings.Caption != null)
808 {
809 <span class="image-caption dw-mod">@settings.Caption</span>
810 @:</div>
811 }
812 }
813 else
814 {
815 if (settings.Caption != null)
816 {
817 @:<div>
818 }
819 if (!string.IsNullOrEmpty(settings.Link))
820 {
821 <a href="@settings.Link">
822 @RenderTheImage(settings)
823 </a>
824 }
825 else
826 {
827 @RenderTheImage(settings)
828 }
829
830 if (settings.Caption != null)
831 {
832 <span class="image-caption dw-mod">@settings.Caption</span>
833 @:</div>
834 }
835 }
836 }
837
838 @helper RenderTheImage(Image settings)
839 {
840 if (settings != null)
841 {
842 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg";
843 string placeholderImage = "/Files/Images/placeholder.gif";
844 string imageEngine = "/Admin/Public/GetImage.ashx?";
845
846 string imageStyle = "";
847
848 switch (settings.Style)
849 {
850 case ImageStyle.Ball:
851 imageStyle = "grid__cell-img--ball";
852 break;
853
854 case ImageStyle.Triangle:
855 imageStyle = "grid__cell-img--triangle";
856 break;
857 }
858
859 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle)
860 {
861 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop;
862
863 if (settings.ImageDefault != null)
864 {
865 settings.ImageDefault.Height = settings.ImageDefault.Width;
866 }
867 if (settings.ImageMedium != null)
868 {
869 settings.ImageMedium.Height = settings.ImageMedium.Width;
870 }
871 if (settings.ImageSmall != null)
872 {
873 settings.ImageSmall.Height = settings.ImageSmall.Width;
874 }
875 }
876
877 string defaultImage = imageEngine;
878 string imageSmall = "";
879 string imageMedium = "";
880
881 if (settings.DisableImageEngine)
882 {
883 defaultImage = settings.Path;
884 }
885 else
886 {
887 if (settings.ImageDefault != null)
888 {
889 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault);
890
891 if (settings.Path.GetType() != typeof(string))
892 {
893 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
894 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
895 }
896 else
897 {
898 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
899 }
900
901 defaultImage += "&AlternativeImage=" + alternativeImage;
902 }
903
904 if (settings.ImageSmall != null)
905 {
906 imageSmall = "data-src-small=\"" + imageEngine;
907 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall);
908
909 if (settings.Path.GetType() != typeof(string))
910 {
911 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
912 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
913 }
914 else
915 {
916 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
917 }
918
919 imageSmall += "&alternativeImage=" + alternativeImage;
920
921 imageSmall += "\"";
922 }
923
924 if (settings.ImageMedium != null)
925 {
926 imageMedium = "data-src-medium=\"" + imageEngine;
927 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium);
928
929 if (settings.Path.GetType() != typeof(string))
930 {
931 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
932 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
933 }
934 else
935 {
936 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
937 }
938
939 imageMedium += "&alternativeImage=" + alternativeImage;
940
941 imageMedium += "\"";
942 }
943 }
944
945 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
946 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
947 if (!string.IsNullOrEmpty(settings.Title))
948 {
949 optionalAttributes.Add("alt", settings.Title);
950 optionalAttributes.Add("title", settings.Title);
951 }
952
953 if (settings.DisableLazyLoad)
954 {
955 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
956 }
957 else
958 {
959 <img id="@settings.Id" loading="lazy" class=" @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
960 }
961 }
962 }
963 @using System.Reflection
964 @using Dynamicweb.Rapido.Blocks.Components.General
965 @using Dynamicweb.Rapido.Blocks.Components
966
967 @* Component *@
968
969 @helper RenderFileField(FileField settings)
970 {
971 var attributes = new Dictionary<string, string>();
972 if (string.IsNullOrEmpty(settings.Id))
973 {
974 settings.Id = Guid.NewGuid().ToString("N");
975 }
976
977 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
978 if (settings.Disabled) { attributes.Add("disabled", "true"); }
979 if (settings.Required) { attributes.Add("required", "true"); }
980 if (settings.Multiple) { attributes.Add("multiple", "true"); }
981 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
982 if (string.IsNullOrEmpty(settings.ChooseFileText))
983 {
984 settings.ChooseFileText = Translate("Choose file");
985 }
986 if (string.IsNullOrEmpty(settings.NoFilesChosenText))
987 {
988 settings.NoFilesChosenText = Translate("No files chosen...");
989 }
990 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
991
992 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
993
994 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)";
995 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : ""));
996
997 attributes.Add("type", "file");
998 if (settings.Value != null) { attributes.Add("value", settings.Value); }
999 settings.CssClass = "u-full-width " + settings.CssClass;
1000
1001 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1002
1003 <div class="form__field-group full-width-input u-full-width @settings.WrapperCssClass dw-mod">
1004 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1005 {
1006 <div class="u-full-width">
1007 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1008 @if (settings.Link != null) {
1009 <div class="u-pull--right">
1010 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1011 @Render(settings.Link)
1012 </div>
1013 }
1014 </div>
1015
1016 }
1017
1018 @if (!string.IsNullOrEmpty(settings.HelpText))
1019 {
1020 <small class="form__help-text">@settings.HelpText</small>
1021 }
1022
1023 <div class="form__field-combi file-input u-no-margin dw-mod">
1024 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" />
1025 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label>
1026 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label>
1027 @if (settings.UploadButton != null)
1028 {
1029 settings.UploadButton.CssClass += " btn--condensed u-no-margin";
1030 @Render(settings.UploadButton)
1031 }
1032 </div>
1033 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1034 </div>
1035 }
1036 @using System.Reflection
1037 @using Dynamicweb.Rapido.Blocks.Components.General
1038 @using Dynamicweb.Rapido.Blocks.Components
1039 @using Dynamicweb.Core
1040 @using System.Linq
1041
1042 @* Component *@
1043
1044 @helper RenderDateTimeField(DateTimeField settings)
1045 {
1046 if (string.IsNullOrEmpty(settings.Id))
1047 {
1048 settings.Id = Guid.NewGuid().ToString("N");
1049 }
1050
1051 var textField = new TextField {
1052 Name = settings.Name,
1053 Id = settings.Id,
1054 Label = settings.Label,
1055 HelpText = settings.HelpText,
1056 Value = settings.Value,
1057 Disabled = settings.Disabled,
1058 Required = settings.Required,
1059 ErrorMessage = settings.ErrorMessage,
1060 CssClass = settings.CssClass,
1061 WrapperCssClass = settings.WrapperCssClass,
1062 OnChange = settings.OnChange,
1063 OnClick = settings.OnClick,
1064 Link = settings.Link,
1065 ExtraAttributes = settings.ExtraAttributes,
1066 //
1067 Placeholder = settings.Placeholder
1068 };
1069
1070 @Render(textField)
1071
1072 List<string> jsAttributes = new List<string>();
1073
1074 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'");
1075
1076 if (!string.IsNullOrEmpty(settings.DateFormat))
1077 {
1078 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'");
1079 }
1080 if (!string.IsNullOrEmpty(settings.MinDate))
1081 {
1082 jsAttributes.Add("minDate: '" + settings.MinDate + "'");
1083 }
1084 if (!string.IsNullOrEmpty(settings.MaxDate))
1085 {
1086 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'");
1087 }
1088 if (settings.IsInline)
1089 {
1090 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower());
1091 }
1092 if (settings.EnableTime)
1093 {
1094 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower());
1095 }
1096 if (settings.EnableWeekNumbers)
1097 {
1098 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower());
1099 }
1100
1101 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value));
1102
1103 <script>
1104 document.addEventListener("DOMContentLoaded", function () {
1105 flatpickr("#@textField.Id", {
1106 @string.Join(",", jsAttributes)
1107 });
1108 });
1109 </script>
1110 }
1111 @using System.Reflection
1112 @using Dynamicweb.Rapido.Blocks.Components.General
1113 @using Dynamicweb.Rapido.Blocks.Components
1114
1115 @* Component *@
1116
1117 @helper RenderTextField(TextField settings)
1118 {
1119 var attributes = new Dictionary<string, string>();
1120 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1121 {
1122 settings.Id = Guid.NewGuid().ToString("N");
1123 }
1124
1125 /*base settings*/
1126 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1127 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1128 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1129 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1130 if (settings.Required) { attributes.Add("required", "true"); }
1131 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1132 /*end*/
1133
1134 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1135 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1136 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1137 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1138 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1139 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1140 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower());
1141 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); };
1142 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1143
1144 settings.CssClass = "u-full-width " + settings.CssClass;
1145
1146 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1147
1148 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1149
1150 string noMargin = "u-no-margin";
1151 if (!settings.ReadOnly) {
1152 noMargin = "";
1153 }
1154
1155 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod">
1156 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1157 {
1158 <div class="u-full-width">
1159 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1160 @if (settings.Link != null) {
1161 settings.Link.ButtonLayout = ButtonLayout.LinkClean;
1162
1163 <div class="u-pull--right">
1164 @Render(settings.Link)
1165 </div>
1166 }
1167 </div>
1168
1169 }
1170
1171 @if (!string.IsNullOrEmpty(settings.HelpText))
1172 {
1173 <small class="form__help-text">@settings.HelpText</small>
1174 }
1175
1176 @if (settings.ActionButton != null)
1177 {
1178 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1179 <div class="form__field-combi u-no-margin dw-mod ">
1180 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1181 @Render(settings.ActionButton)
1182 </div>
1183 }
1184 else
1185 {
1186 <input @ComponentMethods.AddAttributes(resultAttributes) class=" @settings.CssClass dw-mod" />
1187 }
1188
1189 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1190 </div>
1191 }
1192 @using System.Reflection
1193 @using Dynamicweb.Rapido.Blocks.Components.General
1194 @using Dynamicweb.Rapido.Blocks.Components
1195
1196 @* Component *@
1197
1198 @helper RenderNumberField(NumberField settings)
1199 {
1200 var attributes = new Dictionary<string, string>();
1201 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1202 {
1203 settings.Id = Guid.NewGuid().ToString("N");
1204 }
1205
1206 /*base settings*/
1207 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1208 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1209 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1210 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1211 if (settings.Required) { attributes.Add("required", "true"); }
1212 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1213 /*end*/
1214
1215 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1216 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1217 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1218 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1219 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
1220 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }
1221 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }
1222 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }
1223 attributes.Add("type", "number");
1224 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1225 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1226
1227 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1228 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1229 {
1230 <div class="u-full-width">
1231 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1232 @if (settings.Link != null) {
1233 <div class="u-pull--right">
1234 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1235 @Render(settings.Link)
1236 </div>
1237 }
1238 </div>
1239
1240 }
1241
1242 @if (!string.IsNullOrEmpty(settings.HelpText))
1243 {
1244 <small class="form__help-text">@settings.HelpText</small>
1245 }
1246
1247 @if (settings.ActionButton != null)
1248 {
1249 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1250 <div class="form__field-combi u-no-margin dw-mod">
1251 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1252 @Render(settings.ActionButton)
1253 </div>
1254 }
1255 else
1256 {
1257 <div class="form__field-combi u-no-margin dw-mod">
1258 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1259 </div>
1260 }
1261
1262 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1263 </div>
1264 }
1265 @using System.Reflection
1266 @using Dynamicweb.Rapido.Blocks.Components.General
1267 @using Dynamicweb.Rapido.Blocks.Components
1268
1269
1270 @* Component *@
1271
1272 @helper RenderTextareaField(TextareaField settings)
1273 {
1274 Dictionary<string, string> attributes = new Dictionary<string, string>();
1275 string id = settings.Id;
1276 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id))
1277 {
1278 id = Guid.NewGuid().ToString("N");
1279 }
1280
1281 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); }
1282 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1283 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1284 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1285 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1286 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1287 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1288 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1289 if (settings.Required) { attributes.Add("required", "true"); }
1290 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1291 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1292 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); }
1293 attributes.Add("name", settings.Name);
1294
1295 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1296
1297 <div class="form__field-group full-width-input @settings.WrapperCssClass dw-mod">
1298 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1299 {
1300 <div class="u-full-width">
1301 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1302 @if (settings.Link != null) {
1303 <div class="u-pull--right">
1304 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1305 @Render(settings.Link)
1306 </div>
1307 }
1308 </div>
1309 }
1310
1311 @if (!string.IsNullOrEmpty(settings.HelpText))
1312 {
1313 <small class="form__help-text">@settings.HelpText</small>
1314 }
1315
1316 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea>
1317
1318 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1319 </div>
1320 }
1321 @using System.Reflection
1322 @using Dynamicweb.Rapido.Blocks.Components.General
1323 @using Dynamicweb.Rapido.Blocks.Components
1324
1325
1326 @* Component *@
1327
1328 @helper RenderHiddenField(HiddenField settings) {
1329 var attributes = new Dictionary<string, string>();
1330 attributes.Add("type", "hidden");
1331 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1332 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1333 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1334
1335 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>
1336 }
1337 @using System.Reflection
1338 @using Dynamicweb.Rapido.Blocks.Components.General
1339 @using Dynamicweb.Rapido.Blocks.Components
1340
1341 @* Component *@
1342
1343 @helper RenderCheckboxField(CheckboxField settings)
1344 {
1345 var attributes = new Dictionary<string, string>();
1346 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1347 {
1348 settings.Id = Guid.NewGuid().ToString("N");
1349 }
1350
1351 /*base settings*/
1352 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1353 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1354 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1355 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1356 if (settings.Required) { attributes.Add("required", "true"); }
1357 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1358 /*end*/
1359
1360 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1361
1362 attributes.Add("type", "checkbox");
1363 if (settings.Checked) { attributes.Add("checked", "true"); }
1364 settings.CssClass = "form__control " + settings.CssClass;
1365 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1366
1367 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1368
1369 <div class="form__field-group full-width-input @settings.WrapperCssClass dw-mod">
1370 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1371 @if (!string.IsNullOrEmpty(settings.Label))
1372 {
1373 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1374 }
1375
1376 @if (settings.Link != null) {
1377 <span>
1378 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1379 @Render(settings.Link)
1380 </span>
1381 }
1382
1383 @if (!string.IsNullOrEmpty(settings.HelpText))
1384 {
1385 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small>
1386 }
1387 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1388 </div>
1389 }
1390 @using System.Reflection
1391 @using Dynamicweb.Rapido.Blocks.Components.General
1392 @using Dynamicweb.Rapido.Blocks.Components
1393
1394
1395 @* Component *@
1396
1397 @helper RenderCheckboxListField(CheckboxListField settings)
1398 {
1399 <div class="form__field-group full-width-input @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1400 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1401 {
1402 <div class="u-full-width">
1403 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1404 @if (settings.Link != null) {
1405 <div class="u-pull--right">
1406 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1407 @Render(settings.Link)
1408 </div>
1409 }
1410 </div>
1411
1412 }
1413
1414 <div class="u-pull--left">
1415 @if (!string.IsNullOrEmpty(settings.HelpText))
1416 {
1417 <small class="form__help-text">@settings.HelpText</small>
1418 }
1419
1420 @foreach (var item in settings.Options)
1421 {
1422 if (settings.Required)
1423 {
1424 item.Required = true;
1425 }
1426 if (settings.Disabled)
1427 {
1428 item.Disabled = true;
1429 }
1430 if (!string.IsNullOrEmpty(settings.Name))
1431 {
1432 item.Name = settings.Name;
1433 }
1434 if (!string.IsNullOrEmpty(settings.CssClass))
1435 {
1436 item.CssClass += settings.CssClass;
1437 }
1438
1439 /* value is not supported */
1440
1441 if (!string.IsNullOrEmpty(settings.OnClick))
1442 {
1443 item.OnClick += settings.OnClick;
1444 }
1445 if (!string.IsNullOrEmpty(settings.OnChange))
1446 {
1447 item.OnChange += settings.OnChange;
1448 }
1449 @Render(item)
1450 }
1451
1452 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1453 </div>
1454
1455 </div>
1456 }
1457 @using Dynamicweb.Rapido.Blocks.Components.General
1458
1459 @* Component *@
1460
1461 @helper RenderSearch(Search settings)
1462 {
1463 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? "";
1464 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? "";
1465
1466 if (string.IsNullOrEmpty(settings.Id))
1467 {
1468 settings.Id = Guid.NewGuid().ToString("N");
1469 }
1470
1471 var resultAttributes = new Dictionary<string, string>();
1472
1473 if (settings.PageSize != 0)
1474 {
1475 resultAttributes.Add("data-page-size", settings.PageSize.ToString());
1476 }
1477 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1478 {
1479 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl);
1480 if (!string.IsNullOrEmpty(groupValue))
1481 {
1482 resultAttributes.Add("data-selected-group", groupValue);
1483 }
1484 if (!string.IsNullOrEmpty(settings.GroupsParameter))
1485 {
1486 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter);
1487 }
1488 }
1489 resultAttributes.Add("data-force-init", "true");
1490 if (settings.GoToFirstSearchResultOnEnter)
1491 {
1492 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower());
1493 }
1494 if (!string.IsNullOrEmpty(settings.SearchParameter))
1495 {
1496 resultAttributes.Add("data-search-parameter", settings.SearchParameter);
1497 }
1498 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl);
1499 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId);
1500
1501 if (settings.SecondSearchData != null)
1502 {
1503 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl);
1504 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId);
1505 }
1506 if (!string.IsNullOrEmpty(settings.ResultsPageUrl))
1507 {
1508 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl);
1509 }
1510
1511 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1512
1513 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : "";
1514
1515 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)>
1516 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1517 {
1518 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button>
1519 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul>
1520 }
1521
1522 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue">
1523
1524 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")">
1525 @if (settings.SecondSearchData != null)
1526 {
1527 <div class="search__column search__column--products dw-mod">
1528 <div class="search__column-header dw-mod">@Translate("Products")</div>
1529 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1530 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1531 {
1532 @Render(new Link {
1533 Title = Translate("View all"),
1534 CssClass = "js-view-all-button u-margin",
1535 Href = settings.SearchData.ResultsPageUrl
1536 });
1537 }
1538 </div>
1539 <div class="search__column search__column--pages dw-mod">
1540 <div class="search__column-header">@Translate("Pages")</div>
1541 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul>
1542 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl))
1543 {
1544 @Render(new Link
1545 {
1546 Title = Translate("View all"),
1547 CssClass = "js-view-all-button u-margin",
1548 Href = settings.SecondSearchData.ResultsPageUrl
1549 });
1550 }
1551 </div>
1552 }
1553 else
1554 {
1555 <div class="search__column search__column--only dw-mod">
1556 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1557 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1558 {
1559 @Render(new Link {
1560 Title = Translate("View all"),
1561 CssClass = "js-view-all-button u-margin",
1562 Href = settings.SearchData.ResultsPageUrl
1563 });
1564 }
1565 </div>
1566 }
1567 </div>
1568
1569 @if (settings.SearchButton != null)
1570 {
1571 settings.SearchButton.CssClass += " search__btn js-search-btn";
1572 if (settings.RenderDefaultSearchIcon)
1573 {
1574 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue };
1575 }
1576 @Render(settings.SearchButton);
1577 }
1578 </div>
1579 }
1580 @using System.Reflection
1581 @using Dynamicweb.Rapido.Blocks.Components.General
1582 @using Dynamicweb.Rapido.Blocks.Components
1583
1584
1585 @* Component *@
1586
1587 @helper RenderSelectField(SelectField settings)
1588 {
1589 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1590 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1591 {
1592 settings.Id = Guid.NewGuid().ToString("N");
1593 }
1594
1595 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1596 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1597 {
1598 <div class="u-full-width">
1599 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1600 @if (settings.Link != null) {
1601 <div class="u-pull--right">
1602 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1603 @Render(settings.Link)
1604 </div>
1605 }
1606 </div>
1607 }
1608
1609 @if (!string.IsNullOrEmpty(settings.HelpText))
1610 {
1611 <small class="form__help-text">@settings.HelpText</small>
1612 }
1613
1614 @if (settings.ActionButton != null)
1615 {
1616 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1617 <div class="form__field-combi u-no-margin dw-mod">
1618 @RenderSelectBase(settings)
1619 @Render(settings.ActionButton)
1620 </div>
1621 }
1622 else
1623 {
1624 @RenderSelectBase(settings)
1625 }
1626
1627 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1628 </div>
1629 }
1630
1631 @helper RenderSelectBase(SelectField settings)
1632 {
1633 var attributes = new Dictionary<string, string>();
1634
1635 /*base settings*/
1636 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1637 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1638 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1639 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1640 if (settings.Required) { attributes.Add("required", "true"); }
1641 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1642 /*end*/
1643
1644 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1645
1646 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod">
1647 @if (settings.Default != null)
1648 {
1649 @Render(settings.Default)
1650 }
1651
1652 @foreach (var item in settings.Options)
1653 {
1654 if (settings.Value != null) {
1655 item.Checked = item.Value == settings.Value;
1656 }
1657 @Render(item)
1658 }
1659 </select>
1660 }
1661 @using System.Reflection
1662 @using Dynamicweb.Rapido.Blocks.Components.General
1663 @using Dynamicweb.Rapido.Blocks.Components
1664
1665 @* Component *@
1666
1667 @helper RenderRadioButtonField(RadioButtonField settings)
1668 {
1669 var attributes = new Dictionary<string, string>();
1670 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1671 {
1672 settings.Id = Guid.NewGuid().ToString("N");
1673 }
1674
1675 /*base settings*/
1676 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1677 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1678 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1679 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1680 if (settings.Required) { attributes.Add("required", "true"); }
1681 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1682 /*end*/
1683
1684 attributes.Add("type", "radio");
1685 if (settings.Checked) { attributes.Add("checked", "true"); }
1686 settings.CssClass = "form__control " + settings.CssClass;
1687 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1688
1689 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1690
1691 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1692 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1693 @if (!string.IsNullOrEmpty(settings.Label))
1694 {
1695 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1696 }
1697 @if (!string.IsNullOrEmpty(settings.HelpText))
1698 {
1699 <small class="form__help-text">@settings.HelpText</small>
1700 }
1701 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1702 </div>
1703 }
1704 @using System.Reflection
1705 @using Dynamicweb.Rapido.Blocks.Components.General
1706 @using Dynamicweb.Rapido.Blocks.Components
1707
1708
1709 @* Component *@
1710
1711 @helper RenderRadioButtonListField(RadioButtonListField settings)
1712 {
1713 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1714
1715 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1716 @if (!string.IsNullOrEmpty(settings.Label))
1717 {
1718 <label>@settings.Label</label>
1719 }
1720 @if (!string.IsNullOrEmpty(settings.HelpText))
1721 {
1722 <small class="form__help-text">@settings.HelpText</small>
1723 }
1724
1725 @foreach (var item in settings.Options)
1726 {
1727 if (settings.Required)
1728 {
1729 item.Required = true;
1730 }
1731 if (settings.Disabled)
1732 {
1733 item.Disabled = true;
1734 }
1735 if (!string.IsNullOrEmpty(settings.Name))
1736 {
1737 item.Name = settings.Name;
1738 }
1739 if (settings.Value != null && settings.Value == item.Value)
1740 {
1741 item.Checked = true;
1742 }
1743 if (!string.IsNullOrEmpty(settings.OnClick))
1744 {
1745 item.OnClick += settings.OnClick;
1746 }
1747 if (!string.IsNullOrEmpty(settings.OnChange))
1748 {
1749 item.OnChange += settings.OnChange;
1750 }
1751 if (!string.IsNullOrEmpty(settings.CssClass))
1752 {
1753 item.CssClass += settings.CssClass;
1754 }
1755 @Render(item)
1756 }
1757
1758 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1759 </div>
1760 }
1761 @using System.Reflection
1762 @using Dynamicweb.Rapido.Blocks.Components.General
1763 @using Dynamicweb.Rapido.Blocks.Components
1764
1765
1766 @* Component *@
1767
1768 @helper RenderNotificationMessage(NotificationMessage settings)
1769 {
1770 if (!string.IsNullOrEmpty(settings.Message))
1771 {
1772 var attributes = new Dictionary<string, string>();
1773 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1774
1775 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower();
1776 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower();
1777 string minHeightClass = settings.Icon != null ? "u-min-h70px" : "";
1778
1779 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>
1780 @if (settings.Icon != null) {
1781 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message;
1782 @Render(settings.Icon)
1783 } else {
1784 @settings.Message
1785 }
1786 </div>
1787 }
1788 }
1789 @using Dynamicweb.Rapido.Blocks.Components.General
1790
1791
1792 @* Component *@
1793
1794 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {
1795 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";
1796
1797 <div class="@settings.CssClass dw-mod js-handlebars-root" id="@settings.Id" data-template="@settings.ScriptTemplate" data-json-feed="@settings.FeedUrl" data-init-onload="@settings.InitOnLoad.ToString()" data-preloader="@settings.Preloader" @preRender>
1798 @if (settings.SubBlocks != null) {
1799 @RenderBlockList(settings.SubBlocks)
1800 }
1801 </div>
1802 }
1803 @using System.Reflection
1804 @using Dynamicweb.Rapido.Blocks.Components.General
1805 @using Dynamicweb.Rapido.Blocks.Components
1806 @using System.Text.RegularExpressions
1807
1808
1809 @* Component *@
1810
1811 @helper RenderSticker(Sticker settings) {
1812 if (!String.IsNullOrEmpty(settings.Title)) {
1813 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";
1814 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";
1815
1816 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
1817 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {
1818 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";
1819 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";
1820 optionalAttributes.Add("style", styleTag);
1821 }
1822
1823 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>
1824 }
1825 }
1826
1827 @using System.Reflection
1828 @using Dynamicweb.Rapido.Blocks.Components.General
1829 @using Dynamicweb.Rapido.Blocks.Components
1830
1831
1832 @* Component *@
1833
1834 @helper RenderStickersCollection(StickersCollection settings)
1835 {
1836 if (settings.Stickers.Count > 0)
1837 {
1838 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
1839
1840 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1841 @foreach (Sticker sticker in settings.Stickers)
1842 {
1843 @Render(sticker)
1844 }
1845 </div>
1846 }
1847 }
1848
1849 @using Dynamicweb.Rapido.Blocks.Components.General
1850
1851
1852 @* Component *@
1853
1854 @helper RenderForm(Form settings) {
1855 if (settings != null)
1856 {
1857 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
1858 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); };
1859 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); };
1860 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); };
1861 var enctypes = new Dictionary<string, string>
1862 {
1863 { "multipart", "multipart/form-data" },
1864 { "text", "text/plain" },
1865 { "application", "application/x-www-form-urlencoded" }
1866 };
1867 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); };
1868 optionalAttributes.Add("method", settings.Method.ToString());
1869
1870 if (!string.IsNullOrEmpty(settings.FormStartMarkup))
1871 {
1872 @settings.FormStartMarkup
1873 }
1874 else
1875 {
1876 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1877 }
1878
1879 foreach (var field in settings.GetFields())
1880 {
1881 <div class="hidden">
1882
1883 </div>
1884 @Render(field)
1885 }
1886
1887 @:</form>
1888 }
1889 }
1890 @using System.Reflection
1891 @using Dynamicweb.Rapido.Blocks.Components.General
1892 @using Dynamicweb.Rapido.Blocks.Components
1893
1894
1895 @* Component *@
1896
1897 @helper RenderText(Text settings)
1898 {
1899 @settings.Content
1900 }
1901 @using System.Reflection
1902 @using Dynamicweb.Rapido.Blocks.Components.General
1903 @using Dynamicweb.Rapido.Blocks.Components
1904
1905
1906 @* Component *@
1907
1908 @helper RenderContentModule(ContentModule settings) {
1909 if (!string.IsNullOrEmpty(settings.Content))
1910 {
1911 @settings.Content
1912 }
1913 }
1914 @using System.Reflection
1915 @using Dynamicweb.Rapido.Blocks.Components.General
1916 @using Dynamicweb.Rapido.Blocks.Components
1917
1918
1919 @* Component *@
1920
1921 @helper RenderModal(Modal settings) {
1922 if (settings != null)
1923 {
1924 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
1925
1926 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : "";
1927
1928 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange />
1929
1930 <div class="modal-container">
1931 @if (!settings.DisableDarkOverlay)
1932 {
1933 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>
1934 }
1935 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal">
1936 @if (settings.Heading != null)
1937 {
1938 if (!string.IsNullOrEmpty(settings.Heading.Title))
1939 {
1940 <div class="modal__header">
1941 @Render(settings.Heading)
1942 </div>
1943 }
1944 }
1945 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">
1946 @if (!string.IsNullOrEmpty(settings.BodyText))
1947 {
1948 @settings.BodyText
1949 }
1950 @if (settings.BodyTemplate != null)
1951 {
1952 @settings.BodyTemplate
1953 }
1954 @{
1955 var actions = settings.GetActions();
1956 }
1957 </div>
1958 @if (actions.Length > 0)
1959 {
1960 <div class="modal__footer">
1961 @foreach (var action in actions)
1962 {
1963 if (Pageview.Device.ToString() != "Mobile") {
1964 action.CssClass += " u-no-margin";
1965 } else {
1966 action.CssClass += " u-full-width u-margin-bottom";
1967 }
1968
1969 @Render(action)
1970 }
1971 </div>
1972 }
1973 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>
1974 </div>
1975 </div>
1976 }
1977 }
1978 @using Dynamicweb.Rapido.Blocks.Components.General
1979
1980 @* Component *@
1981
1982 @helper RenderMediaListItem(MediaListItem settings)
1983 {
1984 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>
1985 @if (!string.IsNullOrEmpty(settings.Label))
1986 {
1987 if (!string.IsNullOrEmpty(settings.Link))
1988 {
1989 @Render(new Link
1990 {
1991 Href = settings.Link,
1992 CssClass = "media-list-item__sticker dw-mod",
1993 ButtonLayout = ButtonLayout.None,
1994 Title = settings.Label,
1995 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1996 })
1997 }
1998 else if (!string.IsNullOrEmpty(settings.OnClick))
1999 {
2000 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">
2001 <span class="u-uppercase">@settings.Label</span>
2002 </span>
2003 }
2004 else
2005 {
2006 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">
2007 <span class="u-uppercase">@settings.Label</span>
2008 </span>
2009 }
2010 }
2011 <div class="media-list-item__wrap">
2012 <div class="media-list-item__info dw-mod">
2013 <div class="media-list-item__header dw-mod">
2014 @if (!string.IsNullOrEmpty(settings.Title))
2015 {
2016 if (!string.IsNullOrEmpty(settings.Link))
2017 {
2018 @Render(new Link
2019 {
2020 Href = settings.Link,
2021 CssClass = "media-list-item__name dw-mod",
2022 ButtonLayout = ButtonLayout.None,
2023 Title = settings.Title,
2024 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
2025 })
2026 }
2027 else if (!string.IsNullOrEmpty(settings.OnClick))
2028 {
2029 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>
2030 }
2031 else
2032 {
2033 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>
2034 }
2035 }
2036
2037 @if (!string.IsNullOrEmpty(settings.Status))
2038 {
2039 <div class="media-list-item__state dw-mod">@settings.Status</div>
2040 }
2041 </div>
2042 @{
2043 settings.InfoTable.CssClass += " media-list-item__parameters-table";
2044 }
2045
2046 @Render(settings.InfoTable)
2047 </div>
2048 <div class="media-list-item__actions dw-mod">
2049 <div class="media-list-item__actions-list dw-mod">
2050 @{
2051 var actions = settings.GetActions();
2052
2053 foreach (ButtonBase action in actions)
2054 {
2055 action.ButtonLayout = ButtonLayout.None;
2056 action.CssClass += " media-list-item__action link";
2057
2058 @Render(action)
2059 }
2060 }
2061 </div>
2062
2063 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title))
2064 {
2065 settings.SelectButton.CssClass += " u-no-margin";
2066
2067 <div class="media-list-item__action-button">
2068 @Render(settings.SelectButton)
2069 </div>
2070 }
2071 </div>
2072 </div>
2073 </div>
2074 }
2075 @using Dynamicweb.Rapido.Blocks.Components.General
2076 @using Dynamicweb.Rapido.Blocks.Components
2077
2078 @helper RenderTable(Table settings)
2079 {
2080 Dictionary<string, string> attributes = new Dictionary<string, string>();
2081 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2082
2083 var enumToClasses = new Dictionary<TableDesign, string>
2084 {
2085 { TableDesign.Clean, "table--clean" },
2086 { TableDesign.Bordered, "table--bordered" },
2087 { TableDesign.Striped, "table--striped" },
2088 { TableDesign.Hover, "table--hover" },
2089 { TableDesign.Compact, "table--compact" },
2090 { TableDesign.Condensed, "table--condensed" },
2091 { TableDesign.NoTopBorder, "table--no-top-border" }
2092 };
2093 string tableDesignClass = "";
2094 if (settings.Design != TableDesign.None)
2095 {
2096 tableDesignClass = enumToClasses[settings.Design];
2097 }
2098
2099 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }
2100
2101 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2102
2103 <table @ComponentMethods.AddAttributes(resultAttributes)>
2104 @if (settings.Header != null)
2105 {
2106 <thead>
2107 @Render(settings.Header)
2108 </thead>
2109 }
2110 <tbody>
2111 @foreach (var row in settings.Rows)
2112 {
2113 @Render(row)
2114 }
2115 </tbody>
2116 @if (settings.Footer != null)
2117 {
2118 <tfoot>
2119 @Render(settings.Footer)
2120 </tfoot>
2121 }
2122 </table>
2123 }
2124 @using Dynamicweb.Rapido.Blocks.Components.General
2125 @using Dynamicweb.Rapido.Blocks.Components
2126
2127 @helper RenderTableRow(TableRow settings)
2128 {
2129 Dictionary<string, string> attributes = new Dictionary<string, string>();
2130 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2131
2132 var enumToClasses = new Dictionary<TableRowDesign, string>
2133 {
2134 { TableRowDesign.NoBorder, "table__row--no-border" },
2135 { TableRowDesign.Border, "table__row--border" },
2136 { TableRowDesign.TopBorder, "table__row--top-line" },
2137 { TableRowDesign.BottomBorder, "table__row--bottom-line" },
2138 { TableRowDesign.Solid, "table__row--solid" }
2139 };
2140
2141 string tableRowDesignClass = "";
2142 if (settings.Design != TableRowDesign.None)
2143 {
2144 tableRowDesignClass = enumToClasses[settings.Design];
2145 }
2146
2147 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }
2148
2149 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2150
2151 <tr @ComponentMethods.AddAttributes(resultAttributes)>
2152 @foreach (var cell in settings.Cells)
2153 {
2154 if (settings.IsHeaderRow)
2155 {
2156 cell.IsHeader = true;
2157 }
2158 @Render(cell)
2159 }
2160 </tr>
2161 }
2162 @using Dynamicweb.Rapido.Blocks.Components.General
2163 @using Dynamicweb.Rapido.Blocks.Components
2164 @using Dynamicweb.Core
2165
2166 @helper RenderTableCell(TableCell settings)
2167 {
2168 Dictionary<string, string> attributes = new Dictionary<string, string>();
2169 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2170 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }
2171 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }
2172 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }
2173
2174 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2175
2176 string tagName = settings.IsHeader ? "th" : "td";
2177
2178 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")
2179 @settings.Content
2180 @("</" + tagName + ">");
2181 }
2182 @using System.Linq
2183 @using Dynamicweb.Rapido.Blocks.Components.General
2184
2185 @* Component *@
2186
2187 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings)
2188 {
2189 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter
2190 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring
2191
2192 if (settings.NumberOfPages > 1)
2193 {
2194 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx";
2195 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation");
2196 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings);
2197
2198 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel">
2199 @if (settings.ShowPagingInfo)
2200 {
2201 <div class="pager__info dw-mod">
2202 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages
2203 </div>
2204 }
2205 <ul class="pager__list dw-mod">
2206 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls)
2207 {
2208 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon })
2209 }
2210 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls)
2211 {
2212 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon })
2213 }
2214 @if (settings.GetPages().Any())
2215 {
2216 foreach (var page in settings.GetPages())
2217 {
2218 @Render(page)
2219 }
2220 }
2221 else
2222 {
2223 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++)
2224 {
2225 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString());
2226 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) });
2227 }
2228 }
2229 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls)
2230 {
2231 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon })
2232 }
2233 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls)
2234 {
2235 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon })
2236 }
2237 </ul>
2238 </div>
2239 }
2240 }
2241
2242 @helper RenderPaginationItem(PaginationItem settings)
2243 {
2244 if (settings.Icon == null)
2245 {
2246 settings.Icon = new Icon();
2247 }
2248
2249 settings.Icon.Label = settings.Label;
2250 <li class="pager__btn dw-mod">
2251 @if (settings.IsActive)
2252 {
2253 <span class="pager__num pager__num--current dw-mod">
2254 @Render(settings.Icon)
2255 </span>
2256 }
2257 else
2258 {
2259 <a href="@settings.Link" class="pager__num dw-mod">
2260 @Render(settings.Icon)
2261 </a>
2262 }
2263 </li>
2264 }
2265
2266
2267 @using Dynamicweb.Rapido.Blocks.Components.General
2268 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
2269
2270
2271 @functions {
2272
2273 public class ArticleListPopularItems : ComponentBase
2274 {
2275 public string Category { get; set; }
2276
2277 }
2278
2279
2280 }
2281
2282
2283
2284 @using Dynamicweb.Frontend
2285 @using System.Reflection
2286 @using Dynamicweb.Content.Items
2287 @using System.Web.UI.HtmlControls
2288 @using Dynamicweb.Rapido.Blocks.Components
2289 @using Dynamicweb.Rapido.Blocks
2290 @using Dynamicweb.Rapido.Blocks.Components.Articles
2291
2292 @* Components for the articles *@
2293 @using System.Reflection
2294 @using Dynamicweb.Rapido.Blocks.Components.Articles
2295
2296
2297 @* Component for the articles *@
2298
2299 @helper RenderArticleBanner(dynamic settings) {
2300 string filterClasses = "image-filter image-filter--darken";
2301 settings.Layout = ArticleHeaderLayout.Banner;
2302
2303 if (settings.Image != null)
2304 {
2305 if (settings.Image.Path != null)
2306 {
2307 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2308 <div class="background-image @filterClasses dw-mod">
2309 <div class="background-image__wrapper @filterClasses dw-mod">
2310 @{
2311 settings.Image.CssClass += "background-image__cover dw-mod";
2312 }
2313 @Render(settings.Image)
2314 </div>
2315 </div>
2316 <div class="center-container dw-mod">
2317 <div class="grid">
2318 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">
2319 <div class="u-left-middle">
2320 <div>
2321 @if (!String.IsNullOrEmpty(settings.Heading))
2322 {
2323 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2324 }
2325 @if (!String.IsNullOrEmpty(settings.Subheading))
2326 {
2327 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2328 }
2329 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2330 {
2331 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2332 }
2333 @if (!String.IsNullOrEmpty(settings.Link)) {
2334 <div class="grid__cell">
2335 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2336 </div>
2337 }
2338 </div>
2339 </div>
2340 </div>
2341 @if (settings.ExternalParagraphId != 0)
2342 {
2343 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">
2344 <div class="u-color-light-gray--bg u-color-dark dw-mod">
2345 @RenderParagraphContent(settings.ExternalParagraphId)
2346 </div>
2347 </div>
2348 }
2349
2350 </div>
2351 </div>
2352 </section>
2353 if (!String.IsNullOrEmpty(settings.Image.Caption)) {
2354 <div class="image-caption dw-mod">@settings.Image.Caption</div>
2355 }
2356 }
2357 else
2358 {
2359 settings.Layout = ArticleHeaderLayout.Clean;
2360 @RenderArticleCleanHeader(settings);
2361 }
2362 }
2363 else
2364 {
2365 settings.Layout = ArticleHeaderLayout.Clean;
2366 @RenderArticleCleanHeader(settings);
2367 }
2368 }
2369 @using System.Reflection
2370 @using Dynamicweb.Rapido.Blocks.Components
2371 @using Dynamicweb.Rapido.Blocks.Components.General
2372 @using Dynamicweb.Rapido.Blocks.Components.Articles
2373 @using Dynamicweb.Rapido.Blocks
2374
2375
2376 @* Component for the articles *@
2377
2378 @helper RenderArticleHeader(ArticleHeader settings) {
2379 dynamic[] methodParameters = new dynamic[1];
2380 methodParameters[0] = settings;
2381 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");
2382
2383 if (customMethod != null)
2384 {
2385 @customMethod.Invoke(this, methodParameters).ToString();
2386 } else {
2387 switch (settings.Layout)
2388 {
2389 case ArticleHeaderLayout.Clean:
2390 @RenderArticleCleanHeader(settings);
2391 break;
2392 case ArticleHeaderLayout.Split:
2393 @RenderArticleSplitHeader(settings);
2394 break;
2395 case ArticleHeaderLayout.Banner:
2396 @RenderArticleBannerHeader(settings);
2397 break;
2398 case ArticleHeaderLayout.Overlay:
2399 @RenderArticleOverlayHeader(settings);
2400 break;
2401 default:
2402 @RenderArticleCleanHeader(settings);
2403 break;
2404 }
2405 }
2406 }
2407
2408 @helper RenderArticleCleanHeader(ArticleHeader settings) {
2409 dynamic[] methodParameters = new dynamic[1];
2410 methodParameters[0] = settings;
2411 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");
2412
2413 if (customMethod != null)
2414 {
2415 @customMethod.Invoke(this, methodParameters).ToString();
2416 }
2417 else
2418 {
2419 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2420
2421 <div class="grid grid--align-content-start grid--justify-start">
2422 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">
2423 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)
2424 {
2425 <div class="u-border-bottom u-padding-bottom">
2426 @if (!String.IsNullOrEmpty(settings.Category))
2427 {
2428 <div class="u-pull--left">
2429 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2430 </div>
2431 }
2432 <div class="u-pull--right">
2433 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2434 {
2435 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>
2436 }
2437 @if (settings.RatingOutOf != 0)
2438 {
2439 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2440 }
2441 </div>
2442 </div>
2443 }
2444
2445 <div class="grid__cell">
2446 @if (!String.IsNullOrEmpty(settings.Heading))
2447 {
2448 <h1 class="article__header test article__header--giant dw-mod">@settings.Heading </h1>
2449
2450 }
2451 @if (settings.Image != null)
2452 {
2453 if (settings.Image.Path != null)
2454 {
2455 <div class="u-padding-bottom--lg">
2456
2457 @Render(settings.Image)
2458
2459 </div>
2460 }
2461 }
2462 @if (!String.IsNullOrEmpty(settings.Subheading))
2463 {
2464 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2465 }
2466 @if (!String.IsNullOrEmpty(settings.Link))
2467 {
2468 <div class="grid__cell">
2469 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2470 </div>
2471 }
2472 </div>
2473 </div>
2474 @if (settings.ExternalParagraphId != 0)
2475 {
2476 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">
2477 @RenderParagraphContent(settings.ExternalParagraphId)
2478 </div>
2479 }
2480 </div>
2481 }
2482 }
2483
2484 @helper RenderArticleSplitHeader(ArticleHeader settings) {
2485 dynamic[] methodParameters = new dynamic[1];
2486 methodParameters[0] = settings;
2487 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");
2488
2489 if (customMethod != null)
2490 {
2491 @customMethod.Invoke(this, methodParameters).ToString();
2492 }
2493 else
2494 {
2495 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";
2496
2497 if (settings.Image != null)
2498 {
2499 if (settings.Image.Path != null)
2500 {
2501 <section class="multiple-paragraphs-container paragraph-container--full-width">
2502 <div class="grid">
2503 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2504 <div class="u-left-middle u-padding--lg">
2505 <div>
2506 @if (!String.IsNullOrEmpty(settings.Category))
2507 {
2508 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2509 }
2510 @if (!String.IsNullOrEmpty(settings.Heading))
2511 {
2512 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2513 }
2514 @if (!String.IsNullOrEmpty(settings.Subheading))
2515 {
2516 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2517 }
2518 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2519 {
2520 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>
2521 }
2522 @if (settings.RatingOutOf != 0)
2523 {
2524 <div class="u-pull--right">
2525 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2526 </div>
2527 }
2528 @if (!String.IsNullOrEmpty(settings.Link)) {
2529 <div class="u-full-width u-pull--left u-margin-top">
2530 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2531 </div>
2532 }
2533 </div>
2534 </div>
2535 </div>
2536 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod" style="background-image:url(/Admin/Public/GetImage.ashx?width=1800&height=1100&crop=0&DoNotUpscale=true&Quality=99&Format=webP&image=@settings.Image.Path); background-position: center center; background-size: cover;"></div>
2537 @if (settings.ExternalParagraphId != 0)
2538 {
2539 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto u-color-light-gray--bg dw-mod">
2540 @RenderParagraphContent(settings.ExternalParagraphId)
2541 </div>
2542 }
2543 </div>
2544 </section>
2545 }
2546 }
2547 else
2548 {
2549 @RenderArticleCleanHeader(settings);
2550 }
2551 }
2552 }
2553
2554 @helper RenderArticleOverlayHeader(ArticleHeader settings) {
2555 dynamic[] methodParameters = new dynamic[1];
2556 methodParameters[0] = settings;
2557 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");
2558
2559 if (customMethod != null)
2560 {
2561 @customMethod.Invoke(this, methodParameters).ToString();
2562 }
2563 else
2564 {
2565 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2566 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";
2567
2568 if (settings.Image != null)
2569 {
2570 if (settings.Image.Path != null)
2571 {
2572 if (settings.ExternalParagraphId == 0)
2573 {
2574 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2575 <div class="background-image image-filter image-filter--darken dw-mod">
2576 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">
2577 @{
2578 settings.Image.CssClass += "background-image__cover dw-mod";
2579 }
2580 @Render(settings.Image)
2581 </div>
2582 </div>
2583 <div class="center-container dw-mod">
2584 <div class="grid @contentAlignment">
2585 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod">
2586 @if (!String.IsNullOrEmpty(settings.Heading))
2587 {
2588 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2589 }
2590 @if (!String.IsNullOrEmpty(settings.Subheading))
2591 {
2592 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2593 }
2594 <div class="u-margin-top">
2595 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2596 {
2597 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2598 }
2599 @if (settings.RatingOutOf != 0)
2600 {
2601 <div class="u-pull--right">
2602 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2603 </div>
2604 }
2605 </div>
2606 @if (!String.IsNullOrEmpty(settings.Link))
2607 {
2608 <div class="grid__cell">
2609 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2610 </div>
2611 }
2612 </div>
2613 </div>
2614 </div>
2615 </section>
2616 }
2617 else
2618 {
2619 @RenderArticleBanner(settings);
2620 }
2621 }
2622 }
2623 else
2624 {
2625 @RenderArticleCleanHeader(settings);
2626 }
2627 }
2628 }
2629
2630 @helper RenderArticleBannerHeader(dynamic settings) {
2631 dynamic[] methodParameters = new dynamic[1];
2632 methodParameters[0] = settings;
2633 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");
2634
2635 if (customMethod != null)
2636 {
2637 @customMethod.Invoke(this, methodParameters).ToString();
2638 }
2639 else
2640 {
2641 @RenderArticleBanner(settings);
2642 }
2643 }
2644 @using System.Reflection
2645 @using System.Text.RegularExpressions;
2646 @using Dynamicweb.Frontend
2647 @using Dynamicweb.Content.Items
2648 @using Dynamicweb.Rapido.Blocks.Components
2649 @using Dynamicweb.Rapido.Blocks.Components.Articles
2650 @using Dynamicweb.Rapido.Blocks
2651
2652 @* Component for the articles *@
2653
2654 @helper RenderArticleBodyRow(ArticleBodyRow settings)
2655 {
2656 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";
2657 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";
2658
2659 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">
2660 @RenderBlockList(settings.SubBlocks)
2661 </div>
2662 }
2663 @using System.Reflection
2664 @using Dynamicweb.Rapido.Blocks.Components
2665 @using Dynamicweb.Rapido.Blocks.Components.General
2666 @using Dynamicweb.Rapido.Blocks.Components.Articles
2667 @using Dynamicweb.Rapido.Blocks
2668
2669 @* Component for the articles *@
2670
2671 @helper RenderArticleImage(ArticleImage settings)
2672 {
2673 if (settings.Image != null)
2674 {
2675 if (settings.Image.Path != null)
2676 {
2677 <div class="u-margin-bottom--lg">
2678 @Render(settings.Image)
2679 </div>
2680 }
2681 }
2682 }
2683 @using System.Reflection
2684 @using Dynamicweb.Rapido.Blocks.Components
2685 @using Dynamicweb.Rapido.Blocks.Components.Articles
2686
2687
2688 @* Component for the articles *@
2689
2690 @helper RenderArticleSubHeader(ArticleSubHeader settings)
2691 {
2692 if (!String.IsNullOrEmpty(settings.Title))
2693 {
2694 <h2 class="article__header">@settings.Title</h2>
2695 }
2696 }
2697 @using System.Reflection
2698 @using Dynamicweb.Rapido.Blocks.Components
2699 @using Dynamicweb.Rapido.Blocks.Components.Articles
2700 @using Dynamicweb.Rapido.Blocks
2701
2702
2703 @* Component for the articles *@
2704
2705 @helper RenderArticleText(ArticleText settings)
2706 {
2707 if (!String.IsNullOrEmpty(settings.Text))
2708 {
2709 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";
2710
2711 <div class="article__paragraph @greatTextClass dw-mod">
2712 @settings.Text
2713 </div>
2714 }
2715 }
2716 @using System.Reflection
2717 @using Dynamicweb.Rapido.Blocks.Components
2718 @using Dynamicweb.Rapido.Blocks.Components.Articles
2719 @using Dynamicweb.Rapido.Blocks
2720
2721
2722 @* Component for the articles *@
2723
2724 @helper RenderArticleQuote(ArticleQuote settings)
2725 {
2726 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);
2727
2728 <div class="grid u-padding-bottom--lg">
2729 @if (settings.Image != null)
2730 {
2731 if (settings.Image.Path != null) {
2732 <div class="grid__col-3">
2733 <div class="grid__cell-img">
2734 @{
2735 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;
2736 settings.Image.CssClass += " article__image article__image--ball";
2737 settings.Image.ImageDefault.Width = 200;
2738 settings.Image.ImageDefault.Height = 200;
2739 }
2740 @Render(settings.Image)
2741 </div>
2742 </div>
2743 }
2744 }
2745 <div class="grid__col-auto">
2746 @if (!String.IsNullOrEmpty(settings.Text))
2747 {
2748 <div class="article__quote dw-mod">
2749 <i class="fas fa-quote-right u-margin-bottom--lg"></i>
2750 @settings.Text
2751 <i class="fas fa-quote-right"></i>
2752 </div>
2753 }
2754 @if (!String.IsNullOrEmpty(settings.Author))
2755 {
2756 <div class="article__quote-author dw-mod">
2757 - @settings.Author
2758 </div>
2759 }
2760 </div>
2761 </div>
2762 }
2763 @using System.Reflection
2764 @using Dynamicweb.Rapido.Blocks.Components
2765 @using Dynamicweb.Rapido.Blocks.Components.Articles
2766 @using Dynamicweb.Rapido.Blocks
2767
2768 @* Component for the articles *@
2769
2770 @helper RenderArticleInfoTable(ArticleInfoTable settings)
2771 {
2772 <table class="table table--clean">
2773 @foreach (var row in settings.Rows)
2774 {
2775 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";
2776
2777 <tr>
2778 @if (!String.IsNullOrEmpty(row.Icon))
2779 {
2780 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>
2781 }
2782 <td class="u-no-margin-on-p-elements">
2783 <div class="u-bold">@row.Title</div>
2784 @if (!String.IsNullOrEmpty(row.SubTitle))
2785 {
2786 if (row.Link == null)
2787 {
2788 <div>@row.SubTitle</div>
2789 }
2790 else
2791 {
2792 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>
2793 }
2794 }
2795 </td>
2796 </tr>
2797 }
2798 </table>
2799 }
2800 @using System.Reflection
2801 @using Dynamicweb.Rapido.Blocks.Components
2802 @using Dynamicweb.Rapido.Blocks.Components.General
2803 @using Dynamicweb.Rapido.Blocks.Components.Articles
2804 @using Dynamicweb.Rapido.Blocks
2805
2806 @* Component for the articles *@
2807
2808 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)
2809 {
2810 Modal galleryModal = new Modal
2811 {
2812 Id = "ParagraphGallery",
2813 Width = ModalWidth.Full,
2814 BodyTemplate = RenderArticleGalleryModalContent()
2815 };
2816
2817 @Render(galleryModal)
2818 }
2819
2820 @helper RenderArticleGalleryModalContent() {
2821 <div class="modal__image-min-size-wrapper">
2822 @Render(new Image {
2823 Id = "ParagraphGallery",
2824 Path = "#",
2825 CssClass = "modal--full__img",
2826 DisableLazyLoad = true,
2827 DisableImageEngine = true
2828 })
2829 </div>
2830
2831 <div class="modal__images-counter" id="ParagraphGallery_counter"></div>
2832
2833 @Render(new Button {
2834 Id = "ParagraphGallery_prev",
2835 ButtonType = ButtonType.Button,
2836 ButtonLayout = ButtonLayout.None,
2837 CssClass = "modal__prev-btn",
2838 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After },
2839 OnClick = "Gallery.prevImage('ParagraphGallery')"
2840 })
2841
2842 @Render(new Button {
2843 Id = "ParagraphGallery_next",
2844 ButtonType = ButtonType.Button,
2845 ButtonLayout = ButtonLayout.None,
2846 CssClass = "modal__next-btn",
2847 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After },
2848 OnClick = "Gallery.nextImage('ParagraphGallery')"
2849 })
2850 }
2851 @using System.Reflection
2852 @using Dynamicweb.Rapido.Blocks.Components
2853 @using Dynamicweb.Rapido.Blocks.Components.Articles
2854 @using Dynamicweb.Rapido.Blocks
2855
2856
2857 @* Component for the articles *@
2858
2859 @helper RenderArticleRelated(ArticleRelated settings)
2860 {
2861 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
2862 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
2863
2864 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
2865 <div class="center-container dw-mod">
2866 <div class="grid u-padding">
2867 <div class="grid__col-md-12 grid__col-xs-12">
2868 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
2869 </div>
2870 </div>
2871
2872 <div class="js-handlebars-root u-padding" id="@settings.Title.Replace(" ", String.Empty)" data-template="RelatedSimpleTemplate" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div>
2873
2874 <script id="RelatedSimpleTemplate" type="text/x-template">
2875 {{#.}}
2876 <div class="grid u-padding-bottom--lg">
2877 {{#Cases}}
2878 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod">
2879 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column">
2880 {{#if image}}
2881 <div class="u-color-light--bg u-no-padding dw-mod">
2882 <div class="flex-img image-hover__wrapper">
2883 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=680&height=314&crop=1&DoNotUpscale=True&Compression=75&image={{image}}" alt="{{title}}" />
2884 </div>
2885 </div>
2886 {{/if}}
2887
2888 <div class="card u-color-light--bg u-full-height dw-mod">
2889 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
2890 <p class="article__short-summary dw-mod">{{summary}}</p>
2891 </div>
2892 </a>
2893 </div>
2894 {{/Cases}}
2895 </div>
2896 {{/.}}
2897 </script>
2898 </div>
2899 </section>
2900 }
2901 @using System.Reflection
2902 @using Dynamicweb.Rapido.Blocks.Components
2903 @using Dynamicweb.Rapido.Blocks.Components.Articles
2904 @using Dynamicweb.Rapido.Blocks
2905
2906
2907 @* Component for the articles *@
2908
2909 @helper RenderArticleMenu(ArticleMenu settings)
2910 {
2911 if (!String.IsNullOrEmpty(settings.Title)) {
2912 <div class="u-margin u-border-bottom">
2913 <h3 class="u-no-margin">@settings.Title</h3>
2914 </div>
2915 }
2916
2917 <ul class="menu-left u-margin-bottom dw-mod">
2918 @foreach (var item in settings.Items)
2919 {
2920 @Render(item)
2921 }
2922 </ul>
2923 }
2924
2925 @helper RenderArticleMenuItem(ArticleMenuItem settings)
2926 {
2927 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";
2928
2929 if (!String.IsNullOrEmpty(settings.Title)) {
2930 <li class="menu-left__item dw-mod">
2931 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>
2932 </li>
2933 }
2934 }
2935 @using System.Reflection
2936 @using Dynamicweb.Rapido.Blocks.Components
2937 @using Dynamicweb.Rapido.Blocks.Components.Articles
2938 @using Dynamicweb.Rapido.Blocks
2939
2940 @* Component for the articles *@
2941
2942 @helper RenderArticleList(ArticleList settings)
2943 {
2944 if (Pageview != null)
2945 {
2946 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;
2947 string[] sortArticlesListBy = new string[2];
2948
2949 if (isParagraph) {
2950 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "DESC" };
2951 }
2952 else {
2953 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "DESC" };
2954 }
2955
2956 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();
2957
2958 if (!settings.DisablePagination) {
2959 @RenderItemList(new
2960 {
2961 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2962 ListSourceType = settings.SourceType,
2963 ListSourcePage = sourcePage,
2964 ItemFieldsList = "*",
2965 Filter = settings.Filter,
2966 ListOrderBy = sortArticlesListBy[0],
2967 ListOrderByDirection = sortArticlesListBy[1],
2968 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2969 ListSecondOrderByDirection = "DESC",
2970 IncludeAllChildItems = true,
2971 ListTemplate = settings.Template,
2972 ListPageSize = settings.PageSize.ToString()
2973 });
2974 } else {
2975 @RenderItemList(new
2976 {
2977 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2978 ListSourceType = settings.SourceType,
2979 ListSourcePage = sourcePage,
2980 ItemFieldsList = "*",
2981 Filter = settings.Filter,
2982 ListOrderBy = sortArticlesListBy[0],
2983 ListOrderByDirection = sortArticlesListBy[1],
2984 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2985 ListSecondOrderByDirection = "DESC",
2986 IncludeAllChildItems = true,
2987 ListTemplate = settings.Template,
2988 ListPageSize = settings.PageSize.ToString(),
2989 ListViewMode = "Partial",
2990 ListShowTo = settings.PageSize + 1
2991 });
2992 }
2993 }
2994 }
2995 @using System.Reflection
2996 @using Dynamicweb.Rapido.Blocks.Components.Articles
2997
2998
2999 @* Component for the articles *@
3000
3001 @helper RenderArticleSummary(ArticleSummary settings)
3002 {
3003 if (!String.IsNullOrEmpty(settings.Text))
3004 {
3005 <div class="article__summary dw-mod">@settings.Text</div>
3006 }
3007 }
3008 @using System.Reflection
3009 @using Dynamicweb.Rapido.Blocks.Components
3010 @using Dynamicweb.Rapido.Blocks.Components.Articles
3011 @using Dynamicweb.Rapido.Blocks
3012
3013 @* Component for the articles *@
3014
3015 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)
3016 {
3017 string pageId = Pageview.ID.ToString();
3018 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");
3019 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
3020
3021 foreach (var option in settings.Categories)
3022 {
3023 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;
3024 }
3025
3026 if (selectedFilter == pageId)
3027 {
3028 selectedFilter = Translate("All");
3029 }
3030
3031 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3032 {
3033 <div class="u-pull--right u-margin-left">
3034 <div class="collection u-no-margin">
3035 <h5>@Translate("Category")</h5>
3036 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3037 <div class="dropdown u-w180px dw-mod">
3038 <label class="dropdown__header dropdown__btn u-padding-top u-padding-bottom u-font-size--sm dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3039 <div class="dropdown__content dw-mod">
3040 @foreach (var option in settings.Categories)
3041 {
3042 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3043 }
3044 </div>
3045 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3046 </div>
3047 </div>
3048 </div>
3049 }
3050 else
3051 {
3052 <div class="u-full-width u-margin-bottom">
3053 <h5 class="u-no-margin">@Translate("Category")</h5>
3054 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3055 <div class="dropdown u-full-width dw-mod">
3056 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3057 <div class="dropdown__content dw-mod">
3058 @foreach (var option in settings.Categories)
3059 {
3060 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3061 }
3062 </div>
3063 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3064 </div>
3065 </div>
3066 }
3067 }
3068 @using System.Reflection
3069 @using Dynamicweb.Rapido.Blocks.Components
3070 @using Dynamicweb.Rapido.Blocks.Components.Articles
3071 @using Dynamicweb.Rapido.Blocks
3072 @using System.Collections.Generic
3073
3074 @* Component for the articles *@
3075
3076 @helper RenderArticleListFilter(ArticleListFilter settings)
3077 {
3078 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");
3079 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
3080
3081 if (settings.Options != null)
3082 {
3083 if (settings.Options is IEnumerable<dynamic>)
3084 {
3085 var options = (IEnumerable<dynamic>) settings.Options;
3086 settings.Options = options.OrderBy(item => item.Name);
3087 }
3088
3089 foreach (var option in settings.Options)
3090 {
3091 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;
3092 }
3093
3094 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3095 {
3096 <div class="u-pull--right u-margin-left">
3097 <div class="collection u-no-margin">
3098 <h5>@settings.Label</h5>
3099 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3100 <div class="dropdown u-w180px dw-mod">
3101 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3102 <div class="dropdown__content dw-mod">
3103 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3104 @foreach (var option in settings.Options)
3105 {
3106 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3107 }
3108 </div>
3109 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3110 </div>
3111 </div>
3112 </div>
3113 }
3114 else
3115 {
3116 <div class="u-full-width u-margin-bottom">
3117 <h5 class="u-no-margin">@settings.Label</h5>
3118 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3119 <div class="dropdown u-full-width w-mod">
3120 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3121 <div class="dropdown__content dw-mod">
3122 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3123 @foreach (var option in settings.Options)
3124 {
3125 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3126 }
3127 </div>
3128 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3129 </div>
3130 </div>
3131 }
3132 }
3133 }
3134 @using System.Reflection
3135 @using Dynamicweb.Rapido.Blocks.Components
3136 @using Dynamicweb.Rapido.Blocks.Components.Articles
3137 @using Dynamicweb.Rapido.Blocks
3138
3139 @* Component for the articles *@
3140
3141 @helper RenderArticleListSearch(ArticleListSearch settings)
3142 {
3143 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title";
3144 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter);
3145 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : "";
3146 string className = "u-w340px u-pull--right u-margin-left";
3147
3148 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3149 {
3150 className = "u-full-width";
3151 }
3152
3153 <div class="typeahead u-color-inherit dw-mod @className">
3154 <input type="text" class="typeahead-search-field u-no-margin u-padding-top--lg u-padding-bottom--lg u-font-size--sm dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')">
3155 @*<input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParametersInCurrentURL({'Title' : '*' + document.getElementById('ArticleListSearchInput').value + '*', 'ScientificName' : '*' + document.getElementById('ArticleListSearchInput').value + '*'})">*@
3156 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>
3157 </div>
3158 }
3159 @using System.Reflection
3160 @using Dynamicweb.Rapido.Blocks.Components
3161 @using Dynamicweb.Rapido.Blocks.Components.Articles
3162 @using Dynamicweb.Rapido.Blocks
3163
3164 @* Component for the articles *@
3165
3166 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)
3167 {
3168 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>
3169 }
3170 @using System.Reflection
3171 @using Dynamicweb.Rapido.Blocks.Components
3172 @using Dynamicweb.Rapido.Blocks.Components.General
3173 @using Dynamicweb.Rapido.Blocks.Components.Articles
3174 @using Dynamicweb.Rapido.Blocks
3175 @using System.Text.RegularExpressions
3176
3177 @* Component for the articles *@
3178
3179 @helper RenderArticleListItem(ArticleListItem settings)
3180 {
3181 switch (settings.Type) {
3182 case ArticleListItemType.Card:
3183 @RenderArticleListItemCard(settings);
3184 break;
3185 case ArticleListItemType.List:
3186 @RenderArticleListItemList(settings);
3187 break;
3188 case ArticleListItemType.Simple:
3189 @RenderArticleListItemSimple(settings);
3190 break;
3191 default:
3192 @RenderArticleListItemCard(settings);
3193 break;
3194 }
3195 }
3196
3197 @helper RenderArticleListItemCard(ArticleListItem settings) {
3198 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column">
3199 <div class="u-color-light--bg u-no-padding dw-mod">
3200 @if (settings.Logo != null)
3201 {
3202 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3203 settings.Logo.ImageDefault.Crop = 5;
3204 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3205 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3206 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3207 @if (settings.Stickers != null)
3208 {
3209 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3210 {
3211 @Render(settings.Stickers);
3212 }
3213 }
3214 @RenderImage(settings.Logo)
3215 </div>
3216 } else if (settings.Image != null)
3217 {
3218 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">
3219 @if (settings.Stickers != null)
3220 {
3221 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3222 {
3223 @Render(settings.Stickers);
3224 }
3225 }
3226 @Render(settings.Image)
3227 </div>
3228 }
3229 </div>
3230
3231 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3232 {
3233 <div class="card u-color-light--bg u-full-height dw-mod">
3234 @if (settings.Stickers != null)
3235 {
3236 if (settings.Stickers.Position == StickersListPosition.Custom)
3237 {
3238 @Render(settings.Stickers);
3239 }
3240 }
3241 @if (!String.IsNullOrEmpty(settings.Title))
3242 {
3243 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3244 }
3245 @if (!String.IsNullOrEmpty(settings.SubTitle))
3246 {
3247 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3248 }
3249 @if (!String.IsNullOrEmpty(settings.Summary))
3250 {
3251 <p class="article__short-summary dw-mod">@settings.Summary</p>
3252 }
3253
3254 </div>
3255 }
3256 </a>
3257 }
3258
3259 @helper RenderArticleListItemList(ArticleListItem settings) {
3260 <a href="@settings.Link">
3261
3262
3263 <div class="grid u-color-light--bg custom-article-list u-no-padding dw-mod">
3264
3265 <div class="grid__col-md-3">
3266 <div class="u-color-light--bg u-no-padding dw-mod">
3267 @if (settings.Logo != null)
3268 {
3269 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3270 settings.Logo.ImageDefault.Crop = 5;
3271 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3272 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3273 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3274 @*
3275 @if (settings.Stickers != null)
3276 {
3277 if (settings.Stickers.Position != StickersListPosition.Custom)
3278 {
3279 @Render(settings.Stickers);
3280 }
3281 }
3282 *@
3283 @RenderImage(settings.Logo)
3284 </div>
3285 }
3286 else if (settings.Image != null)
3287 {
3288 <div class="flex-img image-hover__wrapper dw-mod">
3289 @*
3290 @if (settings.Stickers != null)
3291 {
3292 if (settings.Stickers.Position != StickersListPosition.Custom)
3293 {
3294 @Render(settings.Stickers);
3295 }
3296 }
3297 *@
3298 @Render(settings.Image)
3299 </div>
3300 }
3301 </div>
3302 </div>
3303
3304 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3305 {
3306 <div class="grid__col-md-9">
3307 @Render(settings.Stickers)
3308
3309 @if (!String.IsNullOrEmpty(settings.Title))
3310 {
3311 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3312 }
3313 @if (settings.Stickers != null)
3314 {
3315 if (settings.Stickers.Position == StickersListPosition.Custom)
3316 {
3317 @Render(settings.Stickers)
3318 ;
3319 }
3320 }
3321 @if (!String.IsNullOrEmpty(settings.SubTitle))
3322 {
3323 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3324 }
3325 @if (!String.IsNullOrEmpty(settings.Summary))
3326 {
3327 <p class="article__short-summary dw-mod">@settings.Summary</p>
3328 }
3329 @if (!String.IsNullOrEmpty(settings.Link))
3330 {
3331 <a href="@settings.Link">@Translate("Mai mult >", "Mai mult >")</a>
3332 }
3333 </div>
3334 }
3335 </div>
3336 </a>
3337 }
3338
3339 @helper RenderArticleListItemSimple(ArticleListItem settings) {
3340 <a href="@settings.Link" class="u-color-inherit">
3341 <div class="grid u-color-light--bg u-no-padding dw-mod">
3342 <div class="grid__col-md-12">
3343 @if (!String.IsNullOrEmpty(settings.Title))
3344 {
3345 <div class="article-list-item__header test u-truncate-text u-no-margin dw-mod">@settings.Title</div>
3346
3347 }
3348 @if (!String.IsNullOrEmpty(settings.SubTitle))
3349 {
3350 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3351 }
3352 </div>
3353 </div>
3354 </a>
3355 }
3356 @using System.Reflection
3357 @using Dynamicweb.Rapido.Blocks.Components.Articles
3358
3359
3360 @* Component for the articles *@
3361
3362 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)
3363 {
3364 <small class="article__subscription">
3365 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3366 {
3367 <text>@Translate("Written")</text>
3368 }
3369 @if (!string.IsNullOrWhiteSpace(settings.Author))
3370 {
3371 <text>@Translate("by") @settings.Author</text>
3372 }
3373 @if (!string.IsNullOrWhiteSpace(settings.Date))
3374 {
3375 <text>@Translate("on") @settings.Date</text>
3376 }
3377 </small>
3378 }
3379 @using System.Reflection
3380 @using Dynamicweb.Rapido.Blocks.Components.Articles
3381 @using Dynamicweb.Rapido.Blocks.Components.General
3382
3383
3384 @* Component for the articles *@
3385
3386 @helper RenderArticleLink(ArticleLink settings)
3387 {
3388 if (!string.IsNullOrEmpty(settings.Title))
3389 {
3390 Button link = new Button {
3391 ConfirmText = settings.ConfirmText,
3392 ConfirmTitle = settings.ConfirmTitle,
3393 ButtonType = settings.ButtonType,
3394 Id = settings.Id,
3395 Title = settings.Title,
3396 AltText = settings.AltText,
3397 OnClick = settings.OnClick,
3398 CssClass = settings.CssClass,
3399 Disabled = settings.Disabled,
3400 Icon = settings.Icon,
3401 Name = settings.Name,
3402 Href = settings.Href,
3403 ButtonLayout = settings.ButtonLayout,
3404 ExtraAttributes = settings.ExtraAttributes
3405 };
3406 <div class="grid__cell">
3407 @Render(link)
3408 </div>
3409 }
3410 }
3411 @using System.Reflection
3412 @using Dynamicweb.Rapido.Blocks
3413 @using Dynamicweb.Rapido.Blocks.Components.Articles
3414 @using Dynamicweb.Rapido.Blocks.Components.General
3415
3416
3417 @* Component for the articles *@
3418
3419 @helper RenderArticleCarousel(ArticleCarousel settings)
3420 {
3421 <div class="grid">
3422 <div class="grid__col-12 u-no-padding u-margin-bottom">
3423 <div class="carousel" id="carousel_@settings.Id">
3424 <div class="carousel__container js-carousel-slides dw-mod">
3425 @RenderBlockList(settings.SubBlocks)
3426 </div>
3427 </div>
3428 </div>
3429 </div>
3430
3431 <script>
3432 document.addEventListener("DOMContentLoaded", function () {
3433 new CarouselModule("#carousel_@settings.Id", {
3434 slideTime: 0,
3435 dots: true
3436 });
3437 });
3438 </script>
3439 }
3440
3441 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)
3442 {
3443 string imageEngine = "/Admin/Public/GetImage.ashx?";
3444
3445 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;
3446 if (settings.ImageSettings != null)
3447 {
3448 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";
3449 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";
3450 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";
3451 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";
3452 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";
3453 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";
3454 }
3455 defaultImage += "&Image=" + settings.Image;
3456
3457 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">
3458 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">
3459 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>
3460 <div class="article-list__item-info">
3461 @if (settings.Stickers != null)
3462 {
3463 settings.Stickers.Position = StickersListPosition.Custom;
3464 @Render(settings.Stickers);
3465 }
3466
3467 <small class="u-margin-top--lg u-color-light">
3468 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3469 {
3470 <text>@Translate("Written")</text>
3471 }
3472 @if (!string.IsNullOrWhiteSpace(settings.Author))
3473 {
3474 <text>@Translate("by") @settings.Author</text>
3475 }
3476 @if (!string.IsNullOrWhiteSpace(settings.Date))
3477 {
3478 <text>@Translate("on") @settings.Date</text>
3479 }
3480 </small>
3481 </div>
3482
3483 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>
3484 </a>
3485 @if (settings.UseFilters == true)
3486 {
3487 <div class="background-image image-filter image-filter--darken dw-mod"></div>
3488 }
3489 </div>
3490 }
3491 @using System.Text.RegularExpressions
3492 @using Dynamicweb.Rapido.Blocks.Components
3493 @using Dynamicweb.Rapido.Blocks.Components.General
3494 @using Dynamicweb.Rapido.Blocks.Components.Articles
3495 @using Dynamicweb.Rapido.Blocks
3496
3497 @* Component for the articles *@
3498
3499 @helper RenderArticleVideo(ArticleVideo settings)
3500 {
3501 if (settings.Url != null)
3502 {
3503 //getting video ID from youtube URL
3504 string videoCode = settings.Url;
3505 Regex regex = new Regex(@".be\/(.[^?]*)");
3506 Match match = regex.Match(videoCode);
3507 string videoId = "";
3508 if (match.Success)
3509 {
3510 videoId = match.Groups[1].Value;
3511 }
3512 else
3513 {
3514 regex = new Regex(@"v=([^&]+)");
3515 match = regex.Match(videoCode);
3516 if (match.Success)
3517 {
3518 videoId = match.Groups[1].Value;
3519 }
3520 }
3521
3522 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;
3523
3524 <div class="video-wrapper">
3525 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>
3526 </div>
3527 }
3528 }
3529 @using System.Reflection
3530 @using Dynamicweb.Rapido.Blocks.Components
3531 @using Dynamicweb.Rapido.Blocks.Components.Articles
3532 @using Dynamicweb.Rapido.Blocks
3533
3534
3535 @functions{
3536 BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle");
3537 public class DF_ArticleParagraph : ComponentBase
3538 {
3539 public ItemViewModel ParagraphContent {get; set;}
3540 public int counter {get; set;}
3541 public string imageColumns {get; set;}
3542 public string imageLayout {get; set;}
3543 public string contentColumns {get; set;}
3544 }
3545
3546 }
3547
3548 @helper RenderDF_ArticleParagraph(DF_ArticleParagraph settings)
3549 {
3550 ItemViewModel paragraph = settings.ParagraphContent;
3551 int count = settings.counter;
3552 string imageColumns = settings.imageColumns;
3553 string imageLayout = settings.imageLayout;
3554 string contentColumns = settings.contentColumns;
3555
3556
3557
3558 string paragraphListHeading = "12";
3559 var contentPosition = paragraph.GetList("ContentPosition") != null ? paragraph.GetList("ContentPosition").SelectedValue : "";
3560 //content position
3561 // number 5 is a random one to make the first item greater than second one
3562 var contentCountTextDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 1 : 0;
3563 var contentCountImageDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 5 : 0;
3564 var contentCountTextDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 5 : 0;
3565 var contentCountImageDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 1 : 0;
3566
3567 var paragraphTextColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6";
3568 var paragraphImageColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6";
3569
3570
3571
3572 if (!paragraph.GetBoolean("RenderAsQuote"))
3573 {
3574 //string enableDropCap = Model.Item.GetString("EnableDropCap") != null ? Model.Item.GetList("EnableDropCap").SelectedValue.ToLower() : "default";
3575 //enableDropCap = enableDropCap == "default" && GetParentSettingsItem("EnableDropCap") != null ? GetParentSettingsItem("EnableDropCap").ToString().ToLower() : enableDropCap;
3576 string text = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : "";
3577
3578 //if (!String.IsNullOrEmpty(text) && enableDropCap == "true" && count == 0 && paragraph.GetString("Text").Substring(0, 3) == "<p>")
3579 //{
3580 // string firstLetter = paragraph.GetString("Text").Substring(3, 1);
3581 // text = paragraph.GetString("Text").Remove(3, 1);
3582 // text = text.Insert(3, "<span class=\"article__drop-cap\">" + firstLetter + "</span>");
3583 // }
3584
3585 if (!String.IsNullOrEmpty(paragraph.GetString("Heading")))
3586 {
3587 var hideHeading = paragraph.GetBoolean("HideHeading");
3588 var hideHeadingClass = hideHeading == true ? "u-hidden" : "";
3589
3590 Block articleParagraphHeader = new Block
3591 {
3592 Id = "ArticleParagraph" + count + "Heading",
3593 SortId = (count * 10),
3594 Component = new ArticleSubHeader { Title = paragraph.GetString("Heading") },
3595 Design = new Design
3596 {
3597 RenderType = RenderType.Column,
3598 Size = paragraphListHeading,
3599 CssClass = String.Format("u-color-light--bg u-padding--lg {0}", hideHeadingClass)
3600 }
3601 };
3602 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphHeader);
3603 }
3604
3605 if (paragraph.GetFile("Image") != null)
3606 {
3607 string imageTitle = !string.IsNullOrEmpty(paragraph.GetString("Heading")) ? paragraph.GetString("Heading") : "";
3608
3609 Block articleParagraphImage = new Block
3610 {
3611 Id = "ArticleParagraph" + count + "Image",
3612 SortId = (count * 10) + 2 + contentCountImageDecisionFirst + contentCountImageDecisionSecond,
3613 Design = new Design
3614 {
3615 RenderType = RenderType.Column,
3616 Size = paragraphImageColumn,
3617 CssClass = "u-color-light--bg u-padding--lg"
3618 }
3619 };
3620
3621 if (imageLayout == "banner")
3622 {
3623 ArticleBanner banner = new ArticleBanner
3624 {
3625 Image = new Image { Path = paragraph.GetFile("Image"), ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, Caption = paragraph.GetString("ImageCaption") },
3626 Heading = imageTitle,
3627 UseFilters = false
3628 };
3629 articleParagraphImage.Component = banner;
3630 }
3631 else
3632 {
3633 ArticleImage image = new ArticleImage
3634 {
3635 Image = new Image
3636 {
3637 Path = paragraph.GetFile("Image"),
3638 Title = imageTitle,
3639 ImageDefault = new ImageSettings { Height = 650, Width = 1300 },
3640 Caption = paragraph.GetString("ImageCaption")
3641 }
3642 };
3643 articleParagraphImage.Component = image;
3644 }
3645
3646 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphImage);
3647 }
3648
3649
3650 if (!String.IsNullOrEmpty(text))
3651 {
3652 Block articleParagraphText = new Block
3653 {
3654 Id = "ArticleParagraph" + count + "Text",
3655 SortId = (count * 10) + 3 + contentCountTextDecisionFirst + contentCountTextDecisionSecond,
3656 Component = new ArticleText { Text = text },
3657 Design = new Design
3658 {
3659 RenderType = RenderType.Column,
3660 Size = paragraphTextColumn,
3661 CssClass = "u-color-light--bg u-padding--lg"
3662 }
3663 };
3664
3665 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphText);
3666 }
3667
3668 if (!String.IsNullOrEmpty(paragraph.GetString("VideoURL")))
3669 {
3670 Block articleParagraphVideo = new Block
3671 {
3672 Id = "ArticleParagraph" + count + "Video",
3673 SortId = (count * 10) + 1,
3674 Component = new ArticleVideo { Url = paragraph.GetString("VideoURL"), AutoPlay = "false" },
3675 Design = new Design
3676 {
3677 RenderType = RenderType.Column,
3678 Size = imageColumns,
3679 CssClass = "u-color-light--bg u-padding--lg"
3680 }
3681 };
3682 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphVideo);
3683 }
3684 }
3685 else
3686 {
3687 if (!String.IsNullOrEmpty(paragraph.GetString("Text")))
3688 {
3689 string quoteText = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : "";
3690 string quoteAuthor = paragraph.GetString("Heading") != null ? paragraph.GetString("Heading") : "";
3691
3692 Block articleParagraphQuote = new Block
3693 {
3694 Id = "ArticleParagraph" + count + "Quote",
3695 SortId = (count * 10) + 3,
3696 Component = new ArticleQuote { Image = new Image { Path = paragraph.GetFile("Image") }, Text = quoteText, Author = quoteAuthor },
3697 Design = new Design
3698 {
3699 RenderType = RenderType.Column,
3700 Size = contentColumns,
3701 CssClass = "u-color-light--bg u-padding--lg"
3702 }
3703 };
3704 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphQuote);
3705 }
3706 }
3707
3708
3709 }
3710
3711 @using System.Reflection
3712 @using Dynamicweb.Rapido.Blocks.Components
3713 @using Dynamicweb.Rapido.Blocks.Components.Articles
3714 @using Dynamicweb.Rapido.Blocks
3715
3716 @functions{
3717 //BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle");
3718 public class DF_RelatedProducts : ComponentBase
3719 {
3720 public string Title {get; set;}
3721 public string Id {get; set;}
3722 public string FeedPageId {get; set;}
3723 public string Query {get; set;}
3724 public string CurrentPageId {get; set;}
3725 public string CurrentProductId {get; set;}
3726 public int PageSize {get; set;}
3727 public bool productManual {get; set;}
3728 }
3729 }
3730
3731 @helper RenderDF_RelatedProducts(DF_RelatedProducts settings)
3732 {
3733 <section class="multiple-paragraphs-container paragraph-container--full-width article--related-products">
3734 <div class="center-container dw-mod">
3735 <div class="grid u-padding">
3736 <div class="grid__col-md-12 grid__col-xs-12">
3737 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
3738 </div>
3739 </div>
3740 @if(settings.productManual == false) {
3741 <div class="js-handlebars-root false u-padding" id="@settings.Id" data-template="ProductContainer" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div>
3742 } else {
3743 <div class="js-handlebars-root true u-padding" id="@settings.Id" data-template="ProductContainer" data-json-feed="@settings.FeedPageId"></div>
3744 }
3745
3746 <script id="ProductContainer" type="text/x-template">
3747 {{#.}}
3748 <div class="u-min-h400px u-full-width">
3749 <div class="grid">
3750 {{#ifCond totalPages '>' 1}}
3751 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons prev">
3752 <div class="grid__cell grid__cell--align-middle-left">
3753 @{
3754 Button prevButton = new Button { Icon = new Icon { Prefix = "fas", Name = "fa-chevron-left fa-2x", LabelPosition = IconLabelPosition.After }, ButtonLayout = ButtonLayout.Clean, CssClass = "btn--condensed {{prevdisabled}} u-position-relative", OnClick = "HandlebarsBolt.UpdateContent('" + settings.Id + "', '{{prevPage}}')" };
3755 prevButton.ExtraAttributes.Add("", "{{prevdisabled}}");
3756 }
3757 @Render(prevButton)
3758 </div>
3759 </div>
3760 {{/ifCond}}
3761 <div class="grid__col-auto grid__col--bleed-x content-promotion__products">
3762 <div id="ProductsContainer" data-template="ProductGridItemContainer" class="grid product-list dw-mod" data-save-cookie="true">
3763 {{#ProductsContainer}}
3764 <div id="Product{{productId}}" class="grid__col-3 product-list__grid-item dw-mod">
3765 {{#Product}}
3766 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height" data-params="{{googleImpression}}">
3767 <div class="grid__cell product-list__grid-item__image dw-mod {{noImage}}">
3768 <a href="{{link}}"
3769 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}"
3770 class="u-block u-position-relative image-hover__wrapper dw-mod">
3771 @Render(new Image { Path = "{{image}}", ImageDefault = new ImageSettings { Width = 300, Height = 300, Crop = 5, FillCanvas = true, DoNotUpscale = true }, Title = "{{name}}", CssClass = "grid__cell-img grid__cell-img--centered u-min-h180px" })
3772 {{#StickersContainers}}
3773 {{>StickersContainer}}
3774 {{/StickersContainers}}
3775 </a>
3776
3777 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}>
3778 {{#Favorite}}
3779 {{>FavoriteTemplate}}
3780 {{/Favorite}}
3781 </div>
3782
3783 </div>
3784
3785 <div class="grid__cell product-list__grid-item__price-info dw-mod">
3786 <a href="{{link}}" onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" title="{{name}}" class="u-color-inherit">
3787 @Render(new Heading { Title = "{{name}}", Level = 6, CssClass = "u-condensed-text u-bold" })
3788 </a>
3789 @RenderGridViewPriceInfo()
3790 </div>
3791
3792 <div class="product-list__grid-item__footer dw-mod">
3793 @RenderProductGridItemAddToCart()
3794 </div>
3795 </div>
3796 {{/Product}}
3797 </div>
3798 {{/ProductsContainer}}
3799 </div>
3800 </div>
3801 {{#ifCond totalPages '>' 1}}
3802 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons next">
3803 <div class="grid__cell grid__cell--align-middle-right">
3804 @{
3805 Button nextButton = new Button { Icon = new Icon { Prefix = "fas", Name = "fa-chevron-right fa-2x", LabelPosition = IconLabelPosition.After }, ButtonLayout = ButtonLayout.Clean, CssClass = "btn--condensed {{nextdisabled}} u-position-relative", OnClick = "HandlebarsBolt.UpdateContent('" + settings.Id + "', '{{nextPage}}')" };
3806 nextButton.ExtraAttributes.Add("", "{{nextdisabled}}");
3807 }
3808 @Render(nextButton)
3809 </div>
3810 </div>
3811 {{/ifCond}}
3812 </div>
3813 </div>
3814 {{/.}}
3815 </script>
3816 <script id="StickersContainer" type="text/x-template">
3817 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod">
3818 {{#Stickers}}
3819 {{>Sticker}}
3820 {{/Stickers}}
3821 </div>
3822 </script>
3823
3824 <script id="Sticker" type="text/x-template">
3825 @Render(new Sticker { Title = "{{Title}}", CssClass = "{{CssClass}}" })
3826 </script>
3827
3828 <script>
3829 @{
3830 bool relatedUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
3831
3832 if (relatedUseGoogleTagManager)
3833 {
3834 <text>
3835 document.addEventListener("DOMContentLoaded", function (event) {
3836 Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) {
3837 let googleImpression = JSON.parse(elem.getAttribute("data-params"));
3838 googleImpression.list = "Related products";
3839 googleEnchantImpression(googleImpression);
3840 elem.classList.remove("js-product-scroll-trigger");
3841 });
3842 });
3843 </text>
3844 }
3845 }
3846 </script>
3847 </div>
3848 </section>
3849 }
3850
3851 @helper RenderGridViewPriceInfo()
3852 {
3853 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
3854 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice");
3855 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToCartButton");
3856 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT");
3857 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat;
3858
3859 if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
3860 {
3861 if (pointShopOnly)
3862 {
3863 <text>
3864 {{#if havePointPrice}}
3865 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div>
3866 @if (showCartButton)
3867 {
3868 <text>
3869 {{#unless canBePurchasedWithPoints}}
3870 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
3871 {{/unless}}
3872 </text>
3873 }
3874 {{else}}
3875 @Translate("Not available")
3876 {{/if}}
3877 </text>
3878 }
3879 else
3880 {
3881 <div class="price price--product-list dw-mod">{{price}}</div>
3882 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>
3883 if (showVATPrice)
3884 {
3885 <div class="vat-price vat-price--product-list u-margin-top dw-mod">
3886 @if (isPricesWithVATEnabled)
3887 {
3888 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span>
3889 }
3890 else
3891 {
3892 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span>
3893 }
3894 </div>
3895 }
3896 <text>
3897 {{#if priceRRP}}
3898 <div><small>@Translate("RRP") {{priceRRP}}</small></div>
3899 {{/if}}
3900 </text>
3901 }
3902 }
3903 }
3904
3905 @helper RenderProductGridItemAddToCart() {
3906 var gridViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView");
3907 var ecommerceSettings = Pageview.AreaSettings.GetItem("Ecommerce");
3908
3909 bool pointShopOnly = ecommerceSettings.GetBoolean("PointShopOnly");
3910 bool showCartButton = gridViewSettings.GetBoolean("ShowAddToCartButton");
3911 bool showViewButton = gridViewSettings.GetBoolean("ShowViewButton");
3912 string viewMoreText = gridViewSettings.GetString("ViewMoreText");
3913 viewMoreText = !string.IsNullOrEmpty(viewMoreText) ? viewMoreText : "View";
3914 string wrapperClass = "buttons-collection--center";
3915 int columnsCount = gridViewSettings.GetList("Columns") != null ? Converter.ToInt32(gridViewSettings.GetList("Columns").SelectedValue) : 4;
3916 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet";
3917
3918 if (pointShopOnly && columnsCount <= 4)
3919 {
3920 hideButtonText = false;
3921 }
3922
3923 var viewBtn = new Link
3924 {
3925 Href = "{{link}}",
3926 Id = "CartButton_{{id}}",
3927 Title = Translate(viewMoreText),
3928 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}",
3929 ButtonLayout = ButtonLayout.Secondary,
3930 CssClass = "u-no-margin"
3931 };
3932
3933 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
3934 {
3935 var addToCartBtn = new AddToCart
3936 {
3937 WrapperCssClass = wrapperClass,
3938 AddButton = new AddToCartButton
3939 {
3940 ProductId = "{{productId}}",
3941 VariantId = "{{variantid}}",
3942 UnitId = "{{unitId}}",
3943 ProductInfo = "{{productInfo}}",
3944 BuyForPoints = pointShopOnly,
3945 HideTitle = hideButtonText,
3946 OnClick = "{{facebookPixelAction}}",
3947 ExtraAttributes = new Dictionary<string, string>
3948 {
3949 { "{{disabledBuyButton}}", "" }
3950 }
3951 }
3952 };
3953
3954 if (!pointShopOnly)
3955 {
3956 addToCartBtn.QuantitySelector = new QuantitySelector
3957 {
3958 Id = "Quantity{{id}}"
3959 };
3960 }
3961
3962 if (showCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
3963 {
3964 if (!showViewButton)
3965 {
3966 @Render(addToCartBtn)
3967 }
3968 else
3969 {
3970 <text>{{#if hideAddToCartButton}}</text>
3971 <div>@Render(viewBtn)</div>
3972 <text>{{else}}</text>
3973 @Render(addToCartBtn)
3974 <text>{{/if}}</text>
3975 }
3976 }
3977 else if (showViewButton)
3978 {
3979 <div>@Render(viewBtn)</div>
3980 }
3981 }
3982 else if (showViewButton)
3983 {
3984 <div>@Render(viewBtn)</div>
3985 }
3986 }
3987
3988 @* Simple helpers *@
3989
3990 @*Requires the Gallery ItemType that comes with Rapido*@
3991 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {
3992 if (gallery != null && gallery.Count > 0)
3993 {
3994 int count = 1;
3995
3996 foreach (var item in gallery)
3997 {
3998 if (item.GetFile("ImagePath") != null)
3999 {
4000 string image = item.GetFile("ImagePath").PathUrlEncoded;
4001 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&height=820&crop=5&Compression=75&DoNotUpscale=1&image=";
4002 int imagesCount = gallery.Count;
4003
4004 if (count == 1)
4005 {
4006 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">
4007 <span class="gallery__main-image">
4008 <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=1&image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" />
4009 </span>
4010 <span class="gallery__image-counter">
4011 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>
4012 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>
4013 </span>
4014 </label>
4015 }
4016 else
4017 {
4018 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>
4019 }
4020
4021 count++;
4022 }
4023 }
4024
4025 @Render(new ArticleGalleryModal())
4026 }
4027 }
4028
4029 @helper RenderMobileFilters(List<Block> subBlocks)
4030 {
4031 if (subBlocks.Count > 0)
4032 {
4033 <div class="grid__col-12">
4034 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />
4035 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">
4036 @RenderBlockList(subBlocks)
4037 </div>
4038 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>
4039 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>
4040 </div>
4041 }
4042 }
4043
4044
4045 @* Include the Blocks for the page *@
4046 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
4047
4048 @using System
4049 @using System.Web
4050 @using System.Collections.Generic
4051 @using Dynamicweb.Rapido.Blocks.Extensibility
4052 @using Dynamicweb.Rapido.Blocks
4053
4054 @functions {
4055 string GoogleTagManagerID = "";
4056 string GoogleAnalyticsID = "";
4057 }
4058
4059 @{
4060 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");
4061 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID");
4062
4063 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
4064
4065 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID))
4066 {
4067 Block tagManager = new Block()
4068 {
4069 Id = "GoogleAnalytics",
4070 SortId = 0,
4071 Template = RenderGoogleAnalyticsSnippet()
4072 };
4073 topSnippetsBlocksPage.Add("Head", tagManager);
4074 }
4075
4076 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))
4077 {
4078 Block tagManager = new Block()
4079 {
4080 Id = "TagManager",
4081 SortId = 1,
4082 Template = RenderGoogleTagManager()
4083 };
4084 topSnippetsBlocksPage.Add("Head", tagManager);
4085
4086 Block tagManagerBodySnippet = new Block()
4087 {
4088 Id = "TagManagerBodySnippet",
4089 SortId = 1,
4090 Template = RenderGoogleTagManagerBodySnippet()
4091 };
4092 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet);
4093 }
4094
4095 Block facebookPixel = new Block()
4096 {
4097 Id = "FacebookPixel",
4098 SortId = 2,
4099 Template = RenderFacebookPixel()
4100 };
4101
4102 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);
4103 }
4104
4105 @helper RenderGoogleAnalyticsSnippet()
4106 {
4107 <!-- Global site tag (gtag.js) - Google Analytics -->
4108 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script>
4109 <script>
4110 window.dataLayer = window.dataLayer || [];
4111 function gtag(){dataLayer.push(arguments);}
4112 gtag('js', new Date());
4113
4114 gtag('config', '@GoogleAnalyticsID');
4115 </script>
4116
4117 }
4118
4119 @helper RenderGoogleTagManager()
4120 {
4121 <script>
4122 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
4123 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
4124 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
4125 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
4126 })(window,document,'script','dataLayer','@GoogleTagManagerID');
4127 </script>
4128
4129 @*google consent mode v2*@
4130 <script>
4131 window.dataLayer = window.dataLayer || [];
4132 function gtag(){dataLayer.push(arguments);}
4133
4134 gtag('consent', 'default', {
4135 'ad_storage': 'denied',
4136 'ad_user_data': 'denied',
4137 'ad_personalization': 'denied',
4138 'analytics_storage': 'denied',
4139 'functionality_storage': 'denied',
4140 'personalization_storage': 'denied',
4141 'security_storage': 'denied'
4142 });
4143 </script>
4144 }
4145
4146 @helper RenderGoogleTagManagerBodySnippet()
4147 {
4148 <!-- Google Tag Manager (noscript) -->
4149 <noscript>
4150 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"
4151 height="0" width="0" style="display:none;visibility:hidden"></iframe>
4152 </noscript>
4153 <!-- End Google Tag Manager (noscript) -->
4154 }
4155
4156 @helper RenderFacebookPixel()
4157 {
4158 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");
4159
4160 if (!string.IsNullOrWhiteSpace(FacebookPixelID))
4161 {
4162 <!-- Facebook Pixel Code -->
4163 <script>
4164 !function(f,b,e,v,n,t,s)
4165 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
4166 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
4167 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
4168 n.queue=[];t=b.createElement(e);t.async=!0;
4169 t.src=v;s=b.getElementsByTagName(e)[0];
4170 s.parentNode.insertBefore(t,s)}(window, document,'script',
4171 'https://connect.facebook.net/en_US/fbevents.js');
4172 fbq('init', '@FacebookPixelID');
4173 fbq('track', 'PageView');
4174 </script>
4175 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>
4176 }
4177 }
4178 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
4179
4180 @using System
4181 @using System.Web
4182 @using System.Collections.Generic
4183 @using Dynamicweb.Rapido.Blocks
4184 @using Dynamicweb.Rapido.Blocks.Extensibility
4185 @using Dynamicweb.Security.UserManagement
4186 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
4187 @using Dynamicweb.Rapido.Blocks.Components.General
4188
4189 @{
4190 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");
4191
4192 Block loginModal = new Block()
4193 {
4194 Id = "LoginModal",
4195 SortId = 10,
4196 Component = new Modal
4197 {
4198 Id = "SignIn",
4199 Heading = new Heading
4200 {
4201 Level = 0,
4202 Title = Translate("Sign in")
4203 },
4204 Width = ModalWidth.Sm,
4205 BodyTemplate = RenderLoginForm()
4206 }
4207 };
4208
4209 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);
4210 }
4211
4212 @helper RenderLoginForm()
4213 {
4214 int pageId = Model.TopPage.ID;
4215 string userSignedInErrorText = "";
4216 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4217 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
4218 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4219 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed;
4220 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4221 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
4222
4223 ProviderCollection providers = Provider.GetActiveProviders();
4224
4225 if (Model.LogOnFailed)
4226 {
4227 switch (Model.LogOnFailedReason)
4228 {
4229 case LogOnFailedReason.PasswordLengthInvalid:
4230 userSignedInErrorText = Translate("Password length is invalid");
4231 break;
4232 case LogOnFailedReason.IncorrectLogin:
4233 userSignedInErrorText = Translate("Invalid email or password");
4234 break;
4235 case LogOnFailedReason.ExceededFailedLogOnLimit:
4236 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
4237 break;
4238 case LogOnFailedReason.LoginLocked:
4239 userSignedInErrorText = Translate("The user account is temporarily locked");
4240 break;
4241 case LogOnFailedReason.PasswordExpired:
4242 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
4243 break;
4244 default:
4245 userSignedInErrorText = Translate("An unknown error occured");
4246 break;
4247 }
4248 }
4249
4250 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" };
4251
4252 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true };
4253
4254 if (!hideForgotPasswordLink) {
4255 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" };
4256 }
4257
4258 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) });
4259 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" });
4260 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" });
4261 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" });
4262 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true });
4263 form.Add(passwordField);
4264 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error });
4265 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") });
4266 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" });
4267
4268 foreach (Provider LoginProvider in providers)
4269 {
4270 var ProviderName = LoginProvider.Name.ToLower();
4271 form.Add(new Link {
4272 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID,
4273 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After },
4274 ButtonLayout = ButtonLayout.LinkClean,
4275 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName,
4276 AltText = ProviderName
4277 });
4278 }
4279
4280 if (!hideCreateAccountLink) {
4281 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" });
4282 form.Add(new Link
4283 {
4284 Href = "/Default.aspx?id=" + createAccountPageId,
4285 ButtonLayout = ButtonLayout.LinkClean,
4286 Title = Translate("Create account"),
4287 CssClass = "u-full-width u-ta-center"
4288 });
4289 }
4290
4291 @Render(form)
4292
4293 if (showModalOnStart)
4294 {
4295 <script>
4296 document.getElementById("SignInModalTrigger").checked = true;
4297 </script>
4298 }
4299 }
4300
4301 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
4302 {
4303 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4304
4305 @using System
4306 @using System.Web
4307 @using System.Collections.Generic
4308 @using Dynamicweb.Rapido.Blocks.Extensibility
4309 @using Dynamicweb.Rapido.Blocks
4310 @using Dynamicweb.Rapido.Services
4311
4312
4313 @functions {
4314 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
4315 }
4316
4317 @{
4318 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4319 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
4320 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed();
4321
4322 var totalNumberOfProductsForDefault = 0;
4323 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT7")))
4324 {
4325 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
4326 totalNumberOfProductsForDefault = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
4327 }
4328
4329 var totalNumberOfProductsForIngrasaminte = 0;
4330 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT5")))
4331 {
4332 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
4333 totalNumberOfProductsForIngrasaminte = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
4334 }
4335
4336 var totalNumberOfProductsForAllCarts = totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte;
4337
4338 Block mobileHeader = new Block()
4339 {
4340 Id = "MobileTop",
4341 SortId = 10,
4342 Template = RenderMobileTop(),
4343 SkipRenderBlocksList = true
4344 };
4345 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);
4346
4347 Block mobileHeaderNavigation = new Block()
4348 {
4349 Id = "MobileHeaderNavigation",
4350 SortId = 10,
4351 Template = RenderMobileHeaderNavigation(),
4352 SkipRenderBlocksList = true,
4353 BlocksList = new List<Block> {
4354 new Block {
4355 Id = "MobileHeaderNavigationTrigger",
4356 SortId = 10,
4357 Template = RenderMobileHeaderNavigationTrigger()
4358 }
4359 }
4360 };
4361 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);
4362
4363 Block mobileHeaderLogo = new Block()
4364 {
4365 Id = "MobileHeaderLogo",
4366 SortId = 20,
4367 Template = RenderMobileHeaderLogo(),
4368 SkipRenderBlocksList = true
4369 };
4370 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);
4371
4372 Block mobileHeaderActions = new Block()
4373 {
4374 Id = "MobileHeaderActions",
4375 SortId = 30,
4376 Template = RenderMobileTopActions(),
4377 SkipRenderBlocksList = true
4378 };
4379 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);
4380
4381 Block mobileHeaderSignIn = new Block()
4382 {
4383 Id = "MobileHeaderAccount",
4384 SortId = 70,
4385 Template = RenderMobileHeaderSignIn(),
4386 SkipRenderBlocksList = true
4387 };
4388 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderSignIn);
4389
4390
4391 Block mobileHeaderActions2 = new Block()
4392 {
4393 Id = "MobileHeaderActions2",
4394 SortId = 80,
4395 Template = RenderMobileTopActions2(),
4396 SkipRenderBlocksList = true
4397 };
4398 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions2);
4399
4400 if (!mobileHideSearch)
4401 {
4402 Block mobileHeaderSearch = new Block
4403 {
4404 Id = "MobileHeaderSearch",
4405 SortId = 10,
4406 Template = RenderMobileTopSearch()
4407 };
4408 mobileHeaderBlocksPage.Add("mobileHeaderActions2", mobileHeaderSearch);
4409 }
4410
4411 Block mobileHeaderMiniCart;
4412
4413 if (!mobileHideCart)
4414 {
4415 mobileHeaderMiniCart = new Block
4416 {
4417 Id = "MobileHeaderMiniCart",
4418 SortId = 20,
4419 Template = RenderMobileTopMiniCart(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte)
4420 };
4421
4422 Block miniCartCounterScriptTemplate = new Block
4423 {
4424 Id = "MiniCartCounterScriptTemplate",
4425 Template = RenderMobileMiniCartCounterContent()
4426 };
4427 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
4428 }
4429 else
4430 {
4431 mobileHeaderMiniCart = new Block
4432 {
4433 Id = "MobileHeaderMiniCart",
4434 SortId = 20
4435 };
4436 }
4437
4438 if (!mobileHideSearch)
4439 {
4440 Block mobileHeaderSearchBar = new Block()
4441 {
4442 Id = "MobileHeaderSearchBar",
4443 SortId = 30,
4444 Template = RenderMobileTopSearchBar()
4445 };
4446 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);
4447 }
4448
4449
4450
4451
4452
4453
4454
4455 switch (mobileTopLayout)
4456 {
4457 case "nav-left":
4458 mobileHeaderNavigation.SortId = 10;
4459 mobileHeaderLogo.SortId = 20;
4460 mobileHeaderActions.SortId = 30;
4461 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
4462 break;
4463 case "nav-right":
4464 mobileHeaderLogo.SortId = 10;
4465 mobileHeaderActions.SortId = 20;
4466 mobileHeaderNavigation.SortId = 30;
4467 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
4468 break;
4469 case "nav-search-left":
4470 mobileHeaderNavigation.SortId = 10;
4471 mobileHeaderLogo.SortId = 20;
4472 mobileHeaderActions.SortId = 30;
4473 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
4474 break;
4475 case "search-left":
4476 mobileHeaderActions.SortId = 10;
4477 mobileHeaderLogo.SortId = 20;
4478 mobileHeaderNavigation.SortId = 30;
4479 mobileHeaderMiniCart.SortId = 0;
4480 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
4481 break;
4482 }
4483 }
4484
4485
4486 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4487
4488 @using System
4489 @using System.Web
4490 @using Dynamicweb.Rapido.Blocks.Extensibility
4491 @using Dynamicweb.Rapido.Blocks
4492
4493 @{
4494 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
4495 }
4496
4497
4498
4499
4500 @helper RenderMobileTop() {
4501 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();
4502
4503 <nav class="main-navigation-mobile dw-mod">
4504 <div class="center-container top-container__center-container dw-mod">
4505 <div class="grid grid--align-center mobile__header-items">
4506 @RenderBlockList(subBlocks)
4507 </div>
4508 </div>
4509 </nav>
4510 }
4511
4512 @helper RenderMobileHeaderNavigation() {
4513 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();
4514
4515 <div class="grid__col-auto-width grid__col--bleed hamburger__item">
4516 <ul class="menu dw-mod u-flex u-flex--align-items-center">
4517
4518 @RenderBlockList(subBlocks)
4519
4520 </ul>
4521 </div>
4522 }
4523
4524 @helper RenderMobileHeaderNavigationTrigger() {
4525 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4526 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>
4527 </li>
4528 }
4529
4530 @helper RenderMobileHeaderLogo() {
4531 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();
4532
4533 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4534 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";
4535 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
4536 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");
4537
4538 string logoLink = Pageview.Area.CultureInfo.TwoLetterISOLanguageName;
4539 logoLink = logoLink == "en" ? "/en" : "/";
4540
4541 string mobileLogo = "/Files/Images/logo-dynamicweb.png";
4542 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)
4543 {
4544 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;
4545 }
4546
4547 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")
4548 {
4549 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&width=100&crop=5&Compression=75&image=" + mobileLogo;
4550 }
4551 else
4552 {
4553 mobileLogo = HttpUtility.UrlDecode(mobileLogo);
4554 }
4555
4556 <div class="grid__col-auto grid__col--bleed logo__item">
4557 <div class="grid__cell @centeredLogo">
4558 <a href="@logoLink" class="logo logo--mobile u-inline-block u-no-margin dw-mod">
4559 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />
4560 </a>
4561 </div>
4562
4563 @RenderBlockList(subBlocks)
4564 </div>
4565 }
4566
4567 @helper RenderMobileTopActions() {
4568 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();
4569
4570 <div class="grid__col-auto-width grid__col--bleed cart__item">
4571 @RenderLanguageSelectorMobile()
4572 <ul class="menu dw-mod">
4573 @RenderBlockList(subBlocks)
4574 </ul>
4575 </div>
4576 }
4577
4578 @helper RenderMobileTopActions2() {
4579 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions2").OrderBy(item => item.SortId).ToList();
4580
4581 <div class="grid__col-auto-width grid__col--bleed search__item u-hidden">
4582 <ul class="menu dw-mod">
4583 @RenderBlockList(subBlocks)
4584 </ul>
4585 </div>
4586 }
4587
4588 @helper RenderMobileHeaderSignIn() {
4589 <div class="menu-mobile__item grid__col--bleed account__item">
4590 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i></label>
4591 </div>
4592 }
4593
4594
4595
4596 @helper RenderMobileTopSearch() {
4597 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4598 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4599 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
4600 </label>
4601 </li>
4602 }
4603
4604 @helper RenderMobileTopMiniCart(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) {
4605 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed");
4606 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
4607 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId;
4608
4609 string cartProductsCount = (totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte).ToString();
4610
4611 int cartPageId = GetPageIdByNavigationTag("CartPage");
4612 int cartPageIngrasaminteId = GetPageIdByNavigationTag("CartPageIngrasaminte");
4613
4614 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
4615 <div class="mini-cart dw-mod">
4616 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button" data-cartpage-ingrasaminte="@cartPageIngrasaminteId" data-cartpage-regular="@cartPageId" data-order-context="@cartProductsCount">
4617 <div id="minicart_icon" class="u-inline u-position-relative" data-miniCartFeedId="@miniCartFeedDefaultPageId" data-miniCartFeed-IngrasaminteId="@miniCartFeedIngrasamintePageId" data-miniCart-ContextId="@miniCartFeedSelectedPageId">
4618 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>
4619 <div class="mini-cart__counter dw-mod">
4620 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=Counter" data-init-onload="false" data-preloader="false">
4621 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">
4622 @cartProductsCount
4623 </div>
4624 </div>
4625 </div>
4626 </div>
4627 </a>
4628 </div>
4629 </li>
4630 }
4631
4632 @helper RenderMobileTopSearchBar()
4633 {
4634 string searchFeedId = "";
4635 string searchSecondFeedId = "";
4636 int groupsFeedId;
4637 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
4638 // string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
4639 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults").ToString();
4640 string resultPageLink;
4641 string searchPlaceholder;
4642 string searchType = "product-search";
4643 string searchTemplate;
4644 string searchContentTemplate = "";
4645 string searchValue = HttpContext.Current.Request.QueryString.Get("q") ?? "";
4646 bool showGroups = true;
4647
4648 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")
4649 {
4650 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4651 resultPageLink = contentSearchPageLink;
4652 searchPlaceholder = Translate("Search page");
4653 groupsFeedId = 0;
4654 searchType = "content-search";
4655 searchTemplate = "SearchPagesTemplate";
4656 showGroups = false;
4657 }
4658 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")
4659 {
4660 searchFeedId = productsPageId + "&feed=true";
4661 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4662 resultPageLink = Converter.ToString(productsPageId);
4663 searchPlaceholder = Translate("Search products or pages");
4664 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4665 searchType = "combined-search";
4666 searchTemplate = "SearchProductsTemplateWrap";
4667 searchContentTemplate = "SearchPagesTemplateWrap";
4668 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4669 }
4670 else
4671 {
4672 resultPageLink = Converter.ToString(productsPageId);
4673 searchFeedId = productsPageId + "&feed=true";
4674 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4675 searchPlaceholder = Translate("Search products");
4676 searchTemplate = "SearchProductsTemplate";
4677 searchType = "product-search";
4678 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4679 }
4680
4681 @*<input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />*@
4682
4683 <div class="main-navigation-mobile typeahead-mobile dw-mod">
4684 <div class="center-container top-container__center-container dw-mod">
4685 <div class="grid">
4686 <div class="u-full-width u-margin-bottom--lg">
4687 <div class="typeahead-mobile__search-field dw-mod js-typeahead u-border u-padding-x" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType" data-search-parameter-name="q">
4688 <input name="q" type="text" class="js-typeahead-search-field u-w160px u-no-margin u-no-border" placeholder="@searchPlaceholder" value="@searchValue">
4689 @if (string.IsNullOrEmpty(searchSecondFeedId))
4690 {
4691 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>
4692 }
4693 else
4694 {
4695 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">
4696 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div>
4697 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div>
4698 </div>
4699 }
4700 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" aria-label="product search"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button>
4701 </div>
4702 </div>
4703 <!-- <div class="grid__col-auto-width close__button">
4704 <ul class="menu dw-mod">
4705 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4706 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4707 <i class="fas fa-times fa-1_5x"></i>
4708 </label>
4709 </li>
4710 </ul>
4711 </div> -->
4712 </div>
4713 </div>
4714 </div>
4715 }
4716
4717 @helper RenderMobileMiniCartCounterContent()
4718 {
4719 <script id="MiniCartCounterContent" type="text/x-template">
4720 {{#.}}
4721 <div class="js-mini-cart-counter-content dw-mod" data-count="{{totalnumberofproductsforallcarts}}">
4722 {{totalnumberofproductsforallcarts}}
4723 </div>
4724 {{/.}}
4725 </script>
4726 }
4727
4728
4729 @helper RenderCheckCartModal(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) {
4730 int cartRegularProductsCount = Converter.ToInt32(Model.Cart.TotalProductsCount);
4731 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
4732 string cartIngrasamintePageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPageIngrasaminte");
4733 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4734
4735 <div class="check-cart__wrapper u-hidden">
4736
4737 <label for="Check_Cart" class="dw-mod">
4738 <button class="u-no-margin u-margin-top--lg btn btn--primary dw-mod" style="pointer-events: none;">@Translate("Selecteaza Cosul")</button>
4739 </label>
4740 <!-- Trigger for the login modal -->
4741 <input type="checkbox" id="Check_Cart" class="modal-trigger"/>
4742 </div>
4743 <!-- Add address modal -->
4744 <div class="modal-container">
4745 <label for="Check_Cart" id="CheckCartModalOverlay" class="modal-overlay"></label>
4746 <div class="modal modal--md" id="CheckCartModal">
4747 <div class="modal__header no-border">
4748 <button type="button" class="close btn btn--primary dw-mod u-margin-top--lg" aria-label="select cart"><i class="fas fa-times"></i></button>
4749 <h2 class="u-ta-center">@Translate("Selecteaza Cosul")</h2>
4750 </div>
4751 <div class="modal__body">
4752 <div class="mini-cart-dropdown__body u-flex dw-mod">
4753 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="MiniCartContentMobile" data-template="MiniCartContentMobileTemplate" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart"></div>
4754 </div>
4755 </div>
4756 </div>
4757 </div>
4758
4759 <script id="MiniCartContentMobileTemplate" type="text/x-template">
4760 {{#.}}
4761 <div class="form__field-group--bordered" style="padding:1rem;">
4762 <div class="container__cart-type">
4763 <div class="radio">
4764 <div>
4765 <input id="cart1" name="radio-2" value="" type="radio" checked>
4766 <label for="cart1" class="radio-label">Cosul Ingrasaminte:</label>
4767 </div>
4768 <div class="radio__item">
4769 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#073E79; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsforingrasamintecart}}</span></div>
4770 <div><button type="button" title="Goleste cosul" class="u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, 'ORDERCONTEXT5');" aria-label="empty cart"><i class="fas fa-trash-alt" alt="goleste cosul"></i></button></div>
4771 </div>
4772 </div>
4773 <div class="radio">
4774 <div>
4775 <input id="cart2" name="radio-2" value="" type="radio">
4776 <label for="cart2" class="radio-label">Cosul cu restul produselor:</label>
4777 </div>
4778 <div class="radio__item">
4779 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#073E79; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsfordefaultcart}}</span></div>
4780 <div><button type="button" title="Goleste cosul" class="u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, 'ORDERCONTEXT7');" aria-label="empty cart"><i class="fas fa-trash-alt" alt="goleste cosul"></i></button></div>
4781 </div>
4782 </div>
4783 </div>
4784 <a id="go_to_cart" href="" class="u-full-width u-no-margin u-margin-top--lg btn btn--primary dw-mod">@Translate("Vezi cosul")</a>
4785 </div>
4786 {{/.}}
4787 </script>
4788
4789 }
4790
4791
4792
4793 @helper RenderLanguageSelectorMobile() {
4794 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
4795 Uri url = Dynamicweb.Context.Current.Request.Url;
4796 string hostName = url.Host;
4797
4798
4799 if (Pageview.Area.IsMaster)
4800 {
4801 languages.Add(Pageview.Page);
4802 if (Pageview.Page.Languages != null)
4803 {
4804 foreach (var language in Pageview.Page.Languages)
4805 {
4806 languages.Add(language);
4807 }
4808 }
4809 }
4810 else
4811 {
4812 languages.Add(Pageview.Page.MasterPage);
4813 if (Pageview.Page.MasterPage != null)
4814 {
4815 if (Pageview.Page.MasterPage.Languages != null)
4816 {
4817 foreach (var language in Pageview.Page.MasterPage.Languages)
4818 {
4819 languages.Add(language);
4820 }
4821 }
4822 }
4823 }
4824
4825 foreach (var language in languages)
4826 {
4827 if (language?.Area != null)
4828 {
4829 if (language != null && language.Area.Active && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
4830 {
4831 if (!string.IsNullOrEmpty(language.Area.DomainLock))
4832 {
4833 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
4834 }
4835 string querystring = $"Default.aspx?ID={language.ID}";
4836
4837 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
4838 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
4839 string defaultUrl = $"{url.Scheme}://{hostName}";
4840
4841
4842 <span class="language-selector-header" style="position:relative; top: -2px; right: 3px;">
4843 @if(language.Area.CultureInfo.Name.ToLower() == "en-gb") {
4844 <a href ="@href">EN</a>
4845 }
4846 else if(language.Area.CultureInfo.Name.ToLower() == "ro-ro") {
4847 <a href="@href">RO</a>
4848 }
4849
4850 </span>
4851 }
4852 }
4853 }
4854 }</text>
4855 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4856
4857 @using System
4858 @using System.Web
4859 @using System.Collections.Generic
4860 @using Dynamicweb.Rapido.Blocks.Extensibility
4861 @using Dynamicweb.Rapido.Blocks
4862
4863 @functions {
4864 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");
4865 }
4866
4867 @{
4868 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4869 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4870 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4871 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4872 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4873 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4874
4875 Block mobileNavigation = new Block()
4876 {
4877 Id = "MobileNavigation",
4878 SortId = 10,
4879 Template = MobileNavigation(),
4880 SkipRenderBlocksList = true
4881 };
4882 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);
4883
4884 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)
4885 {
4886 Block mobileNavigationSignIn = new Block
4887 {
4888 Id = "MobileNavigationSignIn",
4889 SortId = 10,
4890 Template = RenderMobileNavigationSignIn()
4891 };
4892 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);
4893 }
4894
4895 Block mobileNavigationMenu = new Block
4896 {
4897 Id = "MobileNavigationMenu",
4898 SortId = 20,
4899 Template = RenderMobileNavigationMenu()
4900 };
4901 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
4902
4903 Block mobileNavigationActions = new Block
4904 {
4905 Id = "MobileNavigationActions",
4906 SortId = 30,
4907 Template = RenderMobileNavigationActions(),
4908 SkipRenderBlocksList = true
4909 };
4910 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
4911
4912 if (!mobileNavigationItemsHideSignIn)
4913 {
4914 if (Model.CurrentUser.ID <= 0)
4915 {
4916 Block mobileNavigationSignInAction = new Block
4917 {
4918 Id = "MobileNavigationSignInAction",
4919 SortId = 10,
4920 Template = RenderMobileNavigationSignInAction()
4921 };
4922 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);
4923
4924 if (!mobileHideCreateAccountLink)
4925 {
4926 Block mobileNavigationCreateAccountAction = new Block
4927 {
4928 Id = "MobileNavigationCreateAccountAction",
4929 SortId = 20,
4930 Template = RenderMobileNavigationCreateAccountAction()
4931 };
4932 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);
4933 }
4934 }
4935 else
4936 {
4937 if (!mobileHideMyOrdersLink)
4938 {
4939 Block mobileNavigationOrdersAction = new Block
4940 {
4941 Id = "MobileNavigationOrdersAction",
4942 SortId = 20,
4943 Template = RenderMobileNavigationOrdersAction()
4944 };
4945 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);
4946 }
4947 if (!mobileHideMyFavoritesLink)
4948 {
4949 Block mobileNavigationFavoritesAction = new Block
4950 {
4951 Id = "MobileNavigationFavoritesAction",
4952 SortId = 30,
4953 Template = RenderMobileNavigationFavoritesAction()
4954 };
4955 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);
4956 }
4957 if (!mobileHideMySavedCardsLink)
4958 {
4959 Block mobileNavigationSavedCardsAction = new Block
4960 {
4961 Id = "MobileNavigationFavoritesAction",
4962 SortId = 30,
4963 Template = RenderMobileNavigationSavedCardsAction()
4964 };
4965 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);
4966 }
4967
4968 Block mobileNavigationSignOutAction = new Block
4969 {
4970 Id = "MobileNavigationSignOutAction",
4971 SortId = 40,
4972 Template = RenderMobileNavigationSignOutAction()
4973 };
4974 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);
4975 }
4976 }
4977
4978 if (Model.Languages.Count > 1)
4979 {
4980 Block mobileNavigationLanguagesAction = new Block
4981 {
4982 Id = "MobileNavigationLanguagesAction",
4983 SortId = 50,
4984 Template = RenderMobileNavigationLanguagesAction()
4985 };
4986 //mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);
4987 }
4988 }
4989
4990
4991 @helper MobileNavigation()
4992 {
4993 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();
4994 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4995 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";
4996 int toolsPage = GetPageIdByNavigationTag("ToolsNavigationTag");
4997
4998 var navigationSettings = new NavigationSettings();
4999 navigationSettings.StartLevel = 1;
5000 navigationSettings.StopLevel = 3;
5001 navigationSettings.ExpandMode = ExpandMode.All;
5002 navigationSettings.RootPageId = toolsPage;
5003
5004 bool isHomepage = GetPageIdByNavigationTag("homepage") == Pageview.ID ? true : false;
5005
5006 <!-- Trigger for mobile navigation -->
5007 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />
5008
5009 <!-- Mobile navigation -->
5010 <nav class="mobile-navigation mobile-navigation--@position dw-mod">
5011 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">
5012 <div class="agricover-corporate-mobile-navigation">
5013 <ul class="u-no-margin dw-mod">
5014 <li class="menu-left__item dw-mod">
5015 <a class="menu-left__link @(isHomepage ? "active" : "") dw-mod" href="/" title="@Translate("Homepage")">@Translate("Homepage")</a>
5016 </li>
5017 </ul>
5018 @Navigation.RenderNavigation("../Navigation/LeftNavigationExpandableMobile.cshtml", navigationSettings)
5019 @* <div class="mobile-search-tools-bar">@RenderMobileTopSearchBar()</div> *@
5020 </div>
5021 @RenderBlockList(subBlocks)
5022 </div>
5023 </nav>
5024
5025 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>
5026 }
5027
5028 @helper RenderMobileNavigationSignIn()
5029 {
5030 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5031 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
5032 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5033 string myProfilePageLink = linkStart + myProfilePageId;
5034 string userName = Model.CurrentUser.FirstName ?? "";
5035 userName += " " + (Model.CurrentUser.LastName ?? "");
5036 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : "";
5037
5038 <ul class="menu menu-mobile">
5039 <li class="menu-mobile__item">
5040 <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a>
5041 </li>
5042 </ul>
5043 }
5044
5045 @helper RenderMobileNavigationMenu()
5046 {
5047 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
5048 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";
5049 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";
5050 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
5051 int startLevel = 0; //renderPagesInToolBar ? 1 : 0;
5052
5053 @RenderNavigation(new
5054 {
5055 id = "mobilenavigation",
5056 cssclass = "menu menu-mobile dwnavigation",
5057 startLevel = @startLevel,
5058 ecomStartLevel = @startLevel + 1,
5059 endlevel = @levels,
5060 expandmode = "all",
5061 template = @menuTemplate
5062 })
5063
5064 if (isSlidesDesign)
5065 {
5066 <script>
5067 function goToLevel(level) {
5068 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";
5069 }
5070
5071 document.addEventListener('DOMContentLoaded', function () {
5072 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);
5073 });
5074 </script>
5075 }
5076
5077 @* if (renderPagesInToolBar)
5078 {
5079 @RenderNavigation(new
5080 {
5081 id = "topToolsMobileNavigation",
5082 cssclass = "menu menu-mobile dwnavigation",
5083 template = "ToolsMenuForMobile.xslt"
5084 })
5085 } *@
5086 }
5087
5088 @helper RenderMobileNavigationActions()
5089 {
5090 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;
5091
5092 <ul class="menu menu-mobile">
5093 @RenderBlockList(subBlocks)
5094 </ul>
5095 }
5096
5097 @helper RenderMobileNavigationSignInAction()
5098 {
5099 <li class="menu-mobile__item">
5100 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label>
5101 </li>
5102 }
5103
5104 @helper RenderMobileNavigationCreateAccountAction()
5105 {
5106 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
5107
5108 <li class="menu-mobile__item">
5109 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a>
5110 </li>
5111 }
5112
5113 @helper RenderMobileNavigationProfileAction()
5114 {
5115 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5116 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5117 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
5118 string myProfilePageLink = linkStart + myProfilePageId;
5119
5120 <li class="menu-mobile__item">
5121 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a>
5122 </li>
5123 }
5124
5125 @helper RenderMobileNavigationOrdersAction()
5126 {
5127 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5128 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5129 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
5130 string myOrdersPageLink = linkStart + myOrdersPageId;
5131 string ordersIcon = "fas fa-list";
5132
5133 <li class="menu-mobile__item">
5134 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("My Orders")</a>
5135 </li>
5136 }
5137
5138 @helper RenderMobileNavigationFavoritesAction()
5139 {
5140 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5141 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5142 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5143 string myFavoritesPageLink = linkStart + myFavoritesPageId;
5144 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star";
5145
5146
5147 <li class="menu-mobile__item">
5148 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a>
5149 </li>
5150 }
5151
5152 @helper RenderMobileNavigationSavedCardsAction()
5153 {
5154 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5155 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5156 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
5157 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
5158 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card";
5159
5160 <li class="menu-mobile__item">
5161 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a>
5162 </li>
5163 }
5164
5165 @helper RenderMobileNavigationSignOutAction()
5166 {
5167 int pageId = Model.TopPage.ID;
5168 string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt";
5169
5170 <li class="menu-mobile__item">
5171 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a>
5172 </li>
5173 }
5174
5175 @helper RenderMobileNavigationLanguagesAction()
5176 {
5177 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
5178
5179 string selectedLanguage = "";
5180 foreach (var lang in Model.Languages)
5181 {
5182 if (lang.IsCurrent)
5183 {
5184 selectedLanguage = lang.Name;
5185 }
5186 }
5187
5188 <li class="menu-mobile__item dw-mod">
5189 @if (isSlidesDesign)
5190 {
5191 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">
5192 }
5193 else
5194 {
5195 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">
5196 }
5197 <div class="menu-mobile__link__wrap">
5198 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label>
5199 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>
5200 </div>
5201 <ul class="menu-mobile menu-mobile__submenu expand-menu">
5202 @if (isSlidesDesign)
5203 {
5204 <li class="menu-mobile__item dw-mod">
5205 <div class="menu-mobile__link__wrap">
5206 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />
5207 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>
5208 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>
5209 </div>
5210 </li>
5211 }
5212 @foreach (var lang in Model.Languages)
5213 {
5214 <li class="menu-mobile__item dw-mod">
5215 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a>
5216 </li>
5217 }
5218 </ul>
5219 </li>
5220 }</text>
5221 }
5222 else
5223 {
5224 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5225
5226 @using System
5227 @using System.Web
5228 @using System.Collections.Generic
5229 @using Dynamicweb.Rapido.Blocks.Extensibility
5230 @using Dynamicweb.Rapido.Blocks
5231
5232 @functions {
5233 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");
5234 }
5235
5236 @{
5237 Block masterTools = new Block()
5238 {
5239 Id = "MasterDesktopTools",
5240 SortId = 10,
5241 Template = RenderDesktopTools(),
5242 SkipRenderBlocksList = true,
5243 BlocksList = new List<Block>
5244 {
5245 new Block {
5246 Id = "MasterDesktopToolsText",
5247 SortId = 10,
5248 Template = RenderDesktopToolsText(),
5249 Design = new Design
5250 {
5251 Size = "auto",
5252 HidePadding = true,
5253 RenderType = RenderType.Column
5254 }
5255 },
5256 new Block {
5257 Id = "MasterDesktopToolsNavigation",
5258 SortId = 20,
5259 Template = RenderDesktopToolsNavigation(),
5260 Design = new Design
5261 {
5262 Size = "auto-width",
5263 HidePadding = true,
5264 RenderType = RenderType.Column
5265 }
5266 }
5267 }
5268 };
5269 headerBlocksPage.Add("MasterHeader", masterTools);
5270
5271 Block masterDesktopExtra = new Block()
5272 {
5273 Id = "MasterDesktopExtra",
5274 SortId = 10,
5275 Template = RenderDesktopExtra(),
5276 SkipRenderBlocksList = true
5277 };
5278 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);
5279
5280 Block masterDesktopNavigation = new Block()
5281 {
5282 Id = "MasterDesktopNavigation",
5283 SortId = 20,
5284 Template = RenderDesktopNavigation(),
5285 SkipRenderBlocksList = true
5286 };
5287 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);
5288 }
5289
5290 @* Include the Blocks for the page *@
5291 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5292
5293 @using System
5294 @using System.Web
5295 @using Dynamicweb.Rapido.Blocks.Extensibility
5296 @using Dynamicweb.Rapido.Blocks
5297
5298 @{
5299 Block masterDesktopLogo = new Block
5300 {
5301 Id = "MasterDesktopLogo",
5302 SortId = 10,
5303 Template = RenderDesktopLogo(),
5304 Design = new Design
5305 {
5306 Size = "auto-width",
5307 HidePadding = true,
5308 RenderType = RenderType.Column,
5309 CssClass = "grid--align-self-center"
5310 }
5311 };
5312
5313 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);
5314 }
5315
5316
5317 @helper RenderDesktopLogo()
5318 {
5319 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
5320 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5321 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";
5322 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass;
5323 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
5324 string logoLink = Pageview.Area.CultureInfo.TwoLetterISOLanguageName;
5325 logoLink = logoLink == "en" ? "/en" : "/";
5326
5327 if (Path.GetExtension(logo).ToLower() != ".svg")
5328 {
5329 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
5330 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
5331 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logo;
5332 }
5333 else
5334 {
5335 logo = HttpUtility.UrlDecode(logo);
5336 }
5337
5338 <div class="logo @alignClass dw-mod">
5339 <a href="@logoLink" class="logo__img dw-mod u-block">
5340 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />
5341 </a>
5342 </div>
5343 }
5344 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5345
5346 @using Dynamicweb.Frontend.Navigation
5347 @using System
5348 @using System.Web
5349 @using Dynamicweb.Rapido.Blocks.Extensibility
5350 @using Dynamicweb.Rapido.Blocks
5351
5352 @functions {
5353 bool isMegaMenu;
5354 }
5355
5356 @{
5357 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;
5358 Block masterDesktopMenu = new Block
5359 {
5360 Id = "MasterDesktopMenu",
5361 SortId = 10,
5362 Template = RenderDesktopMenu(),
5363 Design = new Design
5364 {
5365 Size = "auto",
5366 HidePadding = true,
5367 RenderType = RenderType.Column
5368 }
5369 };
5370
5371 if (isMegaMenu)
5372 {
5373 masterDesktopMenu.Design.CssClass = "u-reset-position";
5374 }
5375
5376 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);
5377 }
5378
5379 @helper RenderDesktopMenu()
5380 {
5381 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5382 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";
5383 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout;
5384 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";
5385 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
5386 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
5387 int startLevel = renderPagesInToolBar ? 1 : 0;
5388 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
5389 string isHomepage = Model.Area.FirstPage.ID == Model.ID ? "true" : "false";
5390 int productPage = GetPageIdByNavigationTag("ProductsPage");
5391 int toolsPage = GetPageIdByNavigationTag("ToolsNavigationTag");
5392
5393 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">
5394 @if (!isMegaMenu)
5395 {
5396
5397 var navigationSettings = new NavigationSettings();
5398 navigationSettings.StartLevel = 1;
5399 navigationSettings.StopLevel = 3;
5400 navigationSettings.ExpandMode = ExpandMode.All;
5401 navigationSettings.RootPageId = toolsPage;
5402 navigationSettings.ExpandMode = Dynamicweb.Frontend.Navigation.ExpandMode.All;
5403
5404 <div>
5405 @Navigation.RenderNavigation("../Navigation/LeftNavigationExpandable.cshtml", navigationSettings)
5406
5407 </div>
5408 int navigationCustomMenuId = GetPageIdByNavigationTag("MainCustomMenu");
5409
5410 }
5411 else
5412 {
5413 @RenderNavigation(new
5414 {
5415 id = "topnavigation",
5416 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
5417 startLevel = startLevel,
5418 ecomStartLevel = startLevel + 1,
5419 endlevel = 5,
5420 promotionImage = megamenuPromotionImage,
5421 promotionLink = promotionLink,
5422 expandmode = "all",
5423 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),
5424 template = "BaseMegaMenu.xslt",
5425 isHomepage = isHomepage,
5426 productsPage = productPage,
5427 parenttag = "toolsMenu"
5428 });
5429 }
5430 </div>
5431 }
5432 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5433
5434 @using System
5435 @using System.Web
5436 @using Dynamicweb.Rapido.Blocks.Extensibility
5437 @using Dynamicweb.Rapido.Blocks
5438
5439 @{
5440 Block masterDesktopActionsMenu = new Block
5441 {
5442 Id = "MasterDesktopActionsMenu",
5443 SortId = 10,
5444 Template = RenderDesktopActionsMenu(),
5445 Design = new Design
5446 {
5447 CssClass = "u-flex"
5448 },
5449 SkipRenderBlocksList = true
5450
5451 };
5452 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);
5453
5454 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))
5455 {
5456 Block masterDesktopActionsHeaderButton = new Block
5457 {
5458 Id = "MasterDesktopActionsHeaderButton",
5459 SortId = 10,
5460 Template = RenderHeaderButton()
5461 };
5462 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);
5463 }
5464 }
5465
5466 @helper RenderDesktopActionsMenu()
5467 {
5468 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();
5469
5470 <ul class="menu u-flex dw-mod">
5471 @RenderBlockList(subBlocks)
5472 </ul>
5473 }
5474
5475 @helper RenderHeaderButton()
5476 {
5477 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");
5478 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");
5479 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";
5480
5481 <li class="menu__item menu__item--horizontal menu--clean dw-mod">
5482 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left header__buton" href="@headerButtonLink"><span class="header__buton-icon"><i class="fas fa-envelope-open"></i></span>@headerButtonText</a>
5483 </li>
5484 }
5485 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5486
5487 @using System
5488 @using System.Web
5489 @using Dynamicweb.Core;
5490 @using System.Text.RegularExpressions
5491 @using Dynamicweb.Rapido.Blocks.Extensibility
5492 @using Dynamicweb.Rapido.Blocks
5493
5494 @{
5495 Block masterDesktopActionsMenuLanguageSelector = new Block
5496 {
5497 Id = "MasterDesktopActionsMenuLanguageSelector",
5498 SortId = 40,
5499 Template = RenderLanguageSelector()
5500 };
5501
5502 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);
5503 }
5504
5505 @helper RenderLanguageSelector()
5506 {
5507 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5508 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5509 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5510 string languageViewType = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : "";
5511
5512 if (Model.Languages.Count > 1)
5513 {
5514 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
5515 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">
5516 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
5517 </div>
5518 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
5519 @foreach (var lang in Model.Languages)
5520 {
5521 string widthClass = "menu__item--fixed-width";
5522 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;
5523 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
5524 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
5525
5526 if (languageViewType == "flag-culture")
5527 {
5528 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;
5529 }
5530
5531 if (languageViewType == "flag")
5532 {
5533 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";
5534 widthClass = "";
5535 }
5536
5537 if (languageViewType == "name")
5538 {
5539 langInfo = lang.Name;
5540 }
5541
5542 if (languageViewType == "culture")
5543 {
5544 langInfo = cultureName;
5545 widthClass = "";
5546 }
5547
5548 <div class="menu__item dw-mod @widthClass">
5549 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
5550 </div>
5551 }
5552 </div>
5553 </li>
5554 }
5555 }
5556 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5557
5558 @using System
5559 @using System.Web
5560 @using Dynamicweb.Rapido.Blocks.Extensibility
5561 @using Dynamicweb.Rapido.Blocks
5562
5563 @{
5564 Block masterDesktopActionsMenuSignIn = new Block
5565 {
5566 Id = "MasterDesktopActionsMenuSignIn",
5567 SortId = 20,
5568 Template = RenderSignIn()
5569 };
5570
5571 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);
5572 }
5573
5574 @helper RenderSignIn()
5575 {
5576 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
5577 string userInitials = "";
5578 int pageId = Model.TopPage.ID;
5579 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
5580 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
5581 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
5582 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
5583 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5584 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
5585 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft");
5586 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5587 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
5588 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
5589 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
5590 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
5591 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts");
5592 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
5593 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
5594
5595 string linkStart = "/Default.aspx?ID=";
5596 if (Model.CurrentUser.ID <= 0)
5597 {
5598 linkStart += signInProfilePageId + "&RedirectPageId=";
5599 }
5600
5601 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
5602 string myProfilePageLink = linkStart + myProfilePageId;
5603 string myOrdersPageLink = linkStart + myOrdersPageId;
5604 string myFavoritesPageLink = linkStart + myFavoritesPageId;
5605 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
5606 string myOrderDraftsLink = linkStart + myOrderDraftsPageId;
5607
5608 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
5609 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star";
5610 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
5611
5612 if (Model.CurrentUser.ID != 0)
5613 {
5614 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);
5615 }
5616
5617 if (!navigationItemsHideSignIn)
5618 {
5619 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5620 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
5621 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5622
5623 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod sign_in_element">
5624 <div class="@menuLinkClass dw-mod">
5625 @if (Model.CurrentUser.ID <= 0)
5626 {
5627 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
5628 }
5629 else
5630 {
5631 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
5632 }
5633 </div>
5634 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
5635 <ul class="list list--clean dw-mod">
5636 @if (Model.CurrentUser.ID <= 0)
5637 {
5638 <li>
5639 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>
5640 </li>
5641
5642 if (!hideCreateAccountLink)
5643 {
5644 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
5645 }
5646 if (!hideForgotPasswordLink)
5647 {
5648 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
5649 }
5650 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5651 {
5652 @RenderSeparator()
5653 }
5654 }
5655 @if (!hideMyProfileLink)
5656 {
5657 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
5658 }
5659 @if (!hideMyOrdersLink)
5660 {
5661 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
5662 }
5663 @if (!hideMyFavoritesLink)
5664 {
5665 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
5666 }
5667 @if (!hideMySavedCardsLink)
5668 {
5669 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
5670 }
5671 @if (!hideMyOrderDraftsLink)
5672 {
5673 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon)
5674 }
5675 @if (Model.CurrentUser.ID > 0)
5676 {
5677 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5678 {
5679 @RenderSeparator()
5680 }
5681
5682 //Check if impersonation is on
5683 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
5684 {
5685 <li>
5686 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;">
5687 @Translate("Sign out")
5688 </div>
5689 </li>
5690 } else {
5691 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
5692 }
5693 }
5694 </ul>
5695 </div>
5696 </li>
5697 }
5698 }
5699
5700 @helper RenderListItem(string link, string text, string icon = null) {
5701 <li>
5702 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)">
5703 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text
5704 </a>
5705 </li>
5706 }
5707
5708 @helper RenderSeparator()
5709 {
5710 <li class="list__seperator dw-mod"></li>
5711 }
5712 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5713
5714 @using System
5715 @using System.Web
5716 @using Dynamicweb.Rapido.Blocks.Extensibility
5717 @using Dynamicweb.Rapido.Blocks
5718
5719 @{
5720 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");
5721
5722 Block masterDesktopActionsMenuFavorites = new Block
5723 {
5724 Id = "MasterDesktopActionsMenuFavorites",
5725 SortId = 30,
5726 Template = RenderFavorites()
5727 };
5728
5729 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)
5730 {
5731 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);
5732 }
5733 }
5734
5735 @helper RenderFavorites()
5736 {
5737 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5738 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;
5739
5740 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5741 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5742 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5743
5744 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5745 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")">
5746 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>
5747 </a>
5748 </li>
5749 }
5750 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5751
5752 @using System
5753 @using System.Web
5754 @using Dynamicweb.Rapido.Blocks.Extensibility
5755 @using Dynamicweb.Rapido.Blocks
5756 @using Dynamicweb.Rapido.Services
5757 @using Dynamicweb.Ecommerce
5758 @using Dynamicweb.Ecommerce.Orders
5759 @using Df.Dw
5760
5761 @{
5762 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
5763 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
5764
5765 var totalNumberOfProductsForDefault = 0;
5766 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT7")))
5767 {
5768 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
5769 totalNumberOfProductsForDefault = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
5770 }
5771
5772 var totalNumberOfProductsForIngrasaminte = 0;
5773 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT5")))
5774 {
5775 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
5776 totalNumberOfProductsForIngrasaminte = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
5777 }
5778
5779 var totalNumberOfProductsForAllCarts = totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte;
5780
5781 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart)
5782 {
5783 Block masterDesktopActionsMenuMiniCart = new Block
5784 {
5785 Id = "MasterDesktopActionsMenuMiniCart",
5786 SortId = 60,
5787 Template = RenderMiniCart(miniCartLayout == "dropdown"),
5788 SkipRenderBlocksList = true,
5789 BlocksList = new List<Block>()
5790 };
5791
5792 Block miniCartCounterScriptTemplate = new Block
5793 {
5794 Id = "MiniCartCounterScriptTemplate",
5795 Template = RenderMiniCartCounterContent()
5796 };
5797
5798 //dropdown layout is default
5799 RazorEngine.Templating.TemplateWriter layoutTemplate;
5800 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate;
5801
5802 switch (miniCartLayout)
5803 {
5804 case "dropdown":
5805 layoutTemplate = RenderMiniCartDropdownLayout();
5806 miniCartTriggerTemplate = RenderMiniCartTriggerLink(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
5807 break;
5808 case "panel":
5809 layoutTemplate = RenderMiniCartPanelLayout();
5810 //miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5811 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
5812 break;
5813 case "modal":
5814 layoutTemplate = RenderMiniCartModalLayout();
5815 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
5816 break;
5817 case "none":
5818 default:
5819 layoutTemplate = RenderMiniCartDropdownLayout();
5820 miniCartTriggerTemplate = RenderMiniCartTriggerLink(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
5821 break;
5822 }
5823
5824 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5825 {
5826 Id = "MiniCartTrigger",
5827 Template = miniCartTriggerTemplate
5828 });
5829
5830 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
5831 {
5832 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5833 {
5834 Id = "MiniCartLayout",
5835 Template = layoutTemplate
5836 });
5837 }
5838
5839 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);
5840 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
5841 }
5842
5843 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
5844 {
5845 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
5846 Id = "CartInitialization"
5847 });
5848 }
5849 }
5850
5851 @helper RenderMiniCart(bool hasMouseEnterEvent)
5852 {
5853 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();
5854 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5855 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";
5856 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5857 string mouseEvent = "";
5858 string id = "MiniCart";
5859 if (hasMouseEnterEvent)
5860 {
5861 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";
5862 id = "miniCartTrigger";
5863 }
5864 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>
5865 @RenderBlockList(subBlocks)
5866 </li>
5867 }
5868
5869 @helper RenderMiniCartTriggerLabel(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0)
5870 {
5871 int cartPageId = GetPageIdByNavigationTag("CartPage");
5872 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5873 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5874 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5875 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed");
5876 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
5877 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId;
5878
5879 <div id="minicart_icon" data-miniCartFeedId="@miniCartFeedDefaultPageId" data-miniCartFeed-IngrasaminteId="@miniCartFeedIngrasamintePageId" data-miniCart-ContextId="@miniCartFeedSelectedPageId" class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=MiniCart')" title="@Translate("Cart")">
5880 <div class="u-inline u-position-relative">
5881 <i class="@cartIcon fa-1_5x"></i>
5882 @RenderMiniCartCounter(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte)
5883 </div>
5884 </div>
5885 }
5886
5887 @helper RenderMiniCartTriggerLink(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0)
5888 {
5889 int cartPageId = GetPageIdByNavigationTag("CartPage");
5890 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5891 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5892 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5893
5894 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")">
5895 <span class="u-inline u-position-relative">
5896 <i class="@cartIcon fa-1_5x"></i>
5897 @RenderMiniCartCounter(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte)
5898 </span>
5899 </a>
5900 }
5901
5902 @helper RenderMiniCartCounter(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0)
5903 {
5904 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed");
5905 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
5906 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId;
5907
5908 string cartProductsCount = (totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte).ToString();
5909 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5910 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5911 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
5912 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
5913
5914 if (showPrice && counterPosition == "right")
5915 {
5916 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")";
5917 }
5918 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod">
5919 <span class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=Counter" data-init-onload="false" data-preloader="false">
5920 <span class="js-mini-cart-counter-content" data-count="@cartProductsCount">
5921 @cartProductsCount @cartProductsTotalPrice
5922 </span>
5923 </span>
5924 </span>
5925 }
5926
5927 @helper RenderMiniCartCounterContent()
5928 {
5929 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5930 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5931 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;
5932
5933 <script id="MiniCartCounterContent" type="text/x-template">
5934 {{#.}}
5935 <span class="js-mini-cart-counter-content dw-mod" data-count="{{totalnumberofproductsforallcarts}}">
5936 @if (showPriceInMiniCartCounter)
5937 {
5938 @Translate("Cart")<text>({{totalnumberofproductsforallcarts}}) {{totalprice}}</text>
5939 }
5940 else
5941 {
5942 <text>{{totalnumberofproductsforallcarts}}</text>
5943 }
5944 </span>
5945 {{/.}}
5946 </script>
5947 }
5948
5949
5950
5951 @helper RenderMiniCartDropdownLayout()
5952 {
5953 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5954 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5955
5956 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink">
5957 <div class="mini-cart-dropdown__inner dw-mod">
5958 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>
5959 <div class="mini-cart-dropdown__body u-flex dw-mod">
5960 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>
5961 </div>
5962 </div>
5963 </div>
5964 }
5965
5966 @helper RenderMiniCartPanelLayout()
5967 {
5968 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5969 int minicartIngrasaminteFeedPageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
5970 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5971 string cartIngrasamintePageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPageIngrasaminte");
5972
5973
5974 <div class="mini-cart grid__cell dw-mod">
5975 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />
5976 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
5977 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>
5978 <div class="panel__content u-full-width dw-mod">
5979 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>
5980 <div class="panel__content-body panel__content-body--cart dw-mod">
5981 <div class="select__carts-wrapper">
5982 <select id="CartSelect" data-json-feed="/Default.aspx?feedType=MiniCart&ID=">
5983 <option value="@minicartIngrasaminteFeedPageId">Cosul Ingrasaminte</option>
5984 <option value="@miniCartFeedPageId">Cosul cu restul produselor</option>
5985 </select>
5986 </div>
5987 <div class="js-handlebars-root u-flex grid--direction-column u-full-height dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>
5988 </div>
5989 </div>
5990 </div>
5991 </div>
5992 }
5993
5994 @helper RenderMiniCartModalLayout()
5995 {
5996 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5997 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5998
5999 <div class="mini-cart grid__cell dw-mod">
6000 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />
6001 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
6002 <label for="miniCartTrigger" class="modal-overlay"></label>
6003 <div class="modal modal--md modal--top-right dw-mod">
6004 <div class="modal__body u-flex grid--direction-column dw-mod">
6005 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>
6006 <div class="js-handlebars-root u-flex grid--direction-column dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>
6007 </div>
6008 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>
6009 </div>
6010 </div>
6011 </div>
6012 }
6013
6014 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6015
6016 @using System
6017 @using System.Web
6018 @using Dynamicweb.Rapido.Blocks.Extensibility
6019 @using Dynamicweb.Rapido.Blocks
6020
6021 @{
6022 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon");
6023
6024 Block masterDesktopActionsMenuOrderDraft = new Block
6025 {
6026 Id = "MasterDesktopActionsMenuOrderDraft",
6027 SortId = 40,
6028 Template = RenderOrderDraft()
6029 };
6030
6031 if (showOrderDraftLink && Model.CurrentUser.ID > 0)
6032 {
6033 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft);
6034 }
6035 }
6036
6037 @helper RenderOrderDraft()
6038 {
6039 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft");
6040 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId;
6041 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
6042
6043
6044 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6045 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
6046 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6047
6048 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
6049 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")">
6050 <span class="u-inline u-position-relative">
6051 <i class="@draftIcon fa-1_5x"></i>
6052 </span>
6053 </a>
6054 </li>
6055 }
6056 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6057
6058 @using System
6059 @using System.Web
6060 @using Dynamicweb.Rapido.Blocks.Extensibility
6061 @using Dynamicweb.Rapido.Blocks
6062
6063 @{
6064 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");
6065
6066 Block masterDesktopActionsMenuDownloadCart = new Block
6067 {
6068 Id = "MasterDesktopActionsMenuDownloadCart",
6069 SortId = 50,
6070 Template = RenderDownloadCart()
6071 };
6072
6073 if (showDownloadCartLink && Model.CurrentUser.ID > 0)
6074 {
6075 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);
6076 }
6077 }
6078
6079 @helper RenderDownloadCart()
6080 {
6081 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");
6082 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;
6083
6084 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6085 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
6086 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6087 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
6088
6089 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
6090 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")">
6091 <span class="u-inline u-position-relative">
6092 <i class="fas fa-cart-arrow-down fa-1_5x"></i>
6093 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span>
6094 </span>
6095 </a>
6096 </li>
6097 }
6098 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6099
6100 @using System
6101 @using System.Web
6102 @using Dynamicweb.Rapido.Blocks.Extensibility
6103 @using Dynamicweb.Rapido.Blocks
6104
6105 @functions {
6106 public class SearchConfiguration
6107 {
6108 public string searchFeedId { get; set; }
6109 public string searchSecondFeedId { get; set; }
6110 public int groupsFeedId { get; set; }
6111 public string resultPageLink { get; set; }
6112 public string searchPlaceholder { get; set; }
6113 public string searchType { get; set; }
6114 public string searchTemplate { get; set; }
6115 public string searchContentTemplate { get; set; }
6116 public string searchValue { get; set; }
6117 public bool showGroups { get; set; }
6118
6119 public SearchConfiguration()
6120 {
6121 searchFeedId = "";
6122 searchSecondFeedId = "";
6123 searchType = "product-search";
6124 searchContentTemplate = "";
6125 showGroups = true;
6126 }
6127 }
6128 }
6129 @{
6130 Block masterSearchBar = new Block
6131 {
6132 Id = "MasterSearchBar",
6133 SortId = 40,
6134 Template = RenderSearch("bar"),
6135 Design = new Design
6136 {
6137 Size = "auto",
6138 HidePadding = true,
6139 RenderType = RenderType.Column
6140 }
6141 };
6142
6143 Block masterSearchAction = new Block
6144 {
6145 Id = "MasterDesktopActionsMenuSearch",
6146 SortId = 10,
6147 Template = RenderSearch()
6148 };
6149
6150 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);
6151 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);
6152 }
6153
6154 @helper RenderSearch(string type = "mini-search")
6155 {
6156 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));
6157 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
6158 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
6159
6160 SearchConfiguration searchConfiguration = null;
6161
6162 switch (searchType) {
6163 case "contentSearch":
6164 searchConfiguration = new SearchConfiguration() {
6165 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
6166 resultPageLink = contentSearchPageLink,
6167 searchPlaceholder = Translate("Search page"),
6168 groupsFeedId = 0,
6169 searchType = "content-search",
6170 searchTemplate = "SearchPagesTemplate",
6171 showGroups = false
6172 };
6173 break;
6174 case "combinedSearch":
6175 searchConfiguration = new SearchConfiguration() {
6176 searchFeedId = productsPageId + "&feed=true",
6177 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
6178 resultPageLink = Converter.ToString(productsPageId),
6179 searchPlaceholder = Translate("Search products or pages"),
6180 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
6181 searchType = "combined-search",
6182 searchTemplate = "SearchProductsTemplateWrap",
6183 searchContentTemplate = "SearchPagesTemplateWrap",
6184 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
6185 };
6186 break;
6187 default: //productSearch
6188 searchConfiguration = new SearchConfiguration() {
6189 resultPageLink = Converter.ToString(productsPageId),
6190 searchFeedId = productsPageId + "&feed=true",
6191 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
6192 searchPlaceholder = Translate("Search products"),
6193 searchTemplate = "SearchProductsTemplate",
6194 searchType = "product-search",
6195 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
6196 };
6197 break;
6198 }
6199 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
6200
6201 if (type == "mini-search") {
6202 @RenderMiniSearch(searchConfiguration)
6203 } else {
6204 @RenderSearchBar(searchConfiguration)
6205 }
6206 }
6207
6208 @helper RenderSearchBar(SearchConfiguration options)
6209 {
6210 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
6211 data-page-size="7"
6212 data-search-feed-id="@options.searchFeedId"
6213 data-search-second-feed-id="@options.searchSecondFeedId"
6214 data-result-page-id="@options.resultPageLink"
6215 data-groups-page-id="@options.groupsFeedId"
6216 data-search-type="@options.searchType">
6217 @if (options.showGroups)
6218 {
6219 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button>
6220 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul>
6221 }
6222 <div class="typeahead-search-field">
6223 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
6224 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
6225 {
6226 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>
6227 }
6228 else
6229 {
6230 <div class="dropdown dropdown--absolute-position dropdown--combined grid">
6231 <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div>
6232 <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div>
6233 </div>
6234 }
6235 </div>
6236 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button>
6237 </div>
6238 }
6239
6240 @helper RenderMiniSearch(SearchConfiguration options)
6241 {
6242 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6243 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6244
6245 <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" id="miniSearchIcon">
6246 <div class="@menuLinkClass dw-mod" title="@Translate("Search")">
6247 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
6248 </div>
6249 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod">
6250 <div class="typeahead js-typeahead" id="ProductSearchBar"
6251 data-page-size="7"
6252 data-search-feed-id="@options.searchFeedId"
6253 data-search-second-feed-id="@options.searchSecondFeedId"
6254 data-result-page-id="@options.resultPageLink"
6255 data-search-type="@options.searchType">
6256 <div class="typeahead-search-field">
6257 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">
6258 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
6259 {
6260 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>
6261 }
6262 else
6263 {
6264 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">
6265 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div>
6266 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div>
6267 </div>
6268 }
6269 </div>
6270 </div>
6271 </div>
6272 </li>
6273 }
6274 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6275
6276 @using System
6277 @using System.Web
6278 @using Dynamicweb.Rapido.Blocks.Extensibility
6279 @using Dynamicweb.Rapido.Blocks
6280
6281 @{
6282 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6283 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
6284
6285 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");
6286
6287 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");
6288 headerConfigurationPage.RemoveBlock(configDesktopLogo);
6289
6290 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");
6291 headerConfigurationPage.RemoveBlock(configDesktopMenu);
6292
6293 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");
6294 headerConfigurationPage.RemoveBlock(configSearchBar);
6295
6296 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");
6297 headerConfigurationPage.RemoveBlock(configSearchAction);
6298
6299 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");
6300 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);
6301
6302 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");
6303
6304 switch (headerConfigurationTopLayout)
6305 {
6306 case "condensed": //2
6307 configDesktopLogo.Design.Size = "auto-width";
6308 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6309
6310 configDesktopMenu.SortId = 20;
6311 configDesktopMenu.Design.Size = "auto";
6312 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6313
6314 configDesktopActionsMenu.SortId = 30;
6315 configDesktopActionsMenu.Design.Size = "auto-width";
6316 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6317
6318 if (!headerConfigurationHideSearch)
6319 {
6320 configSearchBar.SortId = 40;
6321 configSearchBar.Design.Size = "12";
6322 configDesktopExtra.SortId = 50;
6323 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
6324 }
6325 break;
6326 case "splitted": //3
6327 configDesktopLogo.Design.Size = "auto";
6328 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6329
6330 if (!headerConfigurationHideSearch)
6331 {
6332 configSearchBar.SortId = 20;
6333 configSearchBar.Design.Size = "auto";
6334 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
6335 }
6336
6337 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6338
6339 configDesktopActionsMenu.SortId = 20;
6340 configDesktopActionsMenu.Design.Size = "auto-width";
6341 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6342 break;
6343 case "splitted-center": //4
6344 configDesktopLogo.Design.Size = "auto";
6345 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6346 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6347
6348 configDesktopActionsMenu.SortId = 30;
6349 configDesktopActionsMenu.Design.Size = "auto-width";
6350 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
6351
6352 if (!headerConfigurationHideSearch)
6353 {
6354 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6355 }
6356 break;
6357 case "minimal": //5
6358 configDesktopLogo.Design.Size = "auto-width";
6359 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6360
6361 configDesktopMenu.Design.Size = "auto";
6362 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6363
6364 configDesktopActionsMenu.SortId = 20;
6365 configDesktopActionsMenu.Design.Size = "auto-width";
6366 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6367
6368 if (!headerConfigurationHideSearch)
6369 {
6370 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6371 }
6372 break;
6373 case "minimal-center": //6
6374 configDesktopLogo.Design.Size = "auto-width";
6375 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6376
6377 configDesktopMenu.Design.Size = "auto";
6378 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6379
6380 configDesktopActionsMenu.SortId = 20;
6381 configDesktopActionsMenu.Design.Size = "auto-width";
6382 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6383
6384 if (!headerConfigurationHideSearch)
6385 {
6386 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6387 }
6388 break;
6389 case "minimal-right": //7
6390 configDesktopLogo.Design.Size = "auto-width";
6391 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6392
6393 configDesktopMenu.Design.Size = "auto";
6394 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6395
6396 configDesktopActionsMenu.SortId = 20;
6397 configDesktopActionsMenu.Design.Size = "auto-width";
6398 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6399
6400 if (!headerConfigurationHideSearch)
6401 {
6402 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6403 }
6404 break;
6405 case "two-lines": //8
6406 configDesktopLogo.Design.Size = "auto";
6407 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6408
6409 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6410
6411 configDesktopActionsMenu.SortId = 20;
6412 configDesktopActionsMenu.Design.Size = "auto-width";
6413 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6414
6415 if (!headerConfigurationHideSearch)
6416 {
6417 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6418 }
6419 break;
6420 case "two-lines-centered": //9
6421 configDesktopLogo.Design.Size = "auto";
6422 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6423
6424 configDesktopMenu.Design.Size = "auto-width";
6425 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6426
6427 configDesktopActionsMenu.SortId = 20;
6428 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6429
6430 if (!headerConfigurationHideSearch)
6431 {
6432 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6433 }
6434 break;
6435 case "normal": //1
6436 default:
6437 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6438
6439 if (!headerConfigurationHideSearch)
6440 {
6441 configSearchBar.SortId = 20;
6442 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
6443 }
6444
6445 configDesktopActionsMenu.SortId = 30;
6446 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
6447
6448 configDesktopActionsMenu.Design.Size = "auto-width";
6449 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6450 break;
6451 }
6452 }
6453 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6454
6455 @using System
6456 @using System.Web
6457 @using Dynamicweb.Rapido.Blocks.Extensibility
6458 @using Dynamicweb.Rapido.Blocks
6459
6460 @{
6461
6462 }
6463
6464
6465 @helper RenderDesktopTools()
6466 {
6467 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();
6468
6469 <div class="tools-navigation dw-mod">
6470 <div class="center-container grid top-container__center-container dw-mod">
6471 @RenderBlockList(subBlocks)
6472 </div>
6473 </div>
6474 }
6475
6476 @helper RenderDesktopToolsText()
6477 {
6478 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");
6479 if (!string.IsNullOrEmpty(toolsText))
6480 {
6481 <div class="u-margin-top u-margin-bottom">@toolsText</div>
6482 }
6483 }
6484
6485 @helper RenderDesktopToolsNavigation()
6486 {
6487 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
6488
6489 if (renderPagesInToolBar)
6490 {
6491 @RenderNavigation(new
6492 {
6493 id = "topToolsNavigation",
6494 cssclass = "menu menu-tools dw-mod dwnavigation",
6495 template = "TopMenu.xslt",
6496 endlevel = 1,
6497 startlevel = 1
6498 })
6499 }
6500 <div class = "desktop-search">
6501 <span class="search-desktop-header"><i class="fas fa-search"></i></span>
6502 @RenderMobileTopSearchBar()
6503
6504
6505 @{
6506 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
6507 Uri url = Dynamicweb.Context.Current.Request.Url;
6508 string hostName = url.Host;
6509
6510
6511 if (Pageview.Area.IsMaster)
6512 {
6513 languages.Add(Pageview.Page);
6514 if (Pageview.Page.Languages != null)
6515 {
6516 foreach (var language in Pageview.Page.Languages)
6517 {
6518 languages.Add(language);
6519 }
6520 }
6521 }
6522 else
6523 {
6524 languages.Add(Pageview.Page.MasterPage);
6525 if (Pageview.Page.MasterPage != null)
6526 {
6527 if (Pageview.Page.MasterPage.Languages != null)
6528 {
6529 foreach (var language in Pageview.Page.MasterPage.Languages)
6530 {
6531 languages.Add(language);
6532 }
6533 }
6534 }
6535 }
6536
6537 foreach (var language in languages)
6538 {
6539 if (language?.Area != null)
6540 {
6541 if (language != null && language.Area.Active && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
6542 {
6543 if (!string.IsNullOrEmpty(language.Area.DomainLock))
6544 {
6545 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
6546 }
6547 string querystring = $"Default.aspx?ID={language.ID}";
6548
6549 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
6550 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
6551 string defaultUrl = $"{url.Scheme}://{hostName}";
6552
6553
6554 <span class="language-selector-header">
6555 @if(language.Area.CultureInfo.Name.ToLower() == "en-gb") {
6556 <a href ="@href">EN</a>
6557 }
6558 else if(language.Area.CultureInfo.Name.ToLower() == "ro-ro") {
6559 <a href="@href">RO</a>
6560 }
6561
6562 </span>
6563 }
6564 }
6565 }
6566 }
6567
6568
6569
6570
6571
6572 @*<span class="language-selector-header"><a href ="/en/home">EN </a>/<a href="/"> RO</a></span>*@
6573
6574
6575
6576
6577 </div>
6578 }
6579
6580 @helper RenderDesktopNavigation()
6581 {
6582 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();
6583 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6584 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";
6585 <nav class="main-navigation dw-mod">
6586 <div class="center-container top-container__center-container grid @alignClass dw-mod">
6587 @RenderBlockList(subBlocks)
6588
6589 </div>
6590 <div class = "navigation-overlay"></div>
6591 </nav>
6592 }
6593
6594 @helper RenderDesktopExtra()
6595 {
6596 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();
6597
6598 if (subBlocks.Count > 0)
6599 {
6600 <div class="header header-top dw-mod">
6601 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">
6602 <div class="menu-bars__wrapper">
6603 <i class="fas fa-bars"></i>
6604 </div>
6605 @RenderBlockList(subBlocks)
6606 </div>
6607 </div>
6608 }
6609 }</text>
6610 }
6611
6612 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6613
6614 @using System
6615 @using System.Web
6616 @using Dynamicweb.Rapido.Blocks.Extensibility
6617 @using Dynamicweb.Rapido.Blocks
6618 @using Dynamicweb.Rapido.Blocks.Components.General
6619 @using Dynamicweb.Frontend
6620
6621 @functions {
6622 int impersonationPageId;
6623 string impersonationLayout;
6624 int impersonationFeed;
6625 Block impersonationBar;
6626
6627 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName)
6628 {
6629 string username = "";
6630
6631 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName))
6632 {
6633 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName;
6634 }
6635 else if (!string.IsNullOrEmpty(name))
6636 {
6637 username = name;
6638 }
6639 else if (!string.IsNullOrEmpty(email))
6640 {
6641 username = email;
6642 }
6643 else
6644 {
6645 username = userName;
6646 }
6647 return username;
6648 }
6649
6650 string getUserName(UserViewModel user)
6651 {
6652 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
6653 }
6654
6655 string getUserName(Dynamicweb.Security.UserManagement.User user)
6656 {
6657 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
6658 }
6659 }
6660
6661 @{
6662 impersonationPageId = GetPageIdByNavigationTag("Impersonation");
6663 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar";
6664 impersonationFeed = GetPageIdByNavigationTag("UsersFeed");
6665
6666 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)
6667 {
6668 impersonationBar = new Block
6669 {
6670 Id = "ImpersonationBar",
6671 SortId = 50,
6672 Template = RenderImpersonation(),
6673 SkipRenderBlocksList = true,
6674 Design = new Design
6675 {
6676 Size = "auto-width",
6677 HidePadding = true,
6678 RenderType = RenderType.Column
6679 }
6680 };
6681
6682 if (impersonationLayout == "top-bar") {
6683 impersonationBar.SortId = 9;
6684 }
6685
6686 Block impersonationContent = new Block
6687 {
6688 Id = "ImpersonationContent",
6689 SortId = 20
6690 };
6691
6692 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
6693 {
6694 //Render stop impersonation view
6695 impersonationContent.Template = RenderStopImpersonationView();
6696
6697
6698 Modal stopImpersonation = new Modal
6699 {
6700 Id = "StopImpersonation",
6701 Heading = new Heading {
6702 Level = 2,
6703 Title = Translate("Sign out"),
6704 Icon = new Icon {
6705 Name = "fa-sign-out",
6706 Prefix = "fas",
6707 LabelPosition = IconLabelPosition.After
6708 }
6709 },
6710 Width = ModalWidth.Sm,
6711 BodyTemplate = RenderStopImpersonationForm()
6712 };
6713
6714 Block stopImpersonationBlock = new Block
6715 {
6716 Id = "StopImpersonationBlock",
6717 SortId = 10,
6718 Component = stopImpersonation
6719 };
6720 impersonationBar.BlocksList.Add(stopImpersonationBlock);
6721 }
6722 else
6723 {
6724 //Render main view
6725 switch (impersonationLayout)
6726 {
6727 case "right-lower-box":
6728 impersonationContent.BlocksList.Add(
6729 new Block {
6730 Id = "RightLowerBoxHeader",
6731 SortId = 10,
6732 Component = new Heading {
6733 Level = 5,
6734 Title = Translate("View the list of users you can sign in as"),
6735 CssClass = "impersonation-text"
6736 }
6737 }
6738 );
6739 impersonationContent.BlocksList.Add(
6740 new Block {
6741 Id = "RightLowerBoxContent",
6742 SortId = 20,
6743 Template = RenderImpersonationControls()
6744 }
6745 );
6746 break;
6747 case "right-lower-bar":
6748 impersonationContent.BlocksList.Add(
6749 new Block {
6750 Id = "RightLowerBarContent",
6751 SortId = 10,
6752 Template = RenderImpersonationControls()
6753 }
6754 );
6755 break;
6756 case "bar":
6757 default:
6758 impersonationContent.BlocksList.Add(
6759 new Block {
6760 Id = "ViewListLink",
6761 SortId = 20,
6762 Template = RenderViewListLink()
6763 }
6764 );
6765 impersonationContent.BlocksList.Add(
6766 new Block {
6767 Id = "BarTypeaheadSearch",
6768 SortId = 30,
6769 Template = RenderTypeaheadSearch()
6770 }
6771 );
6772 break;
6773 }
6774 }
6775 impersonationBar.BlocksList.Add(impersonationContent);
6776
6777 impersonationBar.BlocksList.Add(
6778 new Block
6779 {
6780 Id = "ImpersonationSearchTemplates",
6781 SortId = 30,
6782 Template = RenderSearchResultTemplate()
6783 }
6784 );
6785 if (impersonationLayout != "bar" && impersonationLayout != "top-bar")
6786 {
6787 impersonationBar.BlocksList.Add(
6788 new Block
6789 {
6790 Id = "ImpersonationSearchScripts",
6791 SortId = 40,
6792 Template = RenderSearchScripts()
6793 }
6794 );
6795 }
6796 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);
6797 }
6798 }
6799
6800 @helper RenderImpersonation()
6801 {
6802 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList();
6803 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" />
6804 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation">
6805 @if (impersonationLayout == "right-lower-box")
6806 {
6807 @RenderRightLowerBoxHeader()
6808 }
6809 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod">
6810 @*Impersonation*@
6811 @RenderBlockList(subBlocks)
6812 </div>
6813 </div>
6814 }
6815
6816 @helper RenderRightLowerBoxHeader()
6817 {
6818 <div class="impersonation__header dw-mod">
6819 <div class="impersonation__title">@Translate("Impersonation")</div>
6820 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();">
6821 @Render(new Icon
6822 {
6823 Prefix = "fas",
6824 Name = "fa-window-minimize"
6825 })
6826 </label>
6827 </div>
6828 }
6829
6830 @helper RenderStopImpersonationView()
6831 {
6832 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
6833 string userName = getUserName(Pageview.User);
6834 string impersonationText = "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + secondaryUserName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + userName + "</b> ";
6835 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + userName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + secondaryUserName + "</b> " : impersonationText;
6836
6837 if (impersonationLayout == "right-lower-box")
6838 {
6839 <div class="u-margin-bottom--lg u-ta-center">
6840 @impersonationText
6841 </div>
6842 <div class="u-margin-bottom--lg u-ta-center">
6843 @RenderSwitchAccountButton()
6844 </div>
6845 @RenderStopImpersonationButton()
6846 }
6847 else
6848 {
6849 <div class="grid grid--align-center impersonation__stop-wrap">
6850 <div class="impersonation-bar-item dw-mod">
6851 @impersonationText
6852 </div>
6853 <div class="impersonation-bar-item dw-mod">
6854 @RenderSwitchAccountButton()
6855 </div>
6856 <div class="impersonation-bar-item dw-mod">
6857 @RenderStopImpersonationButton()
6858 </div>
6859 </div>
6860 }
6861 }
6862
6863 @helper RenderSwitchAccountButton() {
6864 @Render(new Button
6865 {
6866 Href = "/Default.aspx?ID=" + impersonationPageId,
6867 ButtonType = ButtonType.Button,
6868 ButtonLayout = ButtonLayout.Clean,
6869 Title = Translate("Switch account"),
6870 Icon = new Icon {
6871 Name = "fa-users",
6872 Prefix = "fal",
6873 LabelPosition = IconLabelPosition.After
6874 },
6875 CssClass = "u-no-margin u-color-inherit"
6876 })
6877 }
6878
6879 @helper RenderStopImpersonationForm()
6880 {
6881 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
6882 string userName = getUserName(Pageview.User);
6883 int pageId = Model.TopPage.ID;
6884
6885 <form method="post" class="u-no-margin">
6886 @Render(new Button
6887 {
6888 ButtonType = ButtonType.Submit,
6889 ButtonLayout = ButtonLayout.Secondary,
6890 Title = Translate("Sign out as") + " " + userName,
6891 Href = "/Default.aspx?ID=" + impersonationPageId,
6892 CssClass = "btn--full",
6893 Name = "DwExtranetRemoveSecondaryUser"
6894 })
6895
6896 @Render(new Button
6897 {
6898 ButtonType = ButtonType.Submit,
6899 ButtonLayout = ButtonLayout.Secondary,
6900 Title = Translate("Sign out as") + " " + secondaryUserName,
6901 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId,
6902 CssClass = "btn--full",
6903 Name = "DwExtranetRemoveSecondaryUser"
6904 })
6905 </form>
6906 }
6907
6908 @helper RenderStopImpersonationButton() {
6909 @Render(new Button
6910 {
6911 ButtonType = ButtonType.Button,
6912 ButtonLayout = ButtonLayout.Clean,
6913 Title = Translate("Sign out"),
6914 Icon = new Icon {
6915 Name = "fa-sign-out",
6916 Prefix = "fal",
6917 LabelPosition = IconLabelPosition.After
6918 },
6919 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true",
6920 CssClass = "u-no-margin"
6921 })
6922 }
6923
6924 @helper RenderImpersonationControls()
6925 {
6926 <div class="impersonation__controls">
6927 @RenderViewListLink()
6928 @RenderSearchBox()
6929 </div>
6930 @RenderResultsList()
6931 }
6932
6933 @helper RenderViewListLink()
6934 {
6935 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as");
6936 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link";
6937
6938 @Render(new Link {
6939 ButtonLayout = ButtonLayout.None,
6940 Title = title,
6941 Href = "/Default.aspx?ID=" + impersonationPageId,
6942 CssClass = buttonClasses
6943 })
6944 }
6945
6946 @helper RenderSearchBox()
6947 {
6948 <div class="impersonation__search-wrap">
6949 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField">
6950 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)">
6951 <i class="fal fa-search"></i>
6952 </div>
6953 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();">
6954 <i class="fal fa-times"></i>
6955 </div>
6956 </div>
6957 }
6958
6959 @helper RenderTypeaheadSearch()
6960 {
6961 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar"
6962 data-page-size="5"
6963 data-search-feed-id="@impersonationFeed"
6964 data-result-page-id="@impersonationPageId"
6965 data-search-type="user-search"
6966 data-search-parameter-name="q">
6967
6968 <div class="typeahead-search-field">
6969 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")">
6970 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ImpersonationSearchBarContent" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false"></ul>
6971 </div>
6972 </div>
6973 }
6974
6975 @helper RenderResultsList()
6976 {
6977 <ul id="ImpersonationBoxSearchResults" class="impersonation__search-results js-handlebars-root dw-mod" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false" data-preloader="minimal"></ul>
6978 }
6979
6980 @helper RenderSearchResultTemplate()
6981 {
6982 <script id="ImpersonationSearchResult" type="text/x-template">
6983 {{#.}}
6984 {{#Users}}
6985 <li class="impersonation__search-results-item impersonation-user">
6986 <form method="post" class="impersonation-user__form" name="account{{id}}">
6987 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}">
6988 <div class="impersonation-user__info">
6989 <div class="impersonation-user__name">{{userName}}</div>
6990 <div class="impersonation-user__number">{{customerNumber}}</div>
6991 </div>
6992 @Render(new Button
6993 {
6994 ButtonType = ButtonType.Submit,
6995 ButtonLayout = ButtonLayout.Secondary,
6996 Title = Translate("Sign in as"),
6997 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "")
6998 })
6999 </form>
7000 </li>
7001 {{/Users}}
7002 {{#unless Users}}
7003 <li class="impersonation__search-results-item impersonation__search-results-item--not-found">
7004 @Translate("Your search gave 0 results")
7005 </li>
7006 {{/unless}}
7007 {{/.}}
7008 </script>
7009 }
7010
7011 @helper RenderSearchScripts()
7012 {
7013 <script>
7014 let inputDelayTimer;
7015 function searchKeyUpHandler(e) {
7016 clearTimeout(inputDelayTimer);
7017 let value = e.target.value;
7018 if (value != "") {
7019 inputDelayTimer = setTimeout(function () {
7020 updateResults(value);
7021 }, 500);
7022 } else {
7023 clearResults();
7024 }
7025 };
7026
7027 function updateResults(value) {
7028 if (value == "") {
7029 return null;
7030 }
7031 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value);
7032 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden");
7033 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden");
7034 }
7035
7036 function clearResults() {
7037 document.getElementById("ImpersonationBoxSearchField").value = "";
7038 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults");
7039 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden");
7040 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden");
7041 }
7042 </script>
7043 }
7044 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7045
7046 @using System
7047 @using System.Web
7048 @using System.Collections.Generic
7049 @using Dynamicweb.Rapido.Blocks.Extensibility
7050 @using Dynamicweb.Rapido.Blocks
7051
7052 @{
7053 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");
7054 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";
7055
7056 Block orderLines = new Block
7057 {
7058 Id = "MiniCartOrderLines",
7059 SkipRenderBlocksList = true,
7060 BlocksList = new List<Block>
7061 {
7062 new Block {
7063 Id = "MiniCartOrderLinesList",
7064 SortId = 20,
7065 Template = RenderMiniCartOrderLinesList()
7066 }
7067 }
7068 };
7069
7070 Block orderlinesScriptTemplates = new Block
7071 {
7072 Id = "OrderlinesScriptTemplates"
7073 };
7074
7075 if (orderlinesView == "table")
7076 {
7077 orderLines.Template = RenderMiniCartOrderLinesTable();
7078 orderLines.BlocksList.Add(
7079 new Block
7080 {
7081 Id = "MiniCartOrderlinesTableHeader",
7082 SortId = 10,
7083 Template = RenderMiniCartOrderLinesHeader()
7084 }
7085 );
7086
7087 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();
7088 }
7089 else
7090 {
7091 orderLines.Template = RenderMiniCartOrderLinesBlocks();
7092 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();
7093 }
7094
7095 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);
7096
7097 Block miniCartScriptTemplates = new Block()
7098 {
7099 Id = "MasterMiniCartTemplates",
7100 SortId = 1,
7101 Template = RenderMiniCartScriptTemplates(),
7102 SkipRenderBlocksList = true,
7103 BlocksList = new List<Block>
7104 {
7105 orderLines,
7106 new Block {
7107 Id = "MiniCartFooter",
7108 Template = RenderMiniCartFooter(),
7109 SortId = 50,
7110 SkipRenderBlocksList = true,
7111 BlocksList = new List<Block>
7112 {
7113 new Block {
7114 Id = "MiniCartSubTotal",
7115 Template = RenderMiniCartSubTotal(),
7116 SortId = 30
7117 },
7118 new Block {
7119 Id = "MiniCartFees",
7120 Template = RenderMiniCartFees(),
7121 SortId = 40
7122 },
7123 new Block {
7124 Id = "MiniCartPoints",
7125 Template = RenderMiniCartPoints(),
7126 SortId = 50
7127 },
7128 new Block {
7129 Id = "MiniCartTotal",
7130 Template = RenderMiniCartTotal(),
7131 SortId = 60
7132 },
7133 new Block {
7134 Id = "MiniCartDisclaimer",
7135 Template = RenderMiniCartDisclaimer(),
7136 SortId = 70
7137 },
7138 new Block {
7139 Id = "MiniCartActions",
7140 Template = RenderMiniCartActions(),
7141 SortId = 80
7142 }
7143 }
7144 }
7145 }
7146 };
7147
7148 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);
7149 }
7150
7151 @helper RenderMiniCartScriptsTableTemplates()
7152 {
7153 <script id="MiniCartOrderline" type="text/x-template">
7154 {{#unless isEmpty}}
7155 <tr>
7156 <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"></a></td>
7157 <td class="u-va-middle">
7158 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>
7159 {{#if variantname}}
7160 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>
7161 {{/if}}
7162 {{#if unitname}}
7163 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>
7164 {{/if}}
7165 </td>
7166 <td class="u-ta-right u-va-middle">{{quantity}}</td>
7167 <td class="u-ta-right u-va-middle">
7168 {{#if pointsTotal}}
7169 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
7170 {{else}}
7171 {{totalprice}}
7172 {{/if}}
7173 </td>
7174 </tr>
7175 {{/unless}}
7176 </script>
7177
7178 <script id="MiniCartOrderlineDiscount" type="text/x-template">
7179 {{#unless isEmpty}}
7180 <tr class="table__row--no-border">
7181 <td class="u-w60px"> </td>
7182 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>
7183 <td class="u-ta-right"> </td>
7184 <td class="u-ta-right">{{totalprice}}</td>
7185 </tr>
7186 {{/unless}}
7187 </script>
7188 }
7189
7190 @helper RenderMiniCartScriptsListTemplates()
7191 {
7192
7193 <script id="MiniCartOrderline" type="text/x-template">
7194 {{#unless isEmpty}}
7195 <div class="mini-cart-orderline grid dw-mod">
7196 <div class="grid__col-4">
7197 <a href="{{link}}" class="{{hideimage}}">
7198 <img class="" src="/Admin/Public/GetImage.ashx?width=100&height=100&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}">
7199 </a>
7200 </div>
7201 <div class="grid__col-8">
7202 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{name}}">{{name}}</a>
7203 {{#if variantname}}
7204 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>
7205 {{/if}}
7206 {{#if unitname}}
7207 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>
7208 {{/if}}
7209 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>
7210
7211 <div class="grid__cell-footer">
7212 <div class="grid__cell">
7213 <div class="u-pull--left mini-cart-orderline__price dw-mod">
7214 {{#if pointsTotal}}
7215 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
7216 {{else}}
7217 {{totalprice}}
7218 {{/if}}
7219 </div>
7220 <button type="button"
7221 title="@Translate("Remove orderline")"
7222 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod"
7223 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID={{cartFeedPageId}}', '{{removeLink}}', true);">@Translate("Remove")</button>
7224 </div>
7225 </div>
7226 </div>
7227 </div>
7228 {{/unless}}
7229 </script>
7230
7231 <script id="MiniCartOrderlineDiscount" type="text/x-template">
7232 {{#unless isEmpty}}
7233 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
7234 <div class="grid__col-8">
7235 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>
7236 </div>
7237 <div class="grid__col-4 u-align-right">{{totalprice}}</div>
7238 </div>
7239 {{/unless}}
7240 </script>
7241 }
7242
7243 @helper RenderMiniCartScriptTemplates()
7244 {
7245 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();
7246 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
7247 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));
7248 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
7249
7250 <script id="MiniCartContent" type="text/x-template">
7251 {{#.}}
7252 {{#unless isEmpty}}
7253 @if (miniCartUseGoogleTagManager)
7254 {
7255 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>
7256 }
7257 @RenderBlockList(subBlocks)
7258 {{/unless}}
7259
7260 {{#if isEmpty}}
7261 {{cartIsEmptyMessage}}
7262 {{/if}}
7263 {{/.}}
7264 </script>
7265 }
7266
7267 @helper RenderMiniCartOrderLinesTable()
7268 {
7269 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
7270
7271 <div class="u-overflow-auto">
7272 <table class="table mini-cart-table dw-mod">
7273 @RenderBlockList(subBlocks)
7274 </table>
7275 </div>
7276 }
7277
7278 @helper RenderMiniCartOrderLinesBlocks()
7279 {
7280 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
7281
7282 <div class="u-overflow-hidden">
7283 @RenderBlockList(subBlocks)
7284 </div>
7285 }
7286
7287 @helper RenderMiniCartOrderLinesHeader()
7288 {
7289 <thead>
7290 <tr>
7291 <td> </td>
7292 <td>@Translate("Product")</td>
7293 <td class="u-ta-right">@Translate("Qty")</td>
7294 <td class="u-ta-right" width="120">@Translate("Price")</td>
7295 </tr>
7296 </thead>
7297 }
7298
7299 @helper RenderMiniCartOrderLinesList()
7300 {
7301 <text>
7302 {{#OrderLines}}
7303 {{#ifCond template "===" "CartOrderline"}}
7304 {{>MiniCartOrderline}}
7305 {{/ifCond}}
7306 {{#ifCond template "===" "CartOrderlineMobile"}}
7307 {{>MiniCartOrderline}}
7308 {{/ifCond}}
7309 {{#ifCond template "===" "CartOrderlineDiscount"}}
7310 {{>MiniCartOrderlineDiscount}}
7311 {{/ifCond}}
7312 {{/OrderLines}}
7313 </text>
7314 }
7315
7316 @helper RenderMiniCartFees()
7317 {
7318 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7319 if (!pointShop)
7320 {
7321 <text>
7322 {{#unless hidePaymentfee}}
7323 <div class="grid">
7324 <div class="grid__col-6 grid__col--bleed-y">
7325 {{paymentmethod}}
7326 </div>
7327 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div>
7328 </div>
7329 {{/unless}}
7330 </text>
7331 }
7332 <text>
7333 {{#unless hideShippingfee}}
7334 <div class="grid">
7335 <div class="grid__col-6 grid__col--bleed-y">
7336 {{shippingmethod}}
7337 </div>
7338 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div>
7339 </div>
7340 {{/unless}}
7341 </text>
7342 <text>
7343 {{#if hasTaxSettings}}
7344 <div class="grid">
7345 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div>
7346 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div>
7347 </div>
7348 {{/if}}
7349 </text>
7350 }
7351
7352 @helper RenderMiniCartFooter()
7353 {
7354 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();
7355
7356 <div class="mini-cart__footer u-border-top u-padding-top dw-mod">
7357 @RenderBlockList(subBlocks)
7358 </div>
7359 }
7360
7361 @helper RenderMiniCartActions()
7362 {
7363 int cartPageId = GetPageIdByNavigationTag("CartPage");
7364
7365 <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, '{{orderContext}}');">@Translate("Empty cart")</button>
7366 <a href="/Default.aspx?ID={{cartPageId}}" title="@Translate("Go to cart")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Go to cart")</a>
7367 }
7368
7369 @helper RenderMiniCartPoints()
7370 {
7371 <text>
7372 {{#if earnings}}
7373 <div class="grid">
7374 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div>
7375 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
7376 <div>
7377 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")
7378 </div>
7379 </div>
7380 </div>
7381 {{/if}}
7382 </text>
7383 }
7384
7385 @helper RenderMiniCartSubTotal()
7386 {
7387 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID);
7388 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7389 if (!pointShop)
7390 {
7391 <text>
7392 {{#unless hideSubTotal}}
7393 <div class="grid dw-mod u-bold">
7394 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div>
7395 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
7396 @if (hasTaxSettings)
7397 {
7398 <text>{{subtotalpricewithouttaxes}}</text>
7399 }
7400 else
7401 {
7402 <text>{{subtotalprice}}</text>
7403 }
7404 </div>
7405 </div>
7406 {{/unless}}
7407 </text>
7408 }
7409 }
7410
7411 @helper RenderMiniCartTotal()
7412 {
7413 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7414
7415 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod">
7416 <div class="grid__col-6">@Translate("Total")</div>
7417 <div class="grid__col-6 grid--align-end">
7418 <div>
7419 @if (pointShop)
7420 {
7421 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")
7422 }
7423 else
7424 {
7425 <text>{{totalprice}}</text>
7426 }
7427 </div>
7428 </div>
7429 </div>
7430 }
7431
7432 @helper RenderMiniCartDisclaimer()
7433 {
7434 <text>
7435 {{#if showCheckoutDisclaimer}}
7436 <div class="grid u-margin-bottom u-ta-right">
7437 <small class="grid__col-12">{{checkoutDisclaimer}}</small>
7438 </div>
7439 {{/if}}
7440 </text>
7441 }
7442 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7443
7444 @using Dynamicweb.Rapido.Blocks.Extensibility
7445 @using Dynamicweb.Rapido.Blocks
7446 @using Dynamicweb.Rapido.Blocks.Components.General
7447 @using Dynamicweb.Rapido.Blocks.Components
7448 @using Dynamicweb.Rapido.Services
7449
7450 @{
7451 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";
7452 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
7453 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
7454
7455 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType))
7456 {
7457 if (addToCartNotificationType == "modal")
7458 {
7459 Block addToCartNotificationModal = new Block
7460 {
7461 Id = "AddToCartNotificationModal",
7462 Template = RenderAddToCartNotificationModal()
7463 };
7464
7465 Block addToCartNotificationScript = new Block
7466 {
7467 Id = "AddToCartNotificationScript",
7468 Template = RenderAddToCartNotificationModalScript()
7469 };
7470 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);
7471 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
7472 }
7473 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
7474 {
7475 Block addToCartNotificationScript = new Block
7476 {
7477 Id = "AddToCartNotificationScript",
7478 Template = RenderAddToCartNotificationToggleScript()
7479 };
7480 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
7481 }
7482 }
7483 }
7484
7485 @helper RenderAddToCartNotificationModal()
7486 {
7487 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>
7488 }
7489
7490 @helper RenderAddToCartNotificationModalScript()
7491 {
7492 int cartPageId = GetPageIdByNavigationTag("CartPage");
7493
7494 <script id="LastAddedProductTemplate" type="text/x-template">
7495 @{
7496
7497 Modal lastAddedProduct = new Modal
7498 {
7499 Id = "LastAddedProduct",
7500 Heading = new Heading
7501 {
7502 Level = 2,
7503 Title = Translate("Product is added to the cart")
7504 },
7505 Width = ModalWidth.Md,
7506 BodyTemplate = RenderModalContent()
7507 };
7508
7509 lastAddedProduct.AddActions(
7510 new Button
7511 {
7512 ButtonType = ButtonType.Button,
7513 ButtonLayout = ButtonLayout.Secondary,
7514 Title = Translate("Continue shopping"),
7515 CssClass = "u-pull--left u-no-margin btn--sm",
7516 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
7517 },
7518 new Link
7519 {
7520 Href = "/Default.aspx?ID=" + cartPageId,
7521 ButtonLayout = ButtonLayout.Secondary,
7522 CssClass = "u-pull--right u-no-margin btn--sm",
7523 Title = Translate("Proceed to checkout"),
7524 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
7525 }
7526 );
7527
7528 @Render(lastAddedProduct)
7529 }
7530 </script>
7531 <script>
7532 document.addEventListener('addToCart', function (event) {
7533 Cart.ShowLastAddedProductModal(event.detail);
7534 });
7535 </script>
7536 }
7537
7538 @helper RenderModalContent()
7539 {
7540 <div class="grid">
7541 <div class="grid__col-2">
7542 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true })
7543 </div>
7544 <div class="u-padding grid--align-self-center">
7545 <span>{{quantity}}</span> x
7546 </div>
7547 <div class="grid__col-auto grid--align-self-center">
7548 <div>{{productInfo.name}}</div>
7549 {{#if productInfo.variantName}}
7550 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>
7551 {{/if}}
7552 {{#if productInfo.unitName}}
7553 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>
7554 {{/if}}
7555 </div>
7556 </div>
7557 }
7558
7559 @helper RenderAddToCartNotificationToggleScript()
7560 {
7561 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
7562
7563 <script>
7564 document.addEventListener('addToCart', function () {
7565 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');
7566 });
7567 </script>
7568 }
7569 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7570
7571 @using System
7572 @using System.Web
7573 @using System.Collections.Generic
7574 @using Dynamicweb.Rapido.Blocks.Extensibility
7575 @using Dynamicweb.Rapido.Blocks
7576 @using Dynamicweb.Rapido.Blocks.Components.General
7577
7578 @functions {
7579 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");
7580 }
7581
7582 @{
7583 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
7584 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
7585 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
7586 string footerColumnFourContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour").GetString("Content") : "";
7587 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
7588 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
7589 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
7590 string footerColumnFourHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour").GetString("Header") : "";
7591
7592 Block masterFooterContent = new Block()
7593 {
7594 Id = "MasterFooterContent",
7595 SortId = 10,
7596 Template = RenderFooter(),
7597 SkipRenderBlocksList = true
7598 };
7599 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);
7600
7601 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))
7602 {
7603 Block masterFooterColumnOne = new Block
7604 {
7605 Id = "MasterFooterColumnOne",
7606 SortId = 10,
7607 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),
7608 Design = new Design
7609 {
7610 Size = "auto",
7611 RenderType = RenderType.Column
7612 }
7613 };
7614 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);
7615 }
7616
7617 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))
7618 {
7619 Block masterFooterColumnTwo = new Block
7620 {
7621 Id = "MasterFooterColumnTwo",
7622 SortId = 20,
7623 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),
7624 Design = new Design
7625 {
7626 Size = "auto",
7627 RenderType = RenderType.Column
7628 }
7629 };
7630 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);
7631 }
7632
7633 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
7634 {
7635 Block masterFooterColumnThree = new Block
7636 {
7637 Id = "MasterFooterColumnThree",
7638 SortId = 30,
7639 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),
7640 Design = new Design
7641 {
7642 Size = "auto",
7643 RenderType = RenderType.Column
7644 }
7645 };
7646 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);
7647 }
7648
7649 if (!string.IsNullOrEmpty(footerColumnFourContent) || !string.IsNullOrEmpty(footerColumnFourHeader))
7650 {
7651 Block masterFooterColumnFour = new Block
7652 {
7653 Id = "MasterFooterColumnFour",
7654 SortId = 40,
7655 Template = RenderFooterColumn(footerColumnFourHeader, footerColumnFourContent),
7656 Design = new Design
7657 {
7658 Size = "auto",
7659 RenderType = RenderType.Column
7660 }
7661 };
7662 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnFour);
7663 }
7664
7665 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
7666 {
7667 Block masterFooterSocialLinks = new Block
7668 {
7669 Id = "MasterFooterSocialLinks",
7670 SortId = 40,
7671 Template = RenderFooterSocialLinks(),
7672 Design = new Design
7673 {
7674 Size = "auto",
7675 RenderType = RenderType.Column,
7676 CssClass = "footer__column-wrapper"
7677 }
7678 };
7679 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);
7680 }
7681
7682
7683 Block masterFooterNewsletterSignUpNew = new Block
7684 {
7685 Id = "MasterFooterNewsletterSignUp",
7686 SortId = 50,
7687 Template = RenderFooterNewsletterSignUp(),
7688 Design = new Design
7689 {
7690 Size = "auto",
7691 RenderType = RenderType.Column,
7692 CssClass = "footer__column-wrapper open"
7693 }
7694 };
7695 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUpNew);
7696
7697
7698 @*if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
7699 {
7700 Block masterFooterPayments = new Block
7701 {
7702 Id = "MasterFooterPayments",
7703 SortId = 60,
7704 Template = RenderFooterPayments(),
7705 Design = new Design
7706 {
7707 Size = "12",
7708 RenderType = RenderType.Column
7709 }
7710 };
7711 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);
7712 }
7713
7714 Block masterFooterCopyright = new Block
7715 {
7716 Id = "MasterFooterCopyright",
7717 SortId = 70,
7718 Template = RenderFooterCopyright(),
7719 Design = new Design
7720 {
7721 Size = "12",
7722 RenderType = RenderType.Column
7723 }
7724 };
7725 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);*@
7726 }
7727
7728 @helper RenderFooter()
7729 {
7730 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();
7731
7732 var premiumArea = Model.Area.ID.ToString() == "32" ? "agricover-premium-footer" : "";
7733 var isPremiumArea = Model.Area.ID.ToString() == "32" ? "True" : "";
7734 <footer class="footer no-print dw-mod">
7735
7736 <div class="center-container top-container__center-container dw-mod">
7737 @if (isPremiumArea != "True")
7738 {
7739 @RenderLogoColumn()
7740 }
7741 <div class="grid grid--external-bleed-x footer__wrapper agricover-footer @premiumArea">
7742 @if (isPremiumArea == "True")
7743 {
7744 @RenderLogoColumn()
7745 }
7746 @RenderBlockList(subBlocks)
7747 </div>
7748 </div>
7749 <div class="footer__bottom agricover-footer-bottom">
7750 <div class="center-container top-container__center-container dw-mod">
7751 <div class="grid grid--external-bleed-x footer__wrapper">
7752 @if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
7753 {
7754 <div class="footer__bottom-payments">@RenderFooterPayments()</div>
7755 }
7756 <div class="footer__bottom-copyright">@RenderFooterCopyright()</div>
7757 </div>
7758 </div>
7759 </div>
7760 </footer>
7761 }
7762
7763 @helper RenderLogoColumn()
7764 {
7765
7766 <div class="footer__logo agricover-footer__logo dw-mod">
7767 <img src='@Model.Area.Item.GetItem("Layout").GetString("Footer_Logo")' alt="" />
7768 </div>
7769 }
7770 @helper RenderFooterColumn(string header, string content)
7771 {
7772 <h3 class="footer__heading dw-mod">@header</h3>
7773 <div class="footer__content dw-mod">
7774 @content
7775 </div>
7776 }
7777
7778 @helper RenderFooterNewsletterSignUp()
7779 {
7780 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
7781 {
7782 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
7783 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart };
7784
7785 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId });
7786 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" });
7787 form.Add(new TextField
7788 {
7789 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"),
7790 Type = TextFieldType.Email,
7791 CssClass = "newsletter-email",
7792 ActionButton = new Button
7793 {
7794 ButtonType = ButtonType.Submit, Id = "Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "newsletter-btn"
7795 }
7796 });
7797
7798 <h3 class="footer__heading dw-mod">@Translate("Mailing list")<i class="icon--accordion fas fa-chevron-down"></i>
7799 </h3>
7800 <div class="footer__content dw-mod">
7801 @Render(form)
7802 </div>
7803 }
7804
7805 @RenderANPCIcons()
7806 }
7807
7808 @helper RenderFooterSocialLinks()
7809 {
7810 string currentYear = DateTime.Now.Year.ToString();
7811 <h3 class="footer__heading dw-mod">@Translate("Social links")<i class="icon--accordion fas fa-chevron-down"></i></h3>
7812 <div class="footer__content dw-mod">
7813 <div class="collection dw-mod">
7814 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
7815 {
7816 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
7817 string socialIconClass = socialIcon.SelectedValue;
7818 string socialIconTitle = socialIcon.SelectedName;
7819 string socialLink = socialitem.GetString("Link");
7820 if (socialIconTitle == "Facebook")
7821 {
7822 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="fab fa-facebook-f fa-2x"></i></a>
7823 }
7824 else
7825 {
7826 if (socialIconTitle == "LinkedIn")
7827 {
7828 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="fab fa-linkedin-in fa-2x"></i></a>
7829 }
7830 else
7831 {
7832 if (socialIconTitle == "Twitter")
7833 {
7834 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="fab fa-twitter fa-2x"></i></a>
7835 }
7836 else
7837 {
7838 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
7839 }
7840 }
7841
7842 }
7843
7844 }
7845 <p>© @currentYear @Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
7846 </div>
7847 </div>
7848 }
7849
7850 @helper RenderFooterPayments()
7851 {
7852 <div class="footer__content dw-mod">
7853 <div class="collection dw-mod">
7854 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))
7855 {
7856 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;
7857 string paymentImage = null;
7858 string paymentTitle = paymentItem.SelectedName;
7859 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();
7860 if (selected != null)
7861 {
7862 paymentImage = selected.Icon;
7863 }
7864
7865 <div class="footer__card-type">
7866 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" />
7867 </div>
7868 }
7869 </div>
7870 </div>
7871 }
7872
7873 @helper RenderFooterCopyright()
7874 {
7875 <div class="grid__col-12 footer__copyright dw-mod">
7876
7877 </div>
7878
7879 }
7880
7881 @helper RenderANPCIcons()
7882 {
7883 <div class="u-margin-top--lg u-margin-bottom--lg">
7884 <a href="https://anpc.ro/ce-este-sal/" target="_blank"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=250&Compression=95&image=/Files/Images/pictograma1-ANPC.png" alt="ANPC" title="ANPC" /></a>
7885
7886 <a href="https://ec.europa.eu/consumers/odr" target="_blank"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=250&Compression=95&image=/Files/Images/pictograma2-ANPC.png" alt="Solutionarea online a litigiilor" title="Solutionarea online a litigiilor" /></a>
7887 </div>
7888 }
7889 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
7890
7891 @using System
7892 @using System.Web
7893 @using System.Collections.Generic
7894 @using Dynamicweb.Rapido.Blocks.Extensibility
7895 @using Dynamicweb.Rapido.Blocks
7896 @using Dynamicweb.Ecommerce.Common
7897
7898 @{
7899 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");
7900
7901 Block masterScriptReferences = new Block()
7902 {
7903 Id = "MasterScriptReferences",
7904 SortId = 1,
7905 Template = RenderMasterScriptReferences()
7906 };
7907 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);
7908 }
7909
7910 @helper RenderMasterScriptReferences() {
7911
7912 var version = DateTime.UtcNow.Ticks;
7913 <script src="/Files/Templates/Designs/AgricoverCorporate/dist/vendor.min.js?v=@version"></script>
7914 <script src="/Files/Templates/Designs/AgricoverCorporate/js/custom.min.js?v=@version"></script>
7915 <script src="/Files/Templates/Designs/AgricoverCorporate/dist/app.bundle.js?v=@version"></script>
7916 <script src="/Files/Templates/Designs/AgricoverCorporate/js/customStefan.js?v=@version"></script>
7917
7918 PushPromise($"/Files/Templates/Designs/AgricoverCorporate/dist/vendor.min.js?v={version}");
7919 PushPromise($"/Files/Templates/Designs/AgricoverCorporate/js/custom.min.js?v={version}");
7920 PushPromise($"/Files/Templates/Designs/AgricoverCorporate/dist/app.bundle.js?v={version}");
7921
7922 }
7923 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7924
7925 @using System
7926 @using System.Web
7927 @using System.Collections.Generic
7928 @using Dynamicweb.Rapido.Blocks.Extensibility
7929 @using Dynamicweb.Rapido.Blocks
7930 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7931 @using Dynamicweb.Rapido.Services
7932
7933 @{
7934 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");
7935 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
7936 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));
7937
7938 if (!navigationItemsHideSearch || isFavoriteList)
7939 {
7940 Block masterSearchScriptTemplates = new Block()
7941 {
7942 Id = "MasterSearchScriptTemplates",
7943 SortId = 1,
7944 Template = RenderSearchScriptTemplates()
7945 };
7946
7947 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);
7948 }
7949 }
7950
7951 @helper RenderSearchScriptTemplates()
7952 {
7953 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
7954 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
7955 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
7956 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
7957 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
7958 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
7959 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
7960 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
7961 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7962
7963 <script id="SearchGroupsTemplate" type="text/x-template">
7964 {{#.}}
7965 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
7966 {{/.}}
7967 </script>
7968
7969 <script id="SearchProductsTemplate" type="text/x-template">
7970 {{#each .}}
7971 {{#Product}}
7972 {{#ifCond template "!==" "SearchMore"}}
7973 <li class="dropdown__item dropdown__item--seperator dw-mod">
7974 @if (useFacebookPixel)
7975 {
7976 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
7977 }
7978 @if (useGoogleTagManager)
7979 {
7980 <text>{{{googleEnchantImpression googleImpression}}}</text>
7981 }
7982 <div>
7983 <a href="{{link}}"
7984 class="js-typeahead-link u-color-inherit u-pull--left"
7985 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}"
7986 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}">
7987 <div class="u-margin-right u-pull--left {{noimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div>
7988 <div class="u-pull--left">
7989 <div class="u-bold u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div>
7990 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
7991 {
7992 if (pointShopOnly)
7993 {
7994 <text>
7995 {{#if havePointPrice}}
7996 <div>
7997 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
7998 </div>
7999 {{else}}
8000 <small class="help-text u-no-margin">@Translate("Not available")</small>
8001 {{/if}}
8002 {{#unless canBePurchasedWithPoints}}
8003 {{#if havePointPrice}}
8004 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
8005 {{/if}}
8006 {{/unless}}
8007 </text>
8008 }
8009 else
8010 {
8011 <div>{{#ifCond priceDouble '>' 0}}{{price}}{{/ifCond}}</div>
8012 }
8013 }
8014 </div>
8015 </a>
8016 @*<div class="u-margin-left u-pull--right">
8017 @{
8018 var viewBtn = new Link
8019 {
8020 Href = "{{link}}",
8021 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}",
8022 ButtonLayout = ButtonLayout.Secondary,
8023 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside",
8024 Title = Translate("View")
8025 };
8026 }
8027 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
8028 {
8029 <text>{{#if hideAddToCartButton}}</text>
8030 @Render(viewBtn)
8031 <text>{{else}}</text>
8032 @Render(new AddToCartButton
8033 {
8034 HideTitle = true,
8035 ProductId = "{{productId}}",
8036 ProductInfo = "{{productInfo}}",
8037 BuyForPoints = pointShopOnly,
8038 OnClick = "{{facebookPixelAction}}",
8039 CssClass = "u-w80px u-no-margin js-ignore-click-outside",
8040 Icon = new Icon {
8041 CssClass = "js-ignore-click-outside"
8042 },
8043 ExtraAttributes = new Dictionary<string, string>
8044 {
8045 { "{{disabledBuyButton}}", "" }
8046 }
8047 })
8048 <text>{{/if}}</text>
8049 }
8050 else if (showViewButton)
8051 {
8052 @Render(viewBtn)
8053 }
8054 @if (showAddToDownloadButton)
8055 {
8056 <button type="button" class="btn btn--primary u-no-margin btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}">
8057 <i class="fas fa-plus js-button-icon"></i>
8058 </button>
8059 }
8060 </div>*@
8061 </div>
8062 </li>
8063 {{/ifCond}}
8064 {{#ifCond template "===" "SearchMore"}}
8065 {{>SearchMoreProducts}}
8066 {{/ifCond}}
8067 {{/Product}}
8068 {{else}}
8069 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
8070 @Translate("Your search gave 0 results")
8071 </li>
8072 {{/each}}
8073 </script>
8074
8075 <script id="SearchMoreProducts" type="text/x-template">
8076 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
8077 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
8078 @Translate("View all")
8079 </a>
8080 </li>
8081 </script>
8082
8083 <script id="SearchMorePages" type="text/x-template">
8084 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
8085 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
8086 @Translate("View all")
8087 </a>
8088 </li>
8089 </script>
8090
8091 <script id="SearchPagesTemplate" type="text/x-template">
8092 {{#each .}}
8093 {{#ifCond template "!==" "SearchMore"}}
8094 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod">
8095 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit u-flex">
8096 {{#ifCond icon "!==" null}}
8097 <div class="u-margin-right u-flex grid--align-center"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>
8098 {{/ifCond}}
8099
8100 {{#ifCond image "!==" null}}
8101 <div class="seach__image-wrapper dropdown" style='background:url("{{image}}");'></div>
8102 {{/ifCond}}
8103
8104 <div class="u-flex grid--align-center"><div class='u-bold u-truncate-text u-inline-block js-typeahead-name'>{{name}}</div></div>
8105
8106 </a>
8107 </li>
8108 {{/ifCond}}
8109 {{#ifCond template "===" "SearchMore"}}
8110 {{>SearchMorePages}}
8111 {{/ifCond}}
8112 {{else}}
8113 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
8114 @Translate("Your search gave 0 results")
8115 </li>
8116 {{/each}}
8117 </script>
8118
8119 <script id="SearchPagesTemplateWrap" type="text/x-template">
8120 <div class="dropdown__column-header">@Translate("Pages")</div>
8121 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
8122 {{>SearchPagesTemplate}}
8123 </ul>
8124 </script>
8125
8126 <script id="SearchProductsTemplateWrap" type="text/x-template">
8127 <div class="dropdown__column-header">@Translate("Products")</div>
8128 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
8129 {{>SearchProductsTemplate}}
8130 </ul>
8131 </script>
8132 }
8133
8134 @using Dynamicweb.Rapido.Blocks.Components
8135 @using Dynamicweb.Rapido.Blocks.Components.General
8136 @using Dynamicweb.Rapido.Blocks
8137 @using System.IO
8138
8139
8140 @using Dynamicweb.Rapido.Blocks.Components.General
8141 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8142
8143
8144 @* Component *@
8145
8146 @helper RenderVariantMatrix(VariantMatrix settings) {
8147 if (settings != null)
8148 {
8149 int productLoopCounter = 0;
8150 int groupCount = 0;
8151 List<VariantOption> firstDimension = new List<VariantOption>();
8152 List<VariantOption> secondDimension = new List<VariantOption>();
8153 List<VariantOption> thirdDimension = new List<VariantOption>();
8154
8155 foreach (VariantGroup variantGroup in settings.GetVariantGroups())
8156 {
8157 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions())
8158 {
8159 if (groupCount == 0) {
8160 firstDimension.Add(variantOptions);
8161 }
8162 if (groupCount == 1)
8163 {
8164 secondDimension.Add(variantOptions);
8165 }
8166 if (groupCount == 2)
8167 {
8168 thirdDimension.Add(variantOptions);
8169 }
8170 }
8171 groupCount++;
8172 }
8173
8174 int rowCount = 0;
8175 int columnCount = 0;
8176
8177 <script>
8178 var variantsCollection = [];
8179 </script>
8180
8181 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId">
8182 @if (groupCount == 1)
8183 {
8184 <tbody>
8185 @foreach (VariantOption firstVariantOption in firstDimension)
8186 {
8187 var variantId = firstVariantOption.Id;
8188 <tr>
8189 <td class="u-bold">
8190 @firstVariantOption.Name
8191 </td>
8192 <td>
8193 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
8194 </td>
8195 </tr>
8196 productLoopCounter++;
8197 }
8198
8199 <tr>
8200 <td> </td>
8201 <td>
8202 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
8203 </td>
8204 </tr>
8205 </tbody>
8206 }
8207 @if (groupCount == 2)
8208 {
8209 <thead>
8210 <tr>
8211 <td> </td>
8212 @foreach (VariantOption variant in secondDimension)
8213 {
8214 <td>@variant.Name</td>
8215 }
8216 </tr>
8217 </thead>
8218 <tbody>
8219 @foreach (VariantOption firstVariantOption in firstDimension)
8220 {
8221 string variantId = "";
8222 columnCount = 0;
8223
8224 <tr>
8225 <td class="u-min-w120px">@firstVariantOption.Name</td>
8226
8227 @foreach (VariantOption secondVariantOption in secondDimension)
8228 {
8229 variantId = firstVariantOption.Id + "." + secondVariantOption.Id;
8230 <td>
8231 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
8232 </td>
8233
8234 columnCount++;
8235
8236 productLoopCounter++;
8237 }
8238
8239 <td>
8240 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
8241 </td>
8242 </tr>
8243
8244 rowCount++;
8245 }
8246
8247 @{
8248 columnCount = 0;
8249 }
8250
8251 <tr>
8252 <td> </td>
8253 @foreach (VariantOption secondVariantOption in secondDimension)
8254 {
8255 <td>
8256 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
8257 </td>
8258
8259 columnCount++;
8260 }
8261 <td> </td>
8262 </tr>
8263 </tbody>
8264 }
8265 @if (groupCount == 3)
8266 {
8267 <thead>
8268 <tr>
8269 <td> </td>
8270 @foreach (VariantOption thirdVariantOption in thirdDimension)
8271 {
8272 <td>@thirdVariantOption.Name</td>
8273 }
8274 </tr>
8275 </thead>
8276 <tbody>
8277 @foreach (VariantOption firstVariantOption in firstDimension)
8278 {
8279 int colspan = (thirdDimension.Count + 1);
8280
8281 <tr>
8282 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td>
8283 </tr>
8284
8285 foreach (VariantOption secondVariantOption in secondDimension)
8286 {
8287 string variantId = "";
8288 columnCount = 0;
8289
8290 <tr>
8291 <td class="u-min-w120px">@secondVariantOption.Name</td>
8292
8293 @foreach (VariantOption thirdVariantOption in thirdDimension)
8294 {
8295 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id;
8296
8297 <td>
8298 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
8299 </td>
8300
8301 columnCount++;
8302 productLoopCounter++;
8303 }
8304
8305 <td>
8306 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
8307 </td>
8308 </tr>
8309 rowCount++;
8310 }
8311 }
8312
8313 @{
8314 columnCount = 0;
8315 }
8316
8317 <tr>
8318 <td> </td>
8319 @foreach (VariantOption thirdVariantOption in thirdDimension)
8320 {
8321 <td>
8322 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
8323 </td>
8324
8325 columnCount++;
8326 }
8327 <td> </td>
8328 </tr>
8329 </tbody>
8330 }
8331 </table>
8332
8333 <script>
8334 document.addEventListener("DOMContentLoaded", function (event) {
8335 MatrixUpdateQuantity("@settings.ProductId");
8336 });
8337
8338 MatrixUpdateQuantity = function (productId) {
8339 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId);
8340 var allQtyFields = currentMatrix.getElementsByClassName("js-qty");
8341
8342 var qtyRowArr = [];
8343 var qtyColumnArr = [];
8344
8345 var totalQty = 0;
8346
8347 for (var i = 0; i < allQtyFields.length; i++) {
8348 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0;
8349 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0;
8350 }
8351
8352 for (var i = 0; i < allQtyFields.length; i++) {
8353 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value);
8354 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value);
8355 totalQty += parseFloat(allQtyFields[i].value);
8356 }
8357
8358 //Update row counters
8359 for (var i = 0; i < qtyRowArr.length; i++) {
8360 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
8361
8362 if (qtyRowArr[i] != undefined && qtyCounter != null) {
8363 var currentCount = qtyCounter.innerHTML;
8364 qtyCounter.innerHTML = qtyRowArr[i];
8365
8366 if (currentCount != qtyCounter.innerHTML) {
8367 qtyCounter.classList.add("qty-field--active");
8368 }
8369 }
8370
8371 }
8372
8373 //Update column counters
8374 for (var i = 0; i < qtyColumnArr.length; i++) {
8375 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
8376
8377 if (qtyColumnArr[i] != undefined && qtyCounter != null) {
8378 var currentCount = qtyCounter.innerHTML;
8379 qtyCounter.innerHTML = qtyColumnArr[i];
8380
8381 if (currentCount != qtyCounter.innerHTML) {
8382 qtyCounter.classList.add("qty-field--active");
8383 }
8384 }
8385 }
8386
8387 if (document.getElementById("TotalQtyCount_" + productId)) {
8388 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty;
8389 }
8390
8391 //Clean up animations
8392 setTimeout(function () {
8393 for (var i = 0; i < qtyRowArr.length; i++) {
8394 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
8395 if (qtyCounter != null) {
8396 qtyCounter.classList.remove("qty-field--active");
8397 }
8398 }
8399 for (var i = 0; i < qtyColumnArr.length; i++) {
8400 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
8401 if (qtyCounter != null) {
8402 qtyCounter.classList.remove("qty-field--active");
8403 }
8404 }
8405 }, 1000);
8406 }
8407 </script>
8408 }
8409 }
8410
8411 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount)
8412 {
8413 string loopCount = productLoopCounter.ToString();
8414
8415 bool combinationFound = false;
8416 double stock = 0;
8417 double quantityValue = 0;
8418 string note = "";
8419
8420 VariantProduct variantProduct = null;
8421
8422 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct))
8423 {
8424 stock = variantProduct.Stock;
8425 quantityValue = variantProduct.Quantity;
8426 combinationFound = true;
8427 }
8428
8429 if (combinationFound)
8430 {
8431 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" />
8432 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" />
8433 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" />
8434 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" />
8435 <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount">
8436
8437 if (stock != 0)
8438 {
8439 <small>@Translate("Stock") @stock</small>
8440 }
8441
8442 <script>
8443 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}';
8444 variantsCollection.push(variants);
8445 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" );
8446 </script>
8447 }
8448 else
8449 {
8450 <div class="use-btn-height" style="background-color: #a8a8a8"></div>
8451 }
8452 }
8453 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8454
8455 @* Component *@
8456
8457 @helper RenderAddToCart(AddToCart settings)
8458 {
8459 //set Id for quantity selector to get it's value from button
8460 if (settings.QuantitySelector != null)
8461 {
8462 if (string.IsNullOrEmpty(settings.QuantitySelector.Id))
8463 {
8464 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");
8465 }
8466
8467 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id;
8468
8469 if (settings.Disabled)
8470 {
8471 settings.QuantitySelector.Disabled = true;
8472 }
8473
8474 if (string.IsNullOrEmpty(settings.QuantitySelector.Name))
8475 {
8476 settings.QuantitySelector.Name = settings.QuantitySelector.Id;
8477 }
8478 }
8479
8480 if (settings.Disabled)
8481 {
8482 settings.AddButton.Disabled = true;
8483 }
8484
8485 settings.AddButton.CssClass += " btn--condensed";
8486
8487 //unitsSelector
8488 if (settings.UnitSelector != null)
8489 {
8490 if (settings.Disabled)
8491 {
8492 settings.QuantitySelector.Disabled = true;
8493 }
8494 }
8495
8496 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
8497 @if (settings.UnitSelector != null)
8498 {
8499 @Render(settings.UnitSelector)
8500 }
8501 @if (settings.QuantitySelector != null)
8502 {
8503 @Render(settings.QuantitySelector)
8504 }
8505 @Render(settings.AddButton)
8506 </div>
8507 }
8508 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8509
8510 @* Component *@
8511
8512 @helper RenderAddToCartButton(AddToCartButton settings)
8513 {
8514 if (!settings.HideTitle)
8515 {
8516 if (string.IsNullOrEmpty(settings.Title))
8517 {
8518 if (settings.BuyForPoints)
8519 {
8520 settings.Title = Translate("Buy with points");
8521 }
8522 else
8523 {
8524 settings.Title = Translate("Add to cart");
8525 }
8526 }
8527 }
8528 else
8529 {
8530 settings.Title = "";
8531 }
8532
8533 if (settings.Icon == null)
8534 {
8535 settings.Icon = new Icon();
8536 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
8537 }
8538
8539 if (string.IsNullOrEmpty(settings.Icon.Name))
8540 {
8541 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
8542 }
8543
8544 settings.OnClick = "Cart.AddToCart(event, { " +
8545 "id: '" + settings.ProductId + "'," +
8546 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
8547 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
8548 (settings.BuyForPoints ? "buyForPoints: true," : "") +
8549 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
8550 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") +
8551 "});" + settings.OnClick;
8552
8553 @RenderButton(settings)
8554 }
8555 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8556
8557 @* Component *@
8558
8559 @helper RenderUnitSelector(UnitSelector settings)
8560 {
8561 if (string.IsNullOrEmpty(settings.Id))
8562 {
8563 settings.Id = Guid.NewGuid().ToString("N");
8564 }
8565 var disabledClass = settings.Disabled ? "disabled" : "";
8566
8567 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" />
8568 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
8569 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label>
8570 <div class="dropdown__content dw-mod">
8571 @settings.OptionsContent
8572 </div>
8573 <label class="dropdown-trigger-off" for="@settings.Id"></label>
8574 </div>
8575 }
8576 @using System.Reflection
8577 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8578
8579 @* Component *@
8580
8581 @helper RenderQuantitySelector(QuantitySelector settings)
8582 {
8583 var attributes = new Dictionary<string, string>();
8584
8585 /*base settings*/
8586 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
8587 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
8588 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
8589 if (settings.Disabled) { attributes.Add("disabled", "true"); }
8590 if (settings.Required) { attributes.Add("required", "true"); }
8591 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
8592 /*end*/
8593
8594 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
8595 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
8596 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
8597 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
8598 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
8599 if (settings.Min == null) { settings.Min = 1; }
8600 attributes.Add("min", settings.Min.ToString());
8601 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); }
8602 if (settings.Value == null) { settings.Value = 1; }
8603 attributes.Add("value", settings.Value.ToString());
8604 attributes.Add("type", "number");
8605
8606 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8607
8608 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
8609 }
8610 @using Dynamicweb.Rapido.Blocks.Components
8611
8612 @using Dynamicweb.Frontend
8613 @using Dynamicweb.Frontend.Devices
8614 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8615 @using Dynamicweb.Rapido.Blocks.Components.General
8616 @using System.Collections.Generic;
8617
8618 @* Component *@
8619
8620 @helper RenderCustomerCenterList(CustomerCenterList settings)
8621 {
8622 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false;
8623 string hideActions = isTouchDevice ? "u-block" : "";
8624
8625 <table class="table data-list dw-mod">
8626 @if (settings.GetHeaders().Length > 0) {
8627 <thead>
8628 <tr class="u-bold">
8629 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders())
8630 {
8631 var attributes = new Dictionary<string, string>();
8632 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); }
8633 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); }
8634 attributes.Add("align", header.Align.ToString());
8635 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8636
8637 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td>
8638 }
8639 </tr>
8640 </thead>
8641 }
8642 @foreach (CustomerCenterListItem listItem in settings.GetItems())
8643 {
8644 int columnCount = 0;
8645 int totalColumns = listItem.GetInfoItems().Length;
8646 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : "";
8647 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N");
8648
8649 var attributes = new Dictionary<string, string>();
8650 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); };
8651
8652 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8653 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)>
8654 <tr>
8655 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) {
8656 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
8657
8658 <td rowspan="2" @onClick class="data-list__main-item dw-mod">
8659 @if (!string.IsNullOrEmpty(listItem.Title)) {
8660 <div class="u-bold">@listItem.Title</div>
8661 }
8662 @if (!string.IsNullOrEmpty(listItem.Description)) {
8663 <div>@listItem.Description</div>
8664 }
8665 </td>
8666 }
8667
8668 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems())
8669 {
8670 var infoAttributes = new Dictionary<string, string>();
8671 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); };
8672 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); };
8673 infoAttributes.Add("align", infoItem.Align.ToString());
8674
8675 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8676 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
8677
8678 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod">
8679 @if (!string.IsNullOrEmpty(infoItem.Title)) {
8680 <div>@infoItem.Title</div>
8681 }
8682 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) {
8683 <div><small>@infoItem.Subtitle</small></div>
8684 }
8685 </td>
8686
8687 columnCount++;
8688 }
8689 </tr>
8690 <tr>
8691 <td colspan="@columnCount" align="right" class="u-va-bottom u-no-border">
8692 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id">
8693 @foreach (ButtonBase action in listItem.GetActions())
8694 {
8695 action.ButtonLayout = ButtonLayout.LinkClean;
8696 action.Icon.CssClass += " u-full-height";
8697 action.CssClass += " data-list__action-button link";
8698
8699 @Render(action)
8700 }
8701 </div>
8702 </td>
8703 </tr>
8704 </tbody>
8705 }
8706 </table>
8707 }
8708 @using System.Reflection
8709 @using Dynamicweb.Rapido.Blocks.Components
8710 @using Dynamicweb.Rapido.Blocks.Components.Articles
8711 @using Dynamicweb.Rapido.Blocks
8712
8713
8714 @functions{
8715
8716 public class DF_ItemListField : ComponentBase
8717 {
8718 public int[] itemList {get; set;}
8719 public string itemListDisplay {get; set;}
8720 public string itemLabel {get; set;}
8721 }
8722
8723 }
8724
8725 @helper RenderDF_ItemListField(DF_ItemListField settings)
8726 {
8727 if(settings.itemList != null)
8728 {
8729 int[] itemList = settings.itemList;
8730 string itemLabel = settings.itemLabel;
8731 string itemListDisplay = settings.itemListDisplay != null ? settings.itemListDisplay: "linkList";
8732 var pageService = Dynamicweb.Extensibility.ServiceLocator.Current.GetInstance<Dynamicweb.Content.IPageService>();
8733 var pages = pageService.GetPages(itemList);
8734
8735 if(pages.Any())
8736 {
8737 <div class="grid__col-md-4 grid__col-sm-12 u-margin-bottom">
8738 <div class="u-bold">@itemLabel</div>
8739 <ul>
8740 @foreach(var page in pages)
8741 {
8742 if(page != null)
8743 {
8744 <li><a href="/Default.aspx?ID=@page.ID">@page.MenuText</a></li>
8745 }
8746 }
8747 </ul>
8748 </div>
8749
8750 }
8751 }
8752 }
8753
8754 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
8755
8756 @using System
8757 @using System.Web
8758 @using System.Collections.Generic
8759 @using Dynamicweb.Rapido.Blocks.Extensibility
8760 @using Dynamicweb.Rapido.Blocks
8761
8762 @{
8763 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
8764
8765 Block primaryBottomSnippets = new Block()
8766 {
8767 Id = "MasterJavascriptInitializers",
8768 SortId = 100,
8769 Template = RenderPrimaryBottomSnippets()
8770 };
8771 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);
8772
8773 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
8774 {
8775 Block miniCartPageId = new Block
8776 {
8777 Id = "MiniCartPageId",
8778 Template = RenderMiniCartPageId()
8779 };
8780 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId);
8781 }
8782 }
8783
8784 @helper RenderPrimaryBottomSnippets()
8785 {
8786 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");
8787 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
8788
8789 //if (isWireframeMode)
8790 //{
8791 //<script>
8792 //Wireframe.Init(true);
8793 //</script>
8794 //}
8795
8796
8797 if (useGoogleTagManager)
8798 {
8799 <script>
8800 document.addEventListener('addToCart', function(event) {
8801 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
8802 if (typeof googleImpression == "string") {
8803 googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
8804 }
8805 dataLayer.push({
8806 'event': 'addToCart',
8807 'ecommerce': {
8808 'currencyCode': googleImpression.currency,
8809 'add': {
8810 'products': [{
8811 'name': googleImpression.name,
8812 'id': googleImpression.id,
8813 'price': googleImpression.price,
8814 'brand': googleImpression.brand,
8815 'category': googleImpression.category,
8816 'variant': googleImpression.variant,
8817 'quantity': event.detail.quantity
8818 }]
8819 }
8820 }
8821 });
8822 });
8823 </script>
8824 }
8825
8826 //if digitalwarehouse
8827 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))
8828 {
8829 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);
8830
8831 if (string.IsNullOrEmpty(cartContextId))
8832 {
8833 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");
8834 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);
8835 cartContextId = cartSettings.OrderContextID;
8836 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;
8837 }
8838
8839 <script>
8840 let downloadCart = new DownloadCart({
8841 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),
8842 contextId: "@cartContextId",
8843 addButtonText: "@Translate("Add")",
8844 removeButtonText: "@Translate("Remove")"
8845 });
8846 </script>
8847 }
8848
8849 <!--$$Javascripts-->
8850 }
8851
8852 @helper RenderMiniCartPageId()
8853 {
8854
8855 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
8856 <script>
8857 window.cartId = "@miniCartFeedPageId";
8858 </script>
8859
8860 }
8861 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
8862
8863 @using System
8864 @using System.Web
8865 @using System.Collections.Generic
8866 @using Dynamicweb.Rapido.Blocks
8867
8868 @{
8869 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");
8870
8871 }
8872
8873 @* Include Replacement blocks *@
8874 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
8875
8876 @using System
8877 @using System.Web
8878 @using System.Collections.Generic
8879 @using Dynamicweb.Rapido.Blocks
8880 @using Dynamicweb.Rapido.Blocks.Extensibility
8881
8882 @{
8883
8884
8885 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master");
8886
8887
8888 //string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
8889 //string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
8890 //string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
8891 //string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
8892 //string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
8893 //string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
8894 IList<ItemViewModel> footerColumnOneLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetItems("Pages");
8895 IList<ItemViewModel> footerColumnTwoLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetItems("Pages");
8896 IList<ItemViewModel> footerColumnThreeLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetItems("Pages");
8897 IList<ItemViewModel> footerColumnFourLinks = new List<ItemViewModel>();
8898 if(Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour") != null) {
8899 footerColumnFourLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour").GetItems("Pages");
8900 }
8901
8902
8903 bool footerColumnOneHasLinks = footerColumnOneLinks != null && footerColumnOneLinks.Count > 0 ? true : false;
8904 bool footerColumnTwoHasLinks = footerColumnTwoLinks != null && footerColumnTwoLinks.Count > 0 ? true : false;
8905 bool footerColumnThreeHasLinks = footerColumnThreeLinks != null && footerColumnThreeLinks.Count > 0 ? true : false;
8906 bool footerColumnFourHasLinks = footerColumnFourLinks != null && footerColumnFourLinks.Count > 0 ? true : false;
8907
8908
8909 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader) || footerColumnOneHasLinks)
8910 {
8911
8912 Block masterFooterColumnOne = new Block
8913 {
8914 Id = "MasterFooterColumnOne",
8915 SortId = 10,
8916 Template = RenderFooterColumnCustom(footerColumnOneHeader, footerColumnOneContent, footerColumnOneLinks),
8917 Design = new Design {
8918 Size = "auto",
8919 RenderType = RenderType.Column,
8920 CssClass = "footer__column-wrapper"
8921 }
8922 };
8923 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnOne);
8924 }
8925
8926 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader) )
8927 {
8928 Block masterFooterColumnTwo = new Block
8929 {
8930 Id = "MasterFooterColumnTwo",
8931 SortId = 20,
8932 Template = RenderFooterColumnCustom(footerColumnTwoHeader, footerColumnTwoContent, footerColumnTwoLinks),
8933 Design = new Design
8934 {
8935 Size = "auto",
8936 RenderType = RenderType.Column,
8937 CssClass = "footer__column-wrapper"
8938 }
8939 };
8940 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnTwo);
8941 }
8942
8943 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
8944 {
8945 Block masterFooterColumnThree = new Block
8946 {
8947 Id = "MasterFooterColumnThree",
8948 SortId = 30,
8949 Template = RenderFooterColumnCustom(footerColumnThreeHeader, footerColumnThreeContent, footerColumnThreeLinks),
8950 Design = new Design
8951 {
8952 Size = "auto",
8953 RenderType = RenderType.Column,
8954 CssClass = "footer__column-wrapper"
8955 }
8956 };
8957 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnThree);
8958 }
8959
8960 if (!string.IsNullOrEmpty(footerColumnFourContent) || !string.IsNullOrEmpty(footerColumnFourHeader))
8961 {
8962 Block masterFooterColumnFour = new Block
8963 {
8964 Id = "MasterFooterColumnFour",
8965 SortId = 40,
8966 Template = RenderFooterColumnCustom(footerColumnFourHeader, footerColumnFourContent, footerColumnFourLinks),
8967 Design = new Design
8968 {
8969 Size = "auto",
8970 RenderType = RenderType.Column,
8971 CssClass = "footer__column-wrapper"
8972 }
8973 };
8974 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnFour);
8975 }
8976
8977 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
8978 {
8979 Block masterFooterNewsletterSignUp = new Block
8980 {
8981 Id = "MasterFooterNewsletterSignUp",
8982 SortId = 2,
8983 Template = RenderFooterNewsletterSignUpCustom(),
8984 Design = new Design
8985 {
8986 Size = "auto",
8987 RenderType = RenderType.Column,
8988 CssClass = "footer__column-wrapper open"
8989 }
8990 };
8991 // masterBlocksBlocksPage.ReplaceBlock(masterFooterNewsletterSignUp);
8992 }
8993
8994 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
8995 {
8996 Block masterFooterSocialLinks = new Block
8997 {
8998 Id = "MasterFooterSocialLinks",
8999 SortId = 1,
9000 Template = RenderFooterSocialLinksCustom(),
9001 Design = new Design
9002 {
9003 Size = "auto",
9004 RenderType = RenderType.Column,
9005 CssClass = "footer__column-wrapper"
9006 }
9007 };
9008 //masterBlocksBlocksPage.ReplaceBlock(masterFooterSocialLinks);
9009 }
9010
9011 // edit payments
9012 //if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
9013 //{
9014 //Block masterFooterPaymentsCustom = new Block
9015 //{
9016 //Id = "MasterFooterPayments",
9017 //SortId = 60,
9018 //Design = new Design
9019 //{
9020 //Size = "12",
9021 //RenderType = RenderType.Column
9022 //}
9023 //};
9024 //masterBlocksBlocksPage.ReplaceBlock(masterFooterPaymentsCustom);
9025 //}
9026
9027
9028 Block masterFooterCopyrightCustom = new Block
9029 {
9030 Id = "MasterFooterCopyright",
9031 SortId = 70,
9032 Template = RenderFooterCopyrightCustom(),
9033 Design = new Design
9034 {
9035 Size = "12",
9036 RenderType = RenderType.Column
9037 }
9038 };
9039 masterBlocksBlocksPage.ReplaceBlock(masterFooterCopyrightCustom);
9040 }
9041
9042 @helper RenderFooterColumnCustom(string header, string content, IList<ItemViewModel> links) {
9043 <h3 class="footer__heading dw-mod">@header<i class="icon--accordion fas fa-chevron-down"></i></h3>
9044 <div class="footer__content dw-mod">
9045 @if(links.Any()){
9046 <ul class="footer-links u-margin-bottom dw-mod">
9047 @foreach(var pageLink in links){
9048 string link = pageLink.GetString("Link");
9049 string title = pageLink.GetString("Title");
9050 string icon = pageLink.GetString("Icon");
9051 string newWindow = pageLink.GetBoolean("NewWindow") ? " target=\"_blank\"" : "";
9052 <li class="footer-links__item dw-mod">
9053 <a href="@link" @newWindow class="footer-links__link dw-mod">@icon @title</a>
9054 </li>
9055 }
9056 </ul>
9057 }else{
9058 @content
9059 }
9060 </div>
9061 }
9062 @helper RenderFooterNewsletterSignUpCustom() {
9063 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
9064
9065 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>
9066 <div class="footer__content dw-mod">
9067 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data">
9068 <input name="ID" value="@newsletterSignUpPageId" type="hidden" />
9069 <label for="NewsletterEmail" class="u-margin-bottom">@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us")</label>
9070 <div class="form__field-combi">
9071 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" />
9072 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' />
9073 </div>
9074 </form>
9075 </div>
9076
9077
9078 }
9079
9080 @helper RenderFooterSocialLinksCustom() {
9081 string logoFooter = Model.Area.Item.GetItem("Custom").GetFile("WhiteLogoImage") != null ? Model.Area.Item.GetItem("Custom").GetFile("WhiteLogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
9082
9083 if (Path.GetExtension(logoFooter).ToLower() != ".svg")
9084 {
9085 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
9086 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
9087 logoFooter = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logoFooter;
9088 }
9089 else
9090 {
9091 logoFooter = HttpUtility.UrlDecode(logoFooter);
9092 }
9093
9094 <div class="footer_logo__wrapper">
9095 <img src="@logoFooter" alt='@Translate("Logo")' />
9096 </div>
9097 <div class="footer__content dw-mod">
9098 <div class="collection dw-mod">
9099 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
9100 {
9101 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
9102 string socialIconClass = socialIcon.SelectedValue;
9103 string socialIconTitle = socialIcon.SelectedName;
9104 string socialLink = socialitem.GetString("Link");
9105
9106 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
9107 }
9108 </div>
9109 </div>
9110 }
9111
9112 @helper RenderFooterCopyrightCustom() {
9113 <div class="grid__col-12 footer__copyright dw-mod">
9114 <p class="u--heading-sans u-ta-center">@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
9115 </div>
9116 }
9117 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
9118
9119 @using System
9120 @using System.Web
9121 @using System.Collections.Generic
9122 @using Dynamicweb.Rapido.Blocks
9123 @using Dynamicweb.Rapido.Blocks.Extensibility
9124 @using Dynamicweb.Security.UserManagement
9125 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
9126 @{
9127 Block loginModalCustom = new Block()
9128 {
9129 Id = "LoginModal",
9130 SortId = 10,
9131 Template = LoginModalCustom()
9132 };
9133
9134 loginBlocksPage.RemoveBlock(loginModalCustom);
9135 }
9136
9137 @helper LoginModalCustom() {
9138 int pageId = Model.TopPage.ID;
9139 string userSignedInError = !Model.LogOnFailed ? "" : "checked";
9140 string userSignedInErrorText = "";
9141 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
9142 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
9143 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
9144 bool isCartPage = GetPageIdByNavigationTag("CartPage") == pageId ? true : false;
9145 string redirectToDashboard = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerDashboard"));
9146 string redirectDecision = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ProductID")) || !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("GroupID")) || isCartPage ? "" : redirectToDashboard;
9147
9148 if (Model.LogOnFailed) {
9149 switch (Model.LogOnFailedReason)
9150 {
9151 case LogOnFailedReason.PasswordLengthInvalid:
9152 userSignedInErrorText = Translate("Password length is invalid");
9153 break;
9154 case LogOnFailedReason.IncorrectLogin:
9155 userSignedInErrorText = Translate("Invalid email or password");
9156 break;
9157 case LogOnFailedReason.ExceededFailedLogOnLimit:
9158 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
9159 break;
9160 case LogOnFailedReason.LoginLocked:
9161 userSignedInErrorText = Translate("The user account is temporarily locked");
9162 break;
9163 case LogOnFailedReason.PasswordExpired:
9164 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
9165 break;
9166 default:
9167 userSignedInErrorText = Translate("An unknown error occured");
9168 break;
9169 }
9170 }
9171
9172 <!-- Trigger for the login modal -->
9173 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError />
9174
9175 <!-- Login modal -->
9176 <div class="modal-container">
9177 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label>
9178 <div class="modal modal--md" id="SignInModal">
9179 <div class="modal__header no-border">
9180 <button type="button" class="close btn btn--primary dw-mod u-margin-top--lg"><i class="fas fa-times"></i></button>
9181 <h2 class="u-ta-center">@Translate("Sign in")</h2>
9182 </div>
9183 <div class="modal__body">
9184 <form method="post" id="LoginForm" class="u-no-margin">
9185 <input type="hidden" name="ID" value="@pageId" />
9186 <input type="hidden" name="DWExtranetUsernameRemember" value="True" />
9187 <input type="hidden" name="DWExtranetPasswordRemember" value="True" />
9188 @if(redirectDecision!=""){
9189 <input type="hidden" name="redirect" value="@redirectDecision">
9190 }
9191 @* <label for="username">@Translate("Email")</label> *@
9192 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" />
9193
9194 @* <label for="password">@Translate("Password")</label> *@
9195 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" />
9196 <div class="field-error dw-mod">@userSignedInErrorText</div>
9197
9198 <div class="form__field-group dw-mod">
9199 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control">
9200 <label for="LoginRememberMe">
9201 @Translate("Remember me", "Remember me")
9202 </label>
9203 </div>
9204
9205 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?")</a>
9206
9207 <button type="submit" class="btn btn--primary btn--full dw-mod u-margin-top--lg" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button>
9208 @{
9209 ProviderCollection providers = Provider.GetActiveProviders();
9210 }
9211
9212 @foreach(Provider LoginProvider in providers)
9213 {
9214 var ProviderName = LoginProvider.Name.ToLower();
9215 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a>
9216 }
9217
9218
9219 <div class="dw-mod u-margin-top--lg">
9220 <div class="u-ta-center u-margin-bottom--lg">
9221 <h5 class="u-no-margin">@Translate("No Idera account?")</h5>
9222 <p class="u-no-margin" style="font-size: 13px;">@Translate("Follow the steps and become a member today")</p>
9223 </div>
9224 <a class="btn btn--primary btn--full dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")</a>
9225 </div>
9226 </form>
9227 </div>
9228 </div>
9229 </div>
9230 }
9231
9232 @* Include New blocks *@
9233 @*Include("NewBlocks/Promotion.cshtml")*@
9234 @using Dynamicweb.Content
9235
9236
9237 @{
9238 //BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master");
9239
9240 Block megaMenu = new Block
9241 {
9242 Id = "MegaMenu",
9243 SortId = 100,
9244 Template = RenderMegaMenu()
9245 };
9246 masterBlocksBlocksPage.Add(MasterBlockId.MasterFooter, megaMenu);
9247 }
9248
9249 @helper RenderMegaMenu(){
9250 int megaMenuPage = GetPageIdByNavigationTag("MenuConfiguration");
9251 if(megaMenuPage > 0){
9252 <div class="hidden">
9253 @RenderPageContent(@megaMenuPage)
9254 </div>
9255 }
9256 }
9257
9258 @*Include("NewBlocks/FooterPayments.cshtml")*@
9259
9260
9261 @functions {
9262
9263 public class ManifestIcon
9264 {
9265 public string src { get; set; }
9266 public string type { get; set; }
9267 public string sizes { get; set; }
9268 }
9269
9270 public class Manifest
9271 {
9272 public string name { get; set; }
9273 public string short_name { get; set; }
9274 public string start_url { get; set; }
9275 public string display { get; set; }
9276 public string background_color { get; set; }
9277 public string theme_color { get; set; }
9278 public List<ManifestIcon> icons { get; set; }
9279 }
9280
9281 }
9282
9283 <!DOCTYPE html>
9284
9285 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
9286
9287
9288 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
9289 @RenderBlockList(masterPage.BlocksRoot.BlocksList)
9290
9291
9292
9293 @helper RenderMasterHead()
9294 {
9295 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList();
9296
9297 <head>
9298 <!-- AgricoverCorporate version 3.4.2 -->
9299 @{
9300 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
9301 Uri url = Dynamicweb.Context.Current.Request.Url;
9302 string hostName = url.Host;
9303 string alternateDefaultUrl = "";
9304 var isHomepage = GetPageIdByNavigationTag("homepage") == Pageview.ID;
9305
9306 if (Pageview.Area.IsMaster)
9307 {
9308 languages.Add(Pageview.Page);
9309 if (Pageview.Page.Languages != null)
9310 {
9311 foreach (var language in Pageview.Page.Languages)
9312 {
9313 languages.Add(language);
9314 }
9315 }
9316 }
9317 else
9318 {
9319 languages.Add(Pageview.Page.MasterPage);
9320 if (Pageview.Page.MasterPage != null)
9321 {
9322 if (Pageview.Page.MasterPage.Languages != null)
9323 {
9324 foreach (var language in Pageview.Page.MasterPage.Languages)
9325 {
9326 languages.Add(language);
9327 }
9328 }
9329 }
9330 }
9331
9332 foreach (var language in languages)
9333 {
9334 if (language?.Area != null)
9335 {
9336 @*if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published)*@
9337 if (language.Published && language.Area.Published && language.Area.Active)
9338 {
9339 if (!string.IsNullOrEmpty(language.Area.DomainLock))
9340 {
9341 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
9342 }
9343
9344 string querystring = $"Default.aspx?ID={language.ID}";
9345 string pageID = Pageview.Page.ID.ToString();
9346 string canonicalURL = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + pageID);
9347 var firstPageId = Model.Area.FirstActivePage.ID.ToString();
9348 canonicalURL = firstPageId == pageID ? "" : canonicalURL;
9349 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
9350 {
9351 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
9352 }
9353
9354 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
9355 {
9356 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
9357 }
9358
9359 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
9360 {
9361 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
9362 }
9363
9364 if (isHomepage)
9365 {
9366 querystring = canonicalURL;
9367 }
9368
9369 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
9370 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
9371 string defaultUrl = $"{url.Scheme}://{hostName}";
9372 alternateDefaultUrl = defaultUrl;
9373 var currentAreaId = Model.Area.ID;
9374
9375 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
9376
9377
9378 if (HttpContext.Current.Request.QueryString.Get("GroupID") == null)
9379 {
9380 if (currentAreaId == language.Area.ID && language.Area.CultureInfo.Name.ToLower() == "ro-ro")
9381 {
9382 Pageview.Meta.AddTag("customCan", "<link rel=\"canonical\" href=\"" + href + "\">");
9383 }
9384
9385 if (currentAreaId == language.Area.ID && language.Area.CultureInfo.Name.ToLower() == "en-gb")
9386 {
9387 Pageview.Meta.AddTag("customCan", "<link rel=\"canonical\" href=\"" + href + "\">");
9388 }
9389 }
9390
9391 @*redirect to homepage on Page not found (404)*@
9392 var page404Id = GetPageIdByNavigationTag("Page404");
9393 if (Pageview.Page.ID == page404Id)
9394 {
9395 if (currentAreaId == language.Area.ID && language.Area.CultureInfo.Name.ToLower() == "ro-ro")
9396 {
9397 <meta http-equiv="refresh" content="5; URL=@alternateDefaultUrl"/>
9398 }
9399
9400 if (currentAreaId == language.Area.ID && language.Area.CultureInfo.Name.ToLower() == "en-gb")
9401 {
9402 <meta http-equiv="refresh" content="5; URL=@(alternateDefaultUrl)/en"/>
9403 }
9404 }
9405 }
9406 }
9407 }
9408
9409 <link rel="alternate" hreflang="x-default" href="@alternateDefaultUrl">
9410 }
9411
9412 @RenderBlockList(subBlocks)
9413 <!-- Include the css file -->
9414 @*<link rel="preload" href="https://prod-druid-apc.azureedge.net/v2/druid_webchat_v2.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
9415 <noscript><link rel="stylesheet" href="https://prod-druid-apc.azureedge.net/v2/druid_webchat_v2.css"></noscript> *@
9416 @*<link defer href="https://prod-druid-apc.azureedge.net/druid_webchat.css" rel="stylesheet">*@
9417 </head>
9418 }
9419
9420 @helper RenderMasterMetadata()
9421 {
9422 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();
9423 var brandColors = swatches.GetColorSwatch(1);
9424 string brandColorOne = brandColors.Palette["BrandColor1"];
9425
9426 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null)
9427 {
9428 Manifest manifest = new Manifest
9429 {
9430 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),
9431 short_name = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppShortName")) ? Model.Area.Item.GetItem("Settings").GetString("AppShortName") : Model.Area.Item.GetItem("Settings").GetString("AppName"),
9432 start_url = "/",
9433 display = "standalone",
9434 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),
9435 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")
9436 };
9437
9438 manifest.icons = new List<ManifestIcon>
9439 {
9440 new ManifestIcon
9441 {
9442 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
9443 sizes = "192x192",
9444 type = "image/png"
9445 },
9446 new ManifestIcon
9447 {
9448 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
9449 sizes = "512x512",
9450 type = "image/png"
9451 },
9452 new ManifestIcon
9453 {
9454 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
9455 sizes = "1024x1024",
9456 type = "image/png"
9457 }
9458 };
9459
9460 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/AgricoverCorporate/manifest.json");
9461 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
9462 string currentManifest = File.ReadAllText(manifestFilePath);
9463
9464 if (manifestJSON != currentManifest)
9465 {
9466 File.WriteAllText(manifestFilePath, manifestJSON);
9467 }
9468 }
9469
9470 var titlePrefix = Translate("Agricover");
9471 //string titleTag = Model.Title + " | " + titlePrefix;
9472 string titleTag = Model.Title;
9473 string index = "index";
9474 string follow = "follow";
9475 if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("q")))
9476 {
9477 index = "noindex";
9478 follow = "nofollow";
9479 }
9480
9481 <meta charset="utf-8"/>
9482 <title>@titleTag</title>
9483 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9484 <meta name="robots" content="@index, @follow">
9485 <meta name="theme-color" content="@brandColorOne"/>
9486 <script type="application/ld+json">
9487 {
9488 "@@context": "https://schema.org",
9489 "@@type": "WebSite",
9490 "url": "https://agricover.ro"
9491 }
9492 </script>
9493 <script type="application/ld+json">
9494 {
9495 "@@context": "https://schema.org",
9496 "@@type": "Organization",
9497 "url": "https://agricover.ro",
9498 "contactPoint": [
9499 {
9500 "@@type": "ContactPoint",
9501 "email": "agricover@agricover.ro",
9502 "contactType": "customer service"
9503 }
9504 ]
9505 }
9506 </script>
9507 @RenderSnippet("SchemaOrg")
9508 if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null)
9509 {
9510 Pageview.Meta.AddTag("og:image", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage")));
9511 }
9512
9513 if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description))
9514 {
9515 Pageview.Meta.AddTag("og:description", Model.Description);
9516 }
9517
9518 @*Pageview.Meta.AddTag("og:title", Model.Title);*@
9519 Pageview.Meta.AddTag("og:title", titleTag);
9520 Pageview.Meta.AddTag("og:site_name", Model.Name);
9521 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString());
9522 Pageview.Meta.AddTag("og:type", "Website");
9523
9524 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID")))
9525 {
9526 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"));
9527 }
9528
9529 @Model.MetaTags
9530 }
9531
9532 @helper RenderMasterCss()
9533 {
9534 var fonts = new string[]
9535 {
9536 getFontFamily("Layout", "HeaderFont"),
9537 getFontFamily("Layout", "SubheaderFont"),
9538 getFontFamily("Layout", "TertiaryHeaderFont"),
9539 getFontFamily("Layout", "BodyText"),
9540 getFontFamily("Layout", "Header", "ToolsFont"),
9541 getFontFamily("Layout", "Header", "NavigationFont"),
9542 getFontFamily("Layout", "MobileNavigation", "Font"),
9543 getFontFamily("ProductList", "Facets", "HeaderFont"),
9544 getFontFamily("ProductPage", "PriceFontDesign"),
9545 getFontFamily("Ecommerce", "SaleSticker", "Font"),
9546 getFontFamily("Ecommerce", "NewSticker", "Font"),
9547 getFontFamily("Ecommerce", "CustomSticker", "Font")
9548 };
9549 var premiumAreaID = Model.Area.ID.ToString() == "33" ? "31" : Model.Area.ID.ToString();
9550 var DesignFolder = Pageview.Layout.Design.Name;
9551
9552 string autoCssLink = "/Files/Templates/Designs/AgricoverCorporate/css/rapido/agricovercorporate_" + premiumAreaID + ".min.css?v=148&ticks=" + Model.Area.UpdatedDate.Ticks;
9553 string motorinaIngrasaminteCssLink = "/Files/Templates/Designs/AgricoverCorporate/css/motorina-ingrasaminte_" + premiumAreaID + ".css";
9554 var motorinaIngrasaminteCssLinkWithTicks = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath(motorinaIngrasaminteCssLink));
9555 string applicationCssLinkString = "/Files/Templates/Designs/" + DesignFolder + "/dist/app.bundle.css";
9556 var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath(applicationCssLinkString));
9557 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
9558 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
9559 string fontAwesomeCssLink = "/Files/Templates/Designs/AgricoverCorporate/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
9560 if (useFontAwesomePro)
9561 {
9562 fontAwesomeCssLink = "/Files/Templates/Designs/AgricoverCorporate/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
9563 }
9564
9565 //Favicon
9566 <link href="@favicon" rel="icon" type="image/png">
9567
9568 <link rel="stylesheet" href="/Files/Templates/Designs/AgricoverCorporate/css/base/base.min.css" type="text/css">
9569
9570 //AgricoverCorporate Css from Website Settings
9571 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
9572 <link rel="stylesheet" href="@motorinaIngrasaminteCssLink?@(motorinaIngrasaminteCssLinkWithTicks.LastWriteTime.Ticks)"
9573 type="text/css">
9574
9575 <link rel="preload" href="@(applicationCssLinkString + "?" + cssStyleFileInfo.LastWriteTime.Ticks)" as="style"
9576 onload="this.onload=null;this.rel='stylesheet'">
9577 <noscript>
9578 <link rel="stylesheet" href="@(applicationCssLinkString + "?" + cssStyleFileInfo.LastWriteTime.Ticks)">
9579 </noscript>
9580
9581 // Custom cariere css
9582 <link rel="preload" href="/Files/Templates/Designs/AgricoverCorporate/dist/landing-page-cariere.css" as="style"
9583 onload="this.onload=null;this.rel='stylesheet'">
9584
9585 //Font awesome
9586 <link rel="preload" href="@fontAwesomeCssLink" as="style" onload="this.onload=null;this.rel='stylesheet'">
9587 <noscript>
9588 <link rel="stylesheet" href="@fontAwesomeCssLink">
9589 </noscript>
9590
9591 //Flag icon
9592 <link rel="preload" href="/Files/Templates/Designs/AgricoverCorporate/css/fonts/flag-icon.min.css" as="style"
9593 onload="this.onload=null;this.rel='stylesheet'">
9594 <noscript>
9595 <link rel="stylesheet" href="/Files/Templates/Designs/AgricoverCorporate/css/fonts/flag-icon.min.css">
9596 </noscript>
9597
9598 //Google fonts
9599 var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x)));
9600
9601 <link rel="preload" href="https://fonts.googleapis.com/css?family=@family&display=swap" as="style"
9602 onload="this.onload=null;this.rel='stylesheet'">
9603 <noscript>
9604 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=@family&display=swap">
9605 </noscript>
9606 }
9607
9608 @helper RenderMasterManifest()
9609 {
9610 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))
9611 {
9612 <link rel="manifest" href="/Files/Templates/Designs/AgricoverCorporate/manifest.json">
9613 PushPromise("/Files/Templates/Designs/AgricoverCorporate/manifest.json");
9614 }
9615 }
9616
9617 @helper RenderMasterBody()
9618 {
9619 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();
9620 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";
9621 if (!String.IsNullOrEmpty(designLayout))
9622 {
9623 designLayout = "class=\"" + designLayout + "\"";
9624 }
9625
9626 var isRomanianLayer = Model.Area.ID.ToString() == "31";
9627 <body @designLayout>
9628 @RenderBlockList(subBlocks)
9629
9630 @{
9631 bool consentIsGranted = System.Web.HttpContext.Current.Request?.Cookies["Dynamicweb.CookieOptInLevel"]?.Value == "2";
9632 }
9633 @if (consentIsGranted)
9634 {
9635 <script>
9636 document.addEventListener("DOMContentLoaded", function () {
9637 consentGranted();
9638 });
9639
9640 function consentGranted() {
9641 gtag('consent', 'update', {
9642 'ad_storage': 'granted',
9643 'ad_user_data': 'granted',
9644 'ad_personalization': 'granted',
9645 'analytics_storage': 'granted',
9646 'functionality_storage': 'granted',
9647 'personalization_storage': 'granted',
9648 'security_storage': 'granted'
9649 });
9650 }
9651 </script>
9652 }
9653
9654 </body>
9655 }
9656
9657 @helper RenderMasterHeader()
9658 {
9659 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();
9660 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
9661 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";
9662 string isStiky = Model.PropertyItem != null & Model.PropertyItem.GetList("MoveThisPageBehindTheHeader") != null ? Model.PropertyItem.GetList("MoveThisPageBehindTheHeader").SelectedValue : "False";
9663 var isStickyHomepage = Pageview.Device.ToString() == "Mobile" && GetPageIdByNavigationTag("homepage") == Pageview.ID ? "" : isStiky;
9664 var premiumArea = Model.Area.ID.ToString() == "32" ? "agricover-premium-header" : "";
9665 <header
9666 class="top-container agricover-corporate-header sticky-top @premiumArea @isStickyHomepage @stickyTop no-print dw-mod"
9667 id="Top">
9668 @RenderBlockList(subBlocks)
9669 </header>
9670 }
9671
9672 @helper RenderMain()
9673 {
9674 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();
9675
9676 <main class="site dw-mod agricover-corporate-site ">
9677 @RenderBlockList(subBlocks)
9678 </main>
9679 }
9680
9681 @helper RenderScrollToFormButton()
9682 {
9683 <div class="scroll-to-form-button-container u-hidden">
9684 <button type="button" id="ScrollToReprezentantiButton" data-reprezentanti-button='@Translate("Reprezentanti")'
9685 class="u-no-margin btn dw-mod scroll-to-form-button u-hidden">
9686 <i class="fa fa-chevron-double-down"></i>
9687 </button>
9688 </div>
9689 }
9690
9691 @helper RenderPageContent()
9692 {
9693 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
9694 string pagePos = isNavigationStickyMenu ? "" : "";
9695 var pageId = Model.ID;
9696 var pageObject = Dynamicweb.Services.Pages.GetPage(pageId);
9697 string navigationTagAttribute = pageObject?.NavigationTag ?? string.Empty;
9698 var gdprpageid = GetPageIdByNavigationTag("GDPR");
9699 var areaId = Dynamicweb.Frontend.PageView.Current().AreaID;
9700
9701 @RenderScrollToFormButton()
9702 <div id="Page" class="page @pagePos" data-title="@pageObject.MenuText" data-gdpr="@gdprpageid" data-area-id="@areaId"
9703 data-navigation="@navigationTagAttribute">
9704 <div id="content">
9705 @RenderSnippet("Content")
9706 </div>
9707 </div>
9708 }
9709
9710 @* Hack to support nested helpers *@
9711 @SnippetStart("Content")
9712 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
9713
9714
9715
9716 @* Render the grid *@
9717 @if (Model.ID == GetPageIdByNavigationTag("contactPage"))
9718 {
9719 <script type="application/ld+json">
9720 {
9721 "@@context": "https://schema.org",
9722 "@@type": "Store",
9723 "address": {
9724
9725 "@@type": "PostalAddress",
9726 "addressLocality": "Voluntari ",
9727 "addressRegion": "Ilfov",
9728 "postalCode": "077191",
9729 "streetAddress": "Bulevardul Pipera 1B"
9730 },
9731 "name": "Agricover",
9732 "telephone": "021 336 4645",
9733 "email": "agricover@agricover.ro",
9734 "url": "https://www.agricover.ro"
9735 }
9736 </script>
9737 }
9738 @Model.Grid("Grid", "Grid", "default:true;sort:1", "Corporate")
9739
9740 @SnippetEnd("Content")
9741
9742 <script type="text/javascript">
9743
9744 _linkedin_partner_id = "3552330";
9745
9746 window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
9747
9748 window._linkedin_data_partner_ids.push(_linkedin_partner_id);
9749
9750 </script>
9751 <script type="text/javascript">
9752
9753 (function (l) {
9754
9755 if (!l) {
9756 window.lintrk = function (a, b) {
9757 window.lintrk.q.push([a, b])
9758 };
9759
9760 window.lintrk.q = []
9761 }
9762
9763 var s = document.getElementsByTagName("script")[0];
9764
9765 var b = document.createElement("script");
9766
9767 b.type = "text/javascript";
9768 b.async = true;
9769
9770 b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";
9771
9772 s.parentNode.insertBefore(b, s);
9773 })(window.lintrk);
9774
9775 </script>
9776
9777 <noscript>
9778
9779 <img height="1" width="1" style="display:none;" alt=""
9780 src="https://px.ads.linkedin.com/collect/?pid=3552330&fmt=gif"/>
9781
9782 </noscript>
9783
9784 @helper RenderIosTabletFix()
9785 {
9786 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios)
9787 {
9788 <script>
9789 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream;
9790 if (isIpadIOS) {
9791 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&";
9792 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios";
9793 }
9794 </script>
9795 }
9796 }
9797
9798 </html>
9799
9800