';*/
+}
+
+echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', '', 'left' ) .
+ html_tag( 'table', '', '', '', 'border="0" cellspacing="0" cellpadding="0"' ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', '', 'center' ) .
+ '
'. _("Folders") . "
\n\n";
+
+if ($date_format != 6) {
+ /* First, display the clock. */
+ if ($hour_format == 1) {
+ $hr = 'G:i';
+ if ($date_format == 4) {
+ $hr .= ':s';
+ }
+ } else {
+ if ($date_format == 4) {
+ $hr = 'g:i:s a';
} else {
- $link .= "fold=$mailbox\">-";
+ $hr = 'g:i a';
}
- $link .= '';
+ }
+
+ switch( $date_format ) {
+ case 0:
+ $clk = date('Y-m-d '.$hr. ' T', time());
+ break;
+ case 1:
+ $clk = date('m/d/y '.$hr, time());
+ break;
+ case 2:
+ $clk = date('d/m/y '.$hr, time());
+ break;
+ case 4:
+ case 5:
+ $clk = date($hr, time());
+ break;
+ default:
+ $clk = getDayAbrv( date( 'w', time() ) ) . date( ', ' . $hr, time() );
+ }
+ $clk = str_replace(' ',' ',$clk);
- /* Return the finished product. */
- return ($link);
+ echo '
' . str_replace(' ',' ',_("Last Refresh")) .
+ ": $clk";
+}
+
+/* Next, display the refresh button. */
+echo '
['.
+ _("Check mail") . ']';
+
+/* Lastly, display the folder list. */
+if ( $collapse_folders ) {
+ /* If directed, collapse or uncollapse a folder. */
+ if (isset($fold)) {
+ setPref($data_dir, $username, 'collapse_folder_' . $fold, SM_BOX_COLLAPSED);
+ } else if (isset($unfold)) {
+ setPref($data_dir, $username, 'collapse_folder_' . $unfold, SM_BOX_UNCOLLAPSED);
}
-
- /**
- * This simple function checks if a box is another box's parent.
- */
- function is_parent_box($curbox_name, $parbox_name) {
- global $delimiter;
+}
- /* Extract the name of the parent of the current box. */
- $curparts = explode($delimiter, $curbox_name);
- $curname = array_pop($curparts);
- $actual_parname = implode($delimiter, $curparts);
- $actual_parname = substr($actual_parname,0,strlen($parbox_name));
+/* Get unseen/total display prefs */
+$unseen_type = getPref( $data_dir , $username , 'unseen_type' );
+$unseen_notify = getPref( $data_dir , $username , 'unseen_notify' );
- /* Compare the actual with the given parent name. */
- return ($parbox_name == $actual_parname);
+if (!isset($unseen_type) || empty($unseen_type)) {
+ if (isset($default_unseen_type) && !empty($default_unseen_type)) {
+ $unseen_type = $default_unseen_type;
+ } else {
+ $unseen_type = 1;
}
+}
- /**
- * Recursive function that computes the collapsed status and parent
- * (or not parent) status of this box, and the visiblity and collapsed
- * status and parent (or not parent) status for all children boxes.
- */
- function compute_folder_children(&$parbox, $boxcount) {
- global $boxes, $data_dir, $username;
- $nextbox = $parbox + 1;
+if (!isset($unseen_notify) || empty($unseen_notify)) {
+ if (isset($default_unseen_notify) && !empty($default_unseen_notify)) {
+ $unseen_notify = $default_unseen_notify;
+ } else {
+ $unseen_notify = 0;
+ }
+}
- /* Retreive the name for the parent box. */
- $parbox_name = $boxes[$parbox]['unformatted'];
+if ($oldway) { /* normal behaviour SM */
- /* 'Initialize' this parent box to childless. */
- $boxes[$parbox]['parent'] = false;
+$boxes = sqimap_mailbox_list($imapConnection);
+/* Prepare do do out collapsedness and visibility computation. */
+$curbox = 0;
+$boxcount = count($boxes);
- /* Compute the collapse status for this box. */
- $collapse = 0;
- $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name);
- $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
- $boxes[$parbox]['collapse'] = $collapse;
+/* Compute the collapsedness and visibility of each box. */
- /* Otherwise, get the name of the next box. */
- if (isset($boxes[$nextbox]['unformatted']))
- $nextbox_name = $boxes[$nextbox]['unformatted'];
- else
- $nextbox_name = '';
+while ($curbox < $boxcount) {
+ $boxes[$curbox]['visible'] = TRUE;
+ compute_folder_children($curbox, $boxcount);
+}
- /* Compute any children boxes for this box. */
- while (($nextbox < $boxcount) &&
- (is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) {
+for ($i = 0; $i < count($boxes); $i++) {
+ if ( $boxes[$i]['visible'] ) {
+ $mailbox = $boxes[$i]['formatted'];
+ $mblevel = substr_count($boxes[$i]['unformatted'], $delimiter) + 1;
- /* Note that this 'parent' box has at least one child. */
- $boxes[$parbox]['parent'] = true;
+ /* 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";
- /* Compute the visiblity of this box. */
- if ($boxes[$parbox]['visible'] &&
- ($boxes[$parbox]['collapse'] != SM_BOX_COLLAPSED)) {
- $boxes[$nextbox]['visible'] = true;
+ /* Add the folder name and link. */
+ if (! isset($color[15])) {
+ $color[15] = $color[6];
+ }
+
+ if (in_array('noselect', $boxes[$i]['flags'])) {
+ if( isSpecialMailbox( $boxes[$i]['unformatted']) ) {
+ $line .= "";
} else {
- $boxes[$nextbox]['visible'] = false;
+ $line .= "";
}
-
- /* Compute the visibility of any child boxes. */
- compute_folder_children($nextbox, $boxcount);
+ if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
+ $mailbox = str_replace(' ','',$mailbox);
+ $line .= str_replace(' ', ' ', $mailbox);
+ }
+ $line .= '';
+ } else {
+ $line .= formatMailboxName($imapConnection, $boxes[$i]);
}
- /* Set the parent box to the current next box. */
- $parbox = $nextbox;
+ /* Put the final touches on our folder line. */
+ $line .= "\n";
+
+ /* 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);
}
- echo "\n";
+} /* if ($oldway) else ... */
+do_hook('left_main_after');
+sqimap_logout($imapConnection);
+
?>
+
+