Changeset 6107 for trunk/expressoMail1_2/js
- Timestamp:
- 05/04/12 18:00:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/draw_api.js
r6106 r6107 1701 1701 headers_msgs.followupflagged.id = DataLayer.put('followupflagged', headers_msgs.followupflagged); 1702 1702 DataLayer.commit(false, false, function(data){ 1703 var fail = false;1703 var fail = false; 1704 1704 $.each(data, function(index, value) { 1705 fail = false; 1706 if(typeof value != 'object' || !(value['id'])){ 1705 if(typeof value != 'object'){ 1707 1706 fail = true; 1707 alert(value); 1708 1708 } 1709 1709 }); … … 1720 1720 $('#td_message_followup_' + messageClickedId + ', ' + 1721 1721 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC"); 1722 alert("Não foi possível sinalizar esta mensagem. \nDetalhes do erro: mensagem não contém o atributo message-id.");1723 1722 } 1724 1723 }); … … 3017 3016 //TODO Mudar quando API abstrair atualizações no cache 3018 3017 DataLayer.remove('labeled', false); 3019 //DataLayer.get('labeled');3018 DataLayer.get('labeled'); 3020 3019 var labels = DataLayer.get("labeled", {filter: [ 3021 3020 'AND', … … 3044 3043 var id_labeled = $(event.target).attr("id"); 3045 3044 //TODO Mudar quando API abstrair atualizações no cache 3046 //DataLayer.remove('labeled', false);3047 //DataLayer.get('labeled');3045 DataLayer.remove('labeled', false); 3046 DataLayer.get('labeled'); 3048 3047 DataLayer.remove('labeled', id_labeled); 3049 3048 DataLayer.commit(false, false, function(){ … … 3678 3677 var fileUploadMSG = $('#fileupload_msg'+ID); 3679 3678 var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; 3680 3681 fileUploadMSG.find(".button-files-upload").fileupload({ 3679 3680 fileUploadMSG.find(".button").button().filter(".fileinput-button").find("input:file").fileupload({ 3681 //singleFileUploads : true, 3682 sequentialUploads: true, 3682 3683 type: 'post', 3683 3684 dataType : 'json', 3684 3685 url: "../prototype/post.php", 3685 forceIframeTransport: true, 3686 forceIframeTransport: false, 3687 dropZone : fileUploadMSG, 3686 3688 formData: function(form) { 3689 $.each(this.files, function(index, value){ 3690 3691 }); 3687 3692 return [ 3688 3693 { … … 3699 3704 } 3700 3705 ]; 3701 }, 3706 }, 3702 3707 add: function (e, data) { 3703 3704 3708 if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { 3705 3709 setTimeout(function() { 3706 3710 $('#attDisposition'+ID).val('attachment'); 3707 3711 if(!data.fileInput){ 3708 $(fileUploadMSG).find("input")[0].files = data.files; 3709 data['fileInput'] = $(fileUploadMSG).find("input"); 3712 data.fileInput = fileUploadMSG.find("input:file"); 3713 3714 //fileUploadMSG.find("input:file").trigger("change.undefined"); 3710 3715 } 3711 if(!data.form)3712 data['form'] = fileUploadMSG.parents("form:first");3713 3716 data.submit(); 3714 3717 }, 3000); 3715 } 3716 var attach = {}; 3717 attach.fullFileName = data.files[0].name; 3718 attach.fileName = data.files[0].name; 3719 if(data.files[0].name.length > 50) 3720 attach.fileName = data.files[0].name.substr(0, 32) + " ... " + data.files[0].name.substr(data.files[0].name.length-9, data.files[0].name.length); 3721 attach.fileSize = formatBytes(data.files[0].size); 3722 data.files[0].size = 300; 3723 if(maxAttachmentSize && data.files[0].size > maxAttachmentSize) 3724 attach.error = 'Tamanho de arquivo nao permitido!!!' 3725 3726 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 3727 upload.find('.button.close').button({ 3728 icons: { 3729 primary: "ui-icon-close" 3730 }, 3731 text: false 3732 }).click(function(){ 3733 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 3734 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 3735 delAttachment(ID, idAttach) 3736 $(this).parent().remove(); 3718 } 3719 $.each(data.files, function (index, file) { 3720 var attach = {}; 3721 attach.fullFileName = file.name; 3722 attach.fileName = file.name; 3723 if(file.name.length > 50) 3724 attach.fileName = file.name.substr(0, 32) + " ... " + file.name.substr(file.name.length-9, file.name.length); 3725 attach.fileSize = formatBytes(file.size); 3726 if(maxAttachmentSize && file.size > maxAttachmentSize) 3727 attach.error = 'Tamanho de arquivo nao permitido!!' 3728 3729 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 3730 upload.find('.button.close').button({ 3731 icons: { 3732 primary: "ui-icon-close" 3733 }, 3734 text: false 3735 }).click(function(){ 3736 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 3737 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 3738 delAttachment(ID, idAttach) 3739 $(this).parent().remove(); 3740 }); 3741 3742 fileUploadMSG.find('.attachments-list').append(upload); 3743 3744 if(!maxAttachmentSize || file.size < maxAttachmentSize){ 3745 if(data.fileInput){ 3746 fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 3747 fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); 3748 } 3749 }else 3750 fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); 3737 3751 }); 3738 3739 fileUploadMSG.find('.attachments-list').append(upload);3740 3741 if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize)3742 fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden');3743 else3744 fileUploadMSG.find(' .fileinput-button.new').removeClass('new');3745 3752 }, 3746 3753 done: function(e, data){ … … 3764 3771 fileUploadMSG.find(' .in-progress:first').remove(); 3765 3772 } 3766 }).find('[name="files[]"]').css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "-moz-transform" : "none","-o-transform" : 'none'}); 3767 3773 }).css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "-moz-transform" : "none","-o-transform" : 'none'}) 3774 .end().end().filter(".message-attach-link").click(function(){ 3775 jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {})); 3776 $( "#mailpreview_container span.ui-icon-close" ).click(); 3777 jQuery('#message-attach-dialog').dialog({ 3778 width:920, 3779 height:550, 3780 resizable:false, 3781 modal: true, 3782 closeOnEscape:true, 3783 close:function(event, ui) {event.stopPropagation(); }, 3784 autoOpen:false 3785 }); 3786 3787 3788 jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ 3789 jQuery('#message-attach-dialog').dialog('open'); 3790 jQuery('#message-attach-attach-btn').unbind('click'); 3791 jQuery('#message-attach-attach-btn').click(function(event){ 3792 jQuery.each(selectedMessages, function(folder_name, messages) { 3793 jQuery.each(selectedMessages[folder_name], function(message_number, message) { 3794 if (message) { 3795 var att = new Object(); 3796 att.folder = folder_name; 3797 att.uid = message_number; 3798 att.type = 'imapMSG'; 3799 att.name = onceOpenedMessages[folder_name][message_number].subject + '.eml'; 3800 var idATT = JSON.stringify(att); 3801 addAttachment( ID , idATT); 3802 var attach = {}; 3803 attach.fileName = att.name 3804 if(attach.fileName.length > 45) 3805 attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 3806 3807 attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); 3808 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 3809 upload.find('.status-upload').addClass('ui-icon ui-icon-check'); 3810 upload.find('.in-progress').remove(); 3811 upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); 3812 3813 upload.find('.button.close').button({ 3814 icons: { 3815 primary: "ui-icon-close" 3816 }, 3817 text: false 3818 }).click(function(){ 3819 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 3820 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]'); 3821 delAttachment(ID,idAttach); 3822 $(this).parent().remove(); 3823 }); 3824 3825 fileUploadMSG.find('.attachments-list').append(upload); 3826 } 3827 }); 3828 }); 3829 3830 jQuery('#message-attach-dialog').dialog('close'); 3831 3832 }); 3833 jQuery('#message-attach-cancel-btn').click(function(event){ 3834 jQuery('#message-attach-dialog').dialog('close'); 3835 }); 3836 }); 3837 }); 3838 /* 3839 content.find('[name="files[]"]').fileupload({ 3840 sequentialUploads: true, 3841 limitConcurrentUploads: 1, 3842 type: 'post', 3843 dataType : 'json', 3844 url: "../prototype/post.php", 3845 forceIframeTransport: true, 3846 dropZone : fileUploadMSG.find(".button").filter(".fileinput-button"), 3847 formData: function(form) { 3848 return [ 3849 { 3850 name : "mailAttachment[0][source]", 3851 value : "files0" 3852 }, 3853 { 3854 name : "mailAttachment[0][disposition]", 3855 value : $(form[0]['attDisposition'+$(form[0]['abaID']).val()]).val() 3856 }, 3857 { 3858 name: "MAX_FILE_SIZE", 3859 value : maxAttachmentSize 3860 } 3861 ]; 3862 }, 3863 add: function (e, data) { 3864 if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { 3865 setTimeout(function() { 3866 $('#attDisposition'+ID).val('attachment'); 3867 if(!data.fileInput){ 3868 data.fileInput = fileUploadMSG.find("input:file"); 3869 3870 //fileUploadMSG.find("input:file").trigger("change.undefined"); 3871 } 3872 data.submit(); 3873 }, 3000); 3874 } 3875 }, 3876 done: function(e, data){ 3877 if(!!data.result && data.result != "[]" ){ 3878 var newAttach = data.result; 3879 if(!newAttach.mailAttachment.error){ 3880 if(newAttach.rollback !== false) 3881 { 3882 fileUploadMSG.find('.in-progress:first').parents('p').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>').find('.status-upload').addClass('ui-icon ui-icon-check'); 3883 addAttachment(ID,newAttach['mailAttachment'][0][0].id); 3884 } 3885 else 3886 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); 3887 }else{ 3888 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error'); 3889 } 3890 3891 }else { 3892 fileUploadMSG.find(' .progress.on-complete:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); 3893 } 3894 fileUploadMSG.find(' .in-progress:first').remove(); 3895 }, 3896 change: function (e, data) { 3897 $.each(data.files, function (index, file) { 3898 var attach = {}; 3899 attach.fullFileName = file.name; 3900 attach.fileName = file.name; 3901 if(file.name.length > 50) 3902 attach.fileName = file.name.substr(0, 32) + " ... " + file.name.substr(file.name.length-9, file.name.length); 3903 attach.fileSize = formatBytes(file.size); 3904 if(maxAttachmentSize && file.size > maxAttachmentSize) 3905 attach.error = 'Tamanho de arquivo nao permitido!!' 3906 3907 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 3908 upload.find('.button.close').button({ 3909 icons: { 3910 primary: "ui-icon-close" 3911 }, 3912 text: false 3913 }).click(function(){ 3914 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 3915 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 3916 delAttachment(ID, idAttach) 3917 $(this).parent().remove(); 3918 }); 3919 3920 fileUploadMSG.find('.attachments-list').append(upload); 3921 3922 if(!maxAttachmentSize || file.size < maxAttachmentSize){ 3923 fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 3924 fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); 3925 }else 3926 fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); 3927 3928 })} 3929 }) 3930 fileUploadMSG.find('[name="files[]"]').css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "-moz-transform" : "none","-o-transform" : 'none'}); 3931 //fileUploadMSG.unbind('dragover.undefined'); 3768 3932 3769 3933 fileUploadMSG.find("span.message-attach-link").click(function(event){ … … 3833 3997 3834 3998 }); 3999 */ 3835 4000 // style="width: 100px; height: 20px;"/ 3836 4001 //$('[name="files[]"]').css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "cursor" : "pointer"});// "display": "none"
Note: See TracChangeset
for help on using the changeset viewer.