| | |
| | | this.gui_objects.messagelist.parentNode.onmousedown = function(e){ return p.click_on_list(e); }; |
| | | |
| | | this.enable_command('toggle_status', 'toggle_flag', 'sort', true); |
| | | this.enable_command('set-listmode', this.env.threads && !this.env.search_request); |
| | | |
| | | // load messages |
| | | this.command('list'); |
| | |
| | | |
| | | case 'open': |
| | | if (uid = this.get_single_uid()) { |
| | | obj.href = this.url('show', {_mbox: this.env.mailbox, _uid: uid}); |
| | | obj.href = this.url('show', {_mbox: this.get_message_mailbox(uid), _uid: uid}); |
| | | return true; |
| | | } |
| | | break; |
| | |
| | | break; |
| | | |
| | | case 'list': |
| | | // TODO: don't reset search but re-send for the new folder |
| | | if (props && props != '') |
| | | this.reset_qsearch(); |
| | | if (this.env.action == 'compose' && this.env.extwin) |
| | |
| | | } |
| | | else if (this.task == 'addressbook') |
| | | this.list_contacts(props); |
| | | break; |
| | | |
| | | case 'set-listmode': |
| | | this.set_list_options(null, undefined, undefined, props == 'threads' ? 1 : 0); |
| | | break; |
| | | |
| | | case 'sort': |
| | |
| | | this.load_contact(cid, 'edit'); |
| | | else if (this.task == 'settings' && props) |
| | | this.load_identity(props, 'edit-identity'); |
| | | else if (this.task == 'mail' && (cid = this.get_single_uid())) { |
| | | url = { _mbox: this.env.mailbox }; |
| | | url[this.env.mailbox == this.env.drafts_mailbox && props != 'new' ? '_draft_uid' : '_uid'] = cid; |
| | | else if (this.task == 'mail' && (uid = this.get_single_uid())) { |
| | | url = { _mbox: this.get_message_mailbox(uid) }; |
| | | url[this.env.mailbox == this.env.drafts_mailbox && props != 'new' ? '_draft_uid' : '_uid'] = uid; |
| | | this.open_compose_step(url); |
| | | } |
| | | break; |
| | |
| | | case 'reply-list': |
| | | case 'reply': |
| | | if (uid = this.get_single_uid()) { |
| | | url = {_reply_uid: uid, _mbox: this.env.mailbox}; |
| | | url = {_reply_uid: uid, _mbox: this.get_message_mailbox(uid)}; |
| | | if (command == 'reply-all') |
| | | // do reply-list, when list is detected and popup menu wasn't used |
| | | url._all = (!props && this.env.reply_all_mode == 1 && this.commands['reply-list'] ? 'list' : 'all'); |
| | |
| | | this.gui_objects.messagepartframe.contentWindow.print(); |
| | | } |
| | | else if (uid = this.get_single_uid()) { |
| | | ref.printwin = this.open_window(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : ''), true, true); |
| | | ref.printwin = this.open_window(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.get_message_mailbox(uid))+(this.env.safemode ? '&_safe=1' : ''), true, true); |
| | | if (this.printwin) { |
| | | if (this.env.action != 'show') |
| | | this.mark_message('read', uid); |
| | |
| | | if (this.env.action == 'get') { |
| | | location.href = location.href.replace(/_frame=/, '_download='); |
| | | } |
| | | else if (uid = this.get_single_uid()) |
| | | this.goto_url('viewsource', { _uid: uid, _mbox: this.env.mailbox, _save: 1 }); |
| | | else if (uid = this.get_single_uid()) { |
| | | this.goto_url('viewsource', { _uid: uid, _mbox: this.get_message_mailbox(uid), _save: 1 }); |
| | | } |
| | | break; |
| | | |
| | | // quicksearch |
| | |
| | | |
| | | var uid = list.get_single_selection(); |
| | | |
| | | if (uid && this.env.mailbox == this.env.drafts_mailbox) |
| | | if (uid && (this.env.messages[uid].mbox || this.env.mailbox) == this.env.drafts_mailbox) |
| | | this.open_compose_step({ _draft_uid: uid, _mbox: this.env.mailbox }); |
| | | else if (uid) |
| | | this.show_message(uid, false, false); |
| | |
| | | this.init_message_row = function(row) |
| | | { |
| | | var i, fn = {}, self = this, uid = row.uid, |
| | | status_icon = (this.env.status_col != null ? 'status' : 'msg') + 'icn' + row.uid; |
| | | status_icon = (this.env.status_col != null ? 'status' : 'msg') + 'icn' + row.id; |
| | | |
| | | if (uid && this.env.messages[uid]) |
| | | $.extend(row, this.env.messages[uid]); |
| | |
| | | |
| | | // save message icon position too |
| | | if (this.env.status_col != null) |
| | | row.msgicon = document.getElementById('msgicn'+row.uid); |
| | | row.msgicon = document.getElementById('msgicn'+row.id); |
| | | else |
| | | row.msgicon = row.icon; |
| | | |
| | | // set eventhandler to flag icon |
| | | if (this.env.flagged_col != null && (row.flagicon = document.getElementById('flagicn'+row.uid))) { |
| | | if (this.env.flagged_col != null && (row.flagicon = document.getElementById('flagicn'+row.id))) { |
| | | fn.flagicon = function(e) { self.command('toggle_flag', uid); }; |
| | | } |
| | | |
| | | // set event handler to thread expand/collapse icon |
| | | if (!row.depth && row.has_children && (row.expando = document.getElementById('rcmexpando'+row.uid))) { |
| | | if (!row.depth && row.has_children && (row.expando = document.getElementById('rcmexpando'+row.id))) { |
| | | fn.expando = function(e) { self.expand_message_row(e, uid); }; |
| | | } |
| | | |
| | |
| | | selected: this.select_all_mode || this.message_list.in_selection(uid), |
| | | ml: flags.ml?1:0, |
| | | ctype: flags.ctype, |
| | | mbox: flags.mbox, |
| | | // flags from plugins |
| | | flags: flags.extra_flags |
| | | }); |
| | |
| | | + (flags.deleted ? ' deleted' : '') |
| | | + (flags.flagged ? ' flagged' : '') |
| | | + (message.selected ? ' selected' : ''), |
| | | row = { cols:[], style:{}, id:'rcmrow'+uid }; |
| | | row = { cols:[], style:{}, id:'rcmrow'+this.html_identifier(uid,true), uid:uid }; |
| | | |
| | | // message status icons |
| | | css_class = 'msgicon'; |
| | |
| | | if (this.env.threading) { |
| | | if (message.depth) { |
| | | // This assumes that div width is hardcoded to 15px, |
| | | tree += '<span id="rcmtab' + uid + '" class="branch" style="width:' + (message.depth * 15) + 'px;"> </span>'; |
| | | tree += '<span id="rcmtab' + row.id + '" class="branch" style="width:' + (message.depth * 15) + 'px;"> </span>'; |
| | | |
| | | if ((rows[message.parent_uid] && rows[message.parent_uid].expanded === false) |
| | | || ((this.env.autoexpand_threads == 0 || this.env.autoexpand_threads == 2) && |
| | |
| | | message.expanded = true; |
| | | } |
| | | |
| | | expando = '<div id="rcmexpando' + uid + '" class="' + (message.expanded ? 'expanded' : 'collapsed') + '"> </div>'; |
| | | expando = '<div id="rcmexpando' + row.id + '" class="' + (message.expanded ? 'expanded' : 'collapsed') + '"> </div>'; |
| | | row_class += ' thread' + (message.expanded? ' expanded' : ''); |
| | | } |
| | | |
| | |
| | | row_class += ' unroot'; |
| | | } |
| | | |
| | | tree += '<span id="msgicn'+uid+'" class="'+css_class+'"> </span>'; |
| | | tree += '<span id="msgicn'+row.id+'" class="'+css_class+'"> </span>'; |
| | | row.className = row_class; |
| | | |
| | | // build subject link |
| | | if (!bw.ie && cols.subject) { |
| | | var action = flags.mbox == this.env.drafts_mailbox ? 'compose' : 'show'; |
| | | var uid_param = flags.mbox == this.env.drafts_mailbox ? '_draft_uid' : '_uid'; |
| | | cols.subject = '<a href="./?_task=mail&_action='+action+'&_mbox='+urlencode(flags.mbox)+'&'+uid_param+'='+uid+'"'+ |
| | | cols.subject = '<a href="./?_task=mail&_action='+action+'&_mbox='+urlencode(flags.mbox)+'&'+uid_param+'='+urlencode(uid)+'"'+ |
| | | ' onclick="return rcube_event.cancel(event)" onmouseover="rcube_webmail.long_subject_title(this,'+(message.depth+1)+')">'+cols.subject+'</a>'; |
| | | } |
| | | |
| | |
| | | |
| | | if (c == 'flag') { |
| | | css_class = (flags.flagged ? 'flagged' : 'unflagged'); |
| | | html = '<span id="flagicn'+uid+'" class="'+css_class+'"> </span>'; |
| | | html = '<span id="flagicn'+row.id+'" class="'+css_class+'"> </span>'; |
| | | } |
| | | else if (c == 'attachment') { |
| | | if (/application\/|multipart\/(m|signed)/.test(flags.ctype)) |
| | |
| | | css_class = 'unreadchildren'; |
| | | else |
| | | css_class = 'msgicon'; |
| | | html = '<span id="statusicn'+uid+'" class="'+css_class+'"> </span>'; |
| | | html = '<span id="statusicn'+row.id+'" class="'+css_class+'"> </span>'; |
| | | } |
| | | else if (c == 'threads') |
| | | html = expando; |
| | |
| | | |
| | | var win, target = window, |
| | | action = preview ? 'preview': 'show', |
| | | url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox); |
| | | url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.get_message_mailbox(id)); |
| | | |
| | | if (preview && (win = this.get_frame_window(this.env.contentframe))) { |
| | | target = win; |
| | |
| | | } |
| | | |
| | | if (html) |
| | | $('#rcmtab'+uid).html(html); |
| | | $('#rcmtab'+this.html_identifier(uid, true)).html(html); |
| | | }; |
| | | |
| | | // update parent in a thread |
| | |
| | | |
| | | r.depth--; // move left |
| | | // reset width and clear the content of a tab, icons will be added later |
| | | $('#rcmtab'+r.uid).width(r.depth * 15).html(''); |
| | | $('#rcmtab'+r.id).width(r.depth * 15).html(''); |
| | | if (!r.depth) { // a new root |
| | | count++; // increase roots count |
| | | r.parent_uid = 0; |
| | | if (r.has_children) { |
| | | // replace 'leaf' with 'collapsed' |
| | | $('#rcmrow'+r.uid+' '+'.leaf:first') |
| | | .attr('id', 'rcmexpando' + r.uid) |
| | | $('#'+r.id+' .leaf:first') |
| | | .attr('id', 'rcmexpando' + r.id) |
| | | .attr('class', (r.obj.style.display != 'none' ? 'expanded' : 'collapsed')) |
| | | .bind('mousedown', {uid:r.uid, p:this}, |
| | | function(e) { return e.data.p.expand_message_row(e, e.data.uid); }); |
| | |
| | | r = this.http_request(action, url, lock); |
| | | |
| | | this.env.qsearch = {lock: lock, request: r}; |
| | | this.enable_command('set-listmode', this.env.threads && (this.env.search_scope || 'base') == 'base'); |
| | | } |
| | | }; |
| | | |
| | |
| | | { |
| | | var n, url = {}, mods_arr = [], |
| | | mods = this.env.search_mods, |
| | | mbox = this.env.mailbox; |
| | | mbox = this.env.mailbox, |
| | | scope = this.env.search_scope || 'base'; |
| | | |
| | | if (!filter && this.gui_objects.search_filter) |
| | | filter = this.gui_objects.search_filter.value; |
| | |
| | | } |
| | | } |
| | | |
| | | if (mbox) |
| | | if (scope) |
| | | url._scope = scope; |
| | | if (mbox && scope != 'all') |
| | | url._mbox = mbox; |
| | | |
| | | return url; |
| | |
| | | this.env.qsearch = null; |
| | | this.env.search_request = null; |
| | | this.env.search_id = null; |
| | | |
| | | this.enable_command('set-listmode', this.env.threads); |
| | | }; |
| | | |
| | | this.sent_successfully = function(type, msg, folders) |
| | |
| | | if ((n = $.inArray('status', this.env.coltypes)) >= 0) |
| | | this.env.status_col = n; |
| | | |
| | | if (list) |
| | | if (list) { |
| | | list.hide_column('folder', !(this.env.search_request || this.env.search_id)); |
| | | list.init_header(); |
| | | } |
| | | }; |
| | | |
| | | // replace content of row count display |
| | |
| | | return this.env.cid ? this.env.cid : (this.contact_list ? this.contact_list.get_single_selection() : null); |
| | | }; |
| | | |
| | | // get the IMP mailbox of the message with the given UID |
| | | this.get_message_mailbox = function(uid) |
| | | { |
| | | var msg = this.env.messages ? this.env.messages[uid] : {}; |
| | | return msg.mbox || this.env.mailbox; |
| | | } |
| | | |
| | | // gets cursor position |
| | | this.get_caret_pos = function(obj) |
| | | { |