4 * left_main_advanced.tpl
6 * Displays an experimental mailbox-tree with dhtml behaviour.
7 * It only works on browsers which supports css and javascript. The used
8 * javascript is experimental and doesn't support all browsers.
9 * It has been tested on IE6 an Konquerer 3.0.0-2.
10 * It is now tested and working on: (please test and update this list)
11 * Windows: IE 5.5 SP2, IE 6 SP1, Gecko based (Mozilla, Firebird) and Opera7
14 * In the function ListAdvancedBoxes there is another var $use_folder_images.
15 * setting this to true is only usefull if the images exists in ../images.
17 * Feel free to experiment with the code and report bugs and enhancements
19 * The following variables are avilable in this template:
20 * $clock - formatted string containing last refresh
21 * $mailbox_listing - string containing HTML to display default mailbox tree
22 * $location_of_bar - string "left" or "right" indicating where the frame
23 * is located. Currently only used in
24 * left_main_advanced.tpl
25 * $left_size - width of left column in pixels. Currently only used
26 * in left_main_advanced.tpl
27 * $imapConnection - IMAP connection handle. Needed to allow plugins to
29 * $icon_theme_path - Path to the desired icon theme. If no icon theme has
30 * been chosen, this will be the template directory. If
31 * the user has disabled icons, this will be NULL.
33 * $unread_notification_enabled - Boolean TRUE if the user wants to see unread
34 * message count on mailboxes
35 * $unread_notification_cummulative - Boolean TRUE if the user has enabled
36 * cummulative message counts.
37 * $unread_notification_allFolders - Boolean TRUE if the user wants to see
38 * unread message count on ALL folders or just the
40 * $unread_notification_displayTotal - Boolean TRUE if the user wants to
41 * see the total number of messages in addition to
42 * the unread message count.
43 * $collapsable_folders_enabled - Boolean TRUE if the user has enabled collapsable
45 * $use_special_folder_color - Boolean TRUE if the use has chosen to tag
46 * "Special" folders in a different color.
47 * $message_recycling_enabled - Boolean TRUE if messages that get deleted go to
48 * the Trash folder. FALSE if they are permanently
50 * $trash_folder_name - Name of the Trash folder.
52 * $mailboxes - Associative array of current mailbox structure.
53 * Provided so template authors know what they have to
54 * work with when building a custom mailbox tree.
55 * Array contains the following elements:
56 * $a['MailboxName'] = String containing the name of the mailbox
57 * $a['MailboxFullName'] = String containing full IMAP name of mailbox
58 * $a['MessageCount'] = integer of all messages in the mailbox
59 * $a['UnreadCount'] = integer of unseen message in the mailbox
60 * $a['ViewLink'] = array containing elements needed to view the
61 * mailbox. Elements are:
62 * 'Target' = target frame for link
63 * 'URL' = target URL for link
64 * $a['IsRecent'] = boolean TRUE if the mailbox is tagged "recent"
65 * $a['IsSpecial'] = boolean TRUE if the mailbox is tagged "special"
66 * $a['IsRoot'] = boolean TRUE if the mailbox is the root mailbox
67 * $a['IsNoSelect'] = boolean TRUE if the mailbox is tagged "noselect"
68 * $a['IsCollapsed'] = boolean TRUE if the mailbox is currently collapsed
69 * $a['CollapseLink'] = array containg elements needed to expand/collapse
70 * the mailbox. Elements are:
71 * 'Target' = target frame for link
72 * 'URL' = target URL for link
73 * 'Icon' = the icon to use, based on user prefs
74 * $a['ChildBoxes'] = array containing this same data structure for
75 * each child folder/mailbox of the current
77 * $a['CummulativeMessageCount'] = integer of total messages in all
78 * folders in this mailbox, exlcuding
80 * $a['CummulativeUnreadCount'] = integer of total unseen messages
81 * in all folders in this mailbox,
82 * excluding trash folders.
85 * @copyright © 1999-2006 The SquirrelMail Project Team
86 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
88 * @package squirrelmail
89 * @subpackage templates
93 * Recursively parse the mailbox structure to build the navigation tree.
95 * @param array $box Array containing mailbox data
96 * @param array $settings Array containing perferences, etc, passed to template
97 * @param integer $indent_factor Counter used to control indent spacing
101 function buildMailboxTree ($box, $settings, $indent_factor=0) {
102 // Work in progress...
105 /* retrieve the template vars */
109 * Build an array to pass user prefs to the function that builds the tree in
110 * order to avoid using globals, which are dirty, filthy things in templates. :)
113 $settings['imapConnection'] = $imapConnection;
114 $settings['iconThemePath'] = $icon_theme_path;
115 $settings['unreadNotificationEnabled'] = $unread_notification_enabled;
116 $settings['unreadNotificationAllFolders'] = $unread_notification_allFolders;
117 $settings['unreadNotificationDisplayTotal'] = $unread_notification_displayTotal;
118 $settings['unreadNotificationCummulative'] = $unread_notification_cummulative;
119 $settings['useSpecialFolderColor'] = $use_special_folder_color;
120 $settings['messageRecyclingEnabled'] = $message_recycling_enabled;
121 $settings['trashFolderName'] = $trash_folder_name;
122 $settings['collapsableFoldersEnabled'] = $collapsable_folders_enabled;
125 <body class="sqm_leftMain">
126 <script type="text/javascript" src="js/test.js"></script>
127 <script type="text/javascript">
130 * Advanced tree makes uses dTree JavaScript package by Geir Landrö heavily.
131 * See http://www.destroydrop.com/javascripts/tree/
134 if (document.images) {
135 var treeImages = new Array;
136 var arguments = preload.arguments;
137 for (var i = 0; i<arguments.length; i++) {
138 treeImages[i] = new Image();
139 treeImages[i].src = arguments[i];
146 function fTreeTimeout() {
147 if (vTreeDiv.readyState == "complete")
148 vTreeImg.src = vTreeSrc;
150 setTimeout("fTreeTimeout()", 100);
152 function hidechilds(img) {
153 id = img.id + ".0000";
154 form_id = "mbx[" + img.id +"F]";
155 if (document.all) { //IE, Opera7
156 div = document.all[id];
158 if (div.style.display == "none") {
159 vTreeSrc = "../images/minus.png";
164 vTreeSrc = "../images/plus.png";
170 if (typeof vTreeDiv.readyState != "undefined") //IE
171 setTimeout("fTreeTimeout()",100);
173 vTreeImg.src = vTreeSrc;
174 div.style.display = style;
175 document.all[form_id].value = value;
178 else if (document.getElementById) { //Gecko
179 div = document.getElementById(id);
181 if (div.style.display == "none") {
182 src = "../images/minus.png";
187 src = "../images/plus.png";
191 div.style.display = style;
193 document.getElementById(form_id).value = value;
197 function buttonover(el,on) {
199 el.style.background="$color[0]";}
201 el.style.background="$color[9]";}
203 function buttonclick(el,on) {
205 el.style.border="groove";}
207 el.style.border="ridge";}
209 function hideframe(hide) {
210 left_size = "$left_size";
212 masterf = window.parent.document.all["fs1"];
213 leftf = window.parent.document.all["left"];
214 leftcontent = document.all["leftframe"];
215 leftbutton = document.all["showf"];
216 } else if (document.getElementById) {
217 masterf = window.parent.document.getElementById("fs1");
218 leftf = window.parent.document.getElementById("left");
219 leftcontent = document.getElementById("leftframe");
220 leftbutton = document.getElementById("showf");
225 new_col = calc_col("20");
226 masterf.cols = new_col;
227 document.body.scrollLeft=0;
228 document.body.style.overflow="hidden";
229 leftcontent.style.display = "none";
230 leftbutton.style.display="block";
232 masterf.cols = calc_col(left_size);
233 document.body.style.overflow="";
234 leftbutton.style.display="none";
235 leftcontent.style.display="block";
238 function calc_col(c_w) {
240 if ($location_of_bar == 'right') {
243 echo ' right=false;';
253 function resizeframe(direction) {
255 masterf = window.parent.document.all["fs1"];
256 } else if (document.getElementById) {
257 window.parent.document.getElementById("fs1");
262 if ($location_of_bar == 'right') {
263 echo ' colPat=/^\*,(\d+)$/;';
265 echo ' colPat=/^(\d+),.*$/;';
268 old_col = masterf.cols;
269 colPat.exec(old_col);
271 new_col_width = parseInt(RegExp.$1) + 25;
273 if (parseInt(RegExp.$1) > 35) {
274 new_col_width = parseInt(RegExp.$1) - 25;
277 masterf.cols = calc_col(new_col_width);
281 <style type="text/css">
284 margin: 0px 0px 0px 0px;
285 padding: 5px 5px 5px 5px;
288 vertical-align: middle;
292 border-color: <?php echo $color[9]; ?>;
293 background: <?php echo $color[0]; ?>;
294 color: <?php echo $color[6]; ?>;
305 text-decoration: none;
306 background-color: <?php echo $color[0]; ?>;
310 background-color: <?php echo $color[9]; ?>;
330 border-left-width:0.1em;
331 border-left-color: <?php echo $color[9]; ?>;
332 border-bottom: solid;
333 border-bottom-width:0.1em;
334 border-bottom-color: <?php echo $color[9]; ?>;
345 border-color: <?php echo $color[9]; ?>;
346 background: <?php echo $color[0]; ?>;
351 <div class="sqm_leftMain">
353 $right_pos = $left_size - 20;
355 <div style="position:absolute; top:0; border:0.1em solid blue;">
356 <div id="hidef" style="width=20;font-size:12"><a href="javascript:hideframe(true)"><b><<</b></a></div>
357 <div id="showf" style="width=20;font-size:12;display:none;"><a href="javascript:hideframe(false)"><b>>></b></a></div>
358 <div id="incrf" style="width=20;font-size:12"><a href="javascript:resizeframe(true)"><b>></b></a></div>
359 <div id="decrf" style="width=20;font-size:12"><a href="javascript:resizeframe(false)"><b><</b></a></div>
365 <?php do_hook('left_main_before'); ?>
366 <table class="sqm_wrapperTable" cellspacing="0">
369 <table cellspacing="0">
371 <td style="text-align:center">
372 <span class="sqm_folderHeader"><?php echo _("Folders"); ?></span><br />
373 <span class="sqm_clock"><?php echo $clock; ?></span>
374 <span class="sqm_refreshButton"><small>[<a href="../src/left_main.php" target="left"><?php echo _("Check mail"); ?></a>]</small></span>
379 <?php echo $mailbox_listing; ?>
383 <?php do_hook('left_main_after'); ?>
385 <?php var_dump($template_dir); ?>