X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=d2211729261ae7c644659305412dcaad0b4ec0b7;hb=40c6ff98b6619b90b4fdfb5150ecaf596a29bc32;hp=7d8ecffd597b5f0e96ac18c2c5a6f11d12b4b492;hpb=6fd953618853477f6ffe569ce3c9733ca9f9c2d0;p=squirrelmail.git
diff --git a/src/left_main.php b/src/left_main.php
index 7d8ecffd..d2211729 100644
--- a/src/left_main.php
+++ b/src/left_main.php
@@ -3,7 +3,7 @@
/**
* left_main.php
*
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This is the code for the left bar. The left bar shows the folders
@@ -35,11 +35,8 @@ define('SM_BOX_COLLAPSED', 1);
function formatMailboxName($imapConnection, $box_array) {
- global $folder_prefix, $trash_folder, $sent_folder,
- $color, $move_to_sent, $move_to_trash,
- $unseen_notify, $unseen_type, $collapse_folders,
- $draft_folder, $save_as_draft,
- $use_special_folder_color;
+ global $trash_folder, $color, $move_to_trash,
+ $unseen_notify, $unseen_type, $use_special_folder_color;
$real_box = $box_array['unformatted'];
$mailbox = str_replace(' ','',$box_array['formatted']);
$mailboxURL = urlencode($real_box);
@@ -52,10 +49,10 @@ function formatMailboxName($imapConnection, $box_array) {
$status = array('','');
if (($unseen_notify == 2 && $real_box == 'INBOX') ||
$unseen_notify == 3) {
- $tmp_status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type );
- if ($status !== false) {
- $status = $tmp_status;
- }
+ $tmp_status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type );
+ if ($status !== false) {
+ $status = $tmp_status;
+ }
}
list($unseen_string, $unseen) = $status;
$special_color = ($use_special_folder_color && isSpecialMailbox($real_box));
@@ -68,8 +65,8 @@ function formatMailboxName($imapConnection, $box_array) {
/* Create the link for this folder. */
if ($status !== false) {
- $line .= '';
+ $line .= '';
}
if ($special_color) {
$line .= "";
@@ -82,7 +79,7 @@ function formatMailboxName($imapConnection, $box_array) {
if ($special_color == TRUE)
$line .= '';
if ($status !== false) {
- $line .= '';
+ $line .= '';
}
/* If there are unseen message, close bolding. */
@@ -93,18 +90,12 @@ function formatMailboxName($imapConnection, $box_array) {
$line .= " $unseen_string";
}
- /* If it's the trash folder, show a purge link when needed */
+ /* If it's the trash folder, show a purge link */
if (($move_to_trash) && ($real_box == $trash_folder)) {
- if (! isset($numMessages)) {
- $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
- }
-
- if (($numMessages > 0) or ($box_array['parent'] == 1)) {
- $urlMailbox = urlencode($real_box);
- $line .= "\n\n" .
- ' ['._("Purge").']' .
- '';
- }
+ $urlMailbox = urlencode($real_box);
+ $line .= "\n\n" .
+ ' ['._("Purge").']' .
+ '';
}
@@ -173,7 +164,7 @@ function compute_folder_children(&$parbox, $boxcount) {
* currently appropriate.
*/
function create_collapse_link($boxnum) {
- global $boxes, $imapConnection, $unseen_notify, $color, $use_icons, $icon_theme;
+ global $boxes, $unseen_notify, $color, $use_icons, $icon_theme;
$mailbox = urlencode($boxes[$boxnum]['unformatted']);
/* Create the link for this collapse link. */
@@ -210,7 +201,7 @@ function create_collapse_link($boxnum) {
* @return array unseen message string (for display), unseen message count
*/
function create_unseen_string($boxName, $boxArray, $imapConnection, $unseen_type) {
- global $boxes, $unseen_type, $color, $unseen_cum;
+ global $boxes, $color, $unseen_cum;
/* Initialize the return value. */
$result = array(0,0);
@@ -225,7 +216,7 @@ function create_unseen_string($boxName, $boxArray, $imapConnection, $unseen_type
$status = sqimap_status_messages($imapConnection, $boxName);
$boxUnseenCount = $status['UNSEEN'];
if ($boxUnseenCount === false) {
- return false;
+ return false;
}
if ($unseen_type == 2) {
$boxMessageCount = $status['MESSAGES'];
@@ -245,10 +236,10 @@ function create_unseen_string($boxName, $boxArray, $imapConnection, $unseen_type
/* Collect the counts for this subfolder. */
if (($boxName != $boxes[$i]['unformatted'])
- && (substr($boxes[$i]['unformatted'], 0, $curBoxLength) == $boxName)
- && !in_array('noselect', $boxes[$i]['flags'])) {
- $status = sqimap_status_messages($imapConnection, $boxes[$i]['unformatted']);
- $subUnseenCount = $status['UNSEEN'];
+ && (substr($boxes[$i]['unformatted'], 0, $curBoxLength) == $boxName)
+ && !in_array('noselect', $boxes[$i]['flags'])) {
+ $status = sqimap_status_messages($imapConnection, $boxes[$i]['unformatted']);
+ $subUnseenCount = $status['UNSEEN'];
if ($unseen_type == 2) {
$subMessageCount = $status['MESSAGES'];;
}
@@ -296,7 +287,7 @@ function is_parent_box($curbox_name, $parbox_name) {
}
function ListBoxes ($boxes, $j=0 ) {
- global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type,
+ global $data_dir, $username, $color, $unseen_notify, $unseen_type,
$move_to_trash, $trash_folder, $collapse_folders, $imapConnection,
$use_icons, $icon_theme, $use_special_folder_color;
@@ -381,10 +372,10 @@ function ListBoxes ($boxes, $j=0 ) {
$pre .= '';
}
$pre .= "";
+ $end .= '';
if ($unseen > 0) {
$end .= '';
}
- $end .= '';
if ($boxes->total > 0) {
if ($unseen > 0) {
$pre .= '';
@@ -397,20 +388,20 @@ function ListBoxes ($boxes, $j=0 ) {
if ($unseen_found) {
$end .= " $unseen_string";
}
- $end .= "\n\n" .
- ' ['._("Purge").']'.
- '';
}
+ $end .= "\n\n" .
+ ' ['._("Purge").']'.
+ '';
} else {
if (!$boxes->is_noselect) {
if ($unseen > 0) {
$pre .= '';
}
$pre .= "";
+ $end .= '';
if ($unseen > 0) {
$end .= '';
}
- $end .= '';
}
/* Print unseen information. */
if ($unseen_found) {
@@ -446,8 +437,8 @@ function ListBoxes ($boxes, $j=0 ) {
}
function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) {
- global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type,
- $move_to_trash, $trash_folder, $collapse_folders, $use_special_folder_color;
+ global $data_dir, $username, $color, $unseen_notify, $unseen_type,
+ $move_to_trash, $trash_folder, $collapse_folders, $use_special_folder_color;
if (!isset($boxes) || empty($boxes))
return;
@@ -516,17 +507,11 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) {
}
if (($move_to_trash) && ($mailbox == $trash_folder)) {
- if (! isset($numMessages)) {
- $numMessages = $boxes->total;
- }
$pre = "" . $pre;
$end .= '';
- if ($numMessages > 0) {
- $urlMailbox = urlencode($mailbox);
- $end .= "\n\n" .
- ' ['._("Purge").']'.
- '';
- }
+ $end .= "\n\n" .
+ ' ['._("Purge").']'.
+ '';
} else {
if (!$boxes->is_noselect) { /* \Noselect boxes can't be selected */
$pre = "" . $pre;
@@ -662,156 +647,139 @@ if (! isset($oldway) || $oldway=="" ) {
}
if ($advanced_tree) {
-$xtra .= <<
-
-
-
-
-
-ECHO;
+$xtra .= 'old_col = masterf.cols;'."\n".
+' colPat.exec(old_col);'."\n".
+' if (direction) {'."\n".
+' new_col_width = parseInt(RegExp.$1) + 25;'."\n".
+' } else {'."\n".
+' if (parseInt(RegExp.$1) > 35) {'."\n".
+' new_col_width = parseInt(RegExp.$1) - 25;'."\n".
+' }'."\n".
+' }'."\n".
+' masterf.cols = calc_col(new_col_width);'."\n".
+' }'."\n".
+'//-->'."\n".
+''."\n";
/* style definitions */
-$xtra .= <<
-
-
-
-
-ECHO;
-
+$xtra .= ''."\n";
}
displayHtmlHeader( 'SquirrelMail', $xtra );
@@ -933,10 +879,14 @@ if ($auto_create_special && !isset($auto_create_done)) {
if ( !sqimap_mailbox_exists($imapConnection, $folder)) {
sqimap_mailbox_create($imapConnection, $folder, '');
} else {
- //if (!sqimap_mailbox_is_subscribed($imapConnection, $folder)) {
- // check for subscription is useless and expensive just
- // surpress the NO response
- sqimap_subscribe($imapConnection, $folder, false);
+ // check for subscription is useless and expensive, just
+ // surpress the NO response. Unless we're on Mecury, which
+ // will just subscribe a folder again if it's already
+ // subscribed.
+ if ( strtolower($imap_server_type) != 'mercury32' ||
+ !sqimap_mailbox_is_subscribed($imapConnection, $folder) ) {
+ sqimap_subscribe($imapConnection, $folder, false);
+ }
}
}
}
@@ -946,12 +896,13 @@ if ($auto_create_special && !isset($auto_create_done)) {
sqsession_register($auto_create_done, 'auto_create_done');
}
-if ($advanced_tree)
- echo "\n\n";
-else
- echo "\n\n";
+if ($advanced_tree) {
+ echo "\n\n";
+} else {
+ echo "\n\n";
+}
do_hook('left_main_before');
if ($advanced_tree) {
@@ -967,7 +918,7 @@ if ($advanced_tree) {
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( 'table', '', '', '', 'border="0" cellspacing="0" cellpadding="0" width="98%"' ) .
html_tag( 'tr' ) .
html_tag( 'td', '', 'center' ) .
''. _("Folders") . "
\n\n";
@@ -975,7 +926,7 @@ echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cel
if ($date_format != 6) {
/* First, display the clock. */
if ($hour_format == 1) {
- $hr = 'G:i';
+ $hr = 'H:i';
if ($date_format == 4) {
$hr .= ':s';
}
@@ -989,8 +940,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;
@@ -1006,13 +957,14 @@ if ($date_format != 6) {
}
$clk = str_replace(' ',' ',$clk);
- echo '' . str_replace(' ',' ',_("Last Refresh")) .
- ": $clk
";
+ echo ''
+ . str_replace(' ', ' ', _("Last Refresh"))
+ . ":
$clk
";
}
/* Next, display the refresh button. */
-echo '['.
- _("Check mail") . ']
';
+echo '
';
/* Lastly, display the folder list. */
if ( $collapse_folders ) {
@@ -1124,4 +1076,4 @@ sqimap_logout($imapConnection);
?>
-
+