Changeset 6108 for trunk/expressoMail1_2/js/draw_api.js
- Timestamp:
- 05/04/12 18:03:44 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/draw_api.js
r6107 r6108 1407 1407 } 1408 1408 1409 function html_entities(string) {1410 return String(string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');1411 }1412 1413 1409 // Passar o parâmetro offset para esta função 1414 1410 function make_tr_message(headers_msgs, msg_folder, offsetToGMT){ 1415 headers_msgs.subject = html_entities(headers_msgs.subject); 1411 1416 1412 if (typeof offsetToGMT == 'undefined') 1417 1413 { … … 2913 2909 var subject = document.createElement("TD"); 2914 2910 subject.id = "subject_"+ID; 2915 subject.innerHTML = html_entities(info_msg.subject);2911 subject.innerHTML = info_msg.subject; 2916 2912 subject.className = "header_message_field"; 2917 2913 if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){ … … 3475 3471 return mySplit( term ).pop(); 3476 3472 } 3477 3478 function input_binds(input, ID){3479 var mySource = new Array();3480 var myArray = contacts.split(",");3481 for(var i in myArray){3482 var teste = myArray[i].split(";");3483 if(teste.length > 1)3484 mySource.push({name : teste[0], email: teste[1], value : (teste[0] +" - "+teste[1])});3485 else3486 mySource.push({name : "", email: teste[0], value :teste[0]});3487 }3488 input.bind( "keydown", function( event ) {3489 if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) {3490 event.preventDefault();3491 }3492 if((event.keyCode) == 120){3493 emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);3494 }3495 }).autocomplete({3496 minLength: 0,3497 source: function( request, response ) {3498 response( $.ui.autocomplete.filter(3499 mySource, extractLast( request.term ) ) );3500 },3501 focus: function() {3502 return false;3503 },3504 select: function( event, ui ) {3505 var terms = mySplit( this.value );3506 terms.pop();3507 terms.push( (ui.item.name != "" ? "\""+ui.item.name+"\" " : "") + (ui.item.email ? "<"+ui.item.email+">" : ""));3508 terms.push( "" );3509 this.value = terms.join( ", " );3510 return false;3511 }3512 }).data( "autocomplete" )._renderItem = function( ul, item ) {3513 ul.css({"max-height" : "115px", "overflow-y" : "auto"});3514 if( $(ul).find("li").length > 10 ){3515 return;3516 }3517 return $( "<li></li>" )3518 .data( "item.autocomplete", item )3519 .append( "<a>" + item.name + " - " + item.email + "</a>" )3520 .appendTo( ul );3521 };3522 input.parents("tr:first").find("button").button().click(function(){3523 emQuickSearch($(this).parents("tr:first").find("textarea").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);3524 });3525 }3526 3473 3527 3474 function draw_new_message(border_ID){ … … 3592 3539 } 3593 3540 3541 var input_binds = function(input){ 3542 var mySource = new Array(); 3543 var myArray = contacts.split(","); 3544 for(var i in myArray){ 3545 var teste = myArray[i].split(";"); 3546 if(teste.length > 1) 3547 mySource.push({name : teste[0], email: teste[1], value : (teste[0] +" - "+teste[1])}); 3548 else 3549 mySource.push({name : "", email: teste[0], value :teste[0]}); 3550 } 3551 input.bind( "keydown", function( event ) { 3552 if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { 3553 event.preventDefault(); 3554 } 3555 if((event.keyCode) == 120){ 3556 emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); 3557 } 3558 }).autocomplete({ 3559 minLength: 0, 3560 source: function( request, response ) { 3561 response( $.ui.autocomplete.filter( 3562 mySource, extractLast( request.term ) ) ); 3563 }, 3564 focus: function() { 3565 return false; 3566 }, 3567 select: function( event, ui ) { 3568 var terms = mySplit( this.value ); 3569 terms.pop(); 3570 terms.push( (ui.item.name != "" ? "\""+ui.item.name+"\" " : "") + (ui.item.email ? "<"+ui.item.email+">" : "")); 3571 terms.push( "" ); 3572 this.value = terms.join( ", " ); 3573 return false; 3574 } 3575 }).data( "autocomplete" )._renderItem = function( ul, item ) { 3576 ul.css({"max-height" : "115px", "overflow-y" : "auto"}); 3577 if( $(ul).find("li").length > 10 ){ 3578 return; 3579 } 3580 return $( "<li></li>" ) 3581 .data( "item.autocomplete", item ) 3582 .append( "<a>" + item.name + " - " + item.email + "</a>" ) 3583 .appendTo( ul ); 3584 }; 3585 input.parents("tr:first").find("button").button().click(function(){ 3586 emQuickSearch($(this).parents("tr:first").find("textarea").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); 3587 }); 3588 } 3594 3589 3595 input_binds(content.find('[name="input_to"]').css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur').focus() , ID);3590 input_binds(content.find('[name="input_to"]').css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur').focus()); 3596 3591 3597 3592 //Botão TextoRico/TextoSimples … … 3836 3831 }); 3837 3832 }); 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 : maxAttachmentSize3860 }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 else3886 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: false3913 }).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 }else3926 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');3932 3933 fileUploadMSG.find("span.message-attach-link").click(function(event){3934 jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {}));3935 $( "#mailpreview_container span.ui-icon-close" ).click();3936 jQuery('#message-attach-dialog').dialog({3937 width:920,3938 height:550,3939 resizable:false,3940 modal: true,3941 closeOnEscape:true,3942 close:function(event, ui) {event.stopPropagation(); },3943 autoOpen:false3944 });3945 3946 3947 jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){3948 jQuery('#message-attach-dialog').dialog('open');3949 jQuery('#message-attach-attach-btn').unbind('click');3950 jQuery('#message-attach-attach-btn').click(function(event){3951 jQuery.each(selectedMessages, function(folder_name, messages) {3952 jQuery.each(selectedMessages[folder_name], function(message_number, message) {3953 if (message) {3954 var att = new Object();3955 att.folder = folder_name;3956 att.uid = message_number;3957 att.type = 'imapMSG';3958 att.name = onceOpenedMessages[folder_name][message_number].subject + '.eml';3959 var idATT = JSON.stringify(att);3960 addAttachment( ID , idATT);3961 var attach = {};3962 attach.fileName = att.name3963 if(attach.fileName.length > 45)3964 attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length);3965 3966 attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size);3967 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));3968 upload.find('.status-upload').addClass('ui-icon ui-icon-check');3969 upload.find('.in-progress').remove();3970 upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>');3971 3972 upload.find('.button.close').button({3973 icons: {3974 primary: "ui-icon-close"3975 },3976 text: false3977 }).click(function(){3978 var idAttach = $(this).parent().find('input[name="fileId[]"]').val();3979 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]');3980 delAttachment(ID,idAttach);3981 $(this).parent().remove();3982 });3983 3984 fileUploadMSG.find('.attachments-list').append(upload);3985 }3986 3987 });3988 });3989 3990 jQuery('#message-attach-dialog').dialog('close');3991 3992 });3993 jQuery('#message-attach-cancel-btn').click(function(event){3994 jQuery('#message-attach-dialog').dialog('close');3995 });3996 });3997 3998 });3999 */4000 // style="width: 100px; height: 20px;"/4001 //$('[name="files[]"]').css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "cursor" : "pointer"});// "display": "none"4002 //$('[name="files[]"]').css({"display": "none"});-moz-transform : none;4003 3833 return ID; 4004 3834 }
Note: See TracChangeset
for help on using the changeset viewer.