increment year in copyright notices
[squirrelmail.git] / templates / default / left_main.tpl
index 43e26a8a6d9bbd9b8ede84c6dbe863ec2c10b3ea..92e6c555784f4c59f88a80321b52b656622cf389 100644 (file)
@@ -8,12 +8,8 @@
  *      $clock           - formatted string containing last refresh
  *      $settings        - Array containing user perferences needed by this
  *                         template.  Indexes are as follows:
- *          $settings['imapConnection'] - IMAP connection handle.  Needed to
- *                         allow plugins to read the mailbox.
- *          $settings['iconThemePath'] - Path to the desired icon theme.  If
- *                         the user has disabled icons, this will be NULL.
- *          $settings['templateDirectory'] - contains the path to the current
- *                         template directory.  This may be needed by third
+ *          $settings['templateID'] - contains the ID of the current
+ *                         template set.  This may be needed by third
  *                         party packages that don't integrate easily.
  *          $settings['unreadNotificationEnabled'] - Boolean TRUE if the user
  *                         wants to see unread message count on mailboxes
  * @author Steve Brown
  */
 
-// include required files
-include_once(SM_PATH . 'templates/util_global.php');
 
 /*
  * Recursively parse the mailbox structure to build the navigation tree.
  *
  * @since 1.5.2
  */
-function buildMailboxTree ($box, $settings, $indent_factor=0) {
+function buildMailboxTree ($box, $settings, $icon_theme_path, $indent_factor=0) {
     // stop condition
     if (empty($box)) {
         return '';
@@ -103,7 +97,7 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
                             $box['CummulativeUnreadCount'] :
                             $box['UnreadCount'];
             
-            if ($unseen > 0) {
+            if (!$box['IsNoSelect'] && ($unseen > 0 || $settings['unreadNotificationDisplayTotal'])) {
                 $unseen_str = $unseen;
     
                 // Add the total messages if desired
@@ -143,25 +137,25 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
      * image based on whatever logic they see fit here.
      */
     $folder_icon = '';
-    if (!is_null($settings['iconThemePath'])) {
+    if (!is_null($icon_theme_path)) {
         switch (true) {
             case $box['IsInbox']:
-                $folder_icon = getIcon($settings['iconThemePath'], 'inbox.png', '', $box['MailboxName']);
+                $folder_icon = getIcon($icon_theme_path, 'inbox.png', '', $box['MailboxName']);
                 break; 
             case $box['IsSent']:
-                $folder_icon = getIcon($settings['iconThemePath'], 'senti.png', '', $box['MailboxName']);
+                $folder_icon = getIcon($icon_theme_path, 'senti.png', '', $box['MailboxName']);
                 break; 
             case $box['IsTrash']:
-                $folder_icon = getIcon($settings['iconThemePath'], 'delitem.png', '', $box['MailboxName']);
+                $folder_icon = getIcon($icon_theme_path, 'delitem.png', '', $box['MailboxName']);
                 break; 
             case $box['IsDraft']:
-                $folder_icon = getIcon($settings['iconThemePath'], 'draft.png', '', $box['MailboxName']);
+                $folder_icon = getIcon($icon_theme_path, 'draft.png', '', $box['MailboxName']);
                 break; 
             case $box['IsNoInferiors']:
-                $folder_icon = getIcon($settings['iconThemePath'], 'folder_noinf.png', '', $box['MailboxName']);
+                $folder_icon = getIcon($icon_theme_path, 'folder_noinf.png', '', $box['MailboxName']);
                 break;
             default: 
-                $folder_icon = getIcon($settings['iconThemePath'], 'folder.png', '', $box['MailboxName']);
+                $folder_icon = getIcon($icon_theme_path, 'folder.png', '', $box['MailboxName']);
                 break;
         }
         $folder_icon .= ' ';
@@ -188,7 +182,7 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
         $end .= '</a>';
 
         // Print unread info
-        if ($box['UnreadCount'] > 0) {
+        if ($box['MessageCount'] > 0 || count($box['ChildBoxes'])) {
             if (!empty($unseen_str)) {
                 $end .= '&nbsp;<small>('.$unseen_str.')</small>';
             }
@@ -225,10 +219,21 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
         $spanend = '</span>';
     }
 
+/********
+ * Pulling imapConnection due to segfaults that cannot be tracked down.  Best
+ * we can determine, it's some combination of this var and >= 4 plugins enabled.
+ * No further clue from anyone.
+ ********
+ * Update: syntax of this hook call changed a bit, so if the error is so anomalous,
+ * it might be worth trying this again to see if it is still segfaulting
+ ********
+    
     // let plugins fiddle with end of line
+// FIXME: no hooks in templates!
     $end .= concat_hook_function('left_main_after_each_folder',
-            array(isset($numMessages) ? $numMessages : '',
-            $box['MailboxFullName'], $settings['imapConnection']));
+            $temp=array(isset($numMessages) ? &$numMessages : '',
+            &$box['MailboxFullName'], &$settings['imapConnection']));
+*/
 
     $end .= '</span>';
 
@@ -245,7 +250,7 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
 
     if (!$box['IsCollapsed'] || $box['IsRoot']) {
         for ($i = 0; $i<sizeof($box['ChildBoxes']); $i++) {
-            $out .= buildMailboxTree($box['ChildBoxes'][$i], $settings, $indent_factor);
+            $out .= buildMailboxTree($box['ChildBoxes'][$i], $settings, $icon_theme_path, $indent_factor);
         }
     }
 
@@ -258,7 +263,7 @@ extract($t);
 ?>
 <body class="sqm_leftMain">
 <div class="sqm_leftMain">
-<?php do_hook('left_main_before'); ?>
+<?php /* FIXME: no hooks in templates! */ global $null; do_hook('left_main_before', $null); ?>
 <table class="sqm_wrapperTable" cellspacing="0">
  <tr>
   <td>
@@ -272,9 +277,9 @@ extract($t);
     </tr>
    </table>
    <br />
-   <?php echo buildMailboxTree($mailboxes, $settings); ?>
-  </tr>
- </td>
-</table>   
-<?php do_hook('left_main_after'); ?>
-</div>
\ No newline at end of file
+   <?php echo buildMailboxTree($mailboxes, $settings, $icon_theme_path); ?>
+  </td>
+ </tr>
+</table>
+<?php /* FIXME: no hooks in templates! */ do_hook('left_main_after', $null); ?>
+</div>