Added Flag/Unflag buttons. I have been up for 2 days straight. Please check for...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Feb 2004 10:43:33 +0000 (10:43 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Feb 2004 10:43:33 +0000 (10:43 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6660 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php
include/load_prefs.php
include/options/display.php
src/move_messages.php

index e0486680a7c5c7af0e95f426d0a03ef70159ad46..00b4679a8649b336ec716fe32e350c8b9dbbce81 100644 (file)
@@ -585,7 +585,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
 <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>
@@ -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
+ * $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
@@ -760,11 +761,12 @@ function displayMessageArray($imapConnection, $num_msgs, $start_msg,
  */
 
 function mail_message_listing_beginning ($imapConnection,
+                                         $mbxresponse,
                                          $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;
 
@@ -822,6 +824,15 @@ function mail_message_listing_beginning ($imapConnection,
               <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"));
index 34c1161816e031e55330bc76d45ceac4403653f7..72eb0c6bd9278e21008fa1fb7d397f8c7c2cff16 100644 (file)
@@ -80,6 +80,9 @@ if (!defined('download_php')) {
 // user's icon theme, if using icons
 $icon_theme = getPref($data_dir, $username, 'icon_theme', 'none' );
 
+// show (or not) flag and unflag buttons on mailbox list screen
+$show_flag_buttons = getPref($data_dir, $username, 'show_flag_buttons', SMPREF_OFF );
+
 $use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book);
 
 /* Load the user's special folder preferences */
index 9a311f5cffcfd956bb02fa4becffd2a9601c55c1..72f7b55961b11f253017bb229f2d000f28392726 100644 (file)
@@ -207,6 +207,13 @@ function load_optpage_data_display() {
         );
     }
 
+    $optvals[SMOPT_GRP_MAILBOX][] = array(
+        'name'    => 'show_flag_buttons',
+        'caption' => _("Show Flag / Unflag Buttons"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
     $optvals[SMOPT_GRP_MAILBOX][] = array(
         'name'    => 'page_selector',
         'caption' => _("Enable Page Selector"),
index 9ee018bfcde85dc41f292d75d4c0a600939d0b8c..008bf1eaaff14c85ded0daa42b6a8638a7889af7 100644 (file)
@@ -173,13 +173,16 @@ if(isset($expungeButton)) {
     if (count($id)) {
         $cnt = count($id);
         if (!isset($attache)) {
-            $button_action = concat_hook_function('move_messages_button_action');
             if (isset($markRead)) {
                 sqimap_toggle_flag($imapConnection, $id, '\\Seen',true,true);
             } else if (isset($markUnread)) {
                 sqimap_toggle_flag($imapConnection, $id, '\\Seen',false,true);
+            } else if (isset($markFlagged)) {
+                sqimap_toggle_flag($imapConnection, $id, '\\Flagged', true, true);
+            } else if (isset($markUnflagged)) {
+                sqimap_toggle_flag($imapConnection, $id, '\\Flagged', false, true);
             } else  {
-                if (!$button_action) {
+                if (!boolean_hook_function('move_messages_button_action', NULL, 1)) {
                     sqimap_msgs_list_delete($imapConnection, $mailbox, $id,$bypass_trash);
                     if ($auto_expunge) {
                         $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true);