| | |
| | | if (sel) button_prop.sel = sel; |
| | | if (over) button_prop.over = over; |
| | | |
| | | this.buttons[command][this.buttons[command].length] = button_prop; |
| | | this.buttons[command][this.buttons[command].length] = button_prop; |
| | | }; |
| | | |
| | | // register a specific gui object |
| | |
| | | |
| | | if (this.gui_objects.messagelist) { |
| | | |
| | | this.message_list = new rcube_list_widget(this.gui_objects.messagelist, |
| | | {multiselect:true, multiexpand:true, draggable:true, keyboard:true, dblclick_time:this.dblclick_time}); |
| | | this.message_list = new rcube_list_widget(this.gui_objects.messagelist, { |
| | | multiselect:true, multiexpand:true, draggable:true, keyboard:true, |
| | | column_movable:this.env.col_movable, column_fixed:0, dblclick_time:this.dblclick_time |
| | | }); |
| | | this.message_list.row_init = function(o){ p.init_message_row(o); }; |
| | | this.message_list.addEventListener('dblclick', function(o){ p.msglist_dbl_click(o); }); |
| | | this.message_list.addEventListener('click', function(o){ p.msglist_click(o); }); |
| | |
| | | this.message_list.addEventListener('dragmove', function(e){ p.drag_move(e); }); |
| | | this.message_list.addEventListener('dragend', function(e){ p.drag_end(e); }); |
| | | this.message_list.addEventListener('expandcollapse', function(e){ p.msglist_expand(e); }); |
| | | this.message_list.addEventListener('column_replace', function(e){ p.msglist_set_coltypes(e); }); |
| | | |
| | | document.onmouseup = function(e){ return p.doc_mouse_up(e); }; |
| | | this.gui_objects.messagelist.parentNode.onmousedown = function(e){ return p.click_on_list(e); }; |
| | | |
| | | this.set_message_coltypes(this.env.coltypes); |
| | | this.message_list.init(); |
| | | this.enable_command('toggle_status', 'toggle_flag', 'menu-open', 'menu-save', true); |
| | | |
| | | // load messages |
| | | if (this.env.messagecount) |
| | | this.command('list'); |
| | | this.command('list'); |
| | | } |
| | | |
| | | if (this.gui_objects.qsearchbox) { |
| | |
| | | // show printing dialog |
| | | else if (this.env.action == 'print') |
| | | window.print(); |
| | | |
| | | if (this.env.messagecount) { |
| | | this.enable_command('select-all', 'select-none', 'expunge', true); |
| | | this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading); |
| | | } |
| | | |
| | | if (this.purge_mailbox_test()) |
| | | this.enable_command('purge', true); |
| | | |
| | | this.set_page_buttons(); |
| | | |
| | | // get unread count for each mailbox |
| | | if (this.gui_objects.mailboxlist) { |
| | |
| | | |
| | | // detect client timezone |
| | | $('#rcmlogintz').val(new Date().getTimezoneOffset() / -60); |
| | | |
| | | // display 'loading' message on form submit |
| | | $('form').submit(function () { |
| | | rcmail.display_message(rcmail.get_label('loading'), 'loading', true); |
| | | }); |
| | | |
| | | this.enable_command('login', true); |
| | | break; |
| | |
| | | var selected = list.get_single_selection() != null; |
| | | |
| | | // Hide certain command buttons when Drafts folder is selected |
| | | if (this.env.mailbox == this.env.drafts_mailbox) { |
| | | this.enable_command('reply', 'reply-all', 'forward', false); |
| | | this.enable_command('show', 'print', 'open', 'edit', 'download', 'viewsource', selected); |
| | | this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); |
| | | } |
| | | else { |
| | | this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'edit', 'open', 'download', 'viewsource', selected); |
| | | this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); |
| | | } |
| | | this.enable_command('reply', 'reply-all', 'forward', this.env.mailbox == this.env.drafts_mailbox ? false : selected); |
| | | this.enable_command('show', 'print', 'open', 'edit', 'download', 'viewsource', selected); |
| | | this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); |
| | | |
| | | // reset all-pages-selection |
| | | if (selected || list.selection.length != list.rowcount) |
| | | this.select_all_mode = false; |
| | | |
| | | // start timer for message preview (wait for double click) |
| | | if (selected && this.env.contentframe && !list.multi_selecting) |
| | |
| | | { |
| | | if (this.env.messages[row.uid]) |
| | | this.env.messages[row.uid].expanded = row.expanded; |
| | | }; |
| | | |
| | | this.msglist_set_coltypes = function(list) |
| | | { |
| | | var i, found, name, cols = list.list.tHead.rows[0].cells; |
| | | |
| | | this.env.coltypes = []; |
| | | |
| | | for (i=0; i<cols.length; i++) |
| | | if (cols[i].id && cols[i].id.match(/^rcm/)) { |
| | | name = cols[i].id.replace(/^rcm/, ''); |
| | | this.env.coltypes[this.env.coltypes.length] = name == 'to' ? 'from' : name; |
| | | } |
| | | |
| | | if ((found = $.inArray('flag', this.env.coltypes)) >= 0) |
| | | this.set_env('flagged_col', found); |
| | | |
| | | this.http_post('save-pref', { '_name':'list_cols', '_value':this.env.coltypes }); |
| | | }; |
| | | |
| | | this.check_droptarget = function(id) |
| | |
| | | { |
| | | var update, add_url = ''; |
| | | |
| | | if (!sort_col) sort_col = this.env.sort_col; |
| | | if (!sort_order) sort_order = this.env.sort_order; |
| | | |
| | | if (this.env.sort_col != sort_col || this.env.sort_order != sort_order) { |
| | | update = 1; |
| | | this.set_list_sorting(sort_col, sort_order); |
| | |
| | | add_url += '&_threads=' + threads; |
| | | } |
| | | |
| | | if (cols.join() != this.env.coltypes.join()) { |
| | | update = 1; |
| | | add_url += '&_cols=' + cols.join(','); |
| | | if (cols && cols.length) { |
| | | // make sure new columns are added at the end of the list |
| | | var i, idx, name, newcols = [], oldcols = this.env.coltypes; |
| | | for (i=0; i<oldcols.length; i++) { |
| | | name = oldcols[i] == 'to' ? 'from' : oldcols[i]; |
| | | idx = $.inArray(name, cols); |
| | | if (idx != -1) { |
| | | newcols[newcols.length] = name; |
| | | delete cols[idx]; |
| | | } |
| | | } |
| | | for (i=0; i<cols.length; i++) |
| | | if (cols[i]) |
| | | newcols[newcols.length] = cols[i]; |
| | | |
| | | if (newcols.join() != this.env.coltypes.join()) { |
| | | update = 1; |
| | | add_url += '&_cols=' + newcols.join(','); |
| | | } |
| | | } |
| | | |
| | | if (update) |
| | |
| | | input_to.focus(); |
| | | else if (input_subject.val() == '') |
| | | input_subject.focus(); |
| | | else if (input_message && !html_mode) |
| | | else if (input_message) |
| | | input_message.focus(); |
| | | |
| | | this.env.compose_focus_elem = document.activeElement; |
| | | |
| | | // get summary of all field values |
| | | this.compose_field_hash(true); |
| | |
| | | if (!show_sig) |
| | | show_sig = this.env.show_sig; |
| | | |
| | | var id = obj.options[obj.selectedIndex].value; |
| | | var input_message = $("[name='_message']"); |
| | | var message = input_message.val(); |
| | | var is_html = ($("input[name='_is_html']").val() == '1'); |
| | | var sig_separator = this.env.sig_above && (this.env.compose_mode == 'reply' || this.env.compose_mode == 'forward') ? '---' : '-- '; |
| | | var sig, cursor_pos, p = -1; |
| | | var sig, cursor_pos, p = -1, |
| | | id = obj.options[obj.selectedIndex].value, |
| | | input_message = $("[name='_message']"), |
| | | message = input_message.val(), |
| | | is_html = ($("input[name='_is_html']").val() == '1'), |
| | | sig_separator = this.env.sig_above && (this.env.compose_mode == 'reply' || this.env.compose_mode == 'forward') ? '---' : '-- '; |
| | | |
| | | if (!this.env.identity) |
| | | this.env.identity = id |
| | |
| | | if (p >= 0) { // in place of removed signature |
| | | message = message.substring(0, p) + sig + message.substring(p, message.length); |
| | | cursor_pos = p - 1; |
| | | } |
| | | } |
| | | else if (pos = this.get_caret_pos(input_message.get(0))) { // at cursor position |
| | | message = message.substring(0, pos) + '\n' + sig + '\n\n' + message.substring(pos, message.length); |
| | | cursor_pos = pos; |
| | |
| | | else { // on top |
| | | cursor_pos = 0; |
| | | message = '\n\n' + sig + '\n\n' + message.replace(/^[\r\n]+/, ''); |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | message = message.replace(/[\r\n]+$/, ''); |
| | |
| | | this.set_caret_pos(input_message.get(0), cursor_pos); |
| | | } |
| | | else if (show_sig && this.env.signatures) { // html |
| | | var editor = tinyMCE.get(this.env.composebody); |
| | | var sigElem = editor.dom.get('_rc_sig'); |
| | | var editor = tinyMCE.get(this.env.composebody), |
| | | sigElem = editor.dom.get('_rc_sig'); |
| | | |
| | | // Append the signature as a div within the body |
| | | if (!sigElem) { |
| | | var body = editor.getBody(); |
| | | var doc = editor.getDoc(); |
| | | var body = editor.getBody(), |
| | | doc = editor.getDoc(); |
| | | |
| | | sigElem = doc.createElement('div'); |
| | | sigElem.setAttribute('id', '_rc_sig'); |
| | | |
| | | if (this.env.sig_above) { |
| | | // if no existing sig and top posting then insert at caret pos |
| | | editor.getWin().focus(); // correct focus in IE |
| | | editor.getWin().focus(); // correct focus in IE & Chrome |
| | | |
| | | var node = editor.selection.getNode(); |
| | | if (node.nodeName == 'BODY') { |
| | |
| | | // load contact record |
| | | this.load_contact = function(cid, action, framed) |
| | | { |
| | | var add_url = ''; |
| | | var target = window; |
| | | var add_url = '', target = window; |
| | | |
| | | if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { |
| | | add_url = '&_framed=1'; |
| | | target = window.frames[this.env.contentframe]; |
| | |
| | | return false; |
| | | |
| | | if (action && (cid || action=='add') && !this.drag_active) { |
| | | if (this.env.group) |
| | | add_url += '&_gid='+urlencode(this.env.group); |
| | | |
| | | this.set_busy(true); |
| | | target.location.href = this.env.comm_path+'&_action='+action+'&_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group)+'&_cid='+urlencode(cid) + add_url; |
| | | target.location.href = this.env.comm_path+'&_action='+action+'&_source='+urlencode(this.env.source)+'&_cid='+urlencode(cid) + add_url; |
| | | } |
| | | return true; |
| | | }; |
| | |
| | | |
| | | // set image according to button state |
| | | if (obj && button.type=='image' && button[state]) { |
| | | button.status = state; |
| | | button.status = state; |
| | | obj.src = button[state]; |
| | | } |
| | | // set class name according to button state |
| | | else if (obj && typeof(button[state])!='undefined') { |
| | | button.status = state; |
| | | obj.className = button[state]; |
| | | button.status = state; |
| | | obj.className = button[state]; |
| | | } |
| | | // disable/enable input buttons |
| | | if (obj && button.type=='input') { |
| | |
| | | this.env.flagged_col = null; |
| | | |
| | | var found; |
| | | if((found = $.inArray('subject', this.env.coltypes)) >= 0) { |
| | | if ((found = $.inArray('subject', this.env.coltypes)) >= 0) { |
| | | this.set_env('subject_col', found); |
| | | if (this.message_list) |
| | | this.message_list.subject_col = found+1; |
| | | } |
| | | if((found = $.inArray('flag', this.env.coltypes)) >= 0) |
| | | if ((found = $.inArray('flag', this.env.coltypes)) >= 0) |
| | | this.set_env('flagged_col', found); |
| | | |
| | | this.message_list.init_header(); |
| | | }; |
| | | |
| | | // replace content of row count display |
| | |
| | | case 'search': |
| | | case 'list': |
| | | if (this.task == 'mail') { |
| | | if (this.message_list && (response.action == 'list' || response.action == 'search')) { |
| | | this.msglist_select(this.message_list); |
| | | this.expand_threads(); |
| | | } |
| | | this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0)); |
| | | this.enable_command('purge', this.purge_mailbox_test()); |
| | | this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading && this.env.messagecount); |
| | | |
| | | if (response.action == 'list') |
| | | if (response.action == 'list' || response.action == 'search') { |
| | | this.msglist_select(this.message_list); |
| | | this.expand_threads(); |
| | | this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount }); |
| | | } |
| | | } |
| | | else if (this.task == 'addressbook') { |
| | | this.enable_command('export', (this.contact_list && this.contact_list.rowcount > 0)); |
| | | |
| | | if (response.action == 'list') { |
| | | if (response.action == 'list' || response.action == 'search') { |
| | | this.enable_command('group-create', this.env.address_sources[this.env.source].groups); |
| | | this.enable_command('group-rename', 'group-delete', this.env.address_sources[this.env.source].groups && this.env.group); |
| | | this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount }); |