| | |
| | | | Copyright (C) 2005, RoundCube Dev, - Switzerland | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | Modified: 2005/08/19 (tbr) | |
| | | | Modified: 2005/10/21 (roundcube) | |
| | | | | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | |
| | | // webmail client settings |
| | | this.dblclick_time = 600; |
| | | this.message_time = 5000; |
| | | this.request_timeout = 120000; |
| | | this.mbox_expression = new RegExp('[^0-9a-z\-_]', 'gi'); |
| | | this.env.blank_img = 'skins/default/images/blank.gif'; |
| | | |
| | |
| | | this.task = this.env.task; |
| | | |
| | | // check browser |
| | | if (!(bw.dom && ((bw.ie && bw.vendver>=5.5 && !bw.opera) || (bw.mz && bw.vendver>=1) || (bw.safari && bw.vendver>=125) || (bw.opera && bw.vendver>=8)))) |
| | | if (!bw.dom || !bw.xmlhttp_test()) |
| | | { |
| | | location.href = this.env.comm_path+'&_action=error&_code=0x199'; |
| | | return; |
| | |
| | | this.enable_command('add-attachment', 'send-attachment', 'send', true); |
| | | |
| | | if (this.env.messagecount) |
| | | this.enable_command('select-all', 'select-none', true); |
| | | this.enable_command('select-all', 'select-none', 'sort', true); |
| | | |
| | | this.set_page_buttons(); |
| | | |
| | |
| | | |
| | | // flag object as complete |
| | | this.loaded = true; |
| | | |
| | | |
| | | // show message |
| | | if (this.pending_message) |
| | | this.display_message(this.pending_message[0], this.pending_message[1]); |
| | |
| | | this.list_contacts(); |
| | | break; |
| | | |
| | | case 'sort': |
| | | // get the type of sorting |
| | | this.list_mailbox('', '', props); |
| | | break; |
| | | |
| | | case 'nextpage': |
| | | this.list_page('next'); |
| | | break; |
| | |
| | | |
| | | case 'nextmessage': |
| | | if (this.env.next_uid) |
| | | location.href = this.env.comm_path+'&_action=show&_uid='+this.env.next_uid+'&_mbox='+this.env.mailbox; |
| | | this.show_message(this.env.next_uid); |
| | | //location.href = this.env.comm_path+'&_action=show&_uid='+this.env.next_uid+'&_mbox='+this.env.mailbox; |
| | | break; |
| | | |
| | | case 'previousmessage': |
| | | if (this.env.prev_uid) |
| | | location.href = this.env.comm_path+'&_action=show&_uid='+this.env.prev_uid+'&_mbox='+this.env.mailbox; |
| | | this.show_message(this.env.prev_uid); |
| | | //location.href = this.env.comm_path+'&_action=show&_uid='+this.env.prev_uid+'&_mbox='+this.env.mailbox; |
| | | break; |
| | | |
| | | case 'compose': |
| | |
| | | }; |
| | | |
| | | |
| | | // lock/unlock interface |
| | | this.set_busy = function(a, message) |
| | | { |
| | | if (a && message) |
| | |
| | | |
| | | if (this.gui_objects.editform) |
| | | this.lock_form(this.gui_objects.editform, a); |
| | | |
| | | // clear pending timer |
| | | if (this.request_timer) |
| | | clearTimeout(this.request_timer); |
| | | |
| | | // set timer for requests |
| | | if (a && this.request_timeout) |
| | | this.request_timer = setTimeout(this.ref+'.request_timed_out()', this.request_timeout); |
| | | }; |
| | | |
| | | |
| | |
| | | url = this.env.comm_path; |
| | | |
| | | return url.replace(/_task=[a-z]+/, '_task='+task); |
| | | }; |
| | | |
| | | |
| | | // called when a request timed out |
| | | this.request_timed_out = function() |
| | | { |
| | | this.set_busy(false); |
| | | this.display_message('Request timed out!', 'error'); |
| | | }; |
| | | |
| | | |
| | |
| | | |
| | | if (id) |
| | | { |
| | | this.set_busy(true); |
| | | this.set_busy(true, 'loading'); |
| | | target.location.href = this.env.comm_path+'&_action=show&_uid='+id+'&_mbox='+escape(this.env.mailbox)+add_url; |
| | | } |
| | | }; |
| | |
| | | |
| | | |
| | | // list messages of a specific mailbox |
| | | this.list_mailbox = function(mbox, page) |
| | | this.list_mailbox = function(mbox, page, sort) |
| | | { |
| | | var add_url = ''; |
| | | var target = window; |
| | |
| | | if (!mbox) |
| | | mbox = this.env.mailbox; |
| | | |
| | | // add sort to url if set |
| | | if (sort) |
| | | add_url += '&_sort=' + sort; |
| | | |
| | | // set page=1 if changeing to another mailbox |
| | | if (!page && mbox != this.env.mailbox) |
| | | { |
| | | page = 1; |
| | | add_url += '&_refresh=1'; |
| | | this.env.current_page = page; |
| | | this.clear_selection(); |
| | | } |
| | |
| | | // load message list remotely |
| | | if (this.gui_objects.messagelist) |
| | | { |
| | | this.list_mailbox_remote(mbox, page); |
| | | this.list_mailbox_remote(mbox, page, add_url); |
| | | return; |
| | | } |
| | | |
| | | if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) |
| | | { |
| | | target = window.frames[this.env.contentframe]; |
| | | add_url = '&_framed=1'; |
| | | add_url += '&_framed=1'; |
| | | } |
| | | |
| | | // load message list to target frame/window |
| | |
| | | |
| | | |
| | | // send remote request to load message list |
| | | this.list_mailbox_remote = function(mbox, page) |
| | | this.list_mailbox_remote = function(mbox, page, add_url) |
| | | { |
| | | // clear message list |
| | | var table = this.gui_objects.messagelist; |
| | |
| | | // send request to server |
| | | var url = '_mbox='+escape(mbox)+(page ? '&_page='+page : ''); |
| | | this.set_busy(true, 'loading'); |
| | | this.http_request('list', url); |
| | | this.http_request('list', url+add_url); |
| | | }; |
| | | |
| | | |
| | |
| | | } |
| | | if (row.cells[2].firstChild.tagName=='A') |
| | | row.cells[2].firstChild.onclick = new Function(this.ref+".command('delete-folder','"+name+"')"); |
| | | |
| | | var form; |
| | | if ((form = this.gui_objects.editform) && form.elements['_folder_name']) |
| | | form.elements['_folder_name'].value = ''; |
| | | }; |
| | | |
| | | |
| | |
| | | var cont = msg; |
| | | if (type) |
| | | cont = '<div class="'+type+'">'+cont+'</div>'; |
| | | |
| | | |
| | | this.gui_objects.message._rcube = this; |
| | | this.gui_objects.message.innerHTML = cont; |
| | | this.gui_objects.message.style.display = 'block'; |
| | | |
| | | if (type!='loading') |
| | | this.gui_objects.message.onmousedown = function(){ this._rcube.hide_message(); return true; }; |
| | | |
| | | if (!hold) |
| | | this.message_timer = setTimeout(this.ref+'.hide_message()', this.message_time); |
| | |
| | | this.hide_message = function() |
| | | { |
| | | if (this.gui_objects.message) |
| | | { |
| | | this.gui_objects.message.style.display = 'none'; |
| | | this.gui_objects.message.onmousedown = null; |
| | | } |
| | | }; |
| | | |
| | | |
| | |
| | | var item, reg, text_obj; |
| | | var s_mbox = String(mbox).toLowerCase().replace(this.mbox_expression, ''); |
| | | var s_current = this.env.mailbox.toLowerCase().replace(this.mbox_expression, ''); |
| | | for (var n=0; n<this.gui_objects.mailboxlist.childNodes.length; n++) |
| | | var nodes = this.gui_objects.mailboxlist.getElementsByTagName('LI'); |
| | | |
| | | for (var n=0; n<nodes.length; n++) |
| | | { |
| | | item = this.gui_objects.mailboxlist.childNodes[n]; |
| | | item = nodes[n]; |
| | | if (item.className && item.className.indexOf('mailbox '+s_mbox+' ')>=0) |
| | | this.set_classname(item, 'selected', true); |
| | | else if (item.className && item.className.indexOf('mailbox '+s_current)>=0) |