From: pdontthink Date: Tue, 25 Sep 2007 04:49:39 +0000 (+0000) Subject: Added ability to keep messages selected on mailbox listing - use 'preselected' query... X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=02def6a1abebeff3a3ee0d2ee7b31e3d5e29b74b;hp=ae0d28a9924954b3d0680aebd9405266a0887c02 Added ability to keep messages selected on mailbox listing - use 'preselected' query arg or global var from plugins git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12697 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/ChangeLog b/ChangeLog index 25ec2030..1e075d18 100644 --- 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 "preselected" query argument to mailbox list. Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 2730e123..4085c966 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -427,7 +427,7 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) { 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; @@ -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 = $checkall; + $value = ($checkall || in_array($iUid, $preselected)); break; default : break; } diff --git a/src/right_main.php b/src/right_main.php index 6ee92195..b72f8c37 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -71,6 +71,12 @@ if (!sqgetGlobalVar('checkall',$checkall,SQ_GET)) { $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; @@ -346,6 +352,7 @@ if ($aMailbox['EXISTS'] > 0) { $oTemplate->assign('color', $color); $oTemplate->assign('align', $align); $oTemplate->assign('checkall', $checkall); + $oTemplate->assign('preselected', $preselected); $oTemplate->display('message_list.tpl'); diff --git a/templates/default/message_list.tpl b/templates/default/message_list.tpl index 0e7f5473..c13ffe55 100644 --- a/templates/default/message_list.tpl +++ b/templates/default/message_list.tpl @@ -63,6 +63,7 @@ * $compact_paginator * $aErrors * $checkall + * $preselected * * @copyright © 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; } - $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'; /** @@ -313,7 +314,7 @@ if ($pageOffset < $end_msg) { */ 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'; } @@ -324,7 +325,7 @@ if ($pageOffset < $end_msg) { */ 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; @@ -432,7 +433,7 @@ if ($non_clicked_class != 'even' && $non_clicked_class != 'odd' switch ($iCol) { case SQM_COL_CHECK: - $checked = ($checkall ? ' checked="checked" ' : ''); + $checked = (($checkall || in_array($iUid, $preselected)) ? ' checked="checked" ' : ''); if ($javascript_on) { echo '' ?> " id="" value="" />