-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprintmessage
125 lines (122 loc) · 4.77 KB
/
printmessage
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
<%@ page buffer="8kb" autoFlush="true" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="zm" uri="com.zimbra.zm" %>
<%@ taglib prefix="app" uri="com.zimbra.htmlclient" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="com.zimbra.i18n" %>
<app:handleError>
<zm:getMailbox var="mailbox"/>
${zm:refreshPrefs(mailbox)}
<c:remove var="skin" scope="session"/>
<app:skin mailbox="${mailbox}"/>
<c:choose>
<c:when test="${not empty mailbox.prefs.locale}">
<fmt:setLocale value='${mailbox.prefs.locale}' scope='request' />
</c:when>
<c:otherwise>
<fmt:setLocale value='${pageContext.request.locale}' scope='request' />
</c:otherwise>
</c:choose>
<fmt:setBundle basename="/messages/ZhMsg" scope="request"/>
<c:set var="messageIds" value="${fn:join(paramValues.id, ',')}"/>
${zm:clearMessageCache(mailbox)}
<c:choose>
<c:when test="${not empty param.tz}">
<fmt:setTimeZone var="tz" value="${param.tz}" scope="request"/>
</c:when>
<c:otherwise>
<c:set var="tz" value="${mailbox.prefs.timeZone}" scope="request"/>
</c:otherwise>
</c:choose>
</app:handleError>
<html>
<app:head mailbox="${mailbox}" print="true"/>
<body style='background:white;'>
<div class='ZhCallListPrintView'>
<table cellpadding="0" cellspacing="5" width="100%">
<tr>
<td><b><fmt:message key="zimbraTitle"/></b></td>
<c:set var="mailboxName" value="${(not empty param.acct ? param.acct : mailbox.name)}" />
<td nowrap width='1%'><c:if test="${mailboxName ne 'local@host.local'}"><b>${fn:escapeXml(mailboxName)}</b></c:if></td>
</tr>
</table>
<hr/>
<div class="zPrintMsgs">
<c:forEach items="${messageIds}" var="mid" varStatus="status">
<c:set var="cid" value="${fn:split(mid,':')}"/>
<c:if test="${cid[0] eq 'C'}">
<zm:computeSearchContext var="context" usecache="true" types="conversation" query="*"/>
<c:if test="${fn:length(cid) gt 2}"><c:set var="cidExt" value=":${cid[2]}"/></c:if> <%-- there are two colons when conv is from shared folder so we need to form correct cid as sharedFolderId:convId --%>
<zm:searchConv var="convSearchResult" id="${cid[1]}${cidExt}" context="${context}" markread="false" fetch="all"/>
<table cellpadding="0" cellspacing="5" width="100%">
<tr>
<td>
<div class="ZhPrintSubject">${zm:cook(convSearchResult.hits[0].subject)}</div><hr/>
</td>
</tr>
<tr>
<td>
<c:forEach items="${convSearchResult.hits}" var="hit" varStatus="status">
<zm:getMessage var="message" id="${hit.id}" markread="false" neuterimages="${empty param.xim}" />
<c:url value="/h/printmessage" var="extImageUrl">
<c:param name="id" value="${param.id}"/>
<c:param name="xim" value="1"/>
</c:url>
<app:messagePrintView mailbox="${mailbox}" externalImageUrl="${extImageUrl}" message="${message}" timezone="${tz}"/>
</c:forEach>
</td>
</tr>
</table>
</c:if>
<c:if test="${cid[0] != 'C'}">
<zm:getMessage var="message" id="${mid}" markread="false" neuterimages="${empty param.xim}" part="${param.part}" />
<table cellpadding="0" cellspacing="5" width="100%">
<tr>
<td colspan="2">
<div class="ZhPrintSubject">${zm:cook(message.subject)}</div><hr/>
</td>
</tr>
<tr>
<td colspan="2">
<c:url value="/h/printmessage" var="extImageUrl">
<c:param name="id" value="${param.id}"/>
<c:param name="xim" value="1"/>
</c:url>
<app:messagePrintView mailbox="${mailbox}" externalImageUrl="${extImageUrl}" message="${message}" timezone="${tz}"/>
</td>
</tr>
</table>
</c:if>
<div class="mailSep" style="page-break-after:always"> </div>
</c:forEach>
</div>
<c:if test="${empty messageIds}">
<div class='NoResults'><fmt:message key="noResultsFound"/></div>
</c:if>
<style type="text/css">
.ZhCallListPrintView td, .zPrintMsgs :not(font){
font-family: Tahoma,Arial,Helvetica,sans-serif;
font-size: ${mailbox.prefs.defaultPrintFontSize};
}
.ZhPrintSubject {
padding: 10px;
font-weight: bold;
}
</style>
<script type="text/javascript">
<!--
//Remove the final page-break, to avoid printing empty page
var mailSep = document.getElementsByClassName("mailSep");
for (var index = 0; index < mailSep.length; index++) {
var lastIndex = index +1;
if (lastIndex == mailSep.length)
{
mailSep[index].style.display = "none";
}
}
setTimeout('window.print()', 1000);
//-->
</script>
</body>
</html>