- Added possibility to select all messages in a folder (#1484756)

release-0.6
alecpl 14 years ago
parent 5ffceb7906
commit fb7ec576ab

@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
- Added possibility to select all messages in a folder (#1484756)
- Added 'imap_force_caps' option for after-login CAPABILITY checking (#1485750)
- Password: Support dovecotpw encryption
- TinyMCE 3.3.1

@ -2115,7 +2115,7 @@ class rcube_imap
$mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox;
$flag = strtoupper($flag);
list($uids, $all_mode) = $this->_parse_uids($uids);
list($uids, $all_mode) = $this->_parse_uids($uids, $mailbox);
if (strpos($flag, 'UN') === 0)
$result = iil_C_UnFlag($this->conn, $mailbox, $uids, substr($flag, 2));
@ -2209,7 +2209,7 @@ class rcube_imap
$to_mbox = $this->mod_mailbox($to_mbox);
$from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox;
list($uids, $all_mode) = $this->_parse_uids($uids);
list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox);
// exit if no message uids are specified
if (empty($uids))
@ -2291,7 +2291,7 @@ class rcube_imap
$to_mbox = $this->mod_mailbox($to_mbox);
$from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox;
list($uids, $all_mode) = $this->_parse_uids($uids);
list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox);
// exit if no message uids are specified
if (empty($uids))
@ -2329,7 +2329,7 @@ class rcube_imap
{
$mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox;
list($uids, $all_mode) = $this->_parse_uids($uids);
list($uids, $all_mode) = $this->_parse_uids($uids, $mailbox);
// exit if no message uids are specified
if (empty($uids))
@ -2450,14 +2450,32 @@ class rcube_imap
* Parse message UIDs input
*
* @param mixed UIDs array or comma-separated list or '*' or '1:*'
* @param string Mailbox name
* @return array Two elements array with UIDs converted to list and ALL flag
* @access private
*/
private function _parse_uids($uids)
private function _parse_uids($uids, $mailbox)
{
if ($uids === '*' || $uids === '1:*') {
$uids = '1:*';
$all = true;
if (empty($this->search_set)) {
$uids = '1:*';
$all = true;
}
// get UIDs from current search set
// @TODO: skip iil_C_FetchUIDs() and work with IDs instead of UIDs (?)
else {
if ($this->search_threads)
$uids = iil_C_FetchUIDs($this->conn, $mailbox, array_keys($this->search_set['depth']));
else
$uids = iil_C_FetchUIDs($this->conn, $mailbox, $this->search_set);
// save ID-to-UID mapping in local cache
if (is_array($uids))
foreach ($uids as $id => $uid)
$this->uid_id_map[$mailbox][$uid] = $id;
$uids = join(',', $uids);
}
}
else {
if (is_array($uids))

@ -489,8 +489,8 @@ function rcube_webmail()
case 'menu-open':
case 'menu-save':
this.triggerEvent(command, {props:props});
return false;
this.triggerEvent(command, {props:props});
return false;
break;
case 'open':
@ -753,10 +753,11 @@ function rcube_webmail()
break;
case 'select-all':
this.select_all_mode = props ? false : true;
if (props == 'invert')
this.message_list.invert_selection();
else
this.message_list.select_all(props);
this.message_list.select_all(props == 'page' ? '' : props);
break;
case 'select-none':
@ -1833,9 +1834,10 @@ function rcube_webmail()
// unselect selected messages
this.last_selected = 0;
if (this.message_list)
if (this.message_list) {
this.message_list.clear_selection();
this.select_all_mode = false;
}
this.select_folder(mbox, this.env.mailbox);
this.env.mailbox = mbox;
@ -2254,8 +2256,8 @@ function rcube_webmail()
// @private
this._with_selected_messages = function(action, lock, add_url)
{
var a_uids = new Array();
var count = 0;
var a_uids = new Array(),
count = 0;
if (this.env.uid)
a_uids[0] = this.env.uid;
@ -2287,8 +2289,10 @@ function rcube_webmail()
// remove threads from the end of the list
this.delete_excessive_thread_rows();
add_url += '&_uid='+this.uids_to_list(a_uids);
// send request to server
this.http_post(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock);
this.http_post(action, '_mbox='+urlencode(this.env.mailbox)+add_url, lock);
};
// set a specific flag to one or more messages
@ -2355,7 +2359,7 @@ function rcube_webmail()
for (var i=0; i<a_uids.length; i++)
this.set_message(a_uids[i], 'unread', (flag=='unread' ? true : false));
this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag);
this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag);
for (var i=0; i<a_uids.length; i++)
this.update_thread_root(a_uids[i], flag);
@ -2368,7 +2372,7 @@ function rcube_webmail()
for (var i=0; i<a_uids.length; i++)
this.set_message(a_uids[i], 'flagged', (flag=='flagged' ? true : false));
this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag);
this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag);
};
// mark all message rows as deleted/undeleted
@ -2412,49 +2416,48 @@ function rcube_webmail()
for (var i=0; i<a_uids.length; i++)
this.set_message(a_uids[i], 'deleted', false);
this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=undelete');
this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete');
return true;
};
this.flag_as_deleted = function(a_uids)
{
var add_url = '';
var r_uids = new Array();
var rows = this.message_list ? this.message_list.rows : new Array();
var count = 0;
var add_url = '',
r_uids = new Array(),
rows = this.message_list ? this.message_list.rows : new Array(),
count = 0;
for (var i=0; i<a_uids.length; i++)
{
for (var i=0; i<a_uids.length; i++) {
uid = a_uids[i];
if (rows[uid])
{
if (rows[uid]) {
if (rows[uid].unread)
r_uids[r_uids.length] = uid;
if (this.env.skip_deleted) {
count += this.update_thread(uid);
if (this.env.skip_deleted) {
count += this.update_thread(uid);
this.message_list.remove_row(uid, (this.env.display_next && i == this.message_list.selection.length-1));
}
else
this.set_message(uid, 'deleted', true);
}
}
else
this.set_message(uid, 'deleted', true);
}
}
// make sure there are no selected rows
if (this.env.skip_deleted && this.message_list) {
if(!this.env.display_next)
this.message_list.clear_selection();
this.message_list.clear_selection();
if (count < 0)
add_url += '&_count='+(count*-1);
else if (count > 0)
// remove threads from the end of the list
this.delete_excessive_thread_rows();
}
}
add_url = '&_from='+(this.env.action ? this.env.action : '');
// ??
if (r_uids.length)
add_url += '&_ruid='+r_uids.join(',');
add_url += '&_ruid='+this.uids_to_list(r_uids);
if (this.env.skip_deleted) {
// also send search request to get the right messages
@ -2464,7 +2467,7 @@ function rcube_webmail()
add_url += '&_next_uid='+this.env.next_uid;
}
this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=delete'+add_url);
this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url);
return true;
};
@ -2472,21 +2475,25 @@ function rcube_webmail()
// argument should be a coma-separated list of uids
this.flag_deleted_as_read = function(uids)
{
var icn_src;
var rows = this.message_list ? this.message_list.rows : new Array();
var str = String(uids);
var a_uids = new Array();
var icn_src, uid,
rows = this.message_list ? this.message_list.rows : new Array(),
str = String(uids),
a_uids = str.split(',');
a_uids = str.split(',');
for (var uid, i=0; i<a_uids.length; i++)
{
for (var i=0; i<a_uids.length; i++) {
uid = a_uids[i];
if (rows[uid])
this.set_message(uid, 'unread', false);
}
};
// Converts array of message UIDs to comma-separated list for use in URL
// with select_all mode checking
this.uids_to_list = function(uids)
{
return this.select_all_mode ? '*' : uids.join(',');
};
/*********************************************************/
/********* mailbox folders methods *********/

@ -1066,16 +1066,15 @@ function iil_C_UIDToMID(&$conn, $mailbox, $uid) {
return false;
}
function iil_C_FetchUIDs(&$conn,$mailbox) {
function iil_C_FetchUIDs(&$conn, $mailbox, $message_set=null) {
global $clock;
if (is_array($message_set))
$message_set = join(',', $message_set);
else if (empty($message_set))
$message_set = '1:*';
$num = iil_C_CountMessages($conn, $mailbox);
if ($num == 0) {
return array();
}
$message_set = '1' . ($num>1?':' . $num:'');
return iil_C_FetchHeaderIndex($conn, $mailbox, $message_set, 'UID');
return iil_C_FetchHeaderIndex($conn, $mailbox, $message_set, 'UID', false);
}
function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false, $bodystr=false, $add='')

@ -146,6 +146,7 @@ $labels['messageactions'] = 'More actions...';
$labels['select'] = 'Select';
$labels['all'] = 'All';
$labels['none'] = 'None';
$labels['currpage'] = 'Current page';
$labels['unread'] = 'Unread';
$labels['flagged'] = 'Flagged';
$labels['unanswered'] = 'Unanswered';

@ -132,6 +132,7 @@ $labels['markunflagged'] = 'Jako nieoflagowane';
$labels['messageactions'] = 'Więcej akcji...';
$labels['select'] = 'Zaznacz';
$labels['all'] = 'Wszystkie';
$labels['currpage'] = 'Bieżąca strona';
$labels['none'] = 'Brak';
$labels['unread'] = 'Nieprzeczytane';
$labels['flagged'] = 'Oznaczone';

@ -52,14 +52,14 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va
exit;
}
if($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) {
$uids = get_input_value('_ruid', RCUBE_INPUT_POST);
$read = $IMAP->set_flag($uids, 'SEEN');
if ($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) {
$ruids = get_input_value('_ruid', RCUBE_INPUT_POST);
$read = $IMAP->set_flag($ruids, 'SEEN');
if ($read != -1 && !$CONFIG['skip_deleted'])
$OUTPUT->command('flag_deleted_as_read', $uids);
$OUTPUT->command('flag_deleted_as_read', $ruids);
}
if ($flag == 'SEEN' || $flag == 'UNSEEN' || ($flag == 'DELETED' && !$CONFIG['skip_deleted'])) {
rcmail_send_unread_count($IMAP->get_mailbox_name());
}
@ -99,20 +99,20 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va
if ($old_unseen != $unseen_count) {
$OUTPUT->command('set_unread_count', $mbox, $unseen_count, ($mbox == 'INBOX'));
$_SESSION['unseen_count'][$mbox] = $unseen_count;
$_SESSION['unseen_count'][$mbox] = $unseen_count;
}
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count));
if ($IMAP->threading)
$count = get_input_value('_count', RCUBE_INPUT_POST);
$count = get_input_value('_count', RCUBE_INPUT_POST);
// add new rows from next page (if any)
if ($count && ($jump_back || $nextpage_count > 0)) {
if ($count && $uids != '*' && ($jump_back || $nextpage_count > 0)) {
$sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col'];
$sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
$a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order,
$jump_back ? NULL : $count);
$jump_back ? NULL : $count);
rcmail_js_message_list($a_headers, false, false);
}

@ -34,11 +34,11 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_targe
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
$moved = $IMAP->move_message($uids, $target, $mbox);
if (!$moved) {
// send error message
if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
$OUTPUT->show_message('errormoving', 'error');
$OUTPUT->send();
exit;
@ -55,8 +55,8 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
if (!$del) {
// send error message
if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
$OUTPUT->show_message('errordeleting', 'error');
$OUTPUT->send();
exit;
@ -121,7 +121,7 @@ else
$count = get_input_value('_count', RCUBE_INPUT_POST);
// add new rows from next page (if any)
if ($addrows && $count && ($jump_back || $nextpage_count > 0)) {
if ($addrows && $count && $uids != '*' && ($jump_back || $nextpage_count > 0)) {
$sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col'];
$sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -579,6 +579,14 @@ td.formlinks a:visited
background-position: -30px -15px;
}
#listcontrols a.page {
background-position: -135px 0;
}
#listcontrols a.pagesel {
background-position: -135px -15px;
}
#listcontrols a.unread {
background-position: -45px 0;
}

@ -81,6 +81,7 @@
<div id="listcontrols">
<span><roundcube:label name="select" />:&nbsp;</span>
<roundcube:button command="select-all" type="link" title="all" class="buttonPas all" classAct="button all" classSel="button allsel" content=" " />
<roundcube:button command="select-all" type="link" prop="page" title="currpage" class="buttonPas page" classAct="button page" classSel="button pagesel" content=" " />
<roundcube:button command="select-all" type="link" prop="unread" title="unread" class="buttonPas unread" classAct="button unread" classSel="button unreadsel" content=" " />
<roundcube:button command="select-all" type="link" prop="invert" title="invert" class="buttonPas invert" classAct="button invert" classSel="button invertsel" content=" " />
<roundcube:button command="select-none" type="link" title="none" class="buttonPas none" classAct="button none" classSel="button nonesel" content=" " />

Loading…
Cancel
Save