Happy New Year
[squirrelmail.git] / templates / default_advanced / left_main.tpl
index e3d8e9f253c5360513762f1cef8c7d5b97de335b..f1b6622dad7d47e8861010906844c5a0f7db7622 100644 (file)
  *      $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
@@ -69,7 +67,7 @@
  *                                            in all folders in this mailbox,
  *                                            excluding trash folders.
  *
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2020 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  * @author Steve Brown
  */
 
-// include required files
-include_once(SM_PATH . 'templates/util_global.php');
 
 /*
  * Recursively parse the mailbox structure to build the navigation tree.
  *
  * @param array $box Array containing mailbox data
  * @param array $settings Array containing perferences, etc, passed to template
+ * @param string $icon_theme_path
  * @param integer $indent_factor Counter used to control indent spacing
  * @since 1.5.2
  * @author Steve Brown
  */
-function buildMailboxTree ($box, $settings, $parent_node=-1) {
+function buildMailboxTree ($box, $settings, $icon_theme_path, $parent_node=-1) {
     static $counter;
     
     // stop condition
@@ -97,11 +94,10 @@ function buildMailboxTree ($box, $settings, $parent_node=-1) {
         return '';
     }
     
-    $image_path = $settings['templateDirectory'] . 'images/';
     $out = '';
-    if ($box['IsRoot']) {
+    if ($box['IsRoot']) { 
         // Determine the path to the correct images
-        $out .= 'mailboxes = new dTree("mailboxes", "'.$image_path.'");'."\n";
+        $out .= 'mailboxes = new dTree("mailboxes", "'.$icon_theme_path.'");'."\n";
         $out .= 'mailboxes.config.inOrder = true;'."\n";
         $counter = -1;
     } else {
@@ -147,21 +143,21 @@ function buildMailboxTree ($box, $settings, $parent_node=-1) {
         $img_open = '';
         switch (true) {
             case $box['IsInbox']:
-                $img = $image_path . 'base.png';
-                $img_open = $image_path . 'base.png';
+                $img = 'base.png';
+                $img_open = 'base.png';
                 break; 
             case $box['IsTrash']:
-                $img = $image_path . 'trash.png';
-                $img_open = $image_path . 'trash.png';
+                $img = 'trash.png';
+                $img_open = 'trash.png';
                 break;
             case $box['IsNoSelect']: 
             case $box['IsNoInferiors']:
-                $img = $image_path . 'page.png';
-                $img_open = $image_path . 'page.png';
+                $img = 'page.png';
+                $img_open = 'page.png';
                 break;
             default:
-                $img = $image_path . 'folder.png';
-                $img_open = $image_path . 'folderopen.png'; 
+                $img = 'folder.png';
+                $img_open = 'folderopen.png'; 
                 break;
         }
         
@@ -199,6 +195,11 @@ function buildMailboxTree ($box, $settings, $parent_node=-1) {
             }
         }
 
+        // 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']) {
@@ -209,11 +210,6 @@ function buildMailboxTree ($box, $settings, $parent_node=-1) {
             $spanend = '</span>';
         }               
         
-        /**
-         * NOTE: Plugins would horribly break this advanced tree, so we are
-         *       going to skip that part altogether.
-         */     
-
         $name = str_replace(
                     array(' ','<','>'),
                     array('&nbsp;','&lt;','&gt;'),
@@ -230,18 +226,26 @@ function buildMailboxTree ($box, $settings, $parent_node=-1) {
         }
         
         if ($display_folder) {
+
+            if ($box['IsInbox']) {
+                global $accesskey_folders_inbox;
+                $accesskey = $accesskey_folders_inbox;
+            }
+            else $accesskey = '';
+
             $out .= 'mailboxes.add('.$counter.', '.$parent_node.', ' .
                                        '"'.addslashes($name).'", "'.$url.'", "'.$title.'", ' .
                                        '"'.$target.'", ' .
-                                       '"'.$img.'", ' .
-                                       '"'.$img_open.'"' .
+                                       '"'.getIconPath($icon_theme_path, $img).'", ' .
+                                       '"'.getIconPath($icon_theme_path, $img_open).'", ' .
+                                       '"'.$accesskey.'"' .
                                        ');'."\n";
         }
     }
     
     $parent_node = $counter;
     for ($i = 0; $i<sizeof($box['ChildBoxes']); $i++) {
-        $out .= buildMailboxTree($box['ChildBoxes'][$i], $settings, $parent_node);
+        $out .= buildMailboxTree($box['ChildBoxes'][$i], $settings, $icon_theme_path, $parent_node);
     }
 
     if ($box['IsRoot']) {
@@ -249,6 +253,7 @@ function buildMailboxTree ($box, $settings, $parent_node=-1) {
     }
     
     return $out;
+//FIXME: somewhere above, need to insert the left_main_after_each_folder hook, or if no plugin hooks allowed in templates, at least the output from that hook (but I think it might be impossible not to have the hook here in this fxn
 }
 
 /* retrieve the template vars */
@@ -276,7 +281,7 @@ extract($t);
 //-->
 </script>
 <div class="sqm_leftMain">
-<?php do_hook('left_main_before'); ?>
+<?php if (!empty($plugin_output['left_main_before'])) echo $plugin_output['left_main_before']; ?>
 <div class="dtree">
 <table class="sqm_wrapperTable" cellspacing="0">
  <tr>
@@ -286,7 +291,7 @@ extract($t);
      <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>
@@ -294,21 +299,24 @@ extract($t);
  </tr>
 </table>
 <p>
-<a href="javascript:mailboxes.openAll()">Open All</a>
+<a href="javascript:mailboxes.openAll()"><?php echo _("Open All") ?></a>
 &nbsp;&nbsp;|&nbsp;&nbsp;
-<a href="javascript:mailboxes.closeAll()">Close All</a>
+<a href="javascript:mailboxes.closeAll()"><?php echo _("Close All") ?></a>
 <?php
 if ($settings['messageRecyclingEnabled']) {
     echo '<br />';
-    echo '<a href="empty_trash.php">Purge Trash</a>';
+    echo '<a href="empty_trash.php?smtoken=' . sm_generate_security_token() . '"';
+    if ($accesskey_folders_purge_trash != 'NONE')
+        echo ' accesskey="' . $accesskey_folders_purge_trash . '"';
+    echo '>' . _("Purge Trash") . '</a>';
 }
 ?>
 </p>
 <script type="text/javascript">
 <!--
-<?php echo buildMailboxTree($mailboxes, $settings); ?>
+<?php echo buildMailboxTree($mailboxes, $settings, $icon_theme_path); ?>
 -->
 </script>
 </div>
-<?php do_hook('left_main_after'); ?>
-</div>
\ No newline at end of file
+<?php if (!empty($plugin_output['left_main_after'])) echo $plugin_output['left_main_after']; ?>
+</div>