summaryrefslogtreecommitdiff
path: root/skins/classic/functions.js
diff options
context:
space:
mode:
authorAndy Wermke <andy@dev.next-step-software.com>2013-04-04 16:10:23 +0200
committerAndy Wermke <andy@dev.next-step-software.com>2013-04-04 16:10:23 +0200
commit92cd7f34b07e86062f2c024039e3309768b48ce6 (patch)
tree63b9f39280ebcab80742d9f2b4db6a139c1791e1 /skins/classic/functions.js
parent029d18f13bcf01aa2f1f08dbdfc6400c081bf7cb (diff)
parent443b92a7ee19e321b350750240e0fc54ec5be357 (diff)
Merge branch 'master' of https://github.com/roundcube/roundcubemail
Diffstat (limited to 'skins/classic/functions.js')
-rw-r--r--skins/classic/functions.js76
1 files changed, 60 insertions, 16 deletions
diff --git a/skins/classic/functions.js b/skins/classic/functions.js
index 1742150f3..499783b3f 100644
--- a/skins/classic/functions.js
+++ b/skins/classic/functions.js
@@ -92,6 +92,7 @@ function rcube_mail_ui()
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},
@@ -133,24 +134,24 @@ show_popupmenu: function(popup, show)
{
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']();
@@ -325,7 +326,7 @@ listmenu: function(show)
};
},
-open_listmenu: function(e)
+open_listmenu: function()
{
this.listmenu();
},
@@ -355,7 +356,7 @@ spellmenu: function(show)
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'));
@@ -380,6 +381,35 @@ spellmenu: function(show)
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)
{
var i, target = rcube_event.get_target(evt);
@@ -491,17 +521,26 @@ init_compose_form: function()
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');
},
@@ -791,8 +830,8 @@ function rcube_init_mail_ui()
.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');
@@ -808,6 +847,11 @@ function rcube_init_mail_ui()
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); });