| | |
| | | // delete selected messages from the current mailbox |
| | | this.delete_messages = function(event) |
| | | { |
| | | var uid, i, len, trash = this.env.trash_mailbox, |
| | | list = this.message_list, |
| | | selection = list ? list.get_selection() : []; |
| | | |
| | | // exit if no mailbox specified or if selection is empty |
| | | if (!this.env.uid && !selection.length) |
| | | return; |
| | | |
| | | // also select childs of collapsed rows |
| | | for (i=0, len=selection.length; i<len; i++) { |
| | | uid = selection[i]; |
| | | if (list.rows[uid].has_children && !list.rows[uid].expanded) |
| | | list.select_children(uid); |
| | | } |
| | | var list = this.message_list, trash = this.env.trash_mailbox; |
| | | |
| | | // if config is set to flag for deletion |
| | | if (this.env.flag_for_deletion) { |
| | |
| | | this._with_selected_messages('delete', post_data); |
| | | }; |
| | | |
| | | // Send a specifc move/delete request with UIDs of all selected messages |
| | | // Send a specific move/delete request with UIDs of all selected messages |
| | | // @private |
| | | this._with_selected_messages = function(action, post_data, lock) |
| | | { |
| | |
| | | .prop({checked: subscribed ? true : false, disabled: is_protected ? true : false}); |
| | | |
| | | // add to folder/row-ID map |
| | | this.env.subscriptionrows[id] = [name, display_name, 0]; |
| | | this.env.subscriptionrows[id] = [name, display_name, false]; |
| | | |
| | | // sort folders (to find a place where to insert the row) |
| | | // replace delimiter with \0 character to fix sorting |
| | | // issue where 'Abc Abc' would be placed before 'Abc/def' |
| | | var replace_from = RegExp(RegExp.escape(this.env.delimiter), 'g'), |
| | | replace_to = String.fromCharCode(0); |
| | | |
| | | $.each(this.env.subscriptionrows, function(k,v) { |
| | | var n = v[0]; |
| | | n = n.replace(replace_from, replace_to); |
| | | v.push(n); |
| | | if (v.length < 4) { |
| | | var n = v[0]; |
| | | n = n.replace(replace_from, replace_to); |
| | | v.push(n); |
| | | } |
| | | folders.push(v); |
| | | }); |
| | | |
| | | folders.sort(function(a, b) { |
| | | var len = a.length - 1; n1 = a[len], n2 = b[len]; |
| | | return n1 < n2 ? -1 : 1; |