From ab0b51a1fef87bcc643c3aaf2e635c811b28ccd8 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Tue, 15 Feb 2011 06:10:59 -0500 Subject: [PATCH] - Use only one from IMAP authentication methods to prevent login delays (1487784) --- skins/default/functions.js | 72 +++++++++++++++++++++++++++++++++-- 1 files changed, 67 insertions(+), 5 deletions(-) diff --git a/skins/default/functions.js b/skins/default/functions.js index 64a6d99..3497826 100644 --- a/skins/default/functions.js +++ b/skins/default/functions.js @@ -13,12 +13,64 @@ tab = '#settingstab' + (rcmail.env.action=='preferences' ? 'default' : (rcmail.env.action.indexOf('identity')>0 ? 'identities' : rcmail.env.action.replace(/\./g, ''))); $(tab).addClass('tablink-selected'); - $(tab + '> a').removeAttr('onclick').unbind('click').bind('click', function(){return false;}); + $(tab + '> a').removeAttr('onclick').click(function() { return false; }); } function rcube_show_advanced(visible) { $('tr.advanced').css('display', (visible ? (bw.ie ? 'block' : 'table-row') : 'none')); +} + +// Fieldsets-to-tabs converter +// Warning: don't place "caller" <script> inside page element (id) +function rcube_init_tabs(id, current) +{ + var content = $('#'+id), + fs = content.children('fieldset'); + + if (!fs.length) + return; + + current = current ? current : 0; + + // first hide not selected tabs + fs.each(function(idx) { if (idx != current) $(this).hide(); }); + + // create tabs container + var tabs = $('<div>').addClass('tabsbar').appendTo($(content)); + + // convert fildsets into tabs + fs.each(function(idx) { + var tab, a, elm = $(this), legend = elm.children('legend'); + + // create a tab + a = $('<a>').text(legend.text()).attr('href', '#'); + tab = $('<span>').attr({'id': 'tab'+idx, 'class': 'tablink'}) + .click(function() { rcube_show_tab(id, idx); return false }) + + // remove legend + legend.remove(); + // style fieldset + elm.addClass('tabbed'); + // style selected tab + if (idx == current) + tab.addClass('tablink-selected'); + + // add the tab to container + tab.append(a).appendTo(tabs); + }); +} + +function rcube_show_tab(id, index) +{ + var fs = $('#'+id).children('fieldset'); + + fs.each(function(idx) { + // Show/hide fieldset (tab content) + $(this)[index==idx ? 'show' : 'hide'](); + // Select/unselect tab + $('#tab'+idx).toggleClass('tablink-selected', idx==index); + }); } /** @@ -38,7 +90,8 @@ mailboxmenu: {id:'mailboxoptionsmenu', above:1}, composemenu: {id:'composeoptionsmenu', editable:1}, // toggle: #1486823, #1486930 - uploadmenu: {id:'attachment-form', editable:1, above:1, toggle:!bw.ie&&!bw.linux } + uploadmenu: {id:'attachment-form', editable:1, above:1, toggle:!bw.ie&&!bw.linux }, + uploadform: {id:'upload-form', editable:1, toggle:!bw.ie&&!bw.linux } }; var obj; @@ -74,9 +127,15 @@ show = false; if (show && ref) { - var pos = $(ref).offset(); - if (!above && pos.top + ref.offsetHeight + obj.height() > window.innerHeight) + var parent = $(ref).parent(), + win = $(window), + pos = parent.hasClass('dropbutton') ? parent.offset() : $(ref).offset(); + + if (!above && pos.top + ref.offsetHeight + 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)) }); } @@ -294,7 +353,7 @@ /* Message composing */ init_compose_form: function() { - var f, field, fields = ['cc', 'bcc', 'replyto', 'mailreplyto', 'mailfollowupto'], + var f, field, fields = ['cc', 'bcc', 'replyto', 'followupto'], div = document.getElementById('compose-div'), headers_div = document.getElementById('compose-headers-div'); @@ -441,6 +500,9 @@ if (rcmail.env.action == 'compose') rcmail_ui.init_compose_form(); } + else if (rcmail.env.task == 'addressbook') { + rcmail.addEventListener('afterupload-photo', function(){ rcmail_ui.show_popup('uploadform', false); }); + } } // Events handling in iframes (eg. preview pane) -- Gitblit v1.9.1