/** * Roundcube functions for default skin interface * * @licstart The following is the entire license notice for the * JavaScript code in this file. * * Copyright (c) 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;var b=$("#tabsbar");var c=$("span",b).last(),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(f){var g=$(this),h=g.children("legend");if(g.is(":visible")&&!g.hasClass("tabbed")){var l=$("").text(h.text()).attr("href","#");var k=$("").attr({id:"tab"+f,"class":"tablink"}).click(function(){rcube_show_tab(a,f);return!1});h.remove();g.addClass("tabbed");f==b&&k.addClass("tablink-selected");k.append(l).appendTo(e)}}); d.each(function(f){f!=b&&$(this).hide()})}}function rcube_show_tab(a,b){$("#"+a).children("fieldset").each(function(c){$(this)[b==c?"show":"hide"]();$("#tab"+c).toggleClass("tablink-selected",c==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;for(a in this.popups){var b=$("#"+this.popups[a].id);b.length?this.popups[a].obj=b:delete this.popups[a]}} 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(); a=$(window);f=f.hasClass("dropbutton")?f.offset():e.offset();!d&&f.top+e.height()+c.height()>a.height()&&(d=!0);f.left+c.width()>a.width()&&(f.left=a.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;c=$('input:checkbox[name="s_mods[]"]',b);d=rcmail.env.mailbox;var f=rcmail.env.search_mods,g=rcmail.env.search_scope||"base";if("mail"==rcmail.env.task){f=f[d]?f[d]:f["*"];var h="text";$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+g).prop("checked",!0)}else h="*";if(f[h])c.map(function(){this.checked=!0;this.disabled=this.value!=h});else for(e in c.prop("disabled",!1).prop("checked",!1),f)$("#s_mod_"+e).prop("checked",!0)}}b[a?"show":"hide"]()}, set_searchmod:function(a){var b=rcmail.env.task;var c=rcmail.env.search_mods,d=rcmail.env.mailbox;"all"==$('input[name="s_scope"]:checked').val()&&(d="*");c||(c={});if("mail"==b){c[d]||(c[d]=rcube_clone_object(c["*"]));var e=c[d];b="text"}else e=c,b="*";a.checked?e[a.value]=1:delete e[a.value];a.value==b&&$('input:checkbox[name="s_mods[]"]').map(function(){this!=a&&(this.checked=!0,a.checked?(this.disabled=!0,delete e[this.value]):(this.disabled=!1,e[this.value]=1))});rcmail.set_searchmods(e)},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))}),$.each(["widescreen","desktop","list"],function(){$('input[name="layout"][value="'+this+'"]').prop("checked",rcmail.env.layout==this)}),$("#listoptions-columns",d)["widescreen"==rcmail.env.layout?"hide":"show"](),c[rcmail.gettext("save")]=function(e){d.dialog("close",e);b.save_listmenu()},d.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:null,open:function(e){var f=0;$("#listmenu fieldset").each(function(){var g=$(this).height();g>f&&(f=g)}).css("min-height", f+"px").height(f);setTimeout(function(){d.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(e){d.dialog("destroy").hide();e.originalEvent&&rcube_event.is_keyboard(e.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="layout"]:checked').val(), e=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(e,a,b,"thread"==c?1:0,d)},spellmenu:function(a){var b=rcmail.spellcheck_lang(),c=this.popups.spellmenu.obj,d=$("ul",c);if(!d.length){d=$("