| | |
| | | parent.rcmail.env.frame_lock = null; |
| | | } |
| | | |
| | | // Makes that reference to document.activeElement do not throw |
| | | // "unspecified error" in IE9 (#1489008) |
| | | if (this.env.framed && bw.ie) |
| | | document.documentElement.focus(); |
| | | |
| | | // enable general commands |
| | | this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref', 'compose', 'undo', 'about', 'switch-task', true); |
| | | |
| | |
| | | } |
| | | |
| | | // detect browser capabilities |
| | | if (!this.is_framed()) |
| | | if (!this.is_framed() && !this.env.extwin) |
| | | this.browser_capabilities_check(); |
| | | |
| | | break; |
| | |
| | | } |
| | | else if (this.env.action == 'edit-folder' && this.gui_objects.editform) { |
| | | this.enable_command('save', 'folder-size', true); |
| | | parent.rcmail.env.messagecount = this.env.messagecount; |
| | | parent.rcmail.env.exists = this.env.messagecount; |
| | | parent.rcmail.enable_command('purge', this.env.messagecount); |
| | | $("input[type='text']").first().select(); |
| | | } |
| | |
| | | var prevstate = this.env.compose_extwin; |
| | | $("input[name='_action']", this.gui_objects.messageform).val('compose'); |
| | | this.gui_objects.messageform.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 }); |
| | | this.gui_objects.messageform.target = this.open_window('', 1100, 900); |
| | | this.gui_objects.messageform.target = this.open_window('', 1100); |
| | | this.gui_objects.messageform.submit(); |
| | | } |
| | | else { |
| | | this.open_window(this.env.permaurl, 900, 900); |
| | | this.open_window(this.env.permaurl, 900); |
| | | } |
| | | break; |
| | | |
| | |
| | | |
| | | // start timer for message preview (wait for double click) |
| | | if (selected && this.env.contentframe && !list.multi_selecting && !this.dummy_select) |
| | | this.preview_timer = setTimeout(function(){ ref.msglist_get_preview(); }, 200); |
| | | this.preview_timer = setTimeout(function() { ref.msglist_get_preview(); }, this.dblclick_time); |
| | | else if (this.env.contentframe) |
| | | this.show_contentframe(false); |
| | | }; |
| | |
| | | |
| | | var win = this.get_frame_window(this.env.contentframe); |
| | | |
| | | if (win && win.location.href.indexOf(this.env.blankpage)>=0) { |
| | | if (win && win.location.href.indexOf(this.env.blankpage) >= 0) { |
| | | if (this.preview_timer) |
| | | clearTimeout(this.preview_timer); |
| | | if (this.preview_read_timer) |
| | | clearTimeout(this.preview_read_timer); |
| | | this.preview_timer = setTimeout(function(){ ref.msglist_get_preview(); }, 200); |
| | | |
| | | this.preview_timer = setTimeout(function() { ref.msglist_get_preview(); }, this.dblclick_time); |
| | | } |
| | | }; |
| | | |
| | |
| | | { |
| | | if (this.preview_timer) |
| | | clearTimeout(this.preview_timer); |
| | | |
| | | if (this.preview_read_timer) |
| | | clearTimeout(this.preview_read_timer); |
| | | |
| | | var uid = list.get_single_selection(); |
| | | |
| | | if (uid && this.env.mailbox == this.env.drafts_mailbox) |
| | | this.open_compose_step({ _draft_uid: uid, _mbox: this.env.mailbox }); |
| | | else if (uid) |
| | |
| | | return 0; |
| | | }; |
| | | |
| | | this.open_window = function(url, width, height) |
| | | this.open_window = function(url, width) |
| | | { |
| | | var w = Math.min(width, screen.width - 10), |
| | | h = Math.min(height, screen.height - 100), |
| | | l = (screen.width - w) / 2 + (screen.left || 0), |
| | | t = Math.max(0, (screen.height - h) / 2 + (screen.top || 0) - 20), |
| | | var win = this.is_framed() ? parent.window : window, |
| | | page = $(win), |
| | | page_width = page.width(), |
| | | page_height = bw.mz ? $('body', win).height() : page.height(), |
| | | w = Math.min(width, page_width), |
| | | h = page_height, // always use same height |
| | | l = (win.screenLeft || win.screenX) + 20, |
| | | t = (win.screenTop || win.screenY) + 20, |
| | | wname = 'rcmextwin' + new Date().getTime(), |
| | | extwin = window.open(url + '&_extwin=1', wname, |
| | | extwin = window.open(url + (url.match(/\?/) ? '&' : '?') + '_extwin=1', wname, |
| | | 'width='+w+',height='+h+',top='+t+',left='+l+',resizable=yes,toolbar=no,status=no,location=no'); |
| | | |
| | | // write loading... message to empty windows |
| | |
| | | |
| | | // focus window, delayed to bring to front |
| | | window.setTimeout(function() { extwin.focus(); }, 10); |
| | | // position window with setTimeout for Chrome (#1488931) |
| | | window.setTimeout(function() { extwin.moveTo(l,t); }, bw.chrome ? 100 : 10); |
| | | |
| | | return wname; |
| | | }; |
| | |
| | | if (!row.depth && row.has_children && (expando = document.getElementById('rcmexpando'+row.uid))) { |
| | | row.expando = expando; |
| | | expando.onmousedown = function(e) { return self.expand_message_row(e, uid); }; |
| | | if (bw.touch) { |
| | | expando.addEventListener('touchend', function(e) { |
| | | if (e.changedTouches.length == 1) { |
| | | self.expand_message_row(e, uid); |
| | | return rcube_event.cancel(e); |
| | | } |
| | | }, false); |
| | | } |
| | | } |
| | | |
| | | this.triggerEvent('insertrow', { uid:uid, row:row }); |
| | |
| | | + (!flags.seen ? ' unread' : '') |
| | | + (flags.deleted ? ' deleted' : '') |
| | | + (flags.flagged ? ' flagged' : '') |
| | | + (flags.unread_children && flags.seen && !this.env.autoexpand_threads ? ' unroot' : '') |
| | | + (message.selected ? ' selected' : ''), |
| | | // for performance use DOM instead of jQuery here |
| | | row = document.createElement('tr'); |
| | |
| | | expando = '<div id="rcmexpando' + uid + '" class="' + (message.expanded ? 'expanded' : 'collapsed') + '"> </div>'; |
| | | row_class += ' thread' + (message.expanded? ' expanded' : ''); |
| | | } |
| | | |
| | | if (flags.unread_children && flags.seen && !message.expanded) |
| | | row_class += ' unroot'; |
| | | } |
| | | |
| | | tree += '<span id="msgicn'+uid+'" class="'+css_class+'"> </span>'; |
| | |
| | | html = expando; |
| | | else if (c == 'subject') { |
| | | if (bw.ie) { |
| | | col.onmouseover = function() { rcube_webmail.long_subject_title_ie(this, message.depth+1); }; |
| | | col.onmouseover = function() { rcube_webmail.long_subject_title_ex(this, message.depth+1); }; |
| | | if (bw.ie8) |
| | | tree = '<span></span>' + tree; // #1487821 |
| | | } |
| | |
| | | else |
| | | html = cols[c]; |
| | | |
| | | col.innerHTML = html; |
| | | if (html) |
| | | col.innerHTML = html; |
| | | |
| | | row.appendChild(col); |
| | | } |
| | |
| | | } |
| | | else { |
| | | if (!preview && this.env.message_extwin && !this.env.extwin) |
| | | this.open_window(this.env.comm_path+url, 1000, 1200); |
| | | this.open_window(this.env.comm_path+url, 1000); |
| | | else |
| | | this.location_href(this.env.comm_path+url, target, true); |
| | | |
| | |
| | | |
| | | // open new compose window |
| | | if (this.env.compose_extwin && !this.env.extwin) { |
| | | this.open_window(url, 1150, 900); |
| | | this.open_window(url, 1150); |
| | | } |
| | | else { |
| | | this.redirect(url); |
| | | window.resizeTo(Math.max(1150, $(window).width()), Math.max(900, $(window).height())); |
| | | if (this.env.extwin) |
| | | window.resizeTo(Math.max(1150, $(window).width()), $(window).height()+24); |
| | | } |
| | | }; |
| | | |
| | |
| | | this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); |
| | | // add signature according to selected identity |
| | | // if we have HTML editor, signature is added in callback |
| | | if (input_from.prop('type') == 'select-one' && !this.env.opened_extwin) { |
| | | if (input_from.prop('type') == 'select-one') { |
| | | this.change_identity(input_from[0]); |
| | | } |
| | | } |
| | |
| | | |
| | | this.compose_add_recipient = function(field) |
| | | { |
| | | var recipients = [], input = $('#_'+field); |
| | | var recipients = [], input = $('#_'+field), delim = this.env.recipients_delimiter; |
| | | |
| | | if (this.contact_list && this.contact_list.selection.length) { |
| | | for (var id, n=0; n < this.contact_list.selection.length; n++) { |
| | |
| | | } |
| | | |
| | | if (recipients.length && input.length) { |
| | | var oldval = input.val(); |
| | | input.val((oldval ? oldval + this.env.recipients_delimiter : '') + recipients.join(this.env.recipients_delimiter)); |
| | | var oldval = input.val(), rx = new RegExp(RegExp.escape(delim) + '\\s*$'); |
| | | if (oldval && !rx.test(oldval)) |
| | | oldval += delim + ' '; |
| | | input.val(oldval + recipients.join(delim + ' ') + delim + ' '); |
| | | this.triggerEvent('add-recipient', { field:field, recipients:recipients }); |
| | | } |
| | | }; |
| | |
| | | if (!show_sig) |
| | | show_sig = this.env.show_sig; |
| | | |
| | | // first function execution |
| | | if (!this.env.identities_initialized) { |
| | | this.env.identities_initialized = true; |
| | | if (this.env.show_sig_later) |
| | | this.env.show_sig = true; |
| | | if (this.env.opened_extwin) |
| | | return; |
| | | } |
| | | |
| | | var cursor_pos, p = -1, |
| | | id = obj.options[obj.selectedIndex].value, |
| | | input_message = $("[name='_message']"), |
| | |
| | | sig = this.env.signatures[sig].text; |
| | | sig = sig.replace(/\r\n/g, '\n'); |
| | | |
| | | p = this.env.sig_above ? message.indexOf(sig) : message.lastIndexOf(sig); |
| | | p = this.env.top_posting ? message.indexOf(sig) : message.lastIndexOf(sig); |
| | | if (p >= 0) |
| | | message = message.substring(0, p) + message.substring(p+sig.length, message.length); |
| | | } |
| | |
| | | sig = this.env.signatures[id].text; |
| | | sig = sig.replace(/\r\n/g, '\n'); |
| | | |
| | | if (this.env.sig_above) { |
| | | if (this.env.top_posting) { |
| | | if (p >= 0) { // in place of removed signature |
| | | message = message.substring(0, p) + sig + message.substring(p, message.length); |
| | | cursor_pos = p - 1; |
| | |
| | | sigElem = doc.createElement('div'); |
| | | sigElem.setAttribute('id', '_rc_sig'); |
| | | |
| | | if (this.env.sig_above) { |
| | | if (this.env.top_posting) { |
| | | // if no existing sig and top posting then insert at caret pos |
| | | editor.getWin().focus(); // correct focus in IE & Chrome |
| | | |
| | |
| | | att.html = '<a title="'+this.get_label('cancel')+'" onclick="return rcmail.cancel_attachment_upload(\''+name+'\', \''+att.frame+'\');" href="#cancelupload" class="cancelupload">' |
| | | + (this.env.cancelicon ? '<img src="'+this.env.cancelicon+'" alt="" />' : this.get_label('cancel')) + '</a>' + att.html; |
| | | |
| | | var indicator, li = $('<li>').attr('id', name).addClass(att.classname).html(att.html); |
| | | var indicator, li = $('<li>'); |
| | | |
| | | li.attr('id', name) |
| | | .addClass(att.classname) |
| | | .html(att.html) |
| | | .on('mouseover', function() { rcube_webmail.long_subject_title_ex(this, 0); }); |
| | | |
| | | // replace indicator's li |
| | | if (upload_id && (indicator = document.getElementById(upload_id))) { |
| | |
| | | var n, id, sid, ref = this, writable = false, |
| | | source = this.env.source ? this.env.address_sources[this.env.source] : null; |
| | | |
| | | // we don't have dblclick handler here, so use 200 instead of this.dblclick_time |
| | | if (id = list.get_single_selection()) |
| | | this.preview_timer = setTimeout(function(){ ref.load_contact(id, 'show'); }, 200); |
| | | else if (this.env.contentframe) |
| | |
| | | for (c in cols) { |
| | | col = document.createElement('td'); |
| | | col.className = String(c).toLowerCase(); |
| | | col.innerHTML = cols[c]; |
| | | if (cols[c]) |
| | | col.innerHTML = cols[c]; |
| | | row.appendChild(col); |
| | | } |
| | | |
| | |
| | | |
| | | for (c=0, len=repl.length; c < len; c++) { |
| | | cell = document.createElement('td'); |
| | | cell.innerHTML = repl[c].html; |
| | | cell.innerHTML = repl[c].html || ''; |
| | | if (repl[c].id) cell.id = repl[c].id; |
| | | if (repl[c].className) cell.className = repl[c].className; |
| | | tr.appendChild(cell); |
| | | } |
| | | th.appendChild(tr); |
| | | thead.parentNode.replaceChild(th, thead); |
| | | thead = th; |
| | | list.thead = thead = th; |
| | | } |
| | | |
| | | for (n=0, len=this.env.coltypes.length; n<len; n++) { |
| | |
| | | // post the given form to a hidden iframe |
| | | this.async_upload_form = function(form, action, onload) |
| | | { |
| | | var ts = new Date().getTime(), |
| | | var frame, ts = new Date().getTime(), |
| | | frame_name = 'rcmupload'+ts; |
| | | |
| | | // upload progress support |
| | |
| | | // have to do it this way for IE |
| | | // otherwise the form will be posted to a new window |
| | | if (document.all) { |
| | | var html = '<iframe name="'+frame_name+'" src="program/resources/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'; |
| | | document.body.insertAdjacentHTML('BeforeEnd', html); |
| | | document.body.insertAdjacentHTML('BeforeEnd', '<iframe name="'+frame_name+'"' |
| | | + ' src="program/resources/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'); |
| | | frame = $('iframe[name="'+frame_name+'"]'); |
| | | } |
| | | else { // for standards-compilant browsers |
| | | var frame = document.createElement('iframe'); |
| | | frame.name = frame_name; |
| | | frame.style.border = 'none'; |
| | | frame.style.width = 0; |
| | | frame.style.height = 0; |
| | | frame.style.visibility = 'hidden'; |
| | | document.body.appendChild(frame); |
| | | // for standards-compliant browsers |
| | | else { |
| | | frame = $('<iframe>').attr('name', frame_name) |
| | | .css({border: 'none', width: 0, height: 0, visibility: 'hidden'}) |
| | | .appendTo(document.body); |
| | | } |
| | | |
| | | // handle upload errors, parsing iframe content in onload |
| | | $(frame_name).bind('load', {ts:ts}, onload); |
| | | frame.bind('load', {ts:ts}, onload); |
| | | |
| | | $(form).attr({ |
| | | target: frame_name, |
| | |
| | | url: ref.url(ref.env.filedrop.action||'upload', { _id:ref.env.compose_id||ref.env.cid||'', _uploadid:ts, _remote:1 }), |
| | | contentType: formdata ? false : 'multipart/form-data; boundary=' + boundary, |
| | | processData: false, |
| | | timeout: 0, // disable default timeout set in ajaxSetup() |
| | | data: formdata || multipart, |
| | | headers: {'X-Roundcube-Request': ref.env.request_token}, |
| | | beforeSend: function(xhr, s) { if (!formdata && xhr.sendAsBinary) xhr.send = xhr.sendAsBinary; }, |
| | | xhr: function() { var xhr = jQuery.ajaxSettings.xhr(); if (!formdata && xhr.sendAsBinary) xhr.send = xhr.sendAsBinary; return xhr; }, |
| | | success: function(data){ ref.http_response(data); }, |
| | | error: function(o, status, err) { ref.http_error(o, status, err, null, 'attachment'); } |
| | | }); |
| | |
| | | multipart += '; filename="' + (f.name_bin || file.name) + '"' + crlf; |
| | | multipart += 'Content-Length: ' + file.size + crlf; |
| | | multipart += 'Content-Type: ' + file.type + crlf + crlf; |
| | | multipart += e.target.result + crlf; |
| | | multipart += reader.result + crlf; |
| | | multipart += dashdash + boundary + crlf; |
| | | |
| | | if (j == last) // we're done, submit the data |
| | |
| | | if (!elem.title) { |
| | | var $elem = $(elem); |
| | | if ($elem.width() + indent * 15 > $elem.parent().width()) |
| | | elem.title = $elem.html(); |
| | | elem.title = $elem.text(); |
| | | } |
| | | }; |
| | | |
| | | rcube_webmail.long_subject_title_ie = function(elem, indent) |
| | | rcube_webmail.long_subject_title_ex = function(elem, indent) |
| | | { |
| | | if (!elem.title) { |
| | | var $elem = $(elem), |