Changeset 6512 for sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js
- Timestamp:
- 06/15/12 09:17:48 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js
r6460 r6512 9 9 */ 10 10 onceOpenedHeadersMessages = {}; 11 12 var dynamicPersonalContacts = new Array();13 var dynamicPersonalGroups = new Array();14 11 15 12 var openTab = { … … 1480 1477 if ((headers_msgs.Forwarded == 'F') || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ 1481 1478 td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; 1482 td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded. gif' title='"+get_lang('Forwarded')+"'>";1479 td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.png' title='"+get_lang('Forwarded')+"'>"; 1483 1480 headers_msgs.Draft = '' 1484 1481 headers_msgs.Answered = ''; … … 1486 1483 } 1487 1484 else if (headers_msgs.Draft == 'X') 1488 td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft. gif' title='"+get_lang('Draft')+"'>";1485 td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.png' title='"+get_lang('Draft')+"'>"; 1489 1486 else if (headers_msgs.Answered == 'A'){ 1490 1487 td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; 1491 td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered. gif' title='"+get_lang('Answered')+"'>";1488 td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.png' title='"+get_lang('Answered')+"'>"; 1492 1489 }else 1493 1490 td_element21.innerHTML = " "; … … 3510 3507 var newBox = location.before(html).prev(); 3511 3508 box_actions(newBox); 3512 if( preferences.expressoMail_ldap_identifier_recipient&& $(newBox).hasClass("invalid-email-box")){3509 if((preferences.expressoMail_ldap_identifier_recipient || personal)&& $(newBox).hasClass("invalid-email-box")){ 3513 3510 //$(newBox).find(".loading").css("background-image", "../prototype/modules/mail/img/ajax-loader.gif"); 3514 3511 show_detais(newBox, input_data, personal); … … 3672 3669 //AO SAIR DO FOCO MONTAGEM DA CAIXA DE EMAIL 3673 3670 .focusout(function(){ 3674 if(!(f9 || $(this).parents("tr:first").find("button").hasClass("ui-state-active"))){ 3675 if($(input).val() != "") 3676 draw_email_box(input.val(), input); 3677 if(input.hasClass("box-input")) 3678 input.remove(); 3679 } 3680 3681 input_search = $(input).val(); 3682 $(input).val(""); 3671 if(!$(this).data('is_open')){ 3672 if(!(f9 || $(this).parents("tr:first").find("button").hasClass("ui-state-active"))){ 3673 if($(input).val() != "") 3674 draw_email_box(input.val(), input); 3675 if(input.hasClass("box-input")) 3676 input.remove(); 3677 } 3678 3679 input_search = $(input).val(); 3680 $(input).val(""); 3681 } 3683 3682 }) 3684 3683 //AO COLAR UM TEXTO NO CAMPO … … 3793 3792 function show_detais(box, value, personal){ 3794 3793 var ldap_id = preferences.expressoMail_ldap_identifier_recipient; 3794 var group = (personal != undefined ? (personal == "G" ? true : false) : false); 3795 3796 if(group){ 3797 DataLayer.read("/group/"+value, {}, function(data){ 3798 if(!data.error){ 3799 if(data.collection.error) 3800 box.find(".box-loading").remove(); 3801 else{ 3802 //box.find(".box-loading").css("background-image", "url(templates/default/images/information.png) no-repeat! !important"); 3803 box.find(".box-loading").removeClass("box-loading").addClass("box-info"); 3804 box.addClass("box-"+value).removeClass("invalid-email-box"); 3805 loadGroupBox(data.collection, ".box-"+value); 3806 box.unbind("dblclick").bind("dblclick", function(e){ 3807 new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do catálogo pessoal\n' + 3808 '<strong>Porém</strong> é possivel remove-lo', { 3809 'buttons': false, 3810 'modal': false, 3811 'position': ['right - 20', 'top + 20'], 3812 'auto_close': 3000 3813 }); 3814 }).find(".box-input").val("\""+data.collection.data[1].value+"\" <"+data.collection.data[1].value+">"); 3815 box.find(".email-box-value").html( (data.collection.data[1].value.length > 18 ? data.collection.data[1].value.substring(0, 15)+"...": data.collection.data[1].value)) 3816 } 3817 }else{ 3818 box.find(".box-loading").remove(); 3819 } 3820 }); 3821 return; 3822 } 3823 3795 3824 if(personal){ 3796 3825 DataLayer.read("/contact/"+value, {}, function(data){ … … 3892 3921 if(parseInt(preferences.use_dynamic_contacts)){ 3893 3922 //PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS 3894 var dynamicContactList = new Array(); 3895 var groupsData = DataLayer.read("/groups").collection.itens; 3896 var contactsData = DataLayer.read("/contacts").collection.itens; 3897 dynamicPersonalGroups = new Array(); 3898 3899 $.each(groupsData, function(index, value){ 3900 var group = { 3901 id : parseInt(value.data[0].value), 3902 name : value.data[2].value, 3903 email : value.data[2].value, 3904 value: value.data[2].value + " - " + value.data[2].value, 3905 type: "G" 3906 }; 3907 dynamicContactList.push(group); 3908 dynamicPersonalGroups.push(group); 3909 }); 3910 3911 dynamicPersonalContacts = new Array(); 3912 3913 $.each(contactsData, function(index, value){ 3914 var contact = { 3915 id : parseInt(value.data[0].value), 3916 name : value.data[1].value, 3917 email : value.data[2].value, 3918 value: value.data[1].value + " - " + value.data[2].value, 3919 type: "P" 3920 }; 3921 dynamicContactList.push(contact); 3922 dynamicPersonalGroups.push(contact); 3923 }); 3923 3924 3924 $.widget( "custom.catcomplete", $.ui.autocomplete, { 3925 3925 _renderMenu: function( ul, items ) { 3926 3926 var self = this, 3927 currentType = " G";3927 currentType = ""; 3928 3928 $.each( items, function( index, item ) { 3929 3929 if ( item.type != currentType) { 3930 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 3930 if(item.type == "G" && $(ul).find(".dynamic-recent").length) 3931 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 3932 if(item.type == "P" && $(ul).find(".dynamic-group").length) 3933 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 3931 3934 currentType = item.type; 3932 3935 } 3933 3936 self._renderItem( ul, item ); 3937 $(ul).find("li:last").find(".dynamic-stars").raty({ 3938 readOnly : true, 3939 half : true, 3940 hints : ['','','','',''], 3941 score : ((parseInt(item.qtd)*5)/topContact), 3942 starOn : '../../prototype/plugins/jq-raty/img/star-on.png', 3943 starOff : '../../prototype/plugins/jq-raty/img/star-off.png', 3944 starHalf : '../../prototype/plugins/jq-raty/img/star-half.png' 3945 }); 3934 3946 }); 3935 3947 } … … 3938 3950 div.find("input").catcomplete({ 3939 3951 minLength: 1, 3940 source: dynamicContactList, 3952 source: function(request, response){ 3953 response( $.ui.autocomplete.filter(dynamicContactList, request.term ) ); 3954 }, 3941 3955 focus: function() { 3942 3956 return false; … … 3947 3961 event.preventDefault(); 3948 3962 $(this).val(""); 3949 draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.email+">" : ui.item.email, $(this)); 3963 if(ui.item.type == "P") 3964 draw_email_box(""+ui.item.id, $(this), true); 3965 else if(ui.item.type == "G") 3966 draw_email_box(""+ui.item.id, $(this), "G"); 3967 else 3968 draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.email+">" : ui.item.email, $(this)); 3950 3969 return false; 3951 3970 }, 3952 autoFocus: true 3971 autoFocus: true, 3972 position : { my: "left top", at: "left bottom", collision: "fit" } 3973 }).bind('catcompleteopen', function(event, ui) { 3974 $(this).data('is_open',true); 3975 }).bind('catcompleteclose', function(event, ui) { 3976 $(this).data('is_open',false); 3953 3977 }) 3954 3978 3955 3979 //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE 3956 3980 .data( "catcomplete" )._renderItem = function( ul, item ) { 3957 ul.css({"min-width":"280px", "width":"50%", "max-height" : "180px", "overflow-y" : "auto"}); 3958 if( $(ul).find("li").length > 10 ){ 3959 return; 3960 } 3961 var listContacts = DataLayer.render("../expressoMail1_2/templates/default/listContacts.ejs", item); 3962 3981 ul.css({"min-width":"400px", "width":"50%", "max-height" : "180px", "overflow-y" : "auto"}); 3982 var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); 3963 3983 return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ 3964 3984 icons : { … … 3968 3988 }).click(function(){ 3969 3989 var removeLi = $(this).parents("li:first"); 3970 $.Zebra_Dialog('Deseja remover este contato?', {3990 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.email+'</b>?', { 3971 3991 'type': 'question', 3972 3992 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), … … 3975 3995 'overlay_opacity': '0.5', 3976 3996 'onClose': function(caption) { 3977 if(caption == 'Sim') 3997 if(caption == 'Sim'){ 3978 3998 $(removeLi).remove(); 3999 DataLayer.delete("/dynamiccontact/"+item.id); 4000 updateDynamicContact(); 4001 updateDynamicContactList(); 4002 } 3979 4003 } 3980 4004 });
Note: See TracChangeset
for help on using the changeset viewer.