Added ability to keep messages selected on mailbox listing - use 'preselected' query...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 25 Sep 2007 04:49:39 +0000 (04:49 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 25 Sep 2007 04:49:39 +0000 (04:49 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12697 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/mailbox_display.php
src/right_main.php
templates/default/message_list.tpl

index 25ec20305134c87901c65671121498a1f8f50452..1e075d18508a2d4b2f9b5c14ebd788d19ca8ea6f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -217,6 +217,7 @@ Version 1.5.2 - SVN
   - Added smtp_auth hook
   - Removed "Include CCs when Forwarding Messages", which had no functionality
     whatsoever.
   - Added smtp_auth hook
   - Removed "Include CCs when Forwarding Messages", which had no functionality
     whatsoever.
+  - Added "preselected" query argument to mailbox list.
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
index 2730e1234d54ebc021bdfc453ed7c2454beb8490..4085c9662b728b37a407db47c347f17787606473 100644 (file)
@@ -427,7 +427,7 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
 function prepareMessageList(&$aMailbox, $aProps) {
 
     /* Globalize link attributes so plugins can share in modifying them */
 function prepareMessageList(&$aMailbox, $aProps) {
 
     /* Globalize link attributes so plugins can share in modifying them */
-    global $link, $title, $target, $onclick, $link_extra;
+    global $link, $title, $target, $onclick, $link_extra, $preselected;
 
     /* retrieve the properties */
     $my_email_address = (isset($aProps['email'])) ? $aProps['email'] : false;
 
     /* retrieve the properties */
     $my_email_address = (isset($aProps['email'])) ? $aProps['email'] : false;
@@ -646,7 +646,7 @@ function prepareMessageList(&$aMailbox, $aProps) {
                     $value = (is_array($value) && $value[0] == 'multipart' && $value[1] == 'mixed') ? true : false;
                     break;
                 case SQM_COL_CHECK:
                     $value = (is_array($value) && $value[0] == 'multipart' && $value[1] == 'mixed') ? true : false;
                     break;
                 case SQM_COL_CHECK:
-                    $value = $checkall;
+                    $value = ($checkall || in_array($iUid, $preselected));
                     break;
                 default : break;
                 }
                     break;
                 default : break;
                 }
index 6ee921956e7b456bb1b2843ac64678beb4d7d38e..b72f8c376f13701fa1c04253e494de899873684c 100644 (file)
@@ -71,6 +71,12 @@ if (!sqgetGlobalVar('checkall',$checkall,SQ_GET)) {
     $checkall = false;
 }
 
     $checkall = false;
 }
 
+if (!sqgetGlobalVar('preselected', $preselected, SQ_GET) || !is_array($preselected)) {
+    $preselected = array();
+} else {
+    $preselected = array_keys($preselected);
+}
+
 /* future work */
 if ( sqgetGlobalVar('account', $account, SQ_GET) ) {
   $account = (int) $account;
 /* future work */
 if ( sqgetGlobalVar('account', $account, SQ_GET) ) {
   $account = (int) $account;
@@ -346,6 +352,7 @@ if ($aMailbox['EXISTS'] > 0) {
     $oTemplate->assign('color', $color);
     $oTemplate->assign('align', $align);
     $oTemplate->assign('checkall', $checkall);
     $oTemplate->assign('color', $color);
     $oTemplate->assign('align', $align);
     $oTemplate->assign('checkall', $checkall);
+    $oTemplate->assign('preselected', $preselected);
 
     $oTemplate->display('message_list.tpl');
 
 
     $oTemplate->display('message_list.tpl');
 
index 0e7f547335979286fee4a8615967b0d0ae8478e3..c13ffe551135ce96bfa6f08583bdf2de0bd359bc 100644 (file)
@@ -63,6 +63,7 @@
  *    $compact_paginator
  *    $aErrors
  *    $checkall
  *    $compact_paginator
  *    $aErrors
  *    $checkall
+ *    $preselected
  *
  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  *
  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
@@ -305,7 +306,7 @@ if ($pageOffset < $end_msg) {
         $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
     }
 
         $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
     }
 
-    $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
+    $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
     $non_clicked_class = 'even';
 
     /**
     $non_clicked_class = 'even';
 
     /**
@@ -313,7 +314,7 @@ if ($pageOffset < $end_msg) {
      */
     if (isset($alt_index_colors) && $alt_index_colors) {
         if (!($i % 2)) {
      */
     if (isset($alt_index_colors) && $alt_index_colors) {
         if (!($i % 2)) {
-            $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
+            $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
             $non_clicked_class = 'odd';
         }
 
             $non_clicked_class = 'odd';
         }
 
@@ -324,7 +325,7 @@ if ($pageOffset < $end_msg) {
      */
     if (isset($aMsg['row']['color']))
     {
      */
     if (isset($aMsg['row']['color']))
     {
-       if ($checkall && $javascript_on && $fancy_index_highlite) {
+       if (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite) {
 //FIXME: would be best not to use $color directly here; want to move this to be a CSS style-defined value only, but the problem is that this CSS class is being defined on the fly right here
            $bgcolor = $color[16];
            $class = 'clicked_misc'.$i;
 //FIXME: would be best not to use $color directly here; want to move this to be a CSS style-defined value only, but the problem is that this CSS class is being defined on the fly right here
            $bgcolor = $color[16];
            $class = 'clicked_misc'.$i;
@@ -432,7 +433,7 @@ if ($non_clicked_class != 'even' && $non_clicked_class != 'odd'
 
         switch ($iCol) {
           case SQM_COL_CHECK:
 
         switch ($iCol) {
           case SQM_COL_CHECK:
-            $checked = ($checkall ? ' checked="checked" ' : '');
+            $checked = (($checkall || in_array($iUid, $preselected)) ? ' checked="checked" ' : '');
             if ($javascript_on) {
                 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
                 <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript . $checked;?> /></td>
             if ($javascript_on) {
                 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
                 <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript . $checked;?> /></td>