-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathToFile_GmailPrintTemplate.html
More file actions
130 lines (122 loc) · 6.61 KB
/
ToFile_GmailPrintTemplate.html
File metadata and controls
130 lines (122 loc) · 6.61 KB
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
<?/**
* Displays Print-Friendly version of Gmail Message (not threaded)
*
* @param {String} gmailAccount Email of user printing
* @param {String} gmailAccountName Name of user printing
* @param {PreppedMessageObject} retrievedMessageObject
*/
const MAIL_NAME = "Gmail";
const LOGO = {src: srcToData("https://www.gmail.com/mail/help/images/logonew.gif"), width: "143", height: "59"};
var messageObject = retrievedMessageObject.messageObject;
var subject = retrievedMessageObject.cleanSubject;
var messageDate = retrievedMessageObject.cleanDateString;
/* it's worth pointing out images in this template will likely break as Gmail constantly changes things.
intent was to mirror the standard Print-to-PDF result */
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" nonce="">
.was_a,d,div,p,a,input {font-family: arial, sans-serif;}
</style>
<title><?=MAIL_NAME?> - <?=subject ?></title>
<style type="text/css" nonce="">
body, td {font-size:13px} .was_a:link, .was_a:active, a:link, a:active {color:#1155CC; text-decoration:none} .was_a:hover, a:hover {text-decoration:underline; cursor: pointer} .was_a:visited, a:visited{color:##6611CC} img{border:0px} pre { white-space: pre; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word; max-width: 800px; overflow: auto;} .logo { left: -7px; position: relative; }
</style>
</head>
<body>
<div class="bodycontainer">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="14px">
<td width="143">
<img src="<?!=LOGO.src?>" width="<?=LOGO.width?>" height="<?=LOGO.height?>" alt="<?=MAIL_NAME?>" class="logo">
</td>
<td align="right">
<font size="-1" color="#777"><b><?=gmailAccountName?> <<?=gmailAccount?>></b></font>
</td></tr>
</tbody>
</table>
<hr>
<div class="maincontent">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td>
<font size="+1"><b><?=subject ?></b></font><br>
</td></tr>
</tbody>
</table>
<hr>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="message">
<tbody>
<tr>
<td><font size="-1"><b><?=messageObject.getFrom()?></b></font></td>
<td align="right"><font size="-1"><?= messageDate?></font></td>
</tr>
<tr>
<td colspan="2" style="padding-bottom: 4px;">
<font size="-1" class="recipient">
<? if (messageObject.getReplyTo() != ""){ ?><div class="replyto">Reply-To: <?=messageObject.getReplyTo() ?></div> <? } ?>
<? if (messageObject.getTo() != ""){ ?><div>To: <?=messageObject.getTo()?></div> <? } ?>
<? if (messageObject.getCc() != ""){ ?><div>Cc: <?=messageObject.getCc()?></div> <? } ?>
<? if (messageObject.getBcc() != ""){ ?><div>To: <?=messageObject.getBcc()?></div> <? } ?>
</font>
</td>
</tr>
<tr><td colspan="2">
<table width="100%" cellpadding="12" cellspacing="0" border="0"><tbody>
<tr><td>
<div style="overflow: hidden;">
<font size="-1">
<?!= retrievedMessageObject.cleanBody ?>
</font>
</div>
<?
var atts = retrievedMessageObject.cleanAttachments;
if (atts.length > 0) {
?>
<br clear="all">
<div style="width:50%;border-top:2px #AAAAAA solid"></div>
<table class="att" cellspacing="0" cellpadding="5" border="0">
<tbody>
<? if (atts.length > 1) { ?>
<tr><td>
<b style="padding-left:3"><?= atts.length ?> attachments</b>
</td></tr>
<? } ?>
<? for(var att_index=0;att_index<atts.length;att_index++){ ?>
<tr><td>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<? var mimeType = atts[att_index].getContentType();
var iconSrc = "generic.gif";
if (mimeType == MimeType.HTML){iconSrc = "html2.gif"; }
else if (mimeType == MimeType.MICROSOFT_EXCEL || mimeType == MimeType.MICROSOFT_EXCEL_LEGACY){iconSrc = "xls.gif"; }
else if (mimeType == MimeType.MICROSOFT_POWERPOINT || mimeType == MimeType.MICROSOFT_POWERPOINT_LEGACY){ iconSrc = "ppt.gif"; }
else if (mimeType == MimeType.MICROSOFT_WORD || mimeType == MimeType.MICROSOFT_WORD_LEGACY || mimeType == MimeType.RTF){ iconSrc = "doc.gif"; }
else if (mimeType == MimeType.PDF){ iconSrc = "pdf.gif"; }
else if (mimeType == MimeType.PLAIN_TEXT){ iconSrc = "txt.gif"; }
else if (mimeType == MimeType.ZIP){ iconSrc = "zip.gif"; }
?>
<span class="was_a"><img width="16" height="16" src="<?!=srcToData("https://ssl.gstatic.com/ui/v1/icons/mail/images/" + iconSrc)?>"></span>
</td>
<td width="7"></td>
<td><b><?=atts[att_index].getName()?></b><br><?=formatBytes(atts[att_index].getSize(),0)?></td>
</tr>
</tbody>
</table>
</td></tr>
<? } ?>
</tbody></table>
<? } ?>
</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</div>
</div>
</body>
</html>