Changeset 7899 for trunk/expressoMail1_2/js/draw_api.js
- Timestamp:
- 02/19/13 16:58:52 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/draw_api.js
r7897 r7899 4758 4758 */ 4759 4759 function attach_message (folder_name, message_number) { 4760 4761 // Callback para caso seja necessário a mensagem não esteja no cache. 4762 var handler_attach_message = function (message) { 4763 var ID = currentTab; 4764 var fileUploadMSG = $('#fileupload_msg'+ID); 4765 fileUploadMSG.find(' .attachments-list').show(); 4766 var att = new Object(); 4767 att.folder = folder_name; 4768 att.uid = message_number; 4769 att.type = 'imapMSG'; 4770 att.name = Base64.encode(message.subject + '.eml'); 4771 var idATT = JSON.stringify(att); 4772 addAttachment(ID, idATT); 4773 var attach = {}; 4774 attach.fileName = message.subject + '.eml'; 4775 attach.fullFileName = message.subject + '.eml'; 4776 if(attach.fileName.length > 20) 4760 var ID = currentTab; 4761 var fileUploadMSG = $('#fileupload_msg'+ID); 4762 fileUploadMSG.find(' .attachments-list').show(); 4763 var att = new Object(); 4764 att.folder = folder_name; 4765 att.uid = message_number; 4766 att.type = 'imapMSG'; 4767 att.name = Base64.encode(onceOpenedHeadersMessages[folder_name][message_number].subject + '.eml'); 4768 var idATT = JSON.stringify(att); 4769 addAttachment(ID, idATT); 4770 var attach = {}; 4771 attach.fileName = onceOpenedHeadersMessages[folder_name][message_number].subject + '.eml'; 4772 attach.fullFileName = onceOpenedHeadersMessages[folder_name][message_number].subject + '.eml'; 4773 if(attach.fileName.length > 20) 4774 { 4775 attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length - 9, attach.fileName.length); 4776 } 4777 4778 attach.error = false; 4779 attach.OK = true; 4780 attach.fileSize = formatBytes(onceOpenedHeadersMessages[folder_name][message_number].Size); 4781 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", { 4782 file: attach 4783 })); 4784 $("#content_id_" + currentTab + " .save").button("enable"); 4785 upload.find('.att-box-loading').remove(); 4786 upload.append('<input type="hidden" name="fileId[]" value=\'' + idATT + '\'/>'); 4787 4788 upload.find('.att-box-delete').click(function() 4789 { 4790 $("#content_id_" + currentTab + " .save").button("enable"); 4791 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 4792 fileUploadMSG.find(' .attachments-list').find('input[value="' + idAttach + '"]').remove(); 4793 delAttachment(ID, idAttach); 4794 $(this).parent().qtip("destroy"); 4795 $(this).parent().remove(); 4796 if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length) 4777 4797 { 4778 attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length - 9, attach.fileName.length);4798 fileUploadMSG.find(' .attachments-list').hide(); 4779 4799 } 4780 4781 attach.error = false; 4782 attach.OK = true; 4783 attach.fileSize = formatBytes(message.Size); 4784 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", { 4785 file: attach 4786 })); 4787 $("#content_id_" + currentTab + " .save").button("enable"); 4788 upload.find('.att-box-loading').remove(); 4789 upload.append('<input type="hidden" name="fileId[]" value=\'' + idATT + '\'/>'); 4790 4791 upload.find('.att-box-delete').click(function() 4792 { 4793 $("#content_id_" + currentTab + " .save").button("enable"); 4794 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 4795 fileUploadMSG.find(' .attachments-list').find('input[value="' + idAttach + '"]').remove(); 4796 delAttachment(ID, idAttach); 4797 $(this).parent().qtip("destroy"); 4798 $(this).parent().remove(); 4799 if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length) 4800 { 4801 fileUploadMSG.find(' .attachments-list').hide(); 4800 }); 4801 4802 fileUploadMSG.find('.attachments-list').append(upload); 4803 4804 upload.find('.att-box-loading').remove(); 4805 4806 fileUploadMSG.find('.attachments-list .att-box:last').qtip( 4807 { 4808 content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", { 4809 attach: attach 4810 }), 4811 position: { 4812 corner: { 4813 tooltip: 'bottomMiddle', 4814 target: 'topMiddle' 4815 }, 4816 adjust: { 4817 resize: true, 4818 scroll: true 4802 4819 } 4803 }); 4804 4805 fileUploadMSG.find('.attachments-list').append(upload); 4806 4807 upload.find('.att-box-loading').remove(); 4808 4809 fileUploadMSG.find('.attachments-list .att-box:last').qtip( 4810 { 4811 content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", { 4812 attach: attach 4813 }), 4814 position: { 4815 corner: { 4816 tooltip: 'bottomMiddle', 4817 target: 'topMiddle' 4818 }, 4819 adjust: { 4820 resize: true, 4821 scroll: true 4822 } 4820 }, 4821 show: { 4822 when: 'mouseover', 4823 // Don't specify a show event 4824 ready: false // Show the tooltip when ready 4825 }, 4826 hide: 'mouseout', 4827 // Don't specify a hide event 4828 style: { 4829 border: { 4830 width: 1, 4831 radius: 5 4823 4832 }, 4824 show: { 4825 when: 'mouseover', 4826 // Don't specify a show event 4827 ready: false // Show the tooltip when ready 4833 width: { 4834 min: 75, 4835 max: 1000 4828 4836 }, 4829 hide: 'mouseout', 4830 // Don't specify a hide event 4831 style: { 4832 border: { 4833 width: 1, 4834 radius: 5 4835 }, 4836 width: { 4837 min: 75, 4838 max: 1000 4839 }, 4840 padding: 5, 4841 textAlign: 'center', 4842 tip: true, 4843 // Give it a speech bubble tip with automatic corner detection 4844 name: 'blue' // Style it according to the preset 'cream' style 4845 } 4846 }); 4847 } 4848 4849 /* Substituída a variável onceOpenedMessages por onceOpenedHeadersMessages, 4850 porque essa última contem as mesmas informações da primeira, e está em escopo global.*/ 4851 4852 // Caso a mensagem ainda não esteja no cache: 4853 if ((onceOpenedHeadersMessages[folder_name] === undefined) || (onceOpenedHeadersMessages[folder_name][message_number] === undefined)) 4854 { 4855 proxy_mensagens.get_msg(message_number, folder_name, '', function (data) { handler_attach_message(data); }); 4856 } else 4857 { 4858 handler_attach_message(onceOpenedHeadersMessages[folder_name][message_number]); 4859 } 4860 4837 padding: 5, 4838 textAlign: 'center', 4839 tip: true, 4840 // Give it a speech bubble tip with automatic corner detection 4841 name: 'blue' // Style it according to the preset 'cream' style 4842 } 4843 }); 4861 4844 } 4862 4845
Note: See TracChangeset
for help on using the changeset viewer.