';
$end = '';
$indent = str_repeat(' ',$indent_factor);
// Get unseeen/total message info if needed
$unseen_str = '';
if ($settings['unreadNotificationEnabled']) {
// We only display the unread count if we on the Inbox or we are told
// to display it on all folders AND there is more than 1 unread message
if ( $settings['unreadNotificationAllFolders'] ||
(!$settings['unreadNotificationAllFolders'] && strtolower($box['MailboxFullName'])=='inbox')
) {
$unseen = $settings['unreadNotificationCummulative'] ?
$box['CummulativeUnreadCount'] :
$box['UnreadCount'];
if (!$box['IsNoSelect'] && ($unseen > 0 || $settings['unreadNotificationDisplayTotal'])) {
$unseen_str = $unseen;
// Add the total messages if desired
if ($settings['unreadNotificationDisplayTotal']) {
$unseen_str .= '/' . ($settings['unreadNotificationCummulative'] ?
$box['CummulativeMessageCount'] :
$box['MessageCount']);
}
$unseen_str = '' . $unseen_str .
'';
}
}
}
/*
* If the box has any children, and collapsable folders have been enabled
* we need to output the expand/collapse link.
*/
if (sizeof($box['ChildBoxes'])>0 && $settings['collapsableFoldersEnabled']) {
$link = $indent .
'' .
$box['CollapseLink']['Icon'] .
'';
$pre .= $link;
} else {
$pre .= $indent . ' ';
}
/**
* Add folder icon. Template authors may choose to display a different
* image based on whatever logic they see fit here.
*/
$folder_icon = '';
if (!is_null($icon_theme_path)) {
switch (true) {
case $box['IsInbox']:
$folder_icon = getIcon($icon_theme_path, 'inbox.png', '', $box['MailboxName']);
break;
case $box['IsSent']:
$folder_icon = getIcon($icon_theme_path, 'senti.png', '', $box['MailboxName']);
break;
case $box['IsTrash']:
$folder_icon = getIcon($icon_theme_path, 'delitem.png', '', $box['MailboxName']);
break;
case $box['IsDraft']:
$folder_icon = getIcon($icon_theme_path, 'draft.png', '', $box['MailboxName']);
break;
case $box['IsNoInferiors']:
$folder_icon = getIcon($icon_theme_path, 'folder_noinf.png', '', $box['MailboxName']);
break;
default:
$folder_icon = getIcon($icon_theme_path, 'folder.png', '', $box['MailboxName']);
break;
}
$folder_icon .= ' ';
}
$pre .= $folder_icon;
// calculate if access key is needed
//
if ($box['IsInbox']) {
global $accesskey_folders_inbox;
$accesskey = $accesskey_folders_inbox;
}
else $accesskey = '';
/*
* The Trash folder should only be displayed if message recycling has
* been enabled, i.e. when deleted is a message moved to the trash or
* deleted forever?
*/
$view_link = '';
if ($settings['messageRecyclingEnabled'] && $box['IsTrash']) {
$pre .= $view_link;
// Boxes with unread messages should be emphasized
if ($box['UnreadCount'] > 0) {
$pre .= '';
$end .= '';
}
$end .= '';
// Print unread info
if ($box['MessageCount'] > 0 || count($box['ChildBoxes'])) {
if (!empty($unseen_str)) {
$end .= ' ('.$unseen_str.')';
}
$end .= "\n" .
' ['. _("Purge").']' .
'';
}
} else {
// Add a few other things for all other folders...
if (!$box['IsNoSelect']) {
$pre .= $view_link;
// Boxes with unread messages should be emphasized
if ($box['UnreadCount'] > 0) {
$pre .= '';
$end .= '';
}
$end .= '';
}
// Display unread info...
if (!empty($unseen_str)) {
$end .= ' ('.$unseen_str.')';
}
}
// Add any extra output that may have been added by plugins, etc
//
if (!empty($box['ExtraOutput']))
$end .= $box['ExtraOutput'];
$span = '';
$spanend = '';
if ($settings['useSpecialFolderColor'] && $box['IsSpecial']) {
$span = '';
$spanend = '';
} elseif ( $box['IsNoSelect'] ) {
$span = '';
$spanend = '';
}
$end .= '';
$out = '';
if (!$box['IsRoot']) {
$out = $span . $pre .
str_replace(
array(' ','<','>'),
array(' ','<','>'),
$box['MailboxName']) .
$end . $spanend . '
' . "\n";
$indent_factor++;
}
if (!$box['IsCollapsed'] || $box['IsRoot']) {
for ($i = 0; $i