5 * Basic template to the left main window. The following variables are
6 * avilable in this template:
7 * $clock - formatted string containing last refresh
8 * $mailbox_listing - string containing HTML to display default mailbox tree
9 * $location_of_bar - string "left" or "right" indicating where the frame
10 * is located. Currently only used in
11 * left_main_advanced.tpl
12 * $left_size - width of left column in pixels. Currently only used
13 * in left_main_advanced.tpl
14 * $imapConnection - IMAP connection handle. Needed to allow plugins to
16 * $icon_theme_path - Path to the desired icon theme. If no icon theme has
17 * been chosen, this will be the template directory. If
18 * the user has disabled icons, this will be NULL.
20 * $unread_notification_enabled - Boolean TRUE if the user wants to see unread
21 * message count on mailboxes
22 * $unread_notification_cummulative - Boolean TRUE if the user has enabled
23 * cummulative message counts.
24 * $unread_notification_allFolders - Boolean TRUE if the user wants to see
25 * unread message count on ALL folders or just the
27 * $unread_notification_displayTotal - Boolean TRUE if the user wants to
28 * see the total number of messages in addition to
29 * the unread message count.
30 * $collapsable_folders_enabled - Boolean TRUE if the user has enabled collapsable
32 * $use_special_folder_color - Boolean TRUE if the use has chosen to tag
33 * "Special" folders in a different color.
34 * $message_recycling_enabled - Boolean TRUE if messages that get deleted go to
35 * the Trash folder. FALSE if they are permanently
37 * $trash_folder_name - Name of the Trash folder.
39 * $mailboxes - Associative array of current mailbox structure.
40 * Provided so template authors know what they have to
41 * work with when building a custom mailbox tree.
42 * Array contains the following elements:
43 * $a['MailboxName'] = String containing the name of the mailbox
44 * $a['MailboxFullName'] = String containing full IMAP name of mailbox
45 * $a['MessageCount'] = integer of all messages in the mailbox
46 * $a['UnreadCount'] = integer of unseen message in the mailbox
47 * $a['ViewLink'] = array containing elements needed to view the
48 * mailbox. Elements are:
49 * 'Target' = target frame for link
50 * 'URL' = target URL for link
51 * $a['IsRecent'] = boolean TRUE if the mailbox is tagged "recent"
52 * $a['IsSpecial'] = boolean TRUE if the mailbox is tagged "special"
53 * $a['IsRoot'] = boolean TRUE if the mailbox is the root mailbox
54 * $a['IsNoSelect'] = boolean TRUE if the mailbox is tagged "noselect"
55 * $a['IsCollapsed'] = boolean TRUE if the mailbox is currently collapsed
56 * $a['CollapseLink'] = array containg elements needed to expand/collapse
57 * the mailbox. Elements are:
58 * 'Target' = target frame for link
59 * 'URL' = target URL for link
60 * 'Icon' = the icon to use, based on user prefs
61 * $a['ChildBoxes'] = array containing this same data structure for
62 * each child folder/mailbox of the current
64 * $a['CummulativeMessageCount'] = integer of total messages in all
65 * folders in this mailbox, exlcuding
67 * $a['CummulativeUnreadCount'] = integer of total unseen messages
68 * in all folders in this mailbox,
69 * excluding trash folders.
72 * @copyright © 1999-2006 The SquirrelMail Project Team
73 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
75 * @package squirrelmail
76 * @subpackage templates
79 // include required files
80 include_once(SM_PATH . 'templates/util_global.php');
83 * Recursively parse the mailbox structure to build the navigation tree.
87 function buildMailboxTree ($box, $settings, $indent_factor=0) {
93 # echo '<b>'.$box['MailboxName'].':</b> '.dump_array($box).'<hr>';
94 $pre = '<span style="white-space: nowrap;">';
96 $indent = str_repeat(' ',$indent_factor);
98 // Get unseeen/total message info if needed
100 if ($settings['unreadNotificationEnabled']) {
101 // We only display the unread count if we on the Inbox or we are told
102 // to display it on all folders.
103 if ( $settings['unreadNotificationAllFolders'] ||
104 (!$settings['unreadNotificationAllFolders'] && strtolower($box['MailboxFullName'])=='inbox')
106 $unseen_str = $settings['unreadNotificationCummulative'] ?
107 $box['CummulativeUnreadCount'] :
110 // Add the total messages if desired
111 if ($settings['unreadNotificationDisplayTotal']) {
112 $unseen_str .= '/' . ($settings['unreadNotificationCummulative'] ?
113 $box['CummulativeMessageCount'] :
114 $box['MessageCount']);
117 $unseen_str = '<span class="'.
118 ($box['IsRecent'] ? 'leftrecent' : 'leftunseen') .
125 * If the box has any children, and collapsable folders have been enabled
126 * we need to output the expand/collapse link.
128 if (sizeof($box['ChildBoxes'])>0 && $settings['collapsableFoldersEnabled']) {
130 '<a href="'.$box['CollapseLink']['URL'].'" ' .
131 'target="'.$box['CollapseLink']['Target'].'" ' .
132 'style="text-decoration:none" ' .
133 # 'alt="'.$box['CollapseLink']['Alt'].'" ' .
134 # 'title="'.$box['CollapseLink']['Alt'].'">' .
136 $box['CollapseLink']['Icon'] .
140 $pre .= $indent . ' ';
144 * The Trash folder should only be displayed if message recycling has
145 * been enabled, i.e. when deleted is a message moved to the trash or
148 $view_link = '<a href="'.$box['ViewLink']['URL'].'" ' .
149 'target="'.$box['ViewLink']['Target'].'" ' .
150 'style="text-decoration:none">';
152 if ($settings['messageRecyclingEnabled'] && $box['MailboxFullName'] == $settings['trashFolderName']) {
155 // Boxes with unread messages should be emphasized
156 if ($box['UnreadCount'] > 0) {
163 if ($box['UnreadCount'] > 0) {
164 if (!empty($unseen_str)) {
165 $end .= ' <small>('.$unseen_str.')</small>';
167 $end .= "\n<small>" .
168 ' [<a href="empty_trash.php">'. _("Purge").'</a>]' .
172 // Add a few other things for all other folders...
173 if (!$box['IsNoSelect']) {
176 // Boxes with unread messages should be emphasized
177 if ($box['UnreadCount'] > 0) {
184 // Display unread info...
185 if (!empty($unseen_str)) {
186 $end .= ' <small>('.$unseen_str.')</small>';
192 if ($settings['useSpecialFolderColor'] && $box['IsSpecial']) {
193 $span = '<span class="leftspecial">';
194 $spanend = '</span>';
195 } elseif ( $box['IsNoSelect'] ) {
196 $span = '<span class="leftnoselect">';
197 $spanend = '</span>';
200 // let plugins fiddle with end of line
201 $end .= concat_hook_function('left_main_after_each_folder',
202 array(isset($numMessages) ? $numMessages : '',
203 $box['MailboxFullName'], $settings['imapConnection']));
208 if (!$box['IsRoot']) {
209 $out = $span . $pre .
212 array(' ','<','>'),
213 $box['MailboxName']) .
214 $end . $spanend . '<br />' . "\n";
218 if (!$box['IsCollapsed'] || $box['IsRoot']) {
219 for ($i = 0; $i<sizeof($box['ChildBoxes']); $i++) {
220 $out .= buildMailboxTree($box['ChildBoxes'][$i], $settings, $indent_factor);
227 // Retrieve the template vars
231 * Build an array to pass user prefs to the function that builds the tree in
232 * order to avoid using globals, which are dirty, filthy things in templates. :)
235 $settings['imapConnection'] = $imapConnection;
236 $settings['iconThemePath'] = $icon_theme_path;
237 $settings['unreadNotificationEnabled'] = $unread_notification_enabled;
238 $settings['unreadNotificationAllFolders'] = $unread_notification_allFolders;
239 $settings['unreadNotificationDisplayTotal'] = $unread_notification_displayTotal;
240 $settings['unreadNotificationCummulative'] = $unread_notification_cummulative;
241 $settings['useSpecialFolderColor'] = $use_special_folder_color;
242 $settings['messageRecyclingEnabled'] = $message_recycling_enabled;
243 $settings['trashFolderName'] = $trash_folder_name;
244 $settings['collapsableFoldersEnabled'] = $collapsable_folders_enabled;
247 <body class="sqm_leftMain">
248 <div class="sqm_leftMain">
249 <?php do_hook('left_main_before'); ?>
250 <table class="sqm_wrapperTable" cellspacing="0">
253 <table cellspacing="0">
255 <td style="text-align:center">
256 <span class="sqm_folderHeader"><?php echo _("Folders"); ?></span><br />
257 <span class="sqm_clock"><?php echo $clock; ?></span>
258 <span class="sqm_refreshButton"><small>[<a href="../src/left_main.php" target="left"><?php echo _("Check mail"); ?></a>]</small></span>
263 <?php echo buildMailboxTree($mailboxes, $settings); ?>
267 <?php do_hook('left_main_after'); ?>