3 * left_main_advanced.tpl
5 * Displays an experimental mailbox-tree with dhtml behaviour.
6 * It only works on browsers which supports css and javascript. The used
7 * javascript is experimental and doesn't support all browsers.
8 * It has been tested on IE6 an Konquerer 3.0.0-2.
9 * It is now tested and working on: (please test and update this list)
10 * Windows: IE 5.5 SP2, IE 6 SP1, Gecko based (Mozilla, Firebird) and Opera7
13 * In the function ListAdvancedBoxes there is another var $use_folder_images.
14 * setting this to true is only usefull if the images exists in ../images.
16 * Feel free to experiment with the code and report bugs and enhancements
18 * The following variables are avilable in this template:
19 * $clock - formatted string containing last refresh
20 * $mailbox_listing - string containing HTML to display default mailbox tree
21 * $location_of_bar - string "left" or "right" indicating where the frame
22 * is located. Currently only used in
23 * left_main_advanced.tpl
24 * $left_size - width of left column in pixels. Currently only used
25 * in left_main_advanced.tpl
26 * $imapConnection - IMAP connection handle. Needed to allow plugins to
28 * $icon_theme_path - Path to the desired icon theme. If no icon theme has
29 * been chosen, this will be the template directory. If
30 * the user has disabled icons, this will be NULL.
32 * $unread_notification_enabled - Boolean TRUE if the user wants to see unread
33 * message count on mailboxes
34 * $unread_notification_cummulative - Boolean TRUE if the user has enabled
35 * cummulative message counts.
36 * $unread_notification_allFolders - Boolean TRUE if the user wants to see
37 * unread message count on ALL folders or just the
39 * $unread_notification_displayTotal - Boolean TRUE if the user wants to
40 * see the total number of messages in addition to
41 * the unread message count.
42 * $collapsable_folders_enabled - Boolean TRUE if the user has enabled collapsable
44 * $use_special_folder_color - Boolean TRUE if the use has chosen to tag
45 * "Special" folders in a different color.
46 * $message_recycling_enabled - Boolean TRUE if messages that get deleted go to
47 * the Trash folder. FALSE if they are permanently
49 * $trash_folder_name - Name of the Trash folder.
51 * $mailboxes - Associative array of current mailbox structure.
52 * Provided so template authors know what they have to
53 * work with when building a custom mailbox tree.
54 * Array contains the following elements:
55 * $a['MailboxName'] = String containing the name of the mailbox
56 * $a['MailboxFullName'] = String containing full IMAP name of mailbox
57 * $a['MessageCount'] = integer of all messages in the mailbox
58 * $a['UnreadCount'] = integer of unseen message in the mailbox
59 * $a['ViewLink'] = array containing elements needed to view the
60 * mailbox. Elements are:
61 * 'Target' = target frame for link
62 * 'URL' = target URL for link
63 * $a['IsRecent'] = boolean TRUE if the mailbox is tagged "recent"
64 * $a['IsSpecial'] = boolean TRUE if the mailbox is tagged "special"
65 * $a['IsRoot'] = boolean TRUE if the mailbox is the root mailbox
66 * $a['IsNoSelect'] = boolean TRUE if the mailbox is tagged "noselect"
67 * $a['IsCollapsed'] = boolean TRUE if the mailbox is currently collapsed
68 * $a['CollapseLink'] = array containg elements needed to expand/collapse
69 * the mailbox. Elements are:
70 * 'Target' = target frame for link
71 * 'URL' = target URL for link
72 * 'Icon' = the icon to use, based on user prefs
73 * $a['ChildBoxes'] = array containing this same data structure for
74 * each child folder/mailbox of the current
76 * $a['CummulativeMessageCount'] = integer of total messages in all
77 * folders in this mailbox, exlcuding
79 * $a['CummulativeUnreadCount'] = integer of total unseen messages
80 * in all folders in this mailbox,
81 * excluding trash folders.
84 * @copyright © 1999-2006 The SquirrelMail Project Team
85 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
87 * @package squirrelmail
88 * @subpackage templates
92 * Recursively parse the mailbox structure to build the navigation tree.
94 * @param array $box Array containing mailbox data
95 * @param array $settings Array containing perferences, etc, passed to template
96 * @param integer $indent_factor Counter used to control indent spacing
100 function buildMailboxTree ($box, $settings, $indent_factor=0) {
101 // Work in progress...
104 /* retrieve the template vars */
108 * Build an array to pass user prefs to the function that builds the tree in
109 * order to avoid using globals, which are dirty, filthy things in templates. :)
112 $settings['imapConnection'] = $imapConnection;
113 $settings['iconThemePath'] = $icon_theme_path;
114 $settings['unreadNotificationEnabled'] = $unread_notification_enabled;
115 $settings['unreadNotificationAllFolders'] = $unread_notification_allFolders;
116 $settings['unreadNotificationDisplayTotal'] = $unread_notification_displayTotal;
117 $settings['unreadNotificationCummulative'] = $unread_notification_cummulative;
118 $settings['useSpecialFolderColor'] = $use_special_folder_color;
119 $settings['messageRecyclingEnabled'] = $message_recycling_enabled;
120 $settings['trashFolderName'] = $trash_folder_name;
121 $settings['collapsableFoldersEnabled'] = $collapsable_folders_enabled;
124 <body class="sqm_leftMain">
125 <script type="text/javascript" src="js/test.js"></script>
126 <script type="text/javascript">
129 * Advanced tree makes uses dTree JavaScript package by Geir Landrö heavily.
130 * See http://www.destroydrop.com/javascripts/tree/
133 if (document.images) {
134 var treeImages = new Array;
135 var arguments = preload.arguments;
136 for (var i = 0; i<arguments.length; i++) {
137 treeImages[i] = new Image();
138 treeImages[i].src = arguments[i];
145 function fTreeTimeout() {
146 if (vTreeDiv.readyState == "complete")
147 vTreeImg.src = vTreeSrc;
149 setTimeout("fTreeTimeout()", 100);
151 function hidechilds(img) {
152 id = img.id + ".0000";
153 form_id = "mbx[" + img.id +"F]";
154 if (document.all) { //IE, Opera7
155 div = document.all[id];
157 if (div.style.display == "none") {
158 vTreeSrc = "../images/minus.png";
163 vTreeSrc = "../images/plus.png";
169 if (typeof vTreeDiv.readyState != "undefined") //IE
170 setTimeout("fTreeTimeout()",100);
172 vTreeImg.src = vTreeSrc;
173 div.style.display = style;
174 document.all[form_id].value = value;
177 else if (document.getElementById) { //Gecko
178 div = document.getElementById(id);
180 if (div.style.display == "none") {
181 src = "../images/minus.png";
186 src = "../images/plus.png";
190 div.style.display = style;
192 document.getElementById(form_id).value = value;
196 function buttonover(el,on) {
198 el.style.background="$color[0]";}
200 el.style.background="$color[9]";}
202 function buttonclick(el,on) {
204 el.style.border="groove";}
206 el.style.border="ridge";}
208 function hideframe(hide) {
209 left_size = "$left_size";
211 masterf = window.parent.document.all["fs1"];
212 leftf = window.parent.document.all["left"];
213 leftcontent = document.all["leftframe"];
214 leftbutton = document.all["showf"];
215 } else if (document.getElementById) {
216 masterf = window.parent.document.getElementById("fs1");
217 leftf = window.parent.document.getElementById("left");
218 leftcontent = document.getElementById("leftframe");
219 leftbutton = document.getElementById("showf");
224 new_col = calc_col("20");
225 masterf.cols = new_col;
226 document.body.scrollLeft=0;
227 document.body.style.overflow="hidden";
228 leftcontent.style.display = "none";
229 leftbutton.style.display="block";
231 masterf.cols = calc_col(left_size);
232 document.body.style.overflow="";
233 leftbutton.style.display="none";
234 leftcontent.style.display="block";
237 function calc_col(c_w) {
239 if ($location_of_bar == 'right') {
242 echo ' right=false;';
252 function resizeframe(direction) {
254 masterf = window.parent.document.all["fs1"];
255 } else if (document.getElementById) {
256 window.parent.document.getElementById("fs1");
261 if ($location_of_bar == 'right') {
262 echo ' colPat=/^\*,(\d+)$/;';
264 echo ' colPat=/^(\d+),.*$/;';
267 old_col = masterf.cols;
268 colPat.exec(old_col);
270 new_col_width = parseInt(RegExp.$1) + 25;
272 if (parseInt(RegExp.$1) > 35) {
273 new_col_width = parseInt(RegExp.$1) - 25;
276 masterf.cols = calc_col(new_col_width);
280 <style type="text/css">
283 margin: 0px 0px 0px 0px;
284 padding: 5px 5px 5px 5px;
287 vertical-align: middle;
291 border-color: <?php echo $color[9]; ?>;
292 background: <?php echo $color[0]; ?>;
293 color: <?php echo $color[6]; ?>;
304 text-decoration: none;
305 background-color: <?php echo $color[0]; ?>;
309 background-color: <?php echo $color[9]; ?>;
329 border-left-width:0.1em;
330 border-left-color: <?php echo $color[9]; ?>;
331 border-bottom: solid;
332 border-bottom-width:0.1em;
333 border-bottom-color: <?php echo $color[9]; ?>;
344 border-color: <?php echo $color[9]; ?>;
345 background: <?php echo $color[0]; ?>;
350 <div class="sqm_leftMain">
352 $right_pos = $left_size - 20;
354 <div style="position:absolute; top:0; border:0.1em solid blue;">
355 <div id="hidef" style="width=20;font-size:12"><a href="javascript:hideframe(true)"><b><<</b></a></div>
356 <div id="showf" style="width=20;font-size:12;display:none;"><a href="javascript:hideframe(false)"><b>>></b></a></div>
357 <div id="incrf" style="width=20;font-size:12"><a href="javascript:resizeframe(true)"><b>></b></a></div>
358 <div id="decrf" style="width=20;font-size:12"><a href="javascript:resizeframe(false)"><b><</b></a></div>
364 <?php do_hook('left_main_before'); ?>
365 <table class="sqm_wrapperTable" cellspacing="0">
368 <table cellspacing="0">
370 <td style="text-align:center">
371 <span class="sqm_folderHeader"><?php echo _("Folders"); ?></span><br />
372 <span class="sqm_clock"><?php echo $clock; ?></span>
373 <span class="sqm_refreshButton"><small>[<a href="../src/left_main.php" target="left"><?php echo _("Check mail"); ?></a>]</small></span>
378 <?php echo $mailbox_listing; ?>
382 <?php do_hook('left_main_after'); ?>