| | |
| | | forwardmenu: {id:'forwardmenu', editable:1}, |
| | | searchmenu: {id:'searchmenu', editable:1}, |
| | | messagemenu: {id:'messagemenu'}, |
| | | attachmentmenu: {id:'attachmentmenu'}, |
| | | listmenu: {id:'listmenu', editable:1}, |
| | | dragmessagemenu:{id:'dragmessagemenu', sticky:1}, |
| | | groupmenu: {id:'groupoptionsmenu', above:1}, |
| | |
| | | { |
| | | var obj = this.popups[popup].obj, |
| | | above = this.popups[popup].above, |
| | | ref = rcube_find_object(popup+'link'); |
| | | ref = $(this.popups[popup].link ? this.popups[popup].link : rcube_find_object(popup+'link')); |
| | | |
| | | if (typeof show == 'undefined') |
| | | show = obj.is(':visible') ? false : true; |
| | | else if (this.popups[popup].toggle && show && this.popups[popup].obj.is(':visible') ) |
| | | show = false; |
| | | |
| | | if (show && ref) { |
| | | var parent = $(ref).parent(), |
| | | if (show && ref.length) { |
| | | var parent = ref.parent(), |
| | | win = $(window), |
| | | pos = parent.hasClass('dropbutton') ? parent.offset() : $(ref).offset(); |
| | | pos = parent.hasClass('dropbutton') ? parent.offset() : ref.offset(); |
| | | |
| | | if (!above && pos.top + ref.offsetHeight + obj.height() > win.height()) |
| | | if (!above && pos.top + ref.height() + obj.height() > win.height()) |
| | | above = true; |
| | | if (pos.left + obj.width() > win.width()) |
| | | pos.left = win.width() - obj.width() - 30; |
| | | |
| | | obj.css({ left:pos.left, top:(pos.top + (above ? -obj.height() : ref.offsetHeight)) }); |
| | | obj.css({ left:pos.left, top:(pos.top + (above ? -obj.height() : ref.height())) }); |
| | | } |
| | | |
| | | obj[show?'show':'hide'](); |
| | |
| | | }; |
| | | }, |
| | | |
| | | open_listmenu: function(e) |
| | | open_listmenu: function() |
| | | { |
| | | this.listmenu(); |
| | | }, |
| | |
| | | |
| | | for (i in rcmail.env.spell_langs) { |
| | | li = $('<li>'); |
| | | link = $('<a href="#">').text(rcmail.env.spell_langs[i]) |
| | | link = $('<a href="#"></a>').text(rcmail.env.spell_langs[i]) |
| | | .addClass('active').data('lang', i) |
| | | .click(function() { |
| | | rcmail.spellcheck_lang_set($(this).data('lang')); |
| | |
| | | }); |
| | | |
| | | this.show_popupmenu('spellmenu', show); |
| | | }, |
| | | |
| | | show_attachmentmenu: function(elem) |
| | | { |
| | | var id = elem.parentNode.id.replace(/^attach/, ''); |
| | | |
| | | $('#attachmenuopen').unbind('click').attr('onclick', '').click(function(e) { |
| | | return rcmail.command('open-attachment', id, this); |
| | | }); |
| | | |
| | | $('#attachmenudownload').unbind('click').attr('onclick', '').click(function() { |
| | | rcmail.command('download-attachment', id, this); |
| | | }); |
| | | |
| | | this.popups.attachmentmenu.link = elem; |
| | | rcmail.command('menu-open', {menu: 'attachmentmenu', id: id}); |
| | | }, |
| | | |
| | | menu_open: function(p) |
| | | { |
| | | if (p && p.props && p.props.menu == 'attachmentmenu') |
| | | this.show_popup('attachmentmenu'); |
| | | else |
| | | this.open_listmenu(); |
| | | }, |
| | | |
| | | menu_save: function(prop) |
| | | { |
| | | this.save_listmenu(); |
| | | }, |
| | | |
| | | body_mouseup: function(evt, p) |
| | |
| | | |
| | | div.style.top = (parseInt(headers_div.offsetHeight, 10) + 3) + 'px'; |
| | | $(window).resize(); |
| | | |
| | | // fixes contacts-table position when there's more than one addressbook |
| | | $('#contacts-table').css('top', $('#directorylist').height() + 24 + 'px'); |
| | | |
| | | // contacts search submit |
| | | $('#quicksearchbox').keydown(function(e) { |
| | | if (rcube_event.get_keycode(e) == 13) |
| | | rcmail.command('search'); |
| | | }); |
| | | }, |
| | | |
| | | resize_compose_body: function() |
| | | { |
| | | var div = $('#compose-div .boxlistcontent'), w = div.width(), h = div.height(); |
| | | w -= 8; // 2 x 3px padding + 2 x 1px border |
| | | h -= 4; |
| | | var div = $('#compose-div .boxlistcontent'), |
| | | w = div.width() - 2, h = div.height(), |
| | | x = bw.ie || bw.opera ? 4 : 0; |
| | | |
| | | $('#compose-body_tbl').width((w+6)+'px').height(''); |
| | | $('#compose-body_ifr').width((w+6)+'px').height((h-54)+'px'); |
| | | $('#compose-body').width(w+'px').height(h+'px'); |
| | | $('#compose-body_tbl').width((w+3)+'px').height(''); |
| | | $('#compose-body_ifr').width((w+3)+'px').height((h-54)+'px'); |
| | | $('#compose-body').width((w-x)+'px').height(h+'px'); |
| | | $('#googie_edit_layer').height(h+'px'); |
| | | }, |
| | | |
| | |
| | | .contents().mouseup(function(e){rcmail_ui.body_mouseup(e)}); |
| | | |
| | | if (rcmail.env.task == 'mail') { |
| | | rcmail.addEventListener('menu-open', 'open_listmenu', rcmail_ui); |
| | | rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui); |
| | | rcmail.addEventListener('menu-open', 'menu_open', rcmail_ui); |
| | | rcmail.addEventListener('menu-save', 'menu_save', rcmail_ui); |
| | | rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui); |
| | | rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui); |
| | | rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); |
| | |
| | | |
| | | if (rcmail.env.action == 'compose') |
| | | rcmail_ui.init_compose_form(); |
| | | else if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') |
| | | // add menu link for each attachment |
| | | $('#attachment-list > li[id^="attach"]').each(function() { |
| | | $(this).append($('<a class="drop">').click(function() { rcmail_ui.show_attachmentmenu(this); })); |
| | | }); |
| | | } |
| | | else if (rcmail.env.task == 'addressbook') { |
| | | rcmail.addEventListener('afterupload-photo', function(){ rcmail_ui.show_popup('uploadform', false); }); |