You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.6 KiB
1 lines
3.6 KiB
var AppInbox=function(){var i=$(".inbox-content"),t=$(".inbox-loading"),n="",e=function(e,o){var a="app_inbox_inbox.html",c=$(".inbox-nav > li."+o+" a").attr("data-title");n=o,t.show(),i.html(""),h(e),$.ajax({type:"GET",cache:!1,url:a,dataType:"html",success:function(n){h(e),$(".inbox-nav > li.active").removeClass("active"),$(".inbox-nav > li."+o).addClass("active"),$(".inbox-header > h1").text(c),t.hide(),i.html(n),Layout.fixContentHeight&&Layout.fixContentHeight()},error:function(i,t,n){h(e)},async:!1}),jQuery("body").on("change",".mail-group-checkbox",function(){var i=jQuery(".mail-checkbox"),t=jQuery(this).is(":checked");jQuery(i).each(function(){$(this).attr("checked",t)})})},o=function(n,e,o){var a="app_inbox_view.html";t.show(),i.html(""),h(n);var c=n.parent("tr").attr("data-messageid");$.ajax({type:"GET",cache:!1,url:a,dataType:"html",data:{message_id:c},success:function(e){h(n),o&&$(".inbox-nav > li.active").removeClass("active"),$(".inbox-header > h1").text("View Message"),t.hide(),i.html(e),Layout.fixContentHeight()},error:function(i,t,e){h(n)},async:!1})},a=function(){$(".inbox-wysihtml5").wysihtml5({stylesheets:["../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"]})},c=function(){$("#fileupload").fileupload({url:"../assets/global/plugins/jquery-file-upload/server/php/",autoUpload:!0}),$.support.cors&&$.ajax({url:"../assets/global/plugins/jquery-file-upload/server/php/",type:"HEAD"}).fail(function(){$('<span class="alert alert-error"/>').text("Upload server currently unavailable - "+new Date).appendTo("#fileupload")})},s=function(n){var e="app_inbox_compose.html";t.show(),i.html(""),h(n),$.ajax({type:"GET",cache:!1,url:e,dataType:"html",success:function(e){h(n),$(".inbox-nav > li.active").removeClass("active"),$(".inbox-header > h1").text("Compose"),t.hide(),i.html(e),c(),a(),$(".inbox-wysihtml5").focus(),Layout.fixContentHeight(),App.initUniform()},error:function(i,t,e){h(n)},async:!1})},l=function(n){var e=$(n).attr("data-messageid"),o="app_inbox_reply.html&messageid="+e;t.show(),i.html(""),h(n),$.ajax({type:"GET",cache:!1,url:o,dataType:"html",success:function(e){h(n),$(".inbox-nav > li.active").removeClass("active"),$(".inbox-header > h1").text("Reply"),t.hide(),i.html(e),$('[name="message"]').val($("#reply_email_content_body").html()),r(),c(),a(),Layout.fixContentHeight(),App.initUniform()},error:function(i,t,e){h(n)},async:!1})},r=function(){var i=$(".inbox-compose .mail-to .inbox-cc"),t=$(".inbox-compose .input-cc");i.hide(),t.show(),$(".close",t).click(function(){t.hide(),i.show()})},u=function(){var i=$(".inbox-compose .mail-to .inbox-bcc"),t=$(".inbox-compose .input-bcc");i.hide(),t.show(),$(".close",t).click(function(){t.hide(),i.show()})},h=function(i){"undefined"!=typeof i&&(i.attr("disabled")?i.attr("disabled",!1):i.attr("disabled",!0))};return{init:function(){$(".inbox").on("click",".compose-btn a",function(){s($(this))}),$(".inbox").on("click",".inbox-discard-btn",function(i){i.preventDefault(),e($(this),n)}),$(".inbox").on("click",".reply-btn",function(){l($(this))}),$(".inbox-content").on("click",".view-message",function(){o($(this))}),$(".inbox-nav > li.inbox > a").click(function(){e($(this),"inbox")}),$(".inbox-nav > li.sent > a").click(function(){e($(this),"sent")}),$(".inbox-nav > li.draft > a").click(function(){e($(this),"draft")}),$(".inbox-nav > li.trash > a").click(function(){e($(this),"trash")}),$(".inbox-content").on("click",".mail-to .inbox-cc",function(){r()}),$(".inbox-content").on("click",".mail-to .inbox-bcc",function(){u()}),"view"===App.getURLParameter("a")?o():"compose"===App.getURLParameter("a")?s():$(".inbox-nav > li.inbox > a").click()}}}();jQuery(document).ready(function(){AppInbox.init()});
|