| | |
| | | searchmenu: { editable:1, callback:searchmenu }, |
| | | attachmentmenu: { }, |
| | | listoptions: { editable:1 }, |
| | | dragmessagemenu: { sticky:1 }, |
| | | dragmenu: { sticky:1 }, |
| | | groupmenu: { above:1 }, |
| | | mailboxmenu: { above:1 }, |
| | | spellmenu: { callback: spellmenu }, |
| | |
| | | this.init_tabs = init_tabs; |
| | | this.show_about = show_about; |
| | | this.show_popup = show_popup; |
| | | this.add_popup = add_popup; |
| | | this.set_searchmod = set_searchmod; |
| | | this.show_uploadform = show_uploadform; |
| | | this.show_header_row = show_header_row; |
| | | this.hide_header_row = hide_header_row; |
| | | this.update_quota = update_quota; |
| | | |
| | | |
| | | // set minimal mode on small screens (don't wait for document.ready) |
| | |
| | | |
| | | var dragmenu = $('#dragmessagemenu'); |
| | | if (dragmenu.length) { |
| | | rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); |
| | | popups.dragmessagemenu = dragmenu; |
| | | rcmail.gui_object('dragmenu', 'dragmessagemenu'); |
| | | popups.dragmenu = dragmenu; |
| | | } |
| | | |
| | | if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { |
| | | rcmail.addEventListener('enable-command', enable_command); |
| | | rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); }); |
| | | rcmail.addEventListener('afterhide-headers', function() { layout_messageview(); }); |
| | | $('#previewheaderstoggle').click(function(e){ toggle_preview_headers(this); return false }); |
| | | $('#previewheaderstoggle').click(function(e){ toggle_preview_headers(); return false }); |
| | | |
| | | // add menu link for each attachment |
| | | $('#attachment-list > li').each(function() { |
| | |
| | | layout_composeview(); |
| | | |
| | | // Show input elements with non-empty value |
| | | var field, fields = ['cc', 'bcc', 'replyto', 'followupto']; |
| | | for (var f=0; f < fields.length; f++) { |
| | | if ((field = $('#_'+fields[f])) && field.length && field.val() != '') |
| | | show_header_row(fields[f], true); |
| | | var f, v, field, fields = ['cc', 'bcc', 'replyto', 'followupto']; |
| | | for (f=0; f < fields.length; f++) { |
| | | v = fields[f]; field = $('#_'+v); |
| | | if (field.length) { |
| | | field.on('change', {v: v}, function(e) { if (this.value) show_header_row(e.data.v, true); }); |
| | | if (field.val() != '') |
| | | show_header_row(v, true); |
| | | } |
| | | } |
| | | |
| | | $('#composeoptionstoggle').click(function(){ |
| | |
| | | new rcube_scroller('#folderlist-content', '#folderlist-header', '#folderlist-footer'); |
| | | |
| | | rcmail.addEventListener('setquota', update_quota); |
| | | rcmail.addEventListener('enable-command', enable_command); |
| | | rcmail.addEventListener('afterimport-messages', show_uploadform); |
| | | } |
| | | else if (rcmail.env.action == 'get') { |
| | | new rcube_splitter({ id:'mailpartsplitterv', p1:'#messagepartheader', p2:'#messagepartcontainer', |
| | | orientation:'v', relative:true, start:226, min:150, size:12}).init(); |
| | | } |
| | | |
| | | if ($('#mailview-left').length) { |
| | |
| | | /*** addressbook task ***/ |
| | | else if (rcmail.env.task == 'addressbook') { |
| | | rcmail.addEventListener('afterupload-photo', show_uploadform); |
| | | rcmail.addEventListener('beforepushgroup', push_contactgroup); |
| | | rcmail.addEventListener('beforepopgroup', pop_contactgroup); |
| | | |
| | | if (rcmail.env.action == '') { |
| | | new rcube_splitter({ id:'addressviewsplitterd', p1:'#addressview-left', p2:'#addressview-right', |
| | |
| | | |
| | | new rcube_scroller('#directorylist-content', '#directorylist-header', '#directorylist-footer'); |
| | | } |
| | | } |
| | | |
| | | // set min-width to show all toolbar buttons |
| | | var screen = $('.minwidth'); |
| | | if (screen.length) { |
| | | screen.css('min-width', $('.toolbar').width() + $('#quicksearchbar').parent().width() + 20); |
| | | var dragmenu = $('#dragcontactmenu'); |
| | | if (dragmenu.length) { |
| | | rcmail.gui_object('dragmenu', 'dragcontactmenu'); |
| | | popups.dragmenu = dragmenu; |
| | | } |
| | | } |
| | | |
| | | // turn a group of fieldsets into tabs |
| | |
| | | } |
| | | |
| | | var select = $(this), |
| | | parent = select.parent(), |
| | | height = Math.max(select.height(), 26) - 2, |
| | | width = select.width() - 22, |
| | | title = $('option', this).first().text(); |
| | |
| | | |
| | | overlay.children().width(width).height(height).css('line-height', (height - 1) + 'px'); |
| | | |
| | | select.change(function() { |
| | | var val = $('option:selected', this).text(); |
| | | $(this).next().children().html(val); |
| | | }); |
| | | |
| | | var parent = select.parent(); |
| | | if (parent.css('position') != 'absolute') |
| | | parent.css('position', 'relative'); |
| | | |
| | | // re-set original select width to fix click action and options width in some browsers |
| | | select.width(overlay.width()); |
| | | select.width(overlay.width()) |
| | | .change(function() { |
| | | var val = $('option:selected', this).text(); |
| | | $(this).next().children().text(val); |
| | | }); |
| | | }); |
| | | |
| | | // set min-width to show all toolbar buttons |
| | | var screen = $('body > div.minwidth'); |
| | | if (screen.length) { |
| | | screen.css('min-width', $('.toolbar').width() + $('#quicksearchbar').width() + $('#searchfilter').width() + 30); |
| | | } |
| | | |
| | | $(document.body) |
| | | .bind('mouseup', body_mouseup) |
| | |
| | | |
| | | $('iframe').load(function(e){ |
| | | // this = iframe |
| | | var doc = this.contentDocument ? this.contentDocument : this.contentWindow ? this.contentWindow.document : null; |
| | | $(doc).mouseup(body_mouseup); |
| | | try { |
| | | var doc = this.contentDocument ? this.contentDocument : this.contentWindow ? this.contentWindow.document : null; |
| | | $(doc).mouseup(body_mouseup); |
| | | } |
| | | catch (e) { |
| | | // catch possible "Permission denied" error in IE |
| | | }; |
| | | }) |
| | | .contents().mouseup(body_mouseup); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | function enable_command(p) |
| | | { |
| | | if (p.command == 'reply-list') { |
| | | var label = rcmail.gettext(p.status ? 'replylist' : 'replyall'); |
| | | if (rcmail.env.action == 'preview') |
| | | $('a.button.replyall').attr('title', label); |
| | | else |
| | | $('a.button.reply-all').text(label).attr('title', label); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register a popup menu |
| | | */ |
| | | function add_popup(popup, config) |
| | | { |
| | | var obj = popups[popup] = $('#'+popup); |
| | | obj.appendTo(document.body); // move it to top for proper absolute positioning |
| | | |
| | | if (obj.length) |
| | | popupconfig[popup] = $.extend(popupconfig[popup] || {}, config || {}); |
| | | } |
| | | |
| | | /** |
| | | * Trigger for popup menus |
| | | */ |
| | |
| | | { |
| | | // auto-register menu object |
| | | if (config || !popupconfig[popup]) |
| | | popupconfig[popup] = $.extend(popupconfig[popup] || {}, config); |
| | | add_popup(popup, config); |
| | | |
| | | var visible = show_popupmenu(popup, show), |
| | | config = popupconfig[popup]; |
| | |
| | | /** |
| | | * Switch between short and full headers display in message preview |
| | | */ |
| | | function toggle_preview_headers(button) |
| | | function toggle_preview_headers() |
| | | { |
| | | $('#preview-shortheaders').toggle(); |
| | | var full = $('#preview-allheaders').toggle(), |
| | |
| | | $('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop('checked', true); |
| | | $('input[name="sort_ord"][value="DESC"]').prop('checked', rcmail.env.sort_order == 'DESC'); |
| | | $('input[name="sort_ord"][value="ASC"]').prop('checked', rcmail.env.sort_order != 'DESC'); |
| | | $('input[name="view"][value="thread"]').prop('checked', rcmail.env.threading ? true : false); |
| | | $('input[name="view"][value="list"]').prop('checked', rcmail.env.threading ? false : true); |
| | | |
| | | // set checkboxes |
| | | $('input[name="list_col[]"]').each(function() { |
| | |
| | | close: function() { |
| | | $dialog.dialog('destroy').hide(); |
| | | }, |
| | | width: 650 |
| | | minWidth: 500, |
| | | width: $dialog.width()+25 |
| | | }).show(); |
| | | } |
| | | |
| | |
| | | |
| | | var sort = $('input[name="sort_col"]:checked').val(), |
| | | ord = $('input[name="sort_ord"]:checked').val(), |
| | | thread = $('input[name="view"]:checked').val(), |
| | | cols = $('input[name="list_col[]"]:checked') |
| | | .map(function(){ return this.value; }).get(); |
| | | |
| | | rcmail.set_list_options(cols, sort, ord, thread == 'thread' ? 1 : 0); |
| | | rcmail.set_list_options(cols, sort, ord, rcmail.env.threading); |
| | | } |
| | | |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | function push_contactgroup(p) |
| | | { |
| | | // lets the contacts list swipe to the left, nice! |
| | | var table = $('#contacts-table'), |
| | | scroller = table.parent().css('overflow', 'hidden'); |
| | | |
| | | table.clone() |
| | | .css({ position:'absolute', top:'0', left:'0', width:table.width()+'px', 'z-index':10 }) |
| | | .appendTo(scroller) |
| | | .animate({ left: -(table.width()+5) + 'px' }, 300, 'swing', function(){ |
| | | $(this).remove(); |
| | | scroller.css('overflow', 'auto') |
| | | }); |
| | | } |
| | | |
| | | function pop_contactgroup(p) |
| | | { |
| | | // lets the contacts list swipe to the left, nice! |
| | | var table = $('#contacts-table'), |
| | | scroller = table.parent().css('overflow', 'hidden'), |
| | | clone = table.clone().appendTo(scroller); |
| | | |
| | | table.css({ position:'absolute', top:'0', left:-(table.width()+5) + 'px', width:table.width()+'px', height:table.height()+'px', 'z-index':10 }) |
| | | .animate({ left:'0' }, 300, 'linear', function(){ |
| | | clone.remove(); |
| | | $(this).css({ position:'relative', left:'0', width:'100%', height:'auto', 'z-index':1 }); |
| | | scroller.css('overflow', 'auto') |
| | | }); |
| | | } |
| | | |
| | | function show_uploadform() |
| | | { |
| | |
| | | $dialog.dialog('close'); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // add icons to clone file input field |
| | | if (rcmail.env.action == 'compose' && !$dialog.data('extended')) { |
| | | $('<a>') |