5 * Template to display the envelope headers when viewing a message.
7 * The following variables are available in this template:
9 * $headers_to_display - Array containing the list of all elements that need
10 * to be displayed. The index of each element is the
11 * translated name of the field to be displayed. The
12 * value of each element is the value to be displayed
13 * for that field. Many values can be controled through
14 * additional templates.
17 * @copyright © 1999-2006 The SquirrelMail Project Team
18 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
19 * @version $Id: read_headers.tpl 11998 2006-12-10 21:06:24Z pdontthink $
20 * @package squirrelmail
21 * @subpackage templates
24 /** add required includes **/
26 /** extract template variables **/
29 /** Begin template **/
31 <div class="readHeaders">
32 <table cellspacing="0" class="spacer">
38 <table cellspacing="0" class="table2">
41 // detect if we want to show reduced header or regular (expanded) header list
42 // default is to show the reduced header when the preview pane is turned on
44 // note that this is an example of a template page making use of its own
45 // value placed on the page's query string; we like to keep things like
46 // that in the core, but for template-specific add-on functionalities, this
47 // kind of thing is perfectly acceptable
49 global $data_dir, $username, $PHP_SELF;
50 $use_previewPane = getPref($data_dir, $username, 'use_previewPane', 0);
51 $show_preview_pane = checkForJavascript() && $use_previewPane;
52 if (!sqGetGlobalVar('expand_header', $expand_header, SQ_FORM, 0))
53 if (!$show_preview_pane)
56 // show reduced (collapsed) header
57 if (!$expand_header) {
59 $subject = (!empty($headers_to_display['Subject'])
60 ? $headers_to_display['Subject'] : _("(no subject)"));
61 $date = (!empty($headers_to_display['Date'])
62 ? $headers_to_display['Date'] : _("Unknown date"));
63 $from = (!empty($headers_to_display['From'])
64 ? $headers_to_display['From'] : _("Unknown sender"));
65 // if available, print "real" name instead of email addr
66 if (strpos($from,"<") !== FALSE) {
67 list($from, $ignore) = $parts = explode('<', $from);
69 $from = preg_replace('/^( )+|( )+$/', '', $from);
70 $from = preg_replace('/^(")+|(")+$/', '', $from);
71 $from = preg_replace('/"$/', '', trim($from));
73 $reduced_header = sprintf(_("<b>%s</b> From <b>%s</b> On <b>%s</b>"), $subject, $from, $date);
74 $expand_link = str_replace('&expand_header=0', '', $PHP_SELF) . '&expand_header=1';
76 echo '<tr><td colspan="2" align="center" valign="top">'
77 . '<a href="' . $expand_link . '">'
78 . getIcon($icon_theme_path, 'plus.png', '-', _("Expand Header"))
83 // show normal/full/expanded header listing
86 $collapse_link = str_replace('&expand_header=1', '', $PHP_SELF) . '&expand_header=0';
88 foreach ($headers_to_display as $field_name=>$value) {
95 <td class="fieldName">
98 echo '<a href="' . $collapse_link . '">'
99 . getIcon($icon_theme_path, 'minus.png', '-', _("Collapse Header"))
101 echo $field_name . ':';
105 <td class="fieldValue">
106 <?php echo $value; ?>
112 if (!empty($plugin_output['read_body_header'])) echo $plugin_output['read_body_header'];
115 <table cellspacing="0" class="spacer">