3 * This file provides output functions for ctrlpnl.php
4 * No data manipulation is done in this file
5 * @author Nick Korbel <lqqkout13@users.sourceforge.net>
7 * @author David Poole <David.Poole@fccc.edu>
11 * Copyright (C) 2003 - 2005 phpScheduleIt
12 * License: GPL, see LICENSE
18 include_once('lib/MailMime.class.php');
20 function startMessage() {
22 <table width
="100%" border
="0" cellpadding
="0" cellspacing
="0">
24 <td style
="vertical-align:top; width:16%; border:solid 2px #0F93DF; background-color:#FFFFFF;">
25 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
27 <td
class="tableTitle" style
="background-color:#0F93DF;">
28 <?
echo translate('Message'); ?
>
30 <td
class="tableTitle" style
="background-color:#0F93DF;">
32 <a href
="javascript: help('msg_view');" class="" style
="color: #FFFFFF" onmouseover
="javascript: window.status='Help - Message View'; return true;" onmouseout
="javascript: window.status=''; return true;">?
</a
>
40 function endMessage() {
49 * Print row of message header (From,To,Subject,etc)
50 * $param The mime structure object and the specific header name
52 function MsgPrintHeader($struct,$hdr_list) {
54 foreach ($hdr_list as $hdr) {
55 $header_value = $struct->headers
[strtolower($hdr)];
56 if (is_array($header_value)) {
57 $value_array = $header_value;
58 $count = count($value_array);
59 for ($i=0; $i < $count; $i++
) {
60 $header_value = $value_array[$i];
61 $displayed_value = $header_value ?
htmlspecialchars(trim($header_value)) : '(none)';
63 . ' <td class="headerName"><nobr>' . translate($hdr) , ":</nobr></td>" . "\n"
64 . ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
68 $displayed_value = $header_value ?
htmlspecialchars(trim($header_value)) : '(none)';
70 . ' <td class="headerName"><nobr>' . translate($hdr) . ":</nobr></td>" . "\n"
71 . ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
78 * Print row of optional message headers
79 * $param The mime structure object and the specific header name
81 function MsgPrintHeaderFull($struct,$hdr_list) {
83 foreach ($hdr_list as $hdr) {
84 $header_value = $struct->headers
[strtolower($hdr)];
85 if (!$header_value) continue;
86 if (is_array($header_value)) {
87 $value_array = $header_value;
88 $count = count($value_array);
89 for ($i=0; $i < $count; $i++
) {
90 $header_value = $value_array[$i];
91 $displayed_value = $header_value ?
htmlspecialchars(trim($header_value)) : '(none)';
92 echo ' <tr class="' . getShowHideHeaders('headers') . '">' . "\n"
93 . ' <td class="headerName"><nobr>' . "$hdr:</nobr></td>" . "\n"
94 . ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
98 $displayed_value = $header_value ?
htmlspecialchars(trim($header_value)) : '(none)';
99 echo ' <tr class="' . getShowHideHeaders('headers') . '">' . "\n"
100 . ' <td class="headerName"><nobr>' . "$hdr:</nobr></td>" . "\n"
101 . ' <td class="headerValue">' . $displayed_value . '</td>' . "\n"
108 * Print table of message options (Toggle Header, Back to Messages, etc..)
111 function MsgDisplayOptions($mail_id, $recip_email) {
112 // Double encode needed for javascript pass-through
113 $enc_mail_id = urlencode(urlencode($mail_id));
114 $enc_recip_email = urlencode(urlencode($recip_email));
116 <table
class="stdFont" width
="100%">
119 <a href
="javascript: history.back();">‹‹ <? echo translate('BackMessageIndex'); ?> </a>
122 <a href
="javascript: ViewOriginal('<? echo $enc_mail_id ?>','<? echo $enc_recip_email ?>');"> <?
echo translate('ViewOriginal'); ?
></a
>
124 <a href
="javascript: void(1);" onclick
="showHideFullHeaders('headers');">
125 <?
echo translate('ToggleHeaders'); ?
></a
>
133 * Print row of original message options (Print, Close, etc..)
136 function MsgOriginalOptions() {
140 <td
class="stdFont" align
="right">
141 <a href
="javascript: window.print();"> <?
echo translate('Print'); ?
></a
>
143 <a href
="javascript: window.close();"> <?
echo translate('CloseWindow'); ?
> </a
>
147 <td
class="stdFont" bgcolor
="#FAFAFA">
153 * Print table of message headers (From,To,Subject,etc)
154 * $param The mime structure object
156 function MsgDisplayHeaders($struct) {
158 $headers = array ('From',
164 $headers_full = array ("Received",
170 echo '<table id="headers" width="100%" border="0" cellspacing="0" cellpadding="1" align="center" style="border-collapse:collapse">' . "\n";
171 MsgPrintHeader($struct,$headers);
172 MsgPrintHeaderFull($struct,$headers_full);
173 echo '</table>' . "\n";
177 * Print table of message body
178 * $param The mime structure object
180 function MsgDisplayBody($struct) {
181 echo '<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">';
183 echo ' <td class="stdFont">';
184 MsgParseBody($struct);
193 * Print text of text/plain MIME entity
194 * $param The body of a mime structure object
196 function MsgBodyPlainText($text) {
197 echo nl2br(htmlspecialchars($text));
201 * Print HTML of text/html MIME entity
202 * $param The body of a mime structure object
204 function MsgBodyHtmlText($text) {
205 echo sanitizeHTML($text);
209 * Print list of attachments
210 * $param The body of a mime structure object
212 function MsgDisplayFooter() {
213 // Globals read from MailMime.class.php
216 if ( $filelist ||
$errors ) {
217 // Space before attachment or warning list
220 echo '<table class="stdFont" width="100%" border="0" cellspacing="0" cellpadding="1" align="center">';
225 echo '--Attachments--<br>';
226 foreach ($filelist as $file) {
231 echo '<br>--warnings--<br>';
232 foreach (array_keys($errors) as $errmsg) {
233 echo $errmsg . '<br>';