If this email is not being shown properly, click here
Error executing template "/Designs/WordMusic/Paragraph/newsletterParagraph.cshtml"
System.MissingMethodException: Method not found: 'System.String Dna.ImageProcessing.ImageProcessorSettings.ToUrl()'.
   at Dna.Frontend.Images.GetImage(ImageProcessorSettings settings)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5ef5a79dbccb4c308b307ab5f7163ce6.<>c__DisplayClass25_0.<RenderEmailParagraphImageTag>b__0(TextWriter __razor_helper_writer) in d:\Domains\Sites\qa-sweetums.dw-demo.com\Files\Templates\Designs\WordMusic\Paragraph\newsletterParagraph.cshtml:line 703
   at CompiledRazorTemplates.Dynamic.RazorEngine_5ef5a79dbccb4c308b307ab5f7163ce6.<>c__DisplayClass24_0.<RenderEmailParagraphImage>b__0(TextWriter __razor_helper_writer) in d:\Domains\Sites\qa-sweetums.dw-demo.com\Files\Templates\Designs\WordMusic\Paragraph\newsletterParagraph.cshtml:line 674
   at CompiledRazorTemplates.Dynamic.RazorEngine_5ef5a79dbccb4c308b307ab5f7163ce6.Execute() in d:\Domains\Sites\qa-sweetums.dw-demo.com\Files\Templates\Designs\WordMusic\Paragraph\newsletterParagraph.cshtml:line 850
   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 RazorTemplateBase<RazorTemplateModel<Template>> 2 @using Dynamicweb.Rendering 3 @using System 4 @using System.Collections.Generic 5 @using Dynamicweb.Core 6 @using System.Web 7 @using Dna.UrlServices 8 @using Dynamicweb.Security.UserManagement 9 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 10 @using System 11 @using Dna.Frontend 12 @using Dynamicweb.Rendering 13 @using Dynamicweb.Core 14 @using Dna.UrlServices 15 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 16 @using System 17 @using System.Collections.Generic 18 @using System.IO 19 @using System.Linq 20 @using System.Net 21 @using System.Web 22 @using System.Web.Script.Serialization 23 @using Dna.UrlServices 24 @using Dynamicweb.Rendering 25 26 @functions{ 27 28 #region Css functions 29 30 public static string GetPalletColorNumber(int number = 0) 31 { 32 switch (number) 33 { 34 case 1: 35 return "#333333"; 36 case 2: 37 return "#ebebeb"; 38 case 3: 39 return "#BF0303"; 40 default: 41 return "#ffffff"; 42 } 43 } 44 45 public static string GetFontFamilyNumber(int number = 0) 46 { 47 switch (number) 48 { 49 case 1: 50 return "font-family: Arial, sans-serif;"; 51 default: 52 return "font-family: Arial, sans-serif;"; 53 } 54 } 55 56 public static string GetFontSize(int fontSize = 0) 57 { 58 return fontSize >= 0 ? string.Concat("font-size: ", fontSize, "px;") : "font-size: 14px"; 59 } 60 61 #endregion Css functions 62 63 #region User functions 64 65 public static string OrganizationsGroupId() 66 { 67 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 68 var userGroup = user != null ? user.Groups.FirstOrDefault(x => x.Name.ToLower() == "organizations") : null; 69 70 return userGroup != null ? userGroup.ID.ToString() : string.Empty; 71 } 72 73 public static string IndividualGroupId() 74 { 75 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 76 var userGroup = user != null ? user.Groups.FirstOrDefault(x => x.Name.ToLower() == "individuals") : null; 77 78 return userGroup != null ? userGroup.ID.ToString() : string.Empty; 79 } 80 81 public static int ChoralClubGroupId() 82 { 83 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 84 var userGroup = user != null ? user.Groups.FirstOrDefault(x => String.Equals(x.Name, "Word Choral Club", StringComparison.CurrentCultureIgnoreCase)) : null; 85 86 return userGroup != null ? userGroup.ID : 0; 87 } 88 89 #endregion User functions 90 91 #region Cart Functions 92 93 public static string SetStockStatus(string stockStatus, string productId, string languageId, out string status, out string statusIcon) 94 { 95 if (string.IsNullOrEmpty(stockStatus)) 96 { 97 var prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(productId, "", languageId); 98 if (prod != null) 99 { 100 stockStatus = prod.get_StockStatus(languageId).Text; 101 } 102 } 103 104 var icon = ""; 105 106 if (!string.IsNullOrEmpty(stockStatus)) 107 { 108 switch (stockStatus) 109 { 110 case "Downloadable": 111 icon = "fa-download"; 112 break; 113 case "Out of Print": 114 icon = "fa-times"; 115 break; 116 case "Available for Preorder": 117 icon = "fa-check"; 118 break; 119 case "Available Now": 120 icon = "fa-check"; 121 break; 122 default: 123 icon = "fa-undo"; 124 break; 125 } 126 } 127 statusIcon = icon; 128 status = stockStatus; 129 return string.Empty; 130 } 131 132 public static string SetStockStatus(string stockStatus, string productId, string languageId, bool hasSubscription, out string status, out string statusIscon, out bool hasDownload, out bool hasProduct) 133 { 134 if (string.IsNullOrEmpty(stockStatus)) 135 { 136 var prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(productId, "", languageId); 137 if (prod != null) 138 { 139 stockStatus = prod.get_StockStatus(languageId).Text; 140 } 141 } 142 143 var download = false; 144 var product = false; 145 var icon = ""; 146 147 if (!string.IsNullOrEmpty(stockStatus)) 148 { 149 switch (stockStatus) 150 { 151 case "Downloadable": 152 icon = "fa-download"; 153 download = true; 154 break; 155 case "Out of Print": 156 icon = "fa-times"; 157 product = true; 158 break; 159 case "Available for Preorder": 160 product = true; 161 icon = "fa-check"; 162 break; 163 case "Available Now": 164 product = !hasSubscription; 165 icon = "fa-check"; 166 break; 167 default: 168 product = true; 169 icon = "fa-undo"; 170 break; 171 } 172 } 173 hasDownload = download; 174 hasProduct = product; 175 statusIscon = icon; 176 status = stockStatus; 177 return string.Empty; 178 } 179 180 #endregion 181 182 public static string setCookie(dynamic obj_options) { 183 var str_output = ""; 184 if (obj_options.GetType().GetProperty("str_action") != null) 185 { 186 if (obj_options.str_action == "save") 187 { 188 var obj_cookie = new System.Web.HttpCookie(obj_options.str_key); 189 obj_cookie.Value = obj_options.str_value; 190 obj_cookie.Expires = DateTime.Now.AddDays(30d); 191 System.Web.HttpContext.Current.Response.Cookies.Add(obj_cookie); 192 } 193 else if (obj_options.str_action == "get") 194 { 195 if (System.Web.HttpContext.Current.Request.Cookies[obj_options.str_key] != null) { 196 str_output = System.Web.HttpContext.Current.Request.Cookies[obj_options.str_key].Value; 197 } 198 } 199 } 200 return str_output; 201 } 202 203 public static string toJson(List<Dictionary<string, string>> dictionary) 204 { 205 var json = new JavaScriptSerializer().Serialize(dictionary); 206 return json; 207 } 208 209 public static string toJson(Dictionary<string, Dictionary<string, string>> dictionary) 210 { 211 var json = new JavaScriptSerializer().Serialize(dictionary); 212 return json; 213 } 214 215 public static string GetAlternativeImage(string imagePath, string designFolder) 216 { 217 var request = (HttpWebRequest)HttpWebRequest.Create(imagePath); 218 request.Method = "HEAD"; 219 var domain = "http://" + System.Web.HttpContext.Current.Request.Url.Host; 220 221 try 222 { 223 request.GetResponse(); 224 return imagePath; 225 } 226 catch 227 { 228 imagePath = domain + designFolder + "images/alternativeimage.jpg"; 229 return imagePath; 230 } 231 } 232 233 public static bool FileExists(string filePath) 234 { 235 var serverPath = HttpContext.Current.Server.MapPath(filePath); 236 return File.Exists(serverPath); 237 } 238 239 public string GetAddressHash(string address, string address2, string city, string region, string zip, string country) 240 { 241 return string.Concat(address, address2, city, region, zip, country); 242 } 243 244 public Dictionary<string, List<string>> GetRibbonsSettings() 245 { 246 var paragraphs = Dynamicweb.Services.Paragraphs.GetParagraphsByPageId(GetPageIdByNavigationTag("Ribbons")); 247 var ribbonSettings = new Dictionary<string, List<string>>(); 248 foreach (var paragraph in paragraphs) 249 { 250 var settings = Dynamicweb.Content.Items.Item.GetItemById(paragraph.ItemType, paragraph.ItemId); 251 var colors = new List<string> {settings.FirstOrDefault(x => x.Key.Equals("Color", StringComparison.InvariantCultureIgnoreCase)).Value.ToString(), settings.FirstOrDefault(x => x.Key.Equals("TextColor", StringComparison.InvariantCultureIgnoreCase)).Value.ToString()}; 252 ribbonSettings.Add(settings.FirstOrDefault(x => x.Key.Equals("IdIn_AX", StringComparison.InvariantCultureIgnoreCase)).Value.ToString(), colors); 253 } 254 return ribbonSettings; 255 } 256 } 257 258 @{ 259 @* Tables and list helpers *@ 260 @helper RenderTableRowSpacer(int height = 30, int colspan = 1, string style = "") 261 { 262 if (height == 0) 263 { 264 height = 30; 265 } 266 267 <tr> 268 @if (colspan > 1) 269 { 270 @: <td @style colspan="@colspan" height="@height"></td> 271 } 272 else 273 { 274 <td @style height="@height"></td> 275 } 276 </tr> 277 } 278 279 @helper RenderTableCellSpacer(int width = 10, int height = 10) 280 { 281 if (width == 0) 282 { 283 width = 10; 284 } 285 if (height == 0) 286 { 287 height = 10; 288 } 289 <td style="@GetFontSize(@width);" width="@width" height="@height">&nbsp;</td> 290 } 291 } 292 293 @helper RenderEmailHtmlHead() 294 { 295 var backgroundColor = GetPalletColorNumber(); 296 var fontFamily = GetFontFamilyNumber(); 297 var textColor = GetPalletColorNumber(1); 298 299 <head> 300 <title>Email</title> 301 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 302 <style type="text/css"> 303 #outlook a { 304 padding: 0; 305 margin: 0; 306 } 307 308 body { 309 width: 100% !important; 310 -webkit-text-size-adjust: 100%; 311 -ms-text-size-adjust: 100%; 312 margin: 0; 313 padding: 0; 314 background-color: @backgroundColor; 315 } 316 317 .ExternalClass { width: 100%; } 318 319 .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { 320 mso-line-height-rule: exactly; 321 line-height: 100%; 322 } 323 324 .backgroundTable { 325 margin: 0; 326 padding: 0; 327 width: 100% !important; 328 mso-line-height-rule: exactly; 329 line-height: 100% !important; 330 } 331 332 img { 333 outline: none; 334 text-decoration: none; 335 -ms-interpolation-mode: bicubic; 336 display: block; 337 border: 0 none; 338 } 339 340 a img { border: 0 none; } 341 342 .image_fix { display: block; } 343 344 p { 345 margin: 0 0; 346 font-size: 14px; 347 line-height: 20px; 348 } 349 350 div { 351 padding: 0; 352 margin: 0; 353 } 354 355 table td { 356 border-collapse: collapse; 357 font-size: 14px; 358 @fontFamily 359 } 360 361 table { 362 border-collapse: collapse; 363 mso-table-lspace: 0; 364 mso-table-rspace: 0; 365 } 366 367 a { 368 text-decoration: underline; 369 padding: 0; 370 margin: 0; 371 } 372 373 a:hover { text-decoration: none; } 374 375 p { 376 font-size: 14px; 377 line-height: 16px; 378 line-height: 20px; 379 margin: 0; 380 @fontFamily 381 } 382 383 /* CLIENT-SPECIFIC STYLES */ 384 385 #outlook a { padding: 0; } 386 387 /* Force Outlook to provide a "view in browser" message */ 388 389 .ReadMsgBody { width: 100%; } 390 391 .ExternalClass { width: 100%; } 392 393 /* Force Hotmail to display emails at full width */ 394 395 .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } 396 397 /* Force Hotmail to display normal line spacing */ 398 399 body, table, td, a { 400 -webkit-text-size-adjust: 100%; 401 -ms-text-size-adjust: 100%; 402 } 403 404 /* Prevent WebKit and Windows mobile changing default text sizes */ 405 406 table, td { 407 mso-table-lspace: 0; 408 mso-table-rspace: 0; 409 } 410 411 /* Remove spacing between tables in Outlook 2007 and up */ 412 413 img { -ms-interpolation-mode: bicubic; } 414 415 /* Allow smoother rendering of resized image in Internet Explorer */ 416 417 /* RESET STYLES */ 418 419 body, body p { 420 margin: 0; 421 padding: 0; 422 } 423 424 img { 425 border: 0; 426 height: auto; 427 line-height: 100%; 428 outline: none; 429 text-decoration: none; 430 } 431 432 table { border-collapse: collapse !important; } 433 434 body { 435 height: 100% !important; 436 margin: 0; 437 padding: 0; 438 width: 100% !important; 439 } 440 441 /* iOS BLUE LINKS */ 442 443 .appleBody a { color: @textColor text-decoration:none; } 444 445 .appleFooter a { color: @textColor text-decoration:none; } 446 447 /* MOBILE STYLES */ 448 449 @@media screen and (max-width: 525px) { 450 /* ALLOWS FOR FLUID TABLES */ 451 table[class="wrapper"] { width: 100% !important; } 452 453 /* ADJUSTS LAYOUT OF LOGO IMAGE */ 454 td[class="logo"] { 455 text-align: left; 456 padding: 20px 0 20px 0 !important; 457 } 458 459 td[class="logo"] img { margin: 0 auto !important; } 460 461 /* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */ 462 td[class="mobile-hide"] { display: none; } 463 464 img[class="mobile-hide"] { display: none !important; } 465 466 img[class="img-max"] { 467 max-width: 100% !important; 468 width: 100% !important; 469 height: auto !important; 470 } 471 472 /* FULL-WIDTH TABLES */ 473 table[class="responsive-table"], 474 .responsive-table { 475 width: 100% !important; 476 display: table; 477 } 478 479 /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */ 480 td[class="padding"] { padding: 10px 5% 15px 5% !important; } 481 482 td[class="padding-copy"] { 483 padding: 10px 5% 10px 5% !important; 484 text-align: center; 485 } 486 487 td[class="padding-meta"] { 488 padding: 30px 5% 0 5% !important; 489 text-align: center; 490 } 491 492 td[class="no-pad"] { padding: 0 0 20px 0 !important; } 493 494 td[class="no-padding"] { padding: 0 !important; } 495 496 td[class="section-padding"] { padding: 50px 15px 50px 15px !important; } 497 498 td[class="section-padding-bottom-image"] { padding: 10px 15px 0 15px !important; } 499 500 /* ADJUST BUTTONS ON MOBILE */ 501 td[class="mobile-wrapper"] { padding: 10px 5% 15px 5% !important; } 502 503 table[class="mobile-button-container"] { 504 margin: 0 auto; 505 width: 100% !important; 506 } 507 508 a[class="mobile-button"] { 509 width: 80% !important; 510 padding: 4px !important; 511 border: 0 !important; 512 font-size: 16px !important; 513 border-radius: 3px; 514 -webkit-border-radius: 3px; 515 -moz-border-radius: 3px; 516 } 517 518 .clearLeft { clear: left; } 519 520 .preheader { 521 display: none !important; 522 visibility: hidden; 523 opacity: 0; 524 color: transparent; 525 height: 0; 526 width: 0; 527 } 528 } 529 </style> 530 </head> 531 } 532 533 @helper RenderEmailFooter(bool renderEmailFooter = true, bool renderSocialMedia = true) 534 { 535 if (renderEmailFooter) 536 { 537 var copyrightMessage = Pageview != null ? string.Concat(Pageview.Area.Item["CompanyName"], " ", Pageview.Area.Item["Copyright"]) : string.Concat(Translate("Word Music & Church Resources"), ". ", Translate("All Rights Reserved")); 538 var backgroundColor = GetPalletColorNumber(); 539 var fontSize = GetFontSize(12); 540 var fontFamily = GetFontFamilyNumber(); 541 var fontColor = GetPalletColorNumber(1); 542 543 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 544 <tr> 545 <td bgcolor="@backgroundColor" align="center" style="padding: 20px 0;"> 546 <table width="700" border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table"> 547 @if (renderSocialMedia) 548 { 549 <tr> 550 <td align="center" style="@fontSize line-height: 18px; @fontFamily color: @fontColor"> 551 552 </td> 553 </tr> 554 <tr><td height="20">&nbsp;</td></tr> 555 } 556 <tr> 557 <td align="left" style="@fontSize line-height: 18px; @fontFamily color: @fontColor"> 558 <span class="appleFooter" style="color: @fontColor">&copy; @DateTime.Now.Year @copyrightMessage</span><br/> 559 </td> 560 </tr> 561 </table> 562 </td> 563 </tr> 564 </table> 565 } 566 567 <script> 568 document.getElementById("remove").style.display = "none"; 569 document.getElementById("remove2").style.display = "none"; 570 </script> 571 } 572 573 @helper RenderEmailHeader(string receiptUrl, string preHeader, bool clearImageTitle = false, bool showLinkToPage = true) 574 { 575 var companyName = Pageview != null ? Pageview.Area.Item["CompanyName"] : Translate("Word Music & Church Resources"); 576 var websiteUrl = Helpers.GetCurrentUrl(true); 577 var designName = Pageview != null ? Pageview.Layout.Design.Name : "WordMusic"; // We need to manually update this folder name for when the helper is used outside of the context of a Design, like the Email notifications triggered by Order State or Scheduled tasks 578 var fontSize = GetFontSize(14); 579 var fontFamily = GetFontFamilyNumber(2); 580 var fontColor = GetPalletColorNumber(1); 581 var backgroundColor = GetPalletColorNumber(0); 582 var imageTitle = clearImageTitle ? "" : companyName; 583 584 if (preHeader.IsNotNullOrEmpty()) 585 { 586 @SnippetStart("preHeader") 587 <div style="@fontSize @fontFamily text-decoration:none; font-size: 1px; color: #ffffff; line-height: 1px;"> 588 <span style="color: #ffffff; font-size: 1px;">@preHeader</span> 589 </div> 590 @SnippetEnd("preHeader") 591 } 592 593 <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center"> 594 @if (showLinkToPage && receiptUrl.IsNotNullOrEmpty()) 595 { 596 <tr id="remove2"> 597 <td style="@fontSize @fontFamily color: @fontColor text-decoration:none;" width="100%" height="20" align="center"> 598 <br/>@Translate("If this email is not being shown properly, click") <a style="@fontSize @fontFamily color: @fontColor text-decoration:underline;" href="@receiptUrl">@Translate("here")</a> 599 </td> 600 </tr> 601 } 602 <tr> 603 <td bgcolor="@backgroundColor"> 604 <div align="center" style="padding: 0 15px 0 15px;"> 605 <table border="0" cellpadding="0" cellspacing="0" width="700" class="responsive-table"> 606 <tr> 607 <td style="padding: 20px 0 20px 0;" class="logo"> 608 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 609 <tr> 610 <td bgcolor="@backgroundColor" width="300" align="left"> 611 <a href="@websiteUrl" target="_blank"> 612 @{ var imageSrc = string.Concat(websiteUrl,"/Files/Templates/Designs/", designName, "/images/logo.jpg");} 613 <img width="300" class="img-max" src="@imageSrc" alt="@imageTitle" title="@companyName"/> 614 </a> 615 </td> 616 <td bgcolor="@backgroundColor" width="400" align="right" class="mobile-hide"> 617 <table border="0" cellpadding="0" cellspacing="0"> 618 <tr> 619 <td align="right" style="padding: 0 0 5px 0; @fontSize @fontFamily color: @fontColor text-decoration:none;"> 620 <span style="color: @fontColor text-decoration:none;"></span> 621 </td> 622 </tr> 623 </table> 624 </td> 625 </tr> 626 </table> 627 </td> 628 </tr> 629 </table> 630 </div> 631 </td> 632 </tr> 633 </table> 634 } 635 636 @helper RenderEmailWrapperStart(int spacingHeight = 0) 637 { 638 @:<table border="0" cellpadding="0" cellspacing="0" width="100%" class="backgroundTable"> 639 @RenderTableRowSpacer(spacingHeight) 640 @:<tr> 641 @:<td align="center" style="padding: 0 15px 30px 15px;" class="section-padding"> 642 } 643 644 @helper RenderEmailWrapperEnd() 645 { 646 @:</td> 647 @:</tr> 648 @:</table> 649 } 650 651 @helper RenderEmailGreating() 652 { 653 <p>@Translate("Thanks!")</p> 654 <p><strong>@Translate("Word Music & Church Resources")</strong></p> 655 <p><strong>@Translate("Customer Service Team")</strong></p> 656 <p><strong>@Translate("1-888-324-9673")</strong></p> 657 } 658 659 @helper RenderEmailParagraphHeading(string headingType, string alignment, string title) 660 { 661 @:<@headingType align="@alignment" style="@GetFontSize(24) margin:0; padding:0; @GetFontFamilyNumber() color:@GetPalletColorNumber(1)"> 662 @title 663 @:</@headingType> 664 } 665 666 @helper RenderEmailParagraphImage(string imageUrl, string imageTitle, string imageHref, string imageAlignment = "image-top", int imageWidth = 600) 667 { 668 if (imageUrl.IsNotNullOrEmpty()) 669 { 670 switch (imageAlignment) 671 { 672 case "image-left-column": 673 <td align="left" valign="top"> 674 @RenderEmailParagraphImageTag(imageUrl, imageTitle, imageHref, 300) 675 </td> 676 @RenderTableCellSpacer(30) 677 break; 678 case "image-right-column": 679 @RenderTableCellSpacer(30) 680 <td align="right" valign="top"> 681 @RenderEmailParagraphImageTag(imageUrl, imageTitle, imageHref, 300) 682 </td> 683 break; 684 case "image-top": 685 <tr> 686 <td align="center" valign="top"> 687 @RenderEmailParagraphImageTag(imageUrl, imageTitle, imageHref) 688 </td> 689 </tr> 690 @RenderTableRowSpacer(10) 691 break; 692 default: 693 throw new NotSupportedException(string.Format("Unsupported item alignment: {0}.", imageAlignment)); 694 } 695 } 696 } 697 698 @helper RenderEmailParagraphImageTag(string imageUrl, string imageTitle, string imageHref, int imageWidth = 600) 699 { 700 if (imageHref.IsNotNullOrEmpty()) 701 { 702 @:<a target="_blank" href="@imageHref"> 703 } 704 <img class="img-max" src="@Images.GetImage(imageUrl,imageWidth,0)" alt="@imageTitle" title="@imageTitle"/> 705 if (imageHref.IsNotNullOrEmpty()) 706 { 707 @:</a> 708 } 709 } 710 711 @helper RenderEmailButton(string href, string text, Dictionary<string, string> options = null) 712 { 713 if (href.IsNotNullOrEmpty() && text.IsNotNullOrEmpty()) 714 { 715 var width = options != null && options.ContainsKey("width") ? options["width"] : "120px"; 716 var height = options != null && options.ContainsKey("height") ? options["height"] : "38px"; 717 var background = options != null && options.ContainsKey("background") ? options["background"] : "#58c2ca"; 718 var border = options != null && options.ContainsKey("border") ? options["border"] : "1px solid #58c2ca"; 719 var color = options != null && options.ContainsKey("color") ? options["color"] : "#ffffff"; 720 var fontFamily = options != null && options.ContainsKey("font-family") ? options["font-family"] : "Arial, sans-serif"; 721 var fontSize = options != null && options.ContainsKey("font-size") ? options["font-size"] : "14px"; 722 var fontStyle = options != null && options.ContainsKey("font-style") ? options["font-style"] : "normal"; 723 var textAlign = options != null && options.ContainsKey("text-align") ? options["text-align"] : "center"; 724 var textDecoration = options != null && options.ContainsKey("text-decoration") ? options["text-decoration"] : "none"; 725 726 var rect = "style=\"width:" + width + ";height:" + height + ";border:" + border + ";color:" + color + ";v-text-anchor:middle; \" fillcolor=\"" + background + "\" stroke=\"f\""; 727 var anchor = "width:" + width + ";height:" + height + ";line-height:" + height + ";background:" + background + ";border:" + border + ";color:" + color + ";font-family:" + fontFamily + ";font-size:" + fontSize + ";font-style:" + fontStyle + ";text-align:" + textAlign + ";text-decoration:" + textDecoration + ";"; 728 729 <div> 730 <!--[if mso]> 731 <v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="@href" @rect> 732 <w:anchorlock/> 733 <center> 734 <![endif]--> 735 <a class="mobile-button" target="_blank" href="@href" style="-webkit-text-size-adjust: none; display: inline-block; @anchor">@text</a> 736 <!--[if mso]> 737 </center> 738 </v:rect> 739 <![endif]--> 740 </div> 741 } 742 } 743 @helper RenderProductImage(LoopItem product, string domain, string style = "") 744 { 745 var productName = product.GetString("Ecom:Order:OrderLine.ProductName"); 746 var productNumber = product.GetString("Ecom:Product.Number").Replace("Parent_","").Replace("/", "_"); 747 var pattern = "/Files/Files/WordMusic/Products/Product_Images/" + productNumber + ".jpg"; 748 var imageUrl = product.GetString("Ecom:Product.ImageSmall.Default.Clean").IsNotNullOrEmpty() ? product.GetString("Ecom:Product.ImageSmall.Default.Clean") : product.GetString("Ecom:Product.ImageMedium.Default.Clean").IsNotNullOrEmpty() ? product.GetString("Ecom:Product.ImageMedium.Default.Clean") : product.GetString("Ecom:Product.ImageLarge.Default.Clean").IsNotNullOrEmpty() ? product.GetString("Ecom:Product.ImageLarge.Default.Clean") : pattern; 749 var image = domain + (Dna.ImageProcessing.Frontend.GetImage(imageUrl, 95, 123)); 750 var img = @GetAlternativeImage(image, GetString("Template:DesignBaseUrl").IsNotNullOrEmpty() ? GetString("Template:DesignBaseUrl") : "/Files/Templates/Designs/WordMusic/"); 751 752 <img style="@style" width="95" class="img-responsive" alt="@productName" title="@productName" src="@img"/> 753 } 754 @{ 755 var title = GetBoolean("Item.ShowTitle") ? GetString("Item.Title") : string.Empty; 756 var titleHeadingType = GetString("Item.HeadingType") != string.Empty ? GetString("Item.HeadingType") : "h2"; 757 var titlePosition = GetString("Item.TitleOrder"); 758 var image = GetString("Item.Image"); 759 var imageTitle = GetString("Item.ImageTitle").IsNotNullOrEmpty() ? GetString("Item.ImageTitle") : title; 760 var text = GetString("Item.Text"); 761 var imageAlignment = GetString("Item.Order"); 762 var backgroundColor = GetString("Item.Background"); 763 var link = GetString("Item.Link"); 764 var titleAlignment = imageAlignment != "image-top" || image == string.Empty ? "left" : "center"; 765 var width = GetInteger("ParagraphColumnLarge"); 766 var col = width == 50 ? "250" : "500"; 767 var breakBol = HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) == 100; 768 769 var resetLink = string.Empty; 770 var loginName = string.Empty; 771 var name = string.Empty; 772 var website = string.Empty; 773 774 if (Pageview.Context != null) 775 { 776 var user = Pageview.Context.GetValue("User") as User; 777 //Security token related 778 if (user != null) 779 { 780 loginName = user.UserName; 781 name = user.Name.IsNotNullOrEmpty() ? user.Name : user.FirstName + " " + user.LastName; 782 var token = Guid.NewGuid().ToString(); 783 resetLink = Helpers.GetCurrentUrl(true) + Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(GetPageIdByNavigationTag("MyAccount")) + "&Username=" + loginName + "&RecoveryToken=" + token; 784 user.PasswordRecoveryTokenExpirationTime = DateTime.UtcNow.AddHours(Dynamicweb.Configuration.SystemConfiguration.Instance.GetInt32("/Globalsettings/Modules/UserManagement/ExtranetPasswordSecurity/RecoveryTokenTimeout")); 785 user.PasswordRecoveryToken = token; 786 user.Save(); 787 } 788 } 789 //variable options 790 text = text.Replace("{{UserName}}", loginName); 791 text = text.Replace("{{ResetLink}}", resetLink); 792 text = text.Replace("{{Name}}", name); 793 text = text.Replace("{{Website}}", website); 794 795 if (GetBoolean("ParagraphContainerIsFirst")) 796 { 797 HttpContext.Current.Items["currentColumns"] = 0; 798 } 799 HttpContext.Current.Items["currentColumns"] = HttpContext.Current.Items["currentColumns"] != null ? int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) + width : width; 800 if (HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) > 100) 801 { 802 HttpContext.Current.Items["currentColumns"] = width; 803 } 804 var blueButton = new Dictionary<string, string> 805 { 806 {"width", "210px"}, 807 {"height", "38px"}, 808 {"background", "#58c2ca"}, 809 {"color", "#ffffff"}, 810 {"font-size", "16px"}, 811 {"font-style", "normal"} 812 }; 813 var openParagraphWrapper = breakBol || (HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) == 0) || GetBoolean("ParagraphContainerIsFirst") ? "<tr align='center' border='0' cellspacing='0' cellpadding='0' width='100%' bgcolor='" + backgroundColor + "' style='" + GetFontFamilyNumber() + "'><td align='center'><table class='responsive-table clearLeft' border='0' cellspacing='0' cellpadding='0' width='500'><tr>" : string.Empty; 814 var closeParagraphWrapper = HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) == 50 ? "</tr><tr><td height='30'></td></tr></table></td></tr>" : string.Empty; 815 HttpContext.Current.Items["oldColumns"] = HttpContext.Current.Items["currentColumns"]; 816 } 817 818 @if (!GetBoolean("ParagraphContainerIsFirst")) 819 { 820 @closeParagraphWrapper 821 } 822 823 @openParagraphWrapper 824 825 <td border="0" cellspacing="0" cellpadding="0" width="@col" bgcolor="@backgroundColor" style="@GetFontFamilyNumber()" class="responsive-table"> 826 <table border="0" cellspacing="0" cellpadding="0" width="@col" bgcolor="@backgroundColor" style="@GetFontFamilyNumber()" class="responsive-table"> 827 @if (title.IsNotNullOrEmpty() && (titlePosition == "title-first" || titlePosition.IsNullOrEmpty())) 828 { 829 <tr> 830 <td align="@titleAlignment" valign="top"> 831 @RenderEmailParagraphHeading(titleHeadingType, titleAlignment, title) 832 </td> 833 @RenderTableCellSpacer() 834 </tr> 835 } 836 @if (imageAlignment == "image-top") 837 { 838 @RenderEmailParagraphImage(image, imageTitle, link, imageAlignment) 839 } 840 841 @if (text.IsNotNullOrEmpty() || imageAlignment != "image-top") 842 { 843 @RenderTableRowSpacer() 844 <tr> 845 <td align="left" valign="top"> 846 <table class="imageAside" colspan="2" border="0" cellspacing="0" cellpadding="0" width="100%" style="@GetFontFamilyNumber()"> 847 <tr> 848 @if (imageAlignment == "image-left-column") 849 { 850 @RenderEmailParagraphImage(image, imageTitle, link, imageAlignment, 300) 851 } 852 @if (text.IsNotNullOrEmpty()) 853 { 854 <td align="@titleAlignment" valign="top" style="font-size: 14px; line-height: 20px; @GetFontFamilyNumber()"> 855 @if (title.IsNotNullOrEmpty() && titlePosition == "title-with-text") 856 { 857 <div> 858 @RenderEmailParagraphHeading(titleHeadingType, titleAlignment, title) 859 </div> 860 } 861 @text 862 @if (GetBoolean("Item.ShowReadMoreButton")) 863 { 864 <br/> 865 <br/> 866 @RenderEmailButton(link, GetString("Item.LinkText"), blueButton) 867 } 868 </td> 869 } 870 @if (imageAlignment == "image-right-column") 871 { 872 @RenderEmailParagraphImage(image, imageTitle, link, imageAlignment, 300) 873 } 874 </tr> 875 </table> 876 </td> 877 </tr> 878 @RenderTableRowSpacer() 879 } 880 </table> 881 </td> 882 883 @if (GetBoolean("ParagraphContainerIsLast")) 884 { 885 @closeParagraphWrapper 886 }
Error executing template "/Designs/WordMusic/Paragraph/newsletterParagraph.cshtml"
System.MissingMethodException: Method not found: 'System.String Dna.ImageProcessing.ImageProcessorSettings.ToUrl()'.
   at Dna.Frontend.Images.GetImage(ImageProcessorSettings settings)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5ef5a79dbccb4c308b307ab5f7163ce6.<>c__DisplayClass25_0.<RenderEmailParagraphImageTag>b__0(TextWriter __razor_helper_writer) in d:\Domains\Sites\qa-sweetums.dw-demo.com\Files\Templates\Designs\WordMusic\Paragraph\newsletterParagraph.cshtml:line 703
   at CompiledRazorTemplates.Dynamic.RazorEngine_5ef5a79dbccb4c308b307ab5f7163ce6.<>c__DisplayClass24_0.<RenderEmailParagraphImage>b__0(TextWriter __razor_helper_writer) in d:\Domains\Sites\qa-sweetums.dw-demo.com\Files\Templates\Designs\WordMusic\Paragraph\newsletterParagraph.cshtml:line 681
   at CompiledRazorTemplates.Dynamic.RazorEngine_5ef5a79dbccb4c308b307ab5f7163ce6.Execute() in d:\Domains\Sites\qa-sweetums.dw-demo.com\Files\Templates\Designs\WordMusic\Paragraph\newsletterParagraph.cshtml:line 872
   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 RazorTemplateBase<RazorTemplateModel<Template>> 2 @using Dynamicweb.Rendering 3 @using System 4 @using System.Collections.Generic 5 @using Dynamicweb.Core 6 @using System.Web 7 @using Dna.UrlServices 8 @using Dynamicweb.Security.UserManagement 9 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 10 @using System 11 @using Dna.Frontend 12 @using Dynamicweb.Rendering 13 @using Dynamicweb.Core 14 @using Dna.UrlServices 15 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 16 @using System 17 @using System.Collections.Generic 18 @using System.IO 19 @using System.Linq 20 @using System.Net 21 @using System.Web 22 @using System.Web.Script.Serialization 23 @using Dna.UrlServices 24 @using Dynamicweb.Rendering 25 26 @functions{ 27 28 #region Css functions 29 30 public static string GetPalletColorNumber(int number = 0) 31 { 32 switch (number) 33 { 34 case 1: 35 return "#333333"; 36 case 2: 37 return "#ebebeb"; 38 case 3: 39 return "#BF0303"; 40 default: 41 return "#ffffff"; 42 } 43 } 44 45 public static string GetFontFamilyNumber(int number = 0) 46 { 47 switch (number) 48 { 49 case 1: 50 return "font-family: Arial, sans-serif;"; 51 default: 52 return "font-family: Arial, sans-serif;"; 53 } 54 } 55 56 public static string GetFontSize(int fontSize = 0) 57 { 58 return fontSize >= 0 ? string.Concat("font-size: ", fontSize, "px;") : "font-size: 14px"; 59 } 60 61 #endregion Css functions 62 63 #region User functions 64 65 public static string OrganizationsGroupId() 66 { 67 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 68 var userGroup = user != null ? user.Groups.FirstOrDefault(x => x.Name.ToLower() == "organizations") : null; 69 70 return userGroup != null ? userGroup.ID.ToString() : string.Empty; 71 } 72 73 public static string IndividualGroupId() 74 { 75 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 76 var userGroup = user != null ? user.Groups.FirstOrDefault(x => x.Name.ToLower() == "individuals") : null; 77 78 return userGroup != null ? userGroup.ID.ToString() : string.Empty; 79 } 80 81 public static int ChoralClubGroupId() 82 { 83 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 84 var userGroup = user != null ? user.Groups.FirstOrDefault(x => String.Equals(x.Name, "Word Choral Club", StringComparison.CurrentCultureIgnoreCase)) : null; 85 86 return userGroup != null ? userGroup.ID : 0; 87 } 88 89 #endregion User functions 90 91 #region Cart Functions 92 93 public static string SetStockStatus(string stockStatus, string productId, string languageId, out string status, out string statusIcon) 94 { 95 if (string.IsNullOrEmpty(stockStatus)) 96 { 97 var prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(productId, "", languageId); 98 if (prod != null) 99 { 100 stockStatus = prod.get_StockStatus(languageId).Text; 101 } 102 } 103 104 var icon = ""; 105 106 if (!string.IsNullOrEmpty(stockStatus)) 107 { 108 switch (stockStatus) 109 { 110 case "Downloadable": 111 icon = "fa-download"; 112 break; 113 case "Out of Print": 114 icon = "fa-times"; 115 break; 116 case "Available for Preorder": 117 icon = "fa-check"; 118 break; 119 case "Available Now": 120 icon = "fa-check"; 121 break; 122 default: 123 icon = "fa-undo"; 124 break; 125 } 126 } 127 statusIcon = icon; 128 status = stockStatus; 129 return string.Empty; 130 } 131 132 public static string SetStockStatus(string stockStatus, string productId, string languageId, bool hasSubscription, out string status, out string statusIscon, out bool hasDownload, out bool hasProduct) 133 { 134 if (string.IsNullOrEmpty(stockStatus)) 135 { 136 var prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(productId, "", languageId); 137 if (prod != null) 138 { 139 stockStatus = prod.get_StockStatus(languageId).Text; 140 } 141 } 142 143 var download = false; 144 var product = false; 145 var icon = ""; 146 147 if (!string.IsNullOrEmpty(stockStatus)) 148 { 149 switch (stockStatus) 150 { 151 case "Downloadable": 152 icon = "fa-download"; 153 download = true; 154 break; 155 case "Out of Print": 156 icon = "fa-times"; 157 product = true; 158 break; 159 case "Available for Preorder": 160 product = true; 161 icon = "fa-check"; 162 break; 163 case "Available Now": 164 product = !hasSubscription; 165 icon = "fa-check"; 166 break; 167 default: 168 product = true; 169 icon = "fa-undo"; 170 break; 171 } 172 } 173 hasDownload = download; 174 hasProduct = product; 175 statusIscon = icon; 176 status = stockStatus; 177 return string.Empty; 178 } 179 180 #endregion 181 182 public static string setCookie(dynamic obj_options) { 183 var str_output = ""; 184 if (obj_options.GetType().GetProperty("str_action") != null) 185 { 186 if (obj_options.str_action == "save") 187 { 188 var obj_cookie = new System.Web.HttpCookie(obj_options.str_key); 189 obj_cookie.Value = obj_options.str_value; 190 obj_cookie.Expires = DateTime.Now.AddDays(30d); 191 System.Web.HttpContext.Current.Response.Cookies.Add(obj_cookie); 192 } 193 else if (obj_options.str_action == "get") 194 { 195 if (System.Web.HttpContext.Current.Request.Cookies[obj_options.str_key] != null) { 196 str_output = System.Web.HttpContext.Current.Request.Cookies[obj_options.str_key].Value; 197 } 198 } 199 } 200 return str_output; 201 } 202 203 public static string toJson(List<Dictionary<string, string>> dictionary) 204 { 205 var json = new JavaScriptSerializer().Serialize(dictionary); 206 return json; 207 } 208 209 public static string toJson(Dictionary<string, Dictionary<string, string>> dictionary) 210 { 211 var json = new JavaScriptSerializer().Serialize(dictionary); 212 return json; 213 } 214 215 public static string GetAlternativeImage(string imagePath, string designFolder) 216 { 217 var request = (HttpWebRequest)HttpWebRequest.Create(imagePath); 218 request.Method = "HEAD"; 219 var domain = "http://" + System.Web.HttpContext.Current.Request.Url.Host; 220 221 try 222 { 223 request.GetResponse(); 224 return imagePath; 225 } 226 catch 227 { 228 imagePath = domain + designFolder + "images/alternativeimage.jpg"; 229 return imagePath; 230 } 231 } 232 233 public static bool FileExists(string filePath) 234 { 235 var serverPath = HttpContext.Current.Server.MapPath(filePath); 236 return File.Exists(serverPath); 237 } 238 239 public string GetAddressHash(string address, string address2, string city, string region, string zip, string country) 240 { 241 return string.Concat(address, address2, city, region, zip, country); 242 } 243 244 public Dictionary<string, List<string>> GetRibbonsSettings() 245 { 246 var paragraphs = Dynamicweb.Services.Paragraphs.GetParagraphsByPageId(GetPageIdByNavigationTag("Ribbons")); 247 var ribbonSettings = new Dictionary<string, List<string>>(); 248 foreach (var paragraph in paragraphs) 249 { 250 var settings = Dynamicweb.Content.Items.Item.GetItemById(paragraph.ItemType, paragraph.ItemId); 251 var colors = new List<string> {settings.FirstOrDefault(x => x.Key.Equals("Color", StringComparison.InvariantCultureIgnoreCase)).Value.ToString(), settings.FirstOrDefault(x => x.Key.Equals("TextColor", StringComparison.InvariantCultureIgnoreCase)).Value.ToString()}; 252 ribbonSettings.Add(settings.FirstOrDefault(x => x.Key.Equals("IdIn_AX", StringComparison.InvariantCultureIgnoreCase)).Value.ToString(), colors); 253 } 254 return ribbonSettings; 255 } 256 } 257 258 @{ 259 @* Tables and list helpers *@ 260 @helper RenderTableRowSpacer(int height = 30, int colspan = 1, string style = "") 261 { 262 if (height == 0) 263 { 264 height = 30; 265 } 266 267 <tr> 268 @if (colspan > 1) 269 { 270 @: <td @style colspan="@colspan" height="@height"></td> 271 } 272 else 273 { 274 <td @style height="@height"></td> 275 } 276 </tr> 277 } 278 279 @helper RenderTableCellSpacer(int width = 10, int height = 10) 280 { 281 if (width == 0) 282 { 283 width = 10; 284 } 285 if (height == 0) 286 { 287 height = 10; 288 } 289 <td style="@GetFontSize(@width);" width="@width" height="@height">&nbsp;</td> 290 } 291 } 292 293 @helper RenderEmailHtmlHead() 294 { 295 var backgroundColor = GetPalletColorNumber(); 296 var fontFamily = GetFontFamilyNumber(); 297 var textColor = GetPalletColorNumber(1); 298 299 <head> 300 <title>Email</title> 301 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 302 <style type="text/css"> 303 #outlook a { 304 padding: 0; 305 margin: 0; 306 } 307 308 body { 309 width: 100% !important; 310 -webkit-text-size-adjust: 100%; 311 -ms-text-size-adjust: 100%; 312 margin: 0; 313 padding: 0; 314 background-color: @backgroundColor; 315 } 316 317 .ExternalClass { width: 100%; } 318 319 .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { 320 mso-line-height-rule: exactly; 321 line-height: 100%; 322 } 323 324 .backgroundTable { 325 margin: 0; 326 padding: 0; 327 width: 100% !important; 328 mso-line-height-rule: exactly; 329 line-height: 100% !important; 330 } 331 332 img { 333 outline: none; 334 text-decoration: none; 335 -ms-interpolation-mode: bicubic; 336 display: block; 337 border: 0 none; 338 } 339 340 a img { border: 0 none; } 341 342 .image_fix { display: block; } 343 344 p { 345 margin: 0 0; 346 font-size: 14px; 347 line-height: 20px; 348 } 349 350 div { 351 padding: 0; 352 margin: 0; 353 } 354 355 table td { 356 border-collapse: collapse; 357 font-size: 14px; 358 @fontFamily 359 } 360 361 table { 362 border-collapse: collapse; 363 mso-table-lspace: 0; 364 mso-table-rspace: 0; 365 } 366 367 a { 368 text-decoration: underline; 369 padding: 0; 370 margin: 0; 371 } 372 373 a:hover { text-decoration: none; } 374 375 p { 376 font-size: 14px; 377 line-height: 16px; 378 line-height: 20px; 379 margin: 0; 380 @fontFamily 381 } 382 383 /* CLIENT-SPECIFIC STYLES */ 384 385 #outlook a { padding: 0; } 386 387 /* Force Outlook to provide a "view in browser" message */ 388 389 .ReadMsgBody { width: 100%; } 390 391 .ExternalClass { width: 100%; } 392 393 /* Force Hotmail to display emails at full width */ 394 395 .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } 396 397 /* Force Hotmail to display normal line spacing */ 398 399 body, table, td, a { 400 -webkit-text-size-adjust: 100%; 401 -ms-text-size-adjust: 100%; 402 } 403 404 /* Prevent WebKit and Windows mobile changing default text sizes */ 405 406 table, td { 407 mso-table-lspace: 0; 408 mso-table-rspace: 0; 409 } 410 411 /* Remove spacing between tables in Outlook 2007 and up */ 412 413 img { -ms-interpolation-mode: bicubic; } 414 415 /* Allow smoother rendering of resized image in Internet Explorer */ 416 417 /* RESET STYLES */ 418 419 body, body p { 420 margin: 0; 421 padding: 0; 422 } 423 424 img { 425 border: 0; 426 height: auto; 427 line-height: 100%; 428 outline: none; 429 text-decoration: none; 430 } 431 432 table { border-collapse: collapse !important; } 433 434 body { 435 height: 100% !important; 436 margin: 0; 437 padding: 0; 438 width: 100% !important; 439 } 440 441 /* iOS BLUE LINKS */ 442 443 .appleBody a { color: @textColor text-decoration:none; } 444 445 .appleFooter a { color: @textColor text-decoration:none; } 446 447 /* MOBILE STYLES */ 448 449 @@media screen and (max-width: 525px) { 450 /* ALLOWS FOR FLUID TABLES */ 451 table[class="wrapper"] { width: 100% !important; } 452 453 /* ADJUSTS LAYOUT OF LOGO IMAGE */ 454 td[class="logo"] { 455 text-align: left; 456 padding: 20px 0 20px 0 !important; 457 } 458 459 td[class="logo"] img { margin: 0 auto !important; } 460 461 /* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */ 462 td[class="mobile-hide"] { display: none; } 463 464 img[class="mobile-hide"] { display: none !important; } 465 466 img[class="img-max"] { 467 max-width: 100% !important; 468 width: 100% !important; 469 height: auto !important; 470 } 471 472 /* FULL-WIDTH TABLES */ 473 table[class="responsive-table"], 474 .responsive-table { 475 width: 100% !important; 476 display: table; 477 } 478 479 /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */ 480 td[class="padding"] { padding: 10px 5% 15px 5% !important; } 481 482 td[class="padding-copy"] { 483 padding: 10px 5% 10px 5% !important; 484 text-align: center; 485 } 486 487 td[class="padding-meta"] { 488 padding: 30px 5% 0 5% !important; 489 text-align: center; 490 } 491 492 td[class="no-pad"] { padding: 0 0 20px 0 !important; } 493 494 td[class="no-padding"] { padding: 0 !important; } 495 496 td[class="section-padding"] { padding: 50px 15px 50px 15px !important; } 497 498 td[class="section-padding-bottom-image"] { padding: 10px 15px 0 15px !important; } 499 500 /* ADJUST BUTTONS ON MOBILE */ 501 td[class="mobile-wrapper"] { padding: 10px 5% 15px 5% !important; } 502 503 table[class="mobile-button-container"] { 504 margin: 0 auto; 505 width: 100% !important; 506 } 507 508 a[class="mobile-button"] { 509 width: 80% !important; 510 padding: 4px !important; 511 border: 0 !important; 512 font-size: 16px !important; 513 border-radius: 3px; 514 -webkit-border-radius: 3px; 515 -moz-border-radius: 3px; 516 } 517 518 .clearLeft { clear: left; } 519 520 .preheader { 521 display: none !important; 522 visibility: hidden; 523 opacity: 0; 524 color: transparent; 525 height: 0; 526 width: 0; 527 } 528 } 529 </style> 530 </head> 531 } 532 533 @helper RenderEmailFooter(bool renderEmailFooter = true, bool renderSocialMedia = true) 534 { 535 if (renderEmailFooter) 536 { 537 var copyrightMessage = Pageview != null ? string.Concat(Pageview.Area.Item["CompanyName"], " ", Pageview.Area.Item["Copyright"]) : string.Concat(Translate("Word Music & Church Resources"), ". ", Translate("All Rights Reserved")); 538 var backgroundColor = GetPalletColorNumber(); 539 var fontSize = GetFontSize(12); 540 var fontFamily = GetFontFamilyNumber(); 541 var fontColor = GetPalletColorNumber(1); 542 543 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 544 <tr> 545 <td bgcolor="@backgroundColor" align="center" style="padding: 20px 0;"> 546 <table width="700" border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table"> 547 @if (renderSocialMedia) 548 { 549 <tr> 550 <td align="center" style="@fontSize line-height: 18px; @fontFamily color: @fontColor"> 551 552 </td> 553 </tr> 554 <tr><td height="20">&nbsp;</td></tr> 555 } 556 <tr> 557 <td align="left" style="@fontSize line-height: 18px; @fontFamily color: @fontColor"> 558 <span class="appleFooter" style="color: @fontColor">&copy; @DateTime.Now.Year @copyrightMessage</span><br/> 559 </td> 560 </tr> 561 </table> 562 </td> 563 </tr> 564 </table> 565 } 566 567 <script> 568 document.getElementById("remove").style.display = "none"; 569 document.getElementById("remove2").style.display = "none"; 570 </script> 571 } 572 573 @helper RenderEmailHeader(string receiptUrl, string preHeader, bool clearImageTitle = false, bool showLinkToPage = true) 574 { 575 var companyName = Pageview != null ? Pageview.Area.Item["CompanyName"] : Translate("Word Music & Church Resources"); 576 var websiteUrl = Helpers.GetCurrentUrl(true); 577 var designName = Pageview != null ? Pageview.Layout.Design.Name : "WordMusic"; // We need to manually update this folder name for when the helper is used outside of the context of a Design, like the Email notifications triggered by Order State or Scheduled tasks 578 var fontSize = GetFontSize(14); 579 var fontFamily = GetFontFamilyNumber(2); 580 var fontColor = GetPalletColorNumber(1); 581 var backgroundColor = GetPalletColorNumber(0); 582 var imageTitle = clearImageTitle ? "" : companyName; 583 584 if (preHeader.IsNotNullOrEmpty()) 585 { 586 @SnippetStart("preHeader") 587 <div style="@fontSize @fontFamily text-decoration:none; font-size: 1px; color: #ffffff; line-height: 1px;"> 588 <span style="color: #ffffff; font-size: 1px;">@preHeader</span> 589 </div> 590 @SnippetEnd("preHeader") 591 } 592 593 <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center"> 594 @if (showLinkToPage && receiptUrl.IsNotNullOrEmpty()) 595 { 596 <tr id="remove2"> 597 <td style="@fontSize @fontFamily color: @fontColor text-decoration:none;" width="100%" height="20" align="center"> 598 <br/>@Translate("If this email is not being shown properly, click") <a style="@fontSize @fontFamily color: @fontColor text-decoration:underline;" href="@receiptUrl">@Translate("here")</a> 599 </td> 600 </tr> 601 } 602 <tr> 603 <td bgcolor="@backgroundColor"> 604 <div align="center" style="padding: 0 15px 0 15px;"> 605 <table border="0" cellpadding="0" cellspacing="0" width="700" class="responsive-table"> 606 <tr> 607 <td style="padding: 20px 0 20px 0;" class="logo"> 608 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 609 <tr> 610 <td bgcolor="@backgroundColor" width="300" align="left"> 611 <a href="@websiteUrl" target="_blank"> 612 @{ var imageSrc = string.Concat(websiteUrl,"/Files/Templates/Designs/", designName, "/images/logo.jpg");} 613 <img width="300" class="img-max" src="@imageSrc" alt="@imageTitle" title="@companyName"/> 614 </a> 615 </td> 616 <td bgcolor="@backgroundColor" width="400" align="right" class="mobile-hide"> 617 <table border="0" cellpadding="0" cellspacing="0"> 618 <tr> 619 <td align="right" style="padding: 0 0 5px 0; @fontSize @fontFamily color: @fontColor text-decoration:none;"> 620 <span style="color: @fontColor text-decoration:none;"></span> 621 </td> 622 </tr> 623 </table> 624 </td> 625 </tr> 626 </table> 627 </td> 628 </tr> 629 </table> 630 </div> 631 </td> 632 </tr> 633 </table> 634 } 635 636 @helper RenderEmailWrapperStart(int spacingHeight = 0) 637 { 638 @:<table border="0" cellpadding="0" cellspacing="0" width="100%" class="backgroundTable"> 639 @RenderTableRowSpacer(spacingHeight) 640 @:<tr> 641 @:<td align="center" style="padding: 0 15px 30px 15px;" class="section-padding"> 642 } 643 644 @helper RenderEmailWrapperEnd() 645 { 646 @:</td> 647 @:</tr> 648 @:</table> 649 } 650 651 @helper RenderEmailGreating() 652 { 653 <p>@Translate("Thanks!")</p> 654 <p><strong>@Translate("Word Music & Church Resources")</strong></p> 655 <p><strong>@Translate("Customer Service Team")</strong></p> 656 <p><strong>@Translate("1-888-324-9673")</strong></p> 657 } 658 659 @helper RenderEmailParagraphHeading(string headingType, string alignment, string title) 660 { 661 @:<@headingType align="@alignment" style="@GetFontSize(24) margin:0; padding:0; @GetFontFamilyNumber() color:@GetPalletColorNumber(1)"> 662 @title 663 @:</@headingType> 664 } 665 666 @helper RenderEmailParagraphImage(string imageUrl, string imageTitle, string imageHref, string imageAlignment = "image-top", int imageWidth = 600) 667 { 668 if (imageUrl.IsNotNullOrEmpty()) 669 { 670 switch (imageAlignment) 671 { 672 case "image-left-column": 673 <td align="left" valign="top"> 674 @RenderEmailParagraphImageTag(imageUrl, imageTitle, imageHref, 300) 675 </td> 676 @RenderTableCellSpacer(30) 677 break; 678 case "image-right-column": 679 @RenderTableCellSpacer(30) 680 <td align="right" valign="top"> 681 @RenderEmailParagraphImageTag(imageUrl, imageTitle, imageHref, 300) 682 </td> 683 break; 684 case "image-top": 685 <tr> 686 <td align="center" valign="top"> 687 @RenderEmailParagraphImageTag(imageUrl, imageTitle, imageHref) 688 </td> 689 </tr> 690 @RenderTableRowSpacer(10) 691 break; 692 default: 693 throw new NotSupportedException(string.Format("Unsupported item alignment: {0}.", imageAlignment)); 694 } 695 } 696 } 697 698 @helper RenderEmailParagraphImageTag(string imageUrl, string imageTitle, string imageHref, int imageWidth = 600) 699 { 700 if (imageHref.IsNotNullOrEmpty()) 701 { 702 @:<a target="_blank" href="@imageHref"> 703 } 704 <img class="img-max" src="@Images.GetImage(imageUrl,imageWidth,0)" alt="@imageTitle" title="@imageTitle"/> 705 if (imageHref.IsNotNullOrEmpty()) 706 { 707 @:</a> 708 } 709 } 710 711 @helper RenderEmailButton(string href, string text, Dictionary<string, string> options = null) 712 { 713 if (href.IsNotNullOrEmpty() && text.IsNotNullOrEmpty()) 714 { 715 var width = options != null && options.ContainsKey("width") ? options["width"] : "120px"; 716 var height = options != null && options.ContainsKey("height") ? options["height"] : "38px"; 717 var background = options != null && options.ContainsKey("background") ? options["background"] : "#58c2ca"; 718 var border = options != null && options.ContainsKey("border") ? options["border"] : "1px solid #58c2ca"; 719 var color = options != null && options.ContainsKey("color") ? options["color"] : "#ffffff"; 720 var fontFamily = options != null && options.ContainsKey("font-family") ? options["font-family"] : "Arial, sans-serif"; 721 var fontSize = options != null && options.ContainsKey("font-size") ? options["font-size"] : "14px"; 722 var fontStyle = options != null && options.ContainsKey("font-style") ? options["font-style"] : "normal"; 723 var textAlign = options != null && options.ContainsKey("text-align") ? options["text-align"] : "center"; 724 var textDecoration = options != null && options.ContainsKey("text-decoration") ? options["text-decoration"] : "none"; 725 726 var rect = "style=\"width:" + width + ";height:" + height + ";border:" + border + ";color:" + color + ";v-text-anchor:middle; \" fillcolor=\"" + background + "\" stroke=\"f\""; 727 var anchor = "width:" + width + ";height:" + height + ";line-height:" + height + ";background:" + background + ";border:" + border + ";color:" + color + ";font-family:" + fontFamily + ";font-size:" + fontSize + ";font-style:" + fontStyle + ";text-align:" + textAlign + ";text-decoration:" + textDecoration + ";"; 728 729 <div> 730 <!--[if mso]> 731 <v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="@href" @rect> 732 <w:anchorlock/> 733 <center> 734 <![endif]--> 735 <a class="mobile-button" target="_blank" href="@href" style="-webkit-text-size-adjust: none; display: inline-block; @anchor">@text</a> 736 <!--[if mso]> 737 </center> 738 </v:rect> 739 <![endif]--> 740 </div> 741 } 742 } 743 @helper RenderProductImage(LoopItem product, string domain, string style = "") 744 { 745 var productName = product.GetString("Ecom:Order:OrderLine.ProductName"); 746 var productNumber = product.GetString("Ecom:Product.Number").Replace("Parent_","").Replace("/", "_"); 747 var pattern = "/Files/Files/WordMusic/Products/Product_Images/" + productNumber + ".jpg"; 748 var imageUrl = product.GetString("Ecom:Product.ImageSmall.Default.Clean").IsNotNullOrEmpty() ? product.GetString("Ecom:Product.ImageSmall.Default.Clean") : product.GetString("Ecom:Product.ImageMedium.Default.Clean").IsNotNullOrEmpty() ? product.GetString("Ecom:Product.ImageMedium.Default.Clean") : product.GetString("Ecom:Product.ImageLarge.Default.Clean").IsNotNullOrEmpty() ? product.GetString("Ecom:Product.ImageLarge.Default.Clean") : pattern; 749 var image = domain + (Dna.ImageProcessing.Frontend.GetImage(imageUrl, 95, 123)); 750 var img = @GetAlternativeImage(image, GetString("Template:DesignBaseUrl").IsNotNullOrEmpty() ? GetString("Template:DesignBaseUrl") : "/Files/Templates/Designs/WordMusic/"); 751 752 <img style="@style" width="95" class="img-responsive" alt="@productName" title="@productName" src="@img"/> 753 } 754 @{ 755 var title = GetBoolean("Item.ShowTitle") ? GetString("Item.Title") : string.Empty; 756 var titleHeadingType = GetString("Item.HeadingType") != string.Empty ? GetString("Item.HeadingType") : "h2"; 757 var titlePosition = GetString("Item.TitleOrder"); 758 var image = GetString("Item.Image"); 759 var imageTitle = GetString("Item.ImageTitle").IsNotNullOrEmpty() ? GetString("Item.ImageTitle") : title; 760 var text = GetString("Item.Text"); 761 var imageAlignment = GetString("Item.Order"); 762 var backgroundColor = GetString("Item.Background"); 763 var link = GetString("Item.Link"); 764 var titleAlignment = imageAlignment != "image-top" || image == string.Empty ? "left" : "center"; 765 var width = GetInteger("ParagraphColumnLarge"); 766 var col = width == 50 ? "250" : "500"; 767 var breakBol = HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) == 100; 768 769 var resetLink = string.Empty; 770 var loginName = string.Empty; 771 var name = string.Empty; 772 var website = string.Empty; 773 774 if (Pageview.Context != null) 775 { 776 var user = Pageview.Context.GetValue("User") as User; 777 //Security token related 778 if (user != null) 779 { 780 loginName = user.UserName; 781 name = user.Name.IsNotNullOrEmpty() ? user.Name : user.FirstName + " " + user.LastName; 782 var token = Guid.NewGuid().ToString(); 783 resetLink = Helpers.GetCurrentUrl(true) + Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(GetPageIdByNavigationTag("MyAccount")) + "&Username=" + loginName + "&RecoveryToken=" + token; 784 user.PasswordRecoveryTokenExpirationTime = DateTime.UtcNow.AddHours(Dynamicweb.Configuration.SystemConfiguration.Instance.GetInt32("/Globalsettings/Modules/UserManagement/ExtranetPasswordSecurity/RecoveryTokenTimeout")); 785 user.PasswordRecoveryToken = token; 786 user.Save(); 787 } 788 } 789 //variable options 790 text = text.Replace("{{UserName}}", loginName); 791 text = text.Replace("{{ResetLink}}", resetLink); 792 text = text.Replace("{{Name}}", name); 793 text = text.Replace("{{Website}}", website); 794 795 if (GetBoolean("ParagraphContainerIsFirst")) 796 { 797 HttpContext.Current.Items["currentColumns"] = 0; 798 } 799 HttpContext.Current.Items["currentColumns"] = HttpContext.Current.Items["currentColumns"] != null ? int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) + width : width; 800 if (HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) > 100) 801 { 802 HttpContext.Current.Items["currentColumns"] = width; 803 } 804 var blueButton = new Dictionary<string, string> 805 { 806 {"width", "210px"}, 807 {"height", "38px"}, 808 {"background", "#58c2ca"}, 809 {"color", "#ffffff"}, 810 {"font-size", "16px"}, 811 {"font-style", "normal"} 812 }; 813 var openParagraphWrapper = breakBol || (HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) == 0) || GetBoolean("ParagraphContainerIsFirst") ? "<tr align='center' border='0' cellspacing='0' cellpadding='0' width='100%' bgcolor='" + backgroundColor + "' style='" + GetFontFamilyNumber() + "'><td align='center'><table class='responsive-table clearLeft' border='0' cellspacing='0' cellpadding='0' width='500'><tr>" : string.Empty; 814 var closeParagraphWrapper = HttpContext.Current.Items["currentColumns"] != null && int.Parse(HttpContext.Current.Items["currentColumns"].ToString()) == 50 ? "</tr><tr><td height='30'></td></tr></table></td></tr>" : string.Empty; 815 HttpContext.Current.Items["oldColumns"] = HttpContext.Current.Items["currentColumns"]; 816 } 817 818 @if (!GetBoolean("ParagraphContainerIsFirst")) 819 { 820 @closeParagraphWrapper 821 } 822 823 @openParagraphWrapper 824 825 <td border="0" cellspacing="0" cellpadding="0" width="@col" bgcolor="@backgroundColor" style="@GetFontFamilyNumber()" class="responsive-table"> 826 <table border="0" cellspacing="0" cellpadding="0" width="@col" bgcolor="@backgroundColor" style="@GetFontFamilyNumber()" class="responsive-table"> 827 @if (title.IsNotNullOrEmpty() && (titlePosition == "title-first" || titlePosition.IsNullOrEmpty())) 828 { 829 <tr> 830 <td align="@titleAlignment" valign="top"> 831 @RenderEmailParagraphHeading(titleHeadingType, titleAlignment, title) 832 </td> 833 @RenderTableCellSpacer() 834 </tr> 835 } 836 @if (imageAlignment == "image-top") 837 { 838 @RenderEmailParagraphImage(image, imageTitle, link, imageAlignment) 839 } 840 841 @if (text.IsNotNullOrEmpty() || imageAlignment != "image-top") 842 { 843 @RenderTableRowSpacer() 844 <tr> 845 <td align="left" valign="top"> 846 <table class="imageAside" colspan="2" border="0" cellspacing="0" cellpadding="0" width="100%" style="@GetFontFamilyNumber()"> 847 <tr> 848 @if (imageAlignment == "image-left-column") 849 { 850 @RenderEmailParagraphImage(image, imageTitle, link, imageAlignment, 300) 851 } 852 @if (text.IsNotNullOrEmpty()) 853 { 854 <td align="@titleAlignment" valign="top" style="font-size: 14px; line-height: 20px; @GetFontFamilyNumber()"> 855 @if (title.IsNotNullOrEmpty() && titlePosition == "title-with-text") 856 { 857 <div> 858 @RenderEmailParagraphHeading(titleHeadingType, titleAlignment, title) 859 </div> 860 } 861 @text 862 @if (GetBoolean("Item.ShowReadMoreButton")) 863 { 864 <br/> 865 <br/> 866 @RenderEmailButton(link, GetString("Item.LinkText"), blueButton) 867 } 868 </td> 869 } 870 @if (imageAlignment == "image-right-column") 871 { 872 @RenderEmailParagraphImage(image, imageTitle, link, imageAlignment, 300) 873 } 874 </tr> 875 </table> 876 </td> 877 </tr> 878 @RenderTableRowSpacer() 879 } 880 </table> 881 </td> 882 883 @if (GetBoolean("ParagraphContainerIsLast")) 884 { 885 @closeParagraphWrapper 886 }
 
© 2025 Word Music & Church Resources. All Rights Reserved.
Click here to Unsubscribe