/** * 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;var b=$("#tabsbar");var d=$("span:last",b),c="#settingstabpreferences",f=window.rcmail&&rcmail.env.action?rcmail.env.action:null;d&&"settingstababout"!=d.attr("id")&&(a=$("#settingstababout"))&&(b=a.clone(!0),a.remove(),d.after(b));f&&(c="#settingstab"+(0").addClass("tabsbar").appendTo(d);c.each(function(d){var c=$(this),e=c.children("legend");var l=$("").text(e.text()).attr("href","#");var h=$("").attr({id:"tab"+d,"class":"tablink"}).click(function(){rcube_show_tab(a,d);return!1});e.remove();c.addClass("tabbed");d==b&&h.addClass("tablink-selected");h.append(l).appendTo(f)})}} 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;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,d){var c;!this.popups[a]&&(c=$("#"+a))&&c.length&&(this.popups[a]=$.extend(d,{id:a,obj:c}));return"function"==typeof this[a]?this[a](b):this.show_popupmenu(a,b)},show_popupmenu:function(a,b){var d=this.popups[a].obj,c=this.popups[a].above,f=$(this.popups[a].link?this.popups[a].link:rcube_find_object(a+"link"));"undefined"==typeof b?b=d.is(":visible")?!1:!0:this.popups[a].toggle&&b&&this.popups[a].obj.is(":visible")&&(b=!1);if(b&&f.length){var e=f.parent(); a=$(window);e=e.hasClass("dropbutton")?e.offset():f.offset();!c&&e.top+f.height()+d.height()>a.height()&&(c=!0);e.left+d.width()>a.width()&&(e.left=a.width()-d.width()-30);d.css({left:e.left,top:e.top+(c?-d.height():f.height())})}d[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,d=rcube_find_object("searchmenulink");"undefined"==typeof a&&(a=b.is(":visible")?!1:!0);if(a&&d){var c=$(d).offset();b.css({left:c.left,top:c.top+d.offsetHeight+2}); if(rcmail.env.search_mods){var f;d=$('input:checkbox[name="s_mods[]"]',b);c=rcmail.env.mailbox;var e=rcmail.env.search_mods,g=rcmail.env.search_scope||"base";if("mail"==rcmail.env.task){e=e[c]?e[c]:e["*"];var k="text";$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+g).prop("checked",!0)}else k="*";if(e[k])d.map(function(){this.checked=!0;this.disabled=this.value!=k});else for(f in d.prop("disabled",!1).prop("checked",!1),e)$("#s_mod_"+f).prop("checked",!0)}}b[a?"show":"hide"]()}, set_searchmod:function(a){var b=rcmail.env.task;var d=rcmail.env.search_mods,c=rcmail.env.mailbox;"all"==$('input[name="s_scope"]:checked').val()&&(c="*");d||(d={});if("mail"==b){d[c]||(d[c]=rcube_clone_object(d["*"]));var f=d[c];b="text"}else f=d,b="*";a.checked?f[a.value]=1:delete f[a.value];a.value==b&&$('input:checkbox[name="s_mods[]"]').map(function(){this!=a&&(this.checked=!0,a.checked?(this.disabled=!0,delete f[this.value]):(this.disabled=!1,f[this.value]=1))});rcmail.set_searchmods(f)},show_listmenu:function(a){var b= this,d={},c=$("#listmenu");c.is(":visible")?c.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",c)["widescreen"==rcmail.env.layout?"hide":"show"](),d[rcmail.gettext("save")]=function(a){c.dialog("close",a);b.save_listmenu()},c.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(){c.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(a){c.dialog("destroy").hide();a.originalEvent&&rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus()},buttons:d,minWidth:500,width:c.width()+20}).show())},save_listmenu:function(){var a=$('input[name="sort_col"]:checked').val(),b=$('input[name="sort_ord"]:checked').val(),d=$('input[name="view"]:checked').val(),c=$('input[name="layout"]:checked').val(), f=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(f,a,b,"thread"==d?1:0,c)},spellmenu:function(a){var b=rcmail.spellcheck_lang(),d=this.popups.spellmenu.obj,c=$("ul",d);if(!c.length){c=$("