| | |
| | | this.enable_command('firstmessage', true); |
| | | } |
| | | } |
| | | |
| | | if (this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox) |
| | | this.set_alttext('delete', 'movemessagetotrash'); |
| | | |
| | | // make preview/message frame visible |
| | | if (this.env.action == 'preview' && this.env.framed && parent.rcmail) |
| | |
| | | if (this.env.iid) |
| | | this.identity_list.highlight_row(this.env.iid); |
| | | } |
| | | |
| | | if (this.gui_objects.subscriptionlist) |
| | | this.init_subscription_list(); |
| | | |
| | | break; |
| | | |
| | |
| | | this.reset_qsearch(); |
| | | |
| | | this.list_mailbox(props); |
| | | |
| | | if (this.env.trash_mailbox) |
| | | this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage'); |
| | | } |
| | | else if (this.task=='addressbook') |
| | | { |
| | |
| | | this.set_busy(true, 'savingmessage'); |
| | | var form = this.gui_objects.messageform; |
| | | form.target = "savetarget"; |
| | | form._draft.value = '1'; |
| | | form.submit(); |
| | | break; |
| | | |
| | |
| | | if (this.env.mailbox == this.env.drafts_mailbox) |
| | | { |
| | | this.enable_command('reply', 'reply-all', 'forward', false); |
| | | this.enable_command('show', 'delete', 'moveto', selected); |
| | | this.enable_command('show', selected); |
| | | this.enable_command('delete', 'moveto', (list.selection.length > 0 ? true : false)); |
| | | } |
| | | else |
| | | { |
| | | this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'delete', 'moveto', selected); |
| | | this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected); |
| | | this.enable_command('delete', 'moveto', (list.selection.length > 0 ? true : false)); |
| | | } |
| | | |
| | | // start timer for message preview (wait for double click) |
| | |
| | | return (id != this.env.mailbox); |
| | | else if (this.task == 'addressbook') |
| | | return (id != this.env.source && this.env.address_sources[id] && !this.env.address_sources[id].readonly); |
| | | else if (this.task == 'settings') |
| | | return (id != this.env.folder); |
| | | }; |
| | | |
| | | |
| | |
| | | { |
| | | id = selection[n]; |
| | | a_uids[a_uids.length] = id; |
| | | this.message_list.remove_row(id); |
| | | this.message_list.remove_row(id, (n == selection.length-1)); |
| | | } |
| | | |
| | | this.message_list.select_next(); |
| | | } |
| | | |
| | | // also send search request to get the right messages |
| | |
| | | } |
| | | |
| | | // check for empty body |
| | | if ((input_message.value == '' || (window.tinyMCE && tinyMCE.getContent() == '')) && !confirm(this.get_label('nobodywarning'))) |
| | | if ((input_message.value == '' && (!window.tinyMCE || tinyMCE.getContent() == '')) && !confirm(this.get_label('nobodywarning'))) |
| | | { |
| | | input_message.focus(); |
| | | return false; |
| | |
| | | { |
| | | page = 1; |
| | | this.env.current_page = page; |
| | | this.reset_qsearch(); |
| | | } |
| | | |
| | | this.select_folder(src, this.env.source); |
| | |
| | | { |
| | | id = selection[n]; |
| | | a_cids[a_cids.length] = id; |
| | | this.contact_list.remove_row(id); |
| | | this.contact_list.remove_row(id, (n == selection.length-1)); |
| | | } |
| | | |
| | | // hide content frame if we delete the currently displayed contact |
| | |
| | | /*********************************************************/ |
| | | /********* user settings methods *********/ |
| | | /*********************************************************/ |
| | | |
| | | this.init_subscription_list = function() |
| | | { |
| | | var p = this; |
| | | this.subscription_list = new rcube_list_widget(this.gui_objects.subscriptionlist, {multiselect:false, draggable:true, keyboard:false}); |
| | | this.subscription_list.addEventListener('select', function(o){ p.subscription_select(o); }); |
| | | this.subscription_list.addEventListener('dragstart', function(o){ p.drag_active = true; }); |
| | | this.subscription_list.addEventListener('dragend', function(o){ p.subscription_move_folder(o); }); |
| | | this.subscription_list.init(); |
| | | } |
| | | |
| | | this.identity_select = function(list) |
| | | { |
| | |
| | | }; |
| | | |
| | | |
| | | this.focus_subscription = function(id) |
| | | { |
| | | var row; |
| | | var reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | if (this.drag_active && this.check_droptarget(id) && |
| | | (id != this.env.folder.replace(reg, '')) && |
| | | (!id.match(new RegExp('^'+RegExp.escape(this.env.folder+this.env.delimiter)))) && |
| | | (row = document.getElementById(this.get_folder_row_id(id)))) |
| | | if (find_in_array(this.env.defaultfolders, id)>=0) |
| | | { |
| | | if (this.env.folder.replace(reg, '')!='') |
| | | { |
| | | this.set_env('dstfolder', this.env.delimiter); |
| | | this.set_classname(this.subscription_list.frame, 'droptarget', true); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | this.set_env('dstfolder', id); |
| | | this.set_classname(row, 'droptarget', true); |
| | | } |
| | | } |
| | | |
| | | |
| | | this.unfocus_subscription = function(id) |
| | | { |
| | | var row; |
| | | if (row = document.getElementById(this.get_folder_row_id(id))) |
| | | { |
| | | this.set_env('dstfolder', null); |
| | | if (find_in_array(this.env.defaultfolders, id)>=0) |
| | | this.set_classname(this.subscription_list.frame, 'droptarget', false); |
| | | else |
| | | this.set_classname(row, 'droptarget', false); |
| | | } |
| | | } |
| | | |
| | | |
| | | this.subscription_select = function(list) |
| | | { |
| | | var id; |
| | | if (id = list.get_single_selection()) |
| | | { |
| | | var folder = this.env.subscriptionrows['rcmrow'+id][0]; |
| | | if (find_in_array(this.env.defaultfolders, folder)!=0) |
| | | this.set_env('folder', folder); |
| | | } |
| | | }; |
| | | |
| | | |
| | | this.subscription_move_folder = function(list) |
| | | { |
| | | var reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | if (this.env.folder && this.env.dstfolder && (this.env.dstfolder != this.env.folder) && |
| | | (this.env.dstfolder != this.env.folder.replace(reg, ''))) |
| | | { |
| | | var reg = new RegExp('[^'+RegExp.escape(this.env.delimiter)+']*['+RegExp.escape(this.env.delimiter)+']', 'g'); |
| | | var basename = this.env.folder.replace(reg, ''); |
| | | var newname = this.env.dstfolder==this.env.delimiter ? basename : this.env.dstfolder+this.env.delimiter+basename; |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.folder)+'&_folder_newname='+urlencode(newname)); |
| | | } |
| | | this.drag_active = false; |
| | | this.unfocus_subscription(this.env.dstfolder); |
| | | }; |
| | | |
| | | |
| | | // tell server to create and subscribe a new mailbox |
| | | this.create_folder = function(name) |
| | | { |
| | |
| | | var form; |
| | | if ((form = this.gui_objects.editform) && form.elements['_folder_name']) |
| | | name = form.elements['_folder_name'].value; |
| | | if (this.env.folder) |
| | | name = this.env.folder+this.env.delimiter+name; |
| | | |
| | | if (name) |
| | | this.http_post('create-folder', '_name='+urlencode(name), true); |
| | |
| | | } |
| | | |
| | | if (oldname && newname) |
| | | { |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(oldname)+'&_folder_newname='+urlencode(newname)); |
| | | for (var row in this.env.subscriptionrows) |
| | | if (this.env.subscriptionrows[row][0].match(new RegExp('^'+RegExp.escape(oldname+this.env.delimiter)))) |
| | | { |
| | | var subnewname = this.env.subscriptionrows[row][0].replace(new RegExp('^'+RegExp.escape(oldname+this.env.delimiter)), newname+this.env.delimiter); |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[row][0])+ |
| | | '&_folder_newname='+urlencode(subnewname)); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | |
| | | |
| | | if (id && (row = document.getElementById(id))) |
| | | { |
| | | var reg = new RegExp('.*['+RegExp.escape(this.env.delimiter)+']'); |
| | | this.name_input = document.createElement('INPUT'); |
| | | this.name_input.value = this.env.subscriptionrows[id][1]; |
| | | this.name_input.value = folder.replace(reg, ''); |
| | | this.name_input.style.width = '100%'; |
| | | reg = new RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | this.name_input.setAttribute('parent', folder.replace(reg, '')); |
| | | this.name_input.onkeypress = function(e){ rcmail.name_input_keypress(e); }; |
| | | |
| | | row.cells[0].replaceChild(this.name_input, row.cells[0].firstChild); |
| | |
| | | { |
| | | var cell = this.name_input ? this.name_input.parentNode : null; |
| | | if (cell && this.edit_folder && this.env.subscriptionrows[this.edit_folder]) |
| | | cell.innerHTML = this.env.subscriptionrows[this.edit_folder][1]; |
| | | { |
| | | var reg = new RegExp('[^'+RegExp.escape(this.env.delimiter)+']*['+RegExp.escape(this.env.delimiter)+']', 'g'); |
| | | cell.innerHTML = this.env.subscriptionrows[this.edit_folder][1].replace(reg, ' '); |
| | | } |
| | | |
| | | this.edit_folder = null; |
| | | }; |
| | |
| | | { |
| | | var newname = this.name_input ? this.name_input.value : null; |
| | | if (this.edit_folder && newname) |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); |
| | | { |
| | | if (this.name_input.getAttribute('parent') && this.name_input.getAttribute('parent')!='') |
| | | newname = this.name_input.getAttribute('parent')+this.env.delimiter+newname; |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); |
| | | } |
| | | } |
| | | // escape |
| | | else if (key==27) |
| | |
| | | // delete a specific mailbox with all its messages |
| | | this.delete_folder = function(folder) |
| | | { |
| | | if (this.edit_folder) |
| | | this.reset_folder_rename(); |
| | | if (this.edit_folder) |
| | | this.reset_folder_rename(); |
| | | |
| | | if (folder) |
| | | { |
| | | this.http_post('delete-folder', '_mboxes='+urlencode(folder)); |
| | | for (var row in this.env.subscriptionrows) |
| | | if (this.env.subscriptionrows[row][0].match(new RegExp('^'+RegExp.escape(folder+this.env.delimiter)))) |
| | | this.http_post('delete-folder', '_mboxes='+urlencode(this.env.subscriptionrows[row][0])); |
| | | } |
| | | }; |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | this.sort_subscription_list(); |
| | | this.init_subscription_list(); |
| | | |
| | | if (document.getElementById('rcmrow'+id).scrollIntoView) |
| | | document.getElementById('rcmrow'+id).scrollIntoView(); |
| | | }; |
| | | |
| | | |
| | |
| | | var index = new Array(); |
| | | var tbody = this.gui_objects.subscriptionlist.tBodies[0]; |
| | | var swapped = false; |
| | | for (var i = 0; i<(tbody.childNodes.length-1); i++) |
| | | for (var i = 0; i<tbody.childNodes.length; i++) |
| | | if (this.env.subscriptionrows[tbody.childNodes[i].id]!=null) |
| | | index.push(i); |
| | | for (i = 0; i<(index.length-1); i++) |
| | | { |
| | | if (this.env.subscriptionrows[tbody.childNodes[index[i]].id][0]> |
| | | this.env.subscriptionrows[tbody.childNodes[index[i+1]].id][0]) |
| | | var one = tbody.childNodes[index[i]]; |
| | | var two = tbody.childNodes[index[i+1]]; |
| | | if (this.env.subscriptionrows[one.id][0].toLowerCase()> |
| | | this.env.subscriptionrows[two.id][0].toLowerCase()) |
| | | { |
| | | var swap = tbody.replaceChild(tbody.childNodes[index[i]], tbody.childNodes[index[i+1]]); |
| | | if (typeof(tbody.childNodes[index[i]]) != 'undefined') |
| | | tbody.insertBefore(swap, tbody.childNodes[index[i]]) |
| | | else |
| | | tbody.appendChild(swap); |
| | | var swap = one.cloneNode(true); |
| | | tbody.replaceChild(swap, two); |
| | | tbody.replaceChild(two, one); |
| | | swapped = true; |
| | | } |
| | | } |
| | |
| | | obj = document.getElementById(button.id); |
| | | |
| | | // get default/passive setting of the button |
| | | if (obj && button.type=='image' && !button.status) |
| | | if (obj && button.type=='image' && !button.status) { |
| | | button.pas = obj._original_src ? obj._original_src : obj.src; |
| | | // respect PNG fix on IE browsers |
| | | if (obj.runtimeStyle && obj.runtimeStyle.filter && obj.runtimeStyle.filter.match(/src=['"]([^'"]+)['"]/)) |
| | | button.pas = RegExp.$1; |
| | | } |
| | | else if (obj && !button.status) |
| | | button.pas = String(obj.className); |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | // display a specific alttext |
| | | this.set_alttext = function(command, label) |
| | | { |
| | | if (!this.buttons[command] || !this.buttons[command].length) |
| | | return; |
| | | |
| | | var button, obj, link; |
| | | for (var n=0; n<this.buttons[command].length; n++) |
| | | { |
| | | button = this.buttons[command][n]; |
| | | obj = document.getElementById(button.id); |
| | | |
| | | if (button.type=='image' && obj) |
| | | { |
| | | obj.setAttribute('alt', this.get_label(label)); |
| | | if ((link = obj.parentNode) && link.tagName == 'A') |
| | | link.setAttribute('title', this.get_label(label)); |
| | | } |
| | | else if (obj) |
| | | obj.setAttribute('title', this.get_label(label)); |
| | | } |
| | | }; |
| | | |
| | | // mouse over button |
| | | this.button_over = function(command, id) |
| | |
| | | }; |
| | | |
| | | |
| | | // display a specific alttext |
| | | this.alttext = function(text) |
| | | { |
| | | |
| | | }; |
| | | // write to the document/window title |
| | | this.set_pagetitle = function(title) |
| | | { |
| | | if (title && document.title) |
| | | document.title = title; |
| | | } |
| | | |
| | | |
| | | // display a system message |
| | |
| | | if (!this.gui_objects.mailboxlist) |
| | | return false; |
| | | |
| | | if (mbox==this.env.mailbox) |
| | | set_title = true; |
| | | |
| | | var reg, text_obj; |
| | | var item = this.get_folder_li(mbox); |
| | | mbox = String(mbox).toLowerCase().replace(this.identifier_expr, ''); |
| | |
| | | if (set_title && document.title) |
| | | { |
| | | var doc_title = String(document.title); |
| | | var new_title = ""; |
| | | |
| | | if (count && doc_title.match(reg)) |
| | | document.title = doc_title.replace(reg, '('+count+') '); |
| | | new_title = doc_title.replace(reg, '('+count+') '); |
| | | else if (count) |
| | | document.title = '('+count+') '+doc_title; |
| | | new_title = '('+count+') '+doc_title; |
| | | else |
| | | document.title = doc_title.replace(reg, ''); |
| | | new_title = doc_title.replace(reg, ''); |
| | | |
| | | this.set_pagetitle(new_title); |
| | | } |
| | | }; |
| | | |
| | |
| | | ctype = ctype_array[0]; |
| | | } |
| | | |
| | | this.set_busy(false); |
| | | if (request_obj.__lock) |
| | | this.set_busy(false); |
| | | |
| | | console.log(request_obj.get_text()); |
| | | |
| | |
| | | } |
| | | |
| | | this.set_busy(true, 'checkingmail'); |
| | | var d = new Date(); |
| | | this.http_request('check-recent', '_t='+d.getTime()); |
| | | this.http_request('check-recent', '_t='+(new Date().getTime()), true); |
| | | }; |
| | | |
| | | |
| | |
| | | |
| | | this.xmlhttp.onreadystatechange = function(){ _ref.xmlhttp_onreadystatechange(); }; |
| | | this.xmlhttp.open('GET', url); |
| | | this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('sessid')); |
| | | this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('roundcube_sessid')); |
| | | this.xmlhttp.send(null); |
| | | }; |
| | | |
| | |
| | | this.xmlhttp.onreadystatechange = function() { ref.xmlhttp_onreadystatechange(); }; |
| | | this.xmlhttp.open('POST', url, true); |
| | | this.xmlhttp.setRequestHeader('Content-Type', contentType); |
| | | this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('sessid')); |
| | | this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('roundcube_sessid')); |
| | | this.xmlhttp.send(req_body); |
| | | }; |
| | | |