';*/
-}
-
-echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) .
- html_tag( 'tr' ) .
- html_tag( 'td', '', 'left' ) .
- '
'. _("Folders") . "
\n\n";
-
+$clock = '';
if ($date_format != 6) {
/* First, display the clock. */
if ($hour_format == 1) {
- $hr = 'G:i';
+ $hr = 'H:i';
if ($date_format == 4) {
$hr .= ':s';
}
@@ -983,8 +127,8 @@ if ($date_format != 6) {
switch( $date_format ) {
case 0:
- $clk = date('Y-m-d '.$hr. ' T', time());
- break;
+ $clk = date('Y-m-d '.$hr. ' T', time());
+ break;
case 1:
$clk = date('m/d/y '.$hr, time());
break;
@@ -1000,15 +144,12 @@ if ($date_format != 6) {
}
$clk = str_replace(' ',' ',$clk);
- echo '' . str_replace(' ',' ',_("Last Refresh")) .
- ": $clk";
+//FIXME don't build HTML here - do it in template
+ $clock = ''
+ . str_replace(' ', ' ', _("Last Refresh"))
+ . ":
$clk
\n";
}
-/* Next, display the refresh button. */
-echo '('.
- _("refresh folder list") . ')';
-
-/* Lastly, display the folder list. */
if ( $collapse_folders ) {
/* If directed, collapse or uncollapse a folder. */
if (isset($fold)) {
@@ -1022,101 +163,49 @@ if ( $collapse_folders ) {
$unseen_type = getPref( $data_dir , $username , 'unseen_type' );
$unseen_notify = getPref( $data_dir , $username , 'unseen_notify' );
-if (!isset($unseen_type) || empty($unseen_type)) {
- if (isset($default_unseen_type) && !empty($default_unseen_type)) {
+if (empty($unseen_type)) {
+ if (!empty($default_unseen_type)) {
$unseen_type = $default_unseen_type;
} else {
$unseen_type = 1;
}
}
-if (!isset($unseen_notify) || empty($unseen_notify)) {
- if (isset($default_unseen_notify) && !empty($default_unseen_notify)) {
+if (empty($unseen_notify)) {
+ if (!empty($default_unseen_notify)) {
$unseen_notify = $default_unseen_notify;
} else {
$unseen_notify = 0;
}
}
-if ($oldway) { /* normal behaviour SM */
-
-$boxes = sqimap_mailbox_list($imapConnection);
-/* Prepare do do out collapsedness and visibility computation. */
-$curbox = 0;
-$boxcount = count($boxes);
-
-/* Compute the collapsedness and visibility of each box. */
-
-while ($curbox < $boxcount) {
- $boxes[$curbox]['visible'] = TRUE;
- compute_folder_children($curbox, $boxcount);
-}
-
-for ($i = 0; $i < count($boxes); $i++) {
- if ( $boxes[$i]['visible'] ) {
- $mailbox = $boxes[$i]['formatted'];
- $mblevel = substr_count($boxes[$i]['unformatted'], $delimiter) + 1;
-
- /* Create the prefix for the folder name and link. */
- $prefix = str_repeat(' ',$mblevel);
- if (isset($collapse_folders) && $collapse_folders && $boxes[$i]['parent']) {
- $prefix = str_replace(' ',' ',substr($prefix,0,strlen($prefix)-2)).
- create_collapse_link($i) . ' ';
- } else {
- $prefix = str_replace(' ',' ',$prefix);
- }
- $line = "
$prefix";
-
- /* Add the folder name and link. */
- if (! isset($color[15])) {
- $color[15] = $color[6];
- }
+/**
+ * pass $mailboxes now instead of $imapconnection - sqimap_get_mailboxes() has been separated from
+ * sqimap_mailbox_tree() so that the cached mailbox list can be used elsewhere in left_main and beyond
+ */
+$boxes = sqimap_mailbox_tree($imapConnection,$mailboxes,$show_only_subscribed_folders);
+$mailbox_structure = getBoxStructure($boxes);
- if (in_array('noselect', $boxes[$i]['flags'])) {
- if( isSpecialMailbox( $boxes[$i]['unformatted']) ) {
- $line .= "";
- } else {
- $line .= "";
- }
- if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
- $mailbox = str_replace(' ','',$mailbox);
- $line .= str_replace(' ', ' ', $mailbox);
- }
- $line .= '';
- } else {
- $line .= formatMailboxName($imapConnection, $boxes[$i]);
- }
+$oTemplate->assign('clock', $clock);
+$oTemplate->assign('mailboxes', $mailbox_structure);
- /* Put the final touches on our folder line. */
- $line .= "\n";
+/*
+ * Build an array to pass user prefs to the template in order to avoid using
+ * globals, which are dirty, filthy things in templates. :)
+ */
+$settings = array();
+#$settings['imapConnection'] = $imapConnection;
+$settings['templateID'] = $sTemplateID;
+$settings['unreadNotificationEnabled'] = $unseen_notify!=1;
+$settings['unreadNotificationAllFolders'] = $unseen_notify == 3;
+$settings['unreadNotificationDisplayTotal'] = $unseen_type == 2;
+$settings['unreadNotificationCummulative'] = $unseen_cum==1;
+$settings['useSpecialFolderColor'] = $use_special_folder_color;
+$settings['messageRecyclingEnabled'] = $move_to_trash;
+$settings['collapsableFoldersEnabled'] = $collapse_folders==1;
+$oTemplate->assign('settings', $settings);
+
+$oTemplate->display('left_main.tpl');
- /* Output the line for this folder. */
- echo $line;
- }
-}
-} else { /* expiremental code */
- $boxes = sqimap_mailbox_tree($imapConnection);
- if (isset($advanced_tree) && $advanced_tree) {
- echo '
'."\n";
- } else {
- //sqimap_get_status_mbx_tree($imap_stream,$boxes)
- ListBoxes($boxes);
- }
-} /* if ($oldway) else ... */
-do_hook('left_main_after');
sqimap_logout($imapConnection);
-
-echo '' . "\n".
- "
\n";
-
-?>
+$oTemplate->display('footer.tpl');