Change string to something already in squirrelmail.pot
[squirrelmail.git] / templates / default / left_main.tpl
index 242e7780684d317c75dbce81385b33cd3c41a537..bca14f91a2cbe423bb07aaaa6cb4e90d14621b17 100644 (file)
@@ -2,38 +2,32 @@
 /**
  * left_main.tpl
  *
- * Basic template to the left main window.  The following variables are
- * avilable in this template:
+ * Basic template to the left main window.  
+ * 
+ * The following variables are avilable in this template:
  *      $clock           - formatted string containing last refresh
- *      $mailbox_listing - string containing HTML to display default mailbox
- *                         tree
- *      $location_of_bar - string "left" or "right" indicating where the frame
- *                         is located.  Currently only used in
- *                         left_main_advanced.tpl
- *      $left_size       - width of left column in pixels. Currently
- *                         only used in left_main_advanced. tpl
- *      $imapConnection  - IMAP connection handle. Needed to allow plugins to
- *                         read the mailbox.
- *      $icon_theme_path - Path to the desired icon theme.  If the user/admin
- *                         has disabled icons, this will be NULL.
- *
- *      $unread_notification_enabled - Boolean TRUE if the user wants to see
- *                         unread message count on mailboxes
- *      $unread_notification_cummulative - Boolean TRUE if the user has enabled
- *                         cummulative message counts.
- *      $unread_notification_allFolders - Boolean TRUE if the user wants to see
- *                         unread message count on ALL folders or just the
- *                         mailbox.
- *      $unread_notification_displayTotal - Boolean TRUE if the user wants to
- *                         see the total number of messages in addition to the
- *                         unread message count.
- *      $collapsable_folders_enabled - Boolean TRUE if the user has enabled
- *                         collapsable folders.
- *      $use_special_folder_color - Boolean TRUE if the use has chosen to tag
- *                         "Special" folders in a different color.
- *      $message_recycling_enabled - Boolean TRUE if messages that get deleted
- *                         go to the Trash folder.  FALSE if they are
- *                         permanently deleted.
+ *      $settings        - Array containing user perferences needed by this
+ *                         template.  Indexes are as follows:
+ *          $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
+ *          $settings['unreadNotificationCummulative'] - Boolean TRUE if the
+ *                         user has enabled cummulative message counts.
+ *          $settings['unreadNotificationAllFolders'] - Boolean TRUE if the
+ *                         user wants to see unread message count on ALL
+ *                         folders or just the Inbox.
+ *          $settings['unreadNotificationDisplayTotal'] - Boolean TRUE if the
+ *                         user wants to see the total number of messages in
+ *                         addition to the unread message count.
+ *          $settings['collapsableFoldersEnabled'] - Boolean TRUE if the user
+ *                         has enabled collapsable folders.
+ *          $settings['useSpecialFolderColor'] - Boolean TRUE if the use has
+ *                         chosen to tag "Special" folders in a different color
+ *          $settings['messageRecyclingEnabled'] - Boolean TRUE if messages
+ *                         that get deleted go to the Trash folder.  FALSE if
+ *                          they are permanently deleted.
  *
  *      $mailboxes       - Associative array of current mailbox structure.
  *                         Provided so template authors know what they have to
  *                                mailbox.  Elements are:
  *                                  'Target' = target frame for link
  *                                  'URL'    = target URL for link
- *          $a['IsRecent']      = boolean TRUE if mailbox is tagged "recent"
- *          $a['IsSpecial']     = boolean TRUE if mailbox is tagged "special"
- *          $a['IsRoot']        = boolean TRUE if mailbox is the root mailbox
- *          $a['IsNoSelect']    = boolean TRUE if mailbox is tagged "noselect"
- *          $a['IsInbox']       = boolean TRUE if mailbox is the Inbox.
- *          $a['IsSent']        = boolean TRUE if mailbox is the Sent box
- *          $a['IsTrash']       = boolean TRUE if mailbox is the Trash box
- *          $a['IsDraft']       = boolean TRUE if mailbox is the Draft box
- *          $a['IsNoInferiors'] = boolean TRUE of mailbox is tagged "no
- *                                inferiors"  
- *          $a['IsCollapsed']   = boolean TRUE if the mailbox is currently
- *                                collapsed 
- * 
- *          $a['CollapseLink']  = array containg elements needed to 
- *                                expand/collapse the mailbox.  Elements are:
- *                                      'Target' = target frame for link
- *                                      'URL'    = target URL for link
- *                                      'Icon'   = the icon to use, based on
- *                                                 user prefs
+ *          $a['IsRecent']      = boolean TRUE if the mailbox is tagged "recent"
+ *          $a['IsSpecial']     = boolean TRUE if the mailbox is tagged "special"
+ *          $a['IsRoot']        = boolean TRUE if the mailbox is the root mailbox
+ *          $a['IsNoSelect']    = boolean TRUE if the mailbox is tagged "noselect"
+ *          $a['IsCollapsed']   = boolean TRUE if the mailbox is currently collapsed
+ *          $a['CollapseLink']  = array containg elements needed to expand/collapse
+ *                                the mailbox.  Elements are:
+ *                                  'Target' = target frame for link
+ *                                  'URL'    = target URL for link
+ *                                  'Icon'   = the icon to use, based on user prefs
  *          $a['ChildBoxes']    = array containing this same data structure for
- *                                each child folder/mailbox.
- *          $a ['CummulativeMessageCount'] = integer of total messages in all
- *                                folders in this mailbox, exlcuding trash
- *                                folders.
- *          $a ['CummulativeUnreadCount'] = integer of total unseen messages
- *                                in all folders in this mailbox, excluding
- *                                trash folders.
+ *                                each child folder/mailbox of the current
+ *                                mailbox.
+ *          $a['CummulativeMessageCount']   = integer of total messages in all
+ *                                            folders in this mailbox, exlcuding
+ *                                            trash folders.
+ *          $a['CummulativeUnreadCount']    = integer of total unseen messages
+ *                                            in all folders in this mailbox,
+ *                                            excluding trash folders.
  *
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2013 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  * @subpackage templates
+ * @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 '';
@@ -112,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
@@ -152,37 +137,46 @@ 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 .= ' ';
     }
     $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 = '<a href="'.$box['ViewLink']['URL'].'" ' .
+                 ($accesskey == '' ? '' : 'accesskey="' . $accesskey . '" ') .
                  'target="'.$box['ViewLink']['Target'].'" ' .
                  'style="text-decoration:none">';
 
@@ -197,12 +191,12 @@ 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>';
             }
             $end .= "\n<small>" .
-                    '&nbsp;&nbsp;[<a href="empty_trash.php">'. _("Purge").'</a>]' .
+                    '&nbsp;&nbsp;[<a href="empty_trash.php?smtoken=' . sm_generate_security_token() . '">'. _("Purge").'</a>]' .
                     '</small>';
         }
     } else {
@@ -224,6 +218,11 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
         }
     }
 
+    // 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']) {
@@ -234,11 +233,6 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
         $spanend = '</span>';
     }
 
-    // let plugins fiddle with end of line
-    $end .= concat_hook_function('left_main_after_each_folder',
-            array(isset($numMessages) ? $numMessages : '',
-            $box['MailboxFullName'], $settings['imapConnection']));
-
     $end .= '</span>';
 
     $out = '';
@@ -254,7 +248,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);
         }
     }
 
@@ -264,25 +258,10 @@ function buildMailboxTree ($box, $settings, $indent_factor=0) {
 // Retrieve the template vars
 extract($t);
 
-/*
- * Build an array to pass user prefs to the function that builds the tree in
- * order to avoid using globals, which are dirty, filthy things in templates. :)
- */
-$settings = array();
-$settings['imapConnection'] = $imapConnection;
-$settings['iconThemePath'] = $icon_theme_path;
-$settings['unreadNotificationEnabled'] = $unread_notification_enabled;
-$settings['unreadNotificationAllFolders'] = $unread_notification_allFolders;
-$settings['unreadNotificationDisplayTotal'] = $unread_notification_displayTotal;
-$settings['unreadNotificationCummulative'] = $unread_notification_cummulative;
-$settings['useSpecialFolderColor'] = $use_special_folder_color;
-$settings['messageRecyclingEnabled'] = $message_recycling_enabled;
-$settings['collapsableFoldersEnabled'] = $collapsable_folders_enabled;
-
 ?>
 <body class="sqm_leftMain">
 <div class="sqm_leftMain">
-<?php do_hook('left_main_before'); ?>
+<?php if (!empty($plugin_output['left_main_before'])) echo $plugin_output['left_main_before']; ?>
 <table class="sqm_wrapperTable" cellspacing="0">
  <tr>
   <td>
@@ -291,14 +270,14 @@ $settings['collapsableFoldersEnabled'] = $collapsable_folders_enabled;
      <td style="text-align:center">
       <span class="sqm_folderHeader"><?php echo _("Folders"); ?></span><br />
       <span class="sqm_clock"><?php echo $clock; ?></span>
-      <span class="sqm_refreshButton"><small>[<a href="../src/left_main.php" target="left"><?php echo _("Check mail"); ?></a>]</small></span>
+      <span class="sqm_refreshButton"><small>[<a href="../src/left_main.php" <?php if ($accesskey_folders_refresh != 'NONE') echo 'accesskey="' . $accesskey_folders_refresh . '" '; ?>target="left"><?php echo _("Check Mail"); ?></a>]</small></span>
      </td>
     </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 if (!empty($plugin_output['left_main_after'])) echo $plugin_output['left_main_after']; ?>
+</div>