| | |
| | | |
| | | case 'login': |
| | | var input_user = $('#rcmloginuser'); |
| | | input_user.bind('keypress', function(e){ return rcmail.login_user_keyup(e); }); |
| | | input_user.bind('keyup', function(e){ return rcmail.login_user_keyup(e); }); |
| | | |
| | | if (input_user.val() == '') |
| | | input_user.focus(); |
| | |
| | | } |
| | | |
| | | // set eventhandler to message icon |
| | | if ((row.icon = row.obj.cells[0].childNodes[0]) && row.icon.nodeName=='IMG') |
| | | if (row.icon = row.obj.getElementsByTagName('TD')[0].getElementsByTagName('IMG')[0]) |
| | | { |
| | | var p = this; |
| | | row.icon.id = 'msgicn_'+row.uid; |
| | |
| | | { |
| | | var found; |
| | | if((found = find_in_array('flag', this.env.coltypes)) >= 0) |
| | | this.set_env('flagged_col', found+1); |
| | | this.set_env('flagged_col', found+1); |
| | | } |
| | | |
| | | // set eventhandler to flag icon, if icon found |
| | | if (this.env.flagged_col && (row.flagged_icon = row.obj.cells[this.env.flagged_col].childNodes[0]) |
| | | && row.flagged_icon.nodeName=='IMG') |
| | | if (this.env.flagged_col && (row.flagged_icon = row.obj.getElementsByTagName('TD')[this.env.flagged_col].getElementsByTagName('IMG')[0])) |
| | | { |
| | | var p = this; |
| | | row.flagged_icon.id = 'flaggedicn_'+row.uid; |
| | |
| | | |
| | | |
| | | case 'sort': |
| | | // get the type of sorting |
| | | var a_sort = props.split('_'); |
| | | var sort_col = a_sort[0]; |
| | | var sort_order = a_sort[1] ? a_sort[1].toUpperCase() : null; |
| | | var sort_order, sort_col = props; |
| | | |
| | | // no sort order specified: toggle |
| | | if (sort_order==null) |
| | | { |
| | | if (this.env.sort_col==sort_col) |
| | | sort_order = this.env.sort_order=='ASC' ? 'DESC' : 'ASC'; |
| | | else |
| | | sort_order = this.env.sort_order; |
| | | } |
| | | |
| | | if (this.env.sort_col==sort_col && this.env.sort_order==sort_order) |
| | | break; |
| | | |
| | | if (this.env.sort_col==sort_col) |
| | | sort_order = this.env.sort_order=='ASC' ? 'DESC' : 'ASC'; |
| | | else |
| | | sort_order = 'ASC'; |
| | | |
| | | // set table header class |
| | | $('#rcm'+this.env.sort_col).removeClass('sorted'+(this.env.sort_order.toUpperCase())); |
| | | $('#rcm'+sort_col).addClass('sorted'+sort_order); |
| | |
| | | |
| | | this.drag_start = function(list) |
| | | { |
| | | this.initialBodyScrollTop = bw.ie ? 0 : window.pageYOffset; |
| | | this.initialMailBoxScrollTop = document.getElementById("mailboxlist-container").scrollTop; |
| | | |
| | | var model = this.task == 'mail' ? this.env.mailboxes : this.env.address_sources; |
| | | |
| | | this.drag_active = true; |
| | |
| | | // save folderlist and folders location/sizes for droptarget calculation in drag_move() |
| | | if (this.gui_objects.folderlist && model) |
| | | { |
| | | this.initialBodyScrollTop = bw.ie ? 0 : window.pageYOffset; |
| | | this.initialListScrollTop = this.gui_objects.folderlist.parentNode.scrollTop; |
| | | |
| | | var li, pos, list, height; |
| | | list = $(this.gui_objects.folderlist); |
| | | pos = list.offset(); |
| | |
| | | if (this.gui_objects.folderlist && this.env.folder_coords) { |
| | | // offsets to compensate for scrolling while dragging a message |
| | | var boffset = bw.ie ? -document.documentElement.scrollTop : this.initialBodyScrollTop; |
| | | var moffset = this.initialMailBoxScrollTop-document.getElementById('mailboxlist-container').scrollTop; |
| | | var moffset = this.initialListScrollTop-this.gui_objects.folderlist.parentNode.scrollTop; |
| | | var toffset = -moffset-boffset; |
| | | |
| | | var li, pos, mouse; |
| | |
| | | this.ksearch_value = q; |
| | | |
| | | this.display_message(this.get_label('searching'), 'loading', true); |
| | | this.http_post('autocomplete', '_search='+q); |
| | | this.http_post('autocomplete', '_search='+urlencode(q)); |
| | | }; |
| | | |
| | | this.ksearch_query_results = function(results, search) |
| | | { |
| | | // ignore this outdated search response |
| | | if (search != this.ksearch_value) |
| | | if (this.ksearch_value && search != this.ksearch_value) |
| | | return; |
| | | |
| | | this.hide_message(); |
| | |
| | | var reg = new RegExp('.*['+RegExp.escape(this.env.delimiter)+']'); |
| | | this.name_input = document.createElement('INPUT'); |
| | | this.name_input.value = this.env.subscriptionrows[id][0].replace(reg, ''); |
| | | this.name_input.style.width = '100%'; |
| | | |
| | | reg = new RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | this.name_input.__parent = this.env.subscriptionrows[id][0].replace(reg, ''); |
| | |
| | | if ((target_li = this.get_folder_li(name))) { |
| | | $(target_li).removeClass('unfocused').addClass('selected'); |
| | | } |
| | | |
| | | // trigger event hook |
| | | this.triggerEvent('selectfolder', { folder:name, old:old }); |
| | | } |
| | | }; |
| | | |
| | |
| | | if (!this.gui_objects.messagelist || !this.message_list) |
| | | return false; |
| | | |
| | | var tbody = this.gui_objects.messagelist.tBodies[0]; |
| | | if (this.message_list.background) |
| | | var tbody = this.message_list.background; |
| | | else |
| | | var tbody = this.gui_objects.messagelist.tBodies[0]; |
| | | |
| | | var rowcount = tbody.rows.length; |
| | | var even = rowcount%2; |
| | | |
| | |
| | | + (even ? ' even' : ' odd') |
| | | + (flags.unread ? ' unread' : '') |
| | | + (flags.deleted ? ' deleted' : '') |
| | | + (flags.flagged ? ' flagged' : ''); |
| | | + (flags.flagged ? ' flagged' : '') |
| | | + (this.message_list.in_selection(uid) ? ' selected' : ''); |
| | | |
| | | var row = $('<tr>').attr('id', 'rcmrow'+uid).attr('class', css_class); |
| | | |
| | | if (this.message_list.in_selection(uid)) |
| | | row.addClass('selected'); |
| | | |
| | | // for performance use DOM instead of jQuery here |
| | | var row = document.createElement('TR'); |
| | | row.id = 'rcmrow'+uid; |
| | | row.className = css_class; |
| | | |
| | | var icon = this.env.messageicon; |
| | | if (flags.deleted && this.env.deletedicon) |
| | | icon = this.env.deletedicon; |
| | |
| | | icon = this.env.unreadicon; |
| | | |
| | | // add icon col |
| | | $('<td>').addClass('icon').html(icon ? '<img src="'+icon+'" alt="" />' : '').appendTo(row); |
| | | |
| | | var col = document.createElement('TD'); |
| | | col.className = 'icon'; |
| | | col.innerHTML = icon ? '<img src="'+icon+'" alt="" />' : ''; |
| | | row.appendChild(col); |
| | | |
| | | // add each submitted col |
| | | for (var n = 0; n < this.coltypes.length; n++) { |
| | | var c = this.coltypes[n]; |
| | | col = $('<td>').addClass(String(c).toLowerCase()); |
| | | |
| | | col = document.createElement('TD'); |
| | | col.className = String(c).toLowerCase(); |
| | | |
| | | if (c=='flag') { |
| | | if (flags.flagged && this.env.flaggedicon) |
| | | col.html('<img src="'+this.env.flaggedicon+'" alt="" />'); |
| | | col.innerHTML = '<img src="'+this.env.flaggedicon+'" alt="" />'; |
| | | else if(!flags.flagged && this.env.unflaggedicon) |
| | | col.html('<img src="'+this.env.unflaggedicon+'" alt="" />'); |
| | | } |
| | | col.innerHTML = '<img src="'+this.env.unflaggedicon+'" alt="" />'; |
| | | } |
| | | else if (c=='attachment') |
| | | col.html(attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : ' '); |
| | | col.innerHTML = (attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : ' '); |
| | | else |
| | | col.html(cols[c]); |
| | | col.innerHTML = cols[c]; |
| | | |
| | | col.appendTo(row); |
| | | row.appendChild(col); |
| | | } |
| | | |
| | | this.message_list.insert_row(row, attop); |
| | | this.triggerEvent('insertrow', { uid:uid, row:row }); |
| | | |
| | | // remove 'old' row |
| | | if (attop && this.env.pagesize && this.message_list.rowcount > this.env.pagesize) { |
| | | var uid = this.message_list.get_last_row(); |
| | | this.message_list.remove_row(uid); |
| | | this.message_list.clear_selection(uid); |
| | | } |
| | | }; |
| | | } |
| | | }; |
| | | |
| | | // messages list handling in background (for performance) |
| | | this.offline_message_list = function(flag) |
| | | { |
| | | if (this.message_list) |
| | | this.message_list.set_background_mode(flag); |
| | | }; |
| | | |
| | | // replace content of row count display |
| | | this.set_rowcount = function(text) |
| | |
| | | var rowcount = tbody.rows.length; |
| | | var even = rowcount%2; |
| | | |
| | | var row = $('<tr>').attr('id', 'rcmrow'+cid).addClass('class').addClass(even ? 'even' : 'odd'); |
| | | |
| | | var row = document.createElement('TR'); |
| | | row.id = 'rcmrow'+cid; |
| | | row.className = 'contact '+(even ? 'even' : 'odd'); |
| | | |
| | | if (this.contact_list.in_selection(cid)) |
| | | row.addClass('selected'); |
| | | row.className += ' selected'; |
| | | |
| | | // add each submitted col |
| | | for (var c in cols) { |
| | | col = $('<td>').addClass(String(c).toLowerCase()).html(cols[c]).appendTo(row); |
| | | col = document.createElement('TD'); |
| | | col.className = String(c).toLowerCase(); |
| | | col.innerHTML = cols[c]; |
| | | row.appendChild(col); |
| | | } |
| | | |
| | | this.contact_list.insert_row(row); |
| | | this.triggerEvent('insertrow', { cid:cid, row:row }); |
| | | |
| | | this.enable_command('export', (this.contact_list.rowcount > 0)); |
| | | }; |
| | | |
| | |
| | | error: function(o) { rcmail.http_error(o); }, |
| | | success: function(data) { rcmail.set_busy(false); $(document.getElementById(id)).val(data); console.log(data); } |
| | | }); |
| | | } |
| | | |
| | | this.plain2html = function(plainText, id) |
| | | { |
| | | this.set_busy(true, 'converting'); |
| | | $(document.getElementById(id)).val('<pre>'+plainText+'</pre>'); |
| | | this.set_busy(false); |
| | | } |
| | | |
| | | |
| | |
| | | console.log(response.exec); |
| | | eval(response.exec); |
| | | } |
| | | |
| | | |
| | | // process the response data according to the sent action |
| | | switch (response.action) { |
| | | case 'delete': |
| | |
| | | this.msglist_select(this.message_list); |
| | | this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0)); |
| | | this.enable_command('purge', this.purge_mailbox_test()); |
| | | |
| | | if (response.action == 'list') |
| | | this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount }); |
| | | } |
| | | else if (this.task == 'addressbook') |
| | | else if (this.task == 'addressbook') { |
| | | this.enable_command('export', (this.contact_list && this.contact_list.rowcount > 0)); |
| | | |
| | | if (response.action == 'list') |
| | | this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount }); |
| | | } |
| | | break; |
| | | } |
| | | }; |
| | |
| | | // handle HTTP request errors |
| | | this.http_error = function(request, status, err) |
| | | { |
| | | alert(status+":"+err); |
| | | /* |
| | | //alert('Error sending request: '+request_obj.url+' => HTTP '+request_obj.xmlhttp.status); |
| | | if (request_obj.__lock) |
| | | this.set_busy(false); |
| | | var errmsg = request.statusText; |
| | | |
| | | request_obj.reset(); |
| | | request_obj.__lock = false; |
| | | this.display_message('Unknown Server Error!', 'error'); |
| | | */ |
| | | this.set_busy(false); |
| | | request.abort(); |
| | | |
| | | this.display_message('Unknown Server Error!' + (errmsg ? ' ('+errmsg+')' : ''), 'error'); |
| | | }; |
| | | |
| | | // use an image to send a keep-alive siganl to the server |