/** * Roundcube functions for default skin interface * * @licstart The following is the entire license notice for the * JavaScript code in this file. * * Copyright (c) 2006-2014, The Roundcube Dev Team * * The JavaScript code in this page is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * @licend The above is the entire license notice * for the JavaScript code in this file. */ function rcube_init_settings_tabs(){var a,b;b=$("#tabsbar");var c=$("span:last",b),d="#settingstabpreferences",e=window.rcmail&&rcmail.env.action?rcmail.env.action:null;c&&"settingstababout"!=c.attr("id")&&(a=$("#settingstababout"))&&(b=a.clone(!0),a.remove(),c.after(b));e&&(d="#settingstab"+(0").addClass("tabsbar").appendTo(c);d.each(function(c){var d,k,l=$(this),h=l.children("legend");k=$("").text(h.text()).attr("href","#");d=$("").attr({id:"tab"+c,"class":"tablink"}).click(function(){rcube_show_tab(a,c);return!1});h.remove();l.addClass("tabbed");c==b&&d.addClass("tablink-selected");d.append(k).appendTo(e)})}} function rcube_show_tab(a,b){$("#"+a).children("fieldset").each(function(a){$(this)[b==a?"show":"hide"]();$("#tab"+a).toggleClass("tablink-selected",a==b)})} function rcube_mail_ui(){this.popups={markmenu:{id:"markmessagemenu"},replyallmenu:{id:"replyallmenu"},forwardmenu:{id:"forwardmenu",editable:1},searchmenu:{id:"searchmenu",editable:1},messagemenu:{id:"messagemenu"},attachmentmenu:{id:"attachmentmenu"},dragmenu:{id:"dragmenu",sticky:1},groupmenu:{id:"groupoptionsmenu",above:1},mailboxmenu:{id:"mailboxoptionsmenu",above:1},composemenu:{id:"composeoptionsmenu",editable:1,overlap:1},spellmenu:{id:"spellmenu"},responsesmenu:{id:"responsesmenu"},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 a,b;for(b in this.popups)a=$("#"+this.popups[b].id),a.length?this.popups[b].obj=a:delete this.popups[b]} rcube_mail_ui.prototype={show_popup:function(a,b,c){var d;!this.popups[a]&&(d=$("#"+a))&&d.length&&(this.popups[a]=$.extend(c,{id:a,obj:d}));return"function"==typeof this[a]?this[a](b):this.show_popupmenu(a,b)},show_popupmenu:function(a,b){var c=this.popups[a].obj,d=this.popups[a].above,e=$(this.popups[a].link?this.popups[a].link:rcube_find_object(a+"link"));"undefined"==typeof b?b=c.is(":visible")?!1:!0:this.popups[a].toggle&&b&&this.popups[a].obj.is(":visible")&&(b=!1);if(b&&e.length){var f=e.parent(), g=$(window),f=f.hasClass("dropbutton")?f.offset():e.offset();!d&&f.top+e.height()+c.height()>g.height()&&(d=!0);f.left+c.width()>g.width()&&(f.left=g.width()-c.width()-30);c.css({left:f.left,top:f.top+(d?-c.height():e.height())})}c[b?"show":"hide"]()},dragmenu:function(a){this.popups.dragmenu.obj[a?"show":"hide"]()},forwardmenu:function(a){$("input[name='forwardtype'][value="+(rcmail.env.forward_attachment?1:0)+"]",this.popups.forwardmenu.obj).prop("checked",!0);this.show_popupmenu("forwardmenu", a)},uploadmenu:function(a){"object"==typeof a&&(a=!1);if(!a)try{$("#attachment-form form")[0].reset()}catch(b){}rcmail.mailvelope_editor||(this.show_popupmenu("uploadmenu",a),!document.all&&this.popups.uploadmenu.obj.is(":visible")&&$("#attachment-form input[type=file]").click())},searchmenu:function(a){var b=this.popups.searchmenu.obj,c=rcube_find_object("searchmenulink");"undefined"==typeof a&&(a=b.is(":visible")?!1:!0);if(a&&c){var d=$(c).offset();b.css({left:d.left,top:d.top+c.offsetHeight+2}); if(rcmail.env.search_mods){var e,f,c=$('input:checkbox[name="s_mods[]"]',b),d=rcmail.env.mailbox,g=rcmail.env.search_mods,k=rcmail.env.search_scope||"base";"mail"==rcmail.env.task?(g=g[d]?g[d]:g["*"],f="text",$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+k).prop("checked",!0)):f="*";if(g[f])c.map(function(){this.checked=!0;this.disabled=this.value!=f});else for(e in c.prop("disabled",!1).prop("checked",!1),g)$("#s_mod_"+e).prop("checked",!0)}}b[a?"show":"hide"]()},set_searchmod:function(a){var b, c;b=rcmail.env.task;var d=rcmail.env.search_mods,e=rcmail.env.mailbox;"all"==$('input[name="s_scope"]:checked').val()&&(e="*");d||(d={});"mail"==b?(d[e]||(d[e]=rcube_clone_object(d["*"])),c=d[e],b="text"):(c=d,b="*");a.checked?c[a.value]=1:delete c[a.value];a.value==b&&$('input:checkbox[name="s_mods[]"]').map(function(){this!=a&&(this.checked=!0,a.checked?(this.disabled=!0,delete c[this.value]):(this.disabled=!1,c[this.value]=1))});rcmail.set_searchmods(c)},show_listmenu:function(a){var b=this,c= {},d=$("#listmenu");d.is(":visible")?d.dialog("close",a.originalEvent):($('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop("checked",!0),$('input[name="sort_ord"][value="DESC"]').prop("checked","DESC"==rcmail.env.sort_order),$('input[name="sort_ord"][value="ASC"]').prop("checked","DESC"!=rcmail.env.sort_order),$('input[name="view"][value="thread"]').prop("checked",rcmail.env.threading?!0:!1),$('input[name="view"][value="list"]').prop("checked",rcmail.env.threading?!1:!0),$('input[name="list_col[]"]').each(function(){$(this).prop("checked", -1!=$.inArray(this.value,rcmail.env.listcols))}),c[rcmail.gettext("save")]=function(a){d.dialog("close",a);b.save_listmenu()},d.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:null,open:function(a){var b=0;$("#listmenu fieldset").each(function(){var a=$(this).height();a>b&&(b=a)}).css("min-height",b+"px").height(b);setTimeout(function(){d.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(a){d.dialog("destroy").hide();a.originalEvent&&rcube_event.is_keyboard(a.originalEvent)&& $("#listmenulink").focus()},buttons:c,minWidth:500,width:d.width()+20}).show())},save_listmenu:function(){var a=$('input[name="sort_col"]:checked').val(),b=$('input[name="sort_ord"]:checked').val(),c=$('input[name="view"]:checked').val(),d=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(d,a,b,"thread"==c?1:0)},spellmenu:function(a){var b,c,d=rcmail.spellcheck_lang(),e=this.popups.spellmenu.obj,f=$("ul",e);if(!f.length){f=$("