Added Flag/Unflag buttons. I have been up for 2 days straight. Please check for...
[squirrelmail.git] / functions / mailbox_display.php
index 6e93c81ec2ac3ed07dbeaa976740033140bcc3a4..00b4679a8649b336ec716fe32e350c8b9dbbce81 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * mailbox_display.php
  *
 /**
  * mailbox_display.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains functions that display mailbox information, such as the
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains functions that display mailbox information, such as the
@@ -585,7 +585,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
 <table border="0" width="100%" cellpadding="0" cellspacing="0">
   <tr>
     <td>
 <table border="0" width="100%" cellpadding="0" cellspacing="0">
   <tr>
     <td>
-      <?php mail_message_listing_beginning($imapConnection, $mailbox, $sort, 
+      <?php mail_message_listing_beginning($imapConnection, $mbxresponse, $mailbox, $sort, 
                                            $msg_cnt_str, $paginator_str, $start_msg); ?>
     </td>
   </tr>
                                            $msg_cnt_str, $paginator_str, $start_msg); ?>
     </td>
   </tr>
@@ -753,6 +753,7 @@ function displayMessageArray($imapConnection, $num_msgs, $start_msg,
  * you need to do a "</table></table>";
  *
  * $moveURL is the URL to submit the delete/move form to
  * you need to do a "</table></table>";
  *
  * $moveURL is the URL to submit the delete/move form to
+ * $mbxresponse is the array with the results of SELECT against the current mailbox 
  * $mailbox is the current mailbox
  * $sort is the current sorting method (-1 for no sorting available [searches])
  * $Message is a message that is centered on top of the list
  * $mailbox is the current mailbox
  * $sort is the current sorting method (-1 for no sorting available [searches])
  * $Message is a message that is centered on top of the list
@@ -760,11 +761,12 @@ function displayMessageArray($imapConnection, $num_msgs, $start_msg,
  */
 
 function mail_message_listing_beginning ($imapConnection,
  */
 
 function mail_message_listing_beginning ($imapConnection,
+                                         $mbxresponse,
                                          $mailbox = '', $sort = -1,
                                          $msg_cnt_str = '',
                                          $paginator = '&nbsp;',
                                          $start_msg = 1) {
                                          $mailbox = '', $sort = -1,
                                          $msg_cnt_str = '',
                                          $paginator = '&nbsp;',
                                          $start_msg = 1) {
-    global $color, $auto_expunge, $base_uri,
+    global $color, $auto_expunge, $base_uri, $show_flag_buttons,
            $allow_server_sort, $server_sort_order,
            $PHP_SELF, $allow_thread_sort, $thread_sort_messages;
 
            $allow_server_sort, $server_sort_order,
            $PHP_SELF, $allow_thread_sort, $thread_sort_messages;
 
@@ -822,6 +824,15 @@ function mail_message_listing_beginning ($imapConnection,
               <tr>
                 <td align="left">
                   <small><?php
               <tr>
                 <td align="left">
                   <small><?php
+                    
+                    // display flag buttons only if supported
+                    if ($show_flag_buttons 
+                        && strpos($mbxresponse['PERMANENTFLAGS'], '\Flagged') !== FALSE) {
+                        echo getButton('SUBMIT', 'markFlagged',_("Flag"));
+                        echo '&nbsp;';
+                        echo getButton('SUBMIT', 'markUnflagged',_("Unflag"));
+                        echo '&nbsp;';
+                    }
                     echo getButton('SUBMIT', 'markRead',_("Read"));
                     echo '&nbsp;';
                     echo getButton('SUBMIT', 'markUnread',_("Unread"));
                     echo getButton('SUBMIT', 'markRead',_("Read"));
                     echo '&nbsp;';
                     echo getButton('SUBMIT', 'markUnread',_("Unread"));