forked from vincentmorneau/oracle-rwd-email-template-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrwd_email.pkb
1054 lines (976 loc) · 48.3 KB
/
rwd_email.pkb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
create or replace PACKAGE BODY rwd_email IS
/**********************************************
***********************************************
***********************************************
GLOBAL STUFF
***********************************************
***********************************************
**********************************************/
/*
Global Header
*/
FUNCTION print_global_header return clob IS
BEGIN
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' ||
'<html xmlns="http://www.w3.org/1999/xhtml">' ||
'<head>' ||
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' ||
'<meta name="viewport" content="width=device-width"/>' ||
'</head>';
END print_global_header;
/*
Global CSS
*/
FUNCTION print_global_css return clob IS
BEGIN
return '<style type="text/css">a:hover,a:active{color:#2795b6!important}a:visited,h1 a:active,h1 a:visited,h2 a:active,h2 a:visited,h3 a:active,h3 a:visited,h4 a:active,h4 a:visited,h5 a:active,h5 a:visited,h6 a:active,h6 a:visited{color:#2ba6cb!important}table.button:active td,table.button:visited td{background:#2795b6!important}table.button:visited td a{color:#fff!important}table.button:hover td,table.large-button:hover td,table.medium-button:hover td,table.small-button:hover td,table.tiny-button:hover td{background:#2795b6!important}table.button td a:visited,table.button:active td a,table.button:hover td a,table.large-button td a:visited,table.large-button:active td a,table.large-button:hover td a,table.medium-button td a:visited,table.medium-button:active td a,table.medium-button:hover td a,table.small-button td a:visited,table.small-button:active td a,table.small-button:hover td a,table.tiny-button td a:visited,table.tiny-button:active td a,table.tiny-button:hover td a{color:#fff!important}table.secondary:hover td{background:#d0d0d0!important;color:#555}table.secondary td a:visited,table.secondary:active td a,table.secondary:hover td a{color:#555!important}table.success:hover td{background:#457a1a!important}table.alert:hover td{background:#970b0e!important}table.facebook:hover td{background:#2d4473!important}table.twitter:hover td{background:#0087bb!important}table.google-plus:hover td{background:#C00!important}@media only screen and (max-width:600px){table[class=body] img{width:auto!important;height:auto!important}table[class=body] center{min-width:0!important}table[class=body] .container{width:95%!important}table[class=body] .row{width:100%!important;display:block!important}table[class=body] .wrapper{display:block!important;padding-right:0!important}table[class=body] .column,table[class=body] .columns{table-layout:fixed!important;float:none!important;width:100%!important;padding-right:0!important;padding-left:0!important;display:block!important}table[class=body] .wrapper.first .column,table[class=body] .wrapper.first .columns{display:table!important}table[class=body] table.column td,table[class=body] table.columns td{width:100%!important}table[class=body] .column td.one,table[class=body] .columns td.one{width:8.333333%!important}table[class=body] .column td.two,table[class=body] .columns td.two{width:16.666666%!important}table[class=body] .column td.three,table[class=body] .columns td.three{width:25%!important}table[class=body] .column td.four,table[class=body] .columns td.four{width:33.333333%!important}table[class=body] .column td.five,table[class=body] .columns td.five{width:41.666666%!important}table[class=body] .column td.six,table[class=body] .columns td.six{width:50%!important}table[class=body] .column td.seven,table[class=body] .columns td.seven{width:58.333333%!important}table[class=body] .column td.eight,table[class=body] .columns td.eight{width:66.666666%!important}table[class=body] .column td.nine,table[class=body] .columns td.nine{width:75%!important}table[class=body] .column td.ten,table[class=body] .columns td.ten{width:83.333333%!important}table[class=body] .column td.eleven,table[class=body] .columns td.eleven{width:91.666666%!important}table[class=body] .column td.twelve,table[class=body] .columns td.twelve{width:100%!important}table[class=body] td.offset-by-eight,table[class=body] td.offset-by-eleven,table[class=body] td.offset-by-five,table[class=body] td.offset-by-four,table[class=body] td.offset-by-nine,table[class=body] td.offset-by-one,table[class=body] td.offset-by-seven,table[class=body] td.offset-by-six,table[class=body] td.offset-by-ten,table[class=body] td.offset-by-three,table[class=body] td.offset-by-two{padding-left:0!important}table[class=body] table.columns td.expander{width:1px!important}table[class=body] .text-pad-right{padding-left:10px!important}table[class=body] .text-pad-left{padding-right:10px!important}table[class=body] .hide-for-small,table[class=body] .show-for-desktop{display:none!important}table[class=body] .hide-for-desktop,table[class=body] .show-for-small{display:inherit!important}table[class=body] .right-text-pad{padding-left:10px!important}table[class=body] .left-text-pad{padding-right:10px!important}}</style>';
END print_global_css;
/*
Global Body HTML tag
*/
FUNCTION outer_body(
p_content in clob) return clob IS
BEGIN
return '<body style="background:' || g_body_background || '; width: 100% !important; min-width: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; color: ' || g_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; text-align: left; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; margin: 0; padding: 0;">'
|| p_content
|| '</body>';
END outer_body;
/*
Global Mandatory Table to wrap the body content
*/
FUNCTION inner_body(
p_content in clob) return clob IS
BEGIN
return '<table class="body" style="background:' || g_body_background || '; border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: left; height: 100%; width: 100%; color: ' || g_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; margin: 0; padding: 0;">'
|| '<tr style="vertical-align: top; text-align: left; padding: 0;" align="left">'
|| p_content
|| '</tr>'
|| '</table>';
END inner_body;
/* Email Footer */
FUNCTION print_global_end return clob IS
BEGIN
return '</html>';
END print_global_end;
/**********************************************
***********************************************
***********************************************
GRID
***********************************************
***********************************************
**********************************************/
/*
Constrains the content to a 580px wrapper on large screens (95% on small screens) and centers it within the body.
*/
FUNCTION print_container (
p_content in clob) return clob IS
BEGIN
return '<table class="container" style="border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: inherit; width: 580px; margin: 0 auto; padding: 0;">'
|| '<tr style="vertical-align: top; text-align: left; padding: 0;" align="left">'
|| print_standard_td(p_content)
|| '</tr>'
|| '</table>';
END print_container;
/*
Separates each row of content.
*/
FUNCTION print_row (
p_content in clob
, p_classes in varchar2 default null
, p_display in varchar2 default 'block'
, p_header_background_color in varchar2 default 'transparent') return clob IS
BEGIN
return '<table class="row ' || p_classes || '" style="border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: left; width: 100%; position: relative; background: ' || p_header_background_color || '; display: ' || p_display || '; padding: 0px;" bgcolor="' || p_header_background_color || '">'
|| '<tr style="vertical-align: top; text-align: left; padding: 0;" align="left">'
|| p_content
|| '</tr>'
|| '</table>';
END print_row;
/*
Grid Standard TD
*/
FUNCTION print_standard_td (
p_content in clob
, p_align in varchar2 default 'left'
, p_padding in varchar2 default '0 0 10px'
, p_background_color in varchar2 default 'transparent'
, p_border in varchar2 default 'none'
, p_extra_attributes in varchar2 default null)
return clob IS
BEGIN
return '<td style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; vertical-align: top; text-align: ' || p_align || '; color: ' || g_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; margin: 0; padding: ' || p_padding || ';" align="' || p_align || '" valign="top">'
|| p_content
|| '</td>';
END print_standard_td;
/*
Grid Standard TD Centered
*/
FUNCTION print_standard_td_center (
p_content in clob) return clob IS
BEGIN
return print_standard_td(
p_content => '<center style="width: 100%; min-width: 580px;">'
|| p_content
|| '</center>'
,p_align => 'center'
);
END print_standard_td_center;
/*
Wraps each .columns table, in order to create a gutter between columns
and force them to expand to full width on small screens.
*/
FUNCTION print_column_wrapper (
p_content in clob) return clob IS
BEGIN
return '<td class="wrapper" style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; vertical-align: top; text-align: left; position: relative; color: ' || g_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; margin: 0; padding: 10px 20px 0px 0px;" align="left" valign="top">'
|| p_content
|| '</td>';
END print_column_wrapper;
/*
Can be any number between one and twelve (spelled out).
Used to determine how wide your .columns tables are.
The number of columns in each row should add up to 12, including offset columns .
*/
FUNCTION print_col (
p_content in clob
, p_number in varchar2
, p_width in varchar2) return clob IS
BEGIN
return '<table class="' || p_number || ' columns" style="border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: left; width: ' || p_width || '; margin: 0 auto; padding: 0;">'
|| '<tr style="vertical-align: top; text-align: left; padding: 0;" align="left">'
|| p_content
|| print_expander
|| '</tr>'
|| '</table>';
END print_col;
/*
1 Columns
*/
FUNCTION print_col_1 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'one', '30px');
END print_col_1;
/*
2 Columns
*/
FUNCTION print_col_2 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'two', '80px');
END print_col_2;
/*
3 Columns
*/
FUNCTION print_col_3 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'three', '130px');
END print_col_3;
/*
4 Columns
*/
FUNCTION print_col_4 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'four', '180px');
END print_col_4;
/*
5 Columns
*/
FUNCTION print_col_5 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'five', '230px');
END print_col_5;
/*
6 Columns
*/
FUNCTION print_col_6 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'six', '280px');
END print_col_6;
/*
7 Columns
*/
FUNCTION print_col_7 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'seven', '330px');
END print_col_7;
/*
8 Columns
*/
FUNCTION print_col_8 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'eight', '380px');
END print_col_8;
/*
9 Columns
*/
FUNCTION print_col_9 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'nine', '430px');
END print_col_9;
/*
10 Columns
*/
FUNCTION print_col_10 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'ten', '480px');
END print_col_10;
/*
11 Columns
*/
FUNCTION print_col_11 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'eleven', '530px');
END print_col_11;
/*
12 Columns
*/
FUNCTION print_col_12 (p_content in clob) return clob IS
BEGIN
return print_col(p_content, 'twelve', '580px');
END print_col_12;
/*
An empty (and invisible) element added after the content element in a .columns table.
It forces the content td to expand to the full width of the screen on small devices,
instead of just the width of the content within the td.
*/
FUNCTION print_expander return clob IS
BEGIN
return '<td class="expander" style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; vertical-align: top; text-align: left; visibility: hidden; width: 0px; color: ' || g_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; margin: 0; padding: 0;" align="left" valign="top"></td>';
END print_expander;
/**********************************************
***********************************************
***********************************************
SUB GRID
***********************************************
***********************************************
**********************************************/
/*
Can be any number between one and twelve (spelled out).
Used to determine how wide your .columns tables are.
The number of sub columns in each row should add up to 12, including offset sub columns .
*/
FUNCTION print_sub_col (p_content in clob
, p_classes in varchar2
, p_width in varchar2
, p_align in varchar2 default 'left') return clob IS
BEGIN
return '<td class="sub-columns ' || p_classes || '" style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; vertical-align: middle; text-align: ' || p_align || '; min-width: 0px; width: ' || p_width || '; color: ' || g_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; margin: 0; padding: 0px 10px 10px 0px;" align="' || p_align || '" valign="middle">'
|| p_content
|| '</td>';
END print_sub_col;
/*
1 Sub Columns
*/
FUNCTION print_sub_col_1 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'one', round(100*1/12, 4) || '%', p_align);
END print_sub_col_1;
/*
2 Sub Columns
*/
FUNCTION print_sub_col_2 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'two', round(100*2/12, 4) || '%', p_align);
END print_sub_col_2;
/*
3 Sub Columns
*/
FUNCTION print_sub_col_3 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'three', round(100*3/12, 4) || '%', p_align);
END print_sub_col_3;
/*
4 Sub Columns
*/
FUNCTION print_sub_col_4 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'four', round(100*4/12, 4) || '%', p_align);
END print_sub_col_4;
/*
5 Sub Columns
*/
FUNCTION print_sub_col_5 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'five', round(100*5/12, 4) || '%', p_align);
END print_sub_col_5;
/*
6 Sub Columns
*/
FUNCTION print_sub_col_6 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'six', round(100*6/12, 4) || '%', p_align);
END print_sub_col_6;
/*
7 Sub Columns
*/
FUNCTION print_sub_col_7 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'seven', round(100*7/12, 4) || '%', p_align);
END print_sub_col_7;
/*
8 Sub Columns
*/
FUNCTION print_sub_col_8 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'eight', round(100*8/12, 4) || '%', p_align);
END print_sub_col_8;
/*
9 Sub Columns
*/
FUNCTION print_sub_col_9 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'nine', round(100*9/12, 4) || '%', p_align);
END print_sub_col_9;
/*
10 Sub Columns
*/
FUNCTION print_sub_col_10 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'ten', round(100*10/12, 4) || '%', p_align);
END print_sub_col_10;
/*
11 Sub Columns
*/
FUNCTION print_sub_col_11 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'eleven', round(100*11/12, 4) || '%', p_align);
END print_sub_col_11;
/*
12 Sub Columns
*/
FUNCTION print_sub_col_12 (p_content in clob, p_align in varchar2 default 'left') return clob IS
BEGIN
return print_sub_col(p_content, 'twelve', round(100*12/12, 4) || '%', p_align);
END print_sub_col_12;
/**********************************************
***********************************************
***********************************************
PANELS
***********************************************
***********************************************
**********************************************/
FUNCTION print_panel (
p_content in clob
, p_background_color in varchar2 default '#f2f2f2'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return '<td class="panel" style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; vertical-align: top; text-align: left; color: ' || p_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; background: ' || p_background_color || '; margin: 0; padding: 10px; border: 1px solid #d9d9d9;" align="left" bgcolor="' || p_background_color || '" valign="top">' || p_content || '</td>';
END print_panel;
/**********************************************
***********************************************
***********************************************
TYPOGRAPHY
***********************************************
***********************************************
**********************************************/
/*
Prints a standard paragraph
*/
FUNCTION print_paragraph (
p_text in varchar2
, p_classes in varchar2 default null
, p_font_size in varchar2 default '14px'
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return '<p class="' || p_classes || '" style="color: ' || p_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; text-align: ' || p_align || '; line-height: ' || g_line_height || '; font-size: ' || p_font_size || '; margin: 0 0 10px; padding: 0;" align="' || p_align || '">' || p_text || '</p>';
END print_paragraph;
/*
Prints a bigger paragraph
*/
FUNCTION print_paragraph_lead (
p_text in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return print_paragraph (
p_text => p_text
, p_classes => 'lead'
, p_font_size => '18px'
, p_align => p_align
, p_text_color => p_text_color);
END print_paragraph_lead;
/*
Prints an H tag
*/
FUNCTION print_h (
p_text in varchar2
, p_h_size in varchar2
, p_font_size in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return '<h' || p_h_size || ' style="color: ' || p_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; text-align: ' || p_align || '; line-height: 1.3; word-break: normal; font-size: ' || p_font_size || '; margin: 0; padding: 0;" align="' || p_align || '">'
|| p_text
|| '</h' || p_h_size || '>';
END print_h;
/*
Prints an H1 tag
*/
FUNCTION print_h1 (
p_text in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return print_h (
p_text => p_text
, p_h_size => '1'
, p_font_size => '40px'
, p_align => p_align
, p_text_color => p_text_color);
END print_h1;
/*
Prints an H2 tag
*/
FUNCTION print_h2 (
p_text in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return print_h (
p_text => p_text
, p_h_size => '2'
, p_font_size => '36px'
, p_align => p_align
, p_text_color => p_text_color);
END print_h2;
/*
Prints an H3 tag
*/
FUNCTION print_h3 (
p_text in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return print_h (
p_text => p_text
, p_h_size => '3'
, p_font_size => '32px'
, p_align => p_align
, p_text_color => p_text_color);
END print_h3;
/*
Prints an H4 tag
*/
FUNCTION print_h4 (
p_text in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return print_h (
p_text => p_text
, p_h_size => '4'
, p_font_size => '28px'
, p_align => p_align
, p_text_color => p_text_color);
END print_h4;
/*
Prints an H5 tag
*/
FUNCTION print_h5 (
p_text in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return print_h (
p_text => p_text
, p_h_size => '5'
, p_font_size => '24px'
, p_align => p_align
, p_text_color => p_text_color);
END print_h5;
/*
Prints an H6 tag
*/
FUNCTION print_h6(
p_text in varchar2
, p_align in varchar2 default 'left'
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return print_h (
p_text => p_text
, p_h_size => '6'
, p_font_size => '20px'
, p_align => p_align
, p_text_color => p_text_color);
END print_h6;
/*
Prints a small text
*/
FUNCTION print_small_text(
p_text in varchar2
, p_text_color in varchar2 default g_text_color) return clob IS
BEGIN
return '<small style="font-size: 10px;">' || p_text || '</small>';
END print_small_text;
/*
Prints a label for the title bar
*/
FUNCTION print_title(
p_text in varchar2
, p_text_color in varchar2 default '#ffffff') return clob IS
BEGIN
return '<span class="template-label" style="color: ' || p_text_color || '; font-weight: bold; font-size: 11px;">' || p_text || '</span>';
END print_title;
/**********************************************
***********************************************
***********************************************
BUTTONS
***********************************************
***********************************************
**********************************************/
FUNCTION print_button (
p_content in clob
, p_button_classes in varchar2 default 'button'
, p_align in varchar2 default 'left'
, p_padding in varchar2 default '0 0 10px'
, p_background_color in varchar2 default 'transparent'
, p_border in varchar2 default 'none'
, p_extra_style in varchar2 default null) return clob IS
BEGIN
return '<table class="' || p_button_classes || '" style="border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: left; width: 100%; overflow: hidden; padding: 0;">'
|| '<tr style="vertical-align: top; text-align: left; padding: 0;" align="left">'
|| '<td style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; vertical-align: top; text-align: ' || p_align || '; color: ' || g_text_color || '; font-family: ' || g_font_family || '; font-weight: normal; line-height: ' || g_line_height || '; font-size: ' || g_font_size || '; background: ' || p_background_color || '; margin: 0; padding: ' || p_padding || '; border: ' || p_border || '; ' || p_extra_style || '" align="' || p_align || '" valign="top" bgcolor="' || p_background_color || '">'
|| p_content
|| '</td>'
|| '</tr>'
|| '</table>';
END print_button;
FUNCTION print_plain_link (
p_url in clob
, p_label in clob) return clob IS
BEGIN
return print_button(
p_content => '<a href="' || p_url || '" style="color: ' || g_text_color || '; text-decoration: none;">' || p_label || '</a>'
);
END print_plain_link;
FUNCTION print_primary_button (
p_url in clob
, p_label in clob) return clob IS
BEGIN
return print_button(
p_content => '<a href="' || p_url || '" style="color: ' || g_primary_button_text_color || '; text-decoration: none; font-weight: bold; font-family: ' || g_font_family || '; font-size: 16px;">' || p_label || '</a>'
,p_align => 'center'
,p_padding => '8px 0'
,p_background_color => g_primary_button_bgcolor
,p_border => '1px solid #2284a1'
,p_extra_style => 'display: block; width: auto !important;'
);
END print_primary_button;
FUNCTION print_button_facebook (
p_url in clob
, p_label in clob) return clob IS
BEGIN
return print_button(
p_content => '<a href="' || p_url || '" style="color: #ffffff; text-decoration: none; font-weight: bold; font-family: ' || g_font_family || '; font-size: 12px;">' || p_label || '</a>'
,p_button_classes => 'tiny-button facebook'
,p_align => 'center'
,p_padding => '5px 0 4px'
,p_background_color => '#3b5998'
,p_border => '1px solid #2d4473'
,p_extra_style => 'display: block; width: auto !important;'
);
END print_button_facebook;
FUNCTION print_button_twitter (
p_url in clob
, p_label in clob) return clob IS
BEGIN
return print_button(
p_content => '<a href="' || p_url || '" style="color: #ffffff; text-decoration: none; font-weight: bold; font-family: ' || g_font_family || '; font-size: 12px;">' || p_label || '</a>'
,p_button_classes => 'tiny-button twitter'
,p_align => 'center'
,p_padding => '5px 0 4px'
,p_background_color => '#00acee'
,p_border => '1px solid #0087bb'
,p_extra_style => 'display: block; width: auto !important;'
);
END print_button_twitter;
FUNCTION print_button_google_plus (
p_url in clob
, p_label in clob) return clob IS
BEGIN
return print_button(
p_content => '<a href="' || p_url || '" style="color: #ffffff; text-decoration: none; font-weight: bold; font-family: ' || g_font_family || '; font-size: 12px;">' || p_label || '</a>'
,p_button_classes => 'tiny-button google-plus'
,p_align => 'center'
,p_padding => '5px 0 4px'
,p_background_color => '#DB4A39'
,p_border => '1px solid #cc0000'
,p_extra_style => 'display: block; width: auto !important;'
);
END print_button_google_plus;
/**********************************************
***********************************************
***********************************************
OTHER FEATURES
***********************************************
***********************************************
**********************************************/
/*
Print an image through a URL
Can be aligned left, center or right
*/
FUNCTION print_image(
p_img_url in varchar2
, p_align in varchar2 default 'left') return clob IS
BEGIN
return '<img src="' || p_img_url || '" style="outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; width: auto; max-width: 100%; float: left; clear: both; display: block;" align="' || p_align || '" />';
END print_image;
/*
Simple line to separate content
*/
FUNCTION print_hr return clob IS
BEGIN
return '<hr style="color: #d9d9d9; height: 1px; background: #d9d9d9; border: none;" />';
END print_hr;
/**********************************************
***********************************************
***********************************************
COMMON PATTERNS
***********************************************
***********************************************
**********************************************/
FUNCTION print_default_body_header(
p_logo_url in varchar2
, p_title in varchar2) return clob IS
BEGIN
return print_row(
p_content => print_standard_td_center(
print_container(
print_column_wrapper (
print_col_12(
print_sub_col_6(print_image(p_logo_url), 'left')
|| print_sub_col_6(print_title(p_title), 'right')
)
)
)
)
, p_classes => 'header'
, p_display => 'table'
, p_header_background_color => g_header_background_color
)
|| '<br />';
END print_default_body_header;
FUNCTION print_default_body_footer(
p_footer_links in varchar2) return clob IS
BEGIN
return '<br /><br />'
|| print_row(
print_column_wrapper (
print_col_12(
print_standard_td_center(
print_paragraph (
p_text => p_footer_links
, p_align => 'center')
)
)
)
);
END print_default_body_footer;
FUNCTION print_global_body(
p_content in clob) return clob IS
BEGIN
return print_global_header
|| outer_body(
print_global_css
|| inner_body(
print_standard_td_center(p_content)
)
)
|| print_global_end;
END print_global_body;
/**********************************************
***********************************************
***********************************************
PRESET TEMPLATES
***********************************************
***********************************************
**********************************************/
/* Basic Template */
FUNCTION basic (p_content in t_content) return clob IS
l_body clob;
BEGIN
/* Build the email body */
l_body := print_global_body(
print_default_body_header(p_content.logo_url, p_content.title)
|| print_container(
print_row(
print_column_wrapper(
print_col_12(
print_standard_td(
print_h1(p_content.welcome_title)
|| print_paragraph_lead(p_content.sub_welcome_title)
|| print_paragraph(p_content.top_paragraph)
)
)
)
)
|| print_row(
print_column_wrapper(
print_col_12(
print_panel(
p_content => print_paragraph(
p_text => p_content.bottom_paragraph)
, p_background_color => '#ECF8FF')
)
)
)
|| '<br />'
|| print_row(
print_column_wrapper(
print_col_6(
print_panel(
print_h6(p_content.social_title)
|| print_button_facebook(
p_url => '#'
,p_label => 'Facebook')
|| print_hr
|| print_button_twitter(
p_url => '#'
,p_label => 'Twitter')
|| print_hr
|| print_button_google_plus(
p_url => '#'
,p_label => 'Google+')
)
)
)
|| print_column_wrapper(
print_col_6(
print_panel(
print_h6(p_content.contact_info)
|| print_paragraph(p_content.contact_phone)
|| print_paragraph(p_content.contact_email)
)
)
)
)
|| print_default_body_footer(p_content.footer_links)
)
);
/* Returns email body */
return l_body;
END basic;
/* Hero Template */
FUNCTION hero (p_content in t_content) RETURN clob IS
l_body clob;
BEGIN
/* Build the email body */
l_body := print_global_body(
print_default_body_header(p_content.logo_url, p_content.title)
|| print_container(
print_row(
print_column_wrapper(
print_col_12(
print_standard_td(
print_h1(p_content.welcome_title)
|| print_paragraph_lead(p_content.sub_welcome_title)
|| print_image(p_content.big_picture_url)
)
)
)
)
|| print_row(
print_column_wrapper(
print_col_12(
print_panel(
p_content => print_paragraph(
p_text => p_content.top_paragraph)
,p_background_color => '#ECF8FF')
)
|| '<br />'
|| print_col_12(
print_h3(p_content.bottom_paragraph_title
|| print_small_text(p_content.bottom_paragraph_subtitle))
|| print_paragraph(
p_text => p_content.bottom_paragraph)
)
)
)
|| '<br />'
|| print_row(
print_column_wrapper(
print_col_6(
print_panel(
print_h6(p_content.social_title)
|| print_button_facebook(
p_url => '#'
,p_label => 'Facebook')
|| print_hr
|| print_button_twitter(
p_url => '#'
,p_label => 'Twitter')
|| print_hr
|| print_button_google_plus(
p_url => '#'
,p_label => 'Google+')
)
)
)
|| print_column_wrapper(
print_col_6(
print_panel(
print_h6(p_content.contact_info)
|| print_paragraph(p_content.contact_phone)
|| print_paragraph(p_content.contact_email)
)
)
)
)
|| print_default_body_footer(p_content.footer_links)
)
);
/* Returns email body */
return l_body;
END hero;
/* Sidebar Template */
FUNCTION sidebar (p_content in t_content) return clob IS
l_body clob;
BEGIN
/* Build the email body */
l_body := print_global_body(
print_default_body_header(p_content.logo_url, p_content.title)
|| print_container(
print_row(
print_column_wrapper(
print_col_6(
print_standard_td(
print_h1(p_content.welcome_title)
|| print_paragraph(p_content.sub_welcome_title)
|| print_paragraph(p_content.left_paragraph)
)
)
|| '<br />'
|| print_col_6(
print_panel(print_paragraph(p_content.top_paragraph))
)
|| '<br />'
|| print_col_6(
print_standard_td(
print_paragraph(p_content.left_paragraph)
|| print_primary_button (
p_url => '#'
, p_label => 'Click Me!')
)
)
)
|| print_column_wrapper(
print_col_6(
print_panel(
print_h6(p_content.right_header)
|| print_paragraph(p_content.right_sub_header)
|| print_plain_link('#', 'Just a Plain Link »')
|| print_hr
|| print_plain_link('#', 'Just a Plain Link »')
|| print_hr
|| print_plain_link('#', 'Just a Plain Link »')
|| print_hr
|| print_plain_link('#', 'Just a Plain Link »')
|| print_hr
|| print_plain_link('#', 'Just a Plain Link »')
)
)
|| '<br />'
|| print_col_6(
print_panel(
print_h6(p_content.social_title)
|| print_button_facebook(
p_url => '#'
,p_label => 'Facebook')
|| print_hr
|| print_button_twitter(
p_url => '#'
,p_label => 'Twitter')
|| print_hr
|| print_button_google_plus(
p_url => '#'
,p_label => 'Google+')
|| '<br />'
|| print_h6(p_content.contact_info)
|| print_paragraph(p_content.contact_phone)
|| print_paragraph(p_content.contact_email)
)
)
)
)
|| print_default_body_footer(p_content.footer_links)
)
);
/* Returns email body */
return l_body;
END sidebar;
/* Sidebar Hero Template */
FUNCTION sidebar_hero (p_content in t_content) return clob IS
l_body clob;
BEGIN
/* Build the email body */
l_body := print_global_body(
print_default_body_header(p_content.logo_url, p_content.title)
|| print_container(
print_row(
print_column_wrapper(
print_col_12(
print_standard_td(
print_h1(p_content.welcome_title)
|| print_paragraph(p_content.sub_welcome_title)
|| print_image(p_content.big_picture_url)
)
)
|| print_col_12(
print_panel(print_paragraph(p_content.top_paragraph))
)
)
)
|| '<br />'
|| print_row(