Changeset 6592 for trunk/expressoMail1_2/js/draw_api.js
- Timestamp:
- 06/22/12 18:01:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/draw_api.js
r6580 r6592 9 9 */ 10 10 onceOpenedHeadersMessages = {}; 11 11 var cache = new Array(); 12 12 var openTab = { 13 13 'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao … … 3551 3551 3552 3552 //DESENHO DAS CAIXA DE EMAIL 3553 function draw_email_box(input_data, location, personal ){3553 function draw_email_box(input_data, location, personal, shared){ 3554 3554 if($.trim(input_data) != ""){ 3555 3555 var box_data = valid_emails(input_data); … … 3559 3559 if((preferences.expressoMail_ldap_identifier_recipient || personal)&& $(newBox).hasClass("invalid-email-box")){ 3560 3560 //$(newBox).find(".loading").css("background-image", "../prototype/modules/mail/img/ajax-loader.gif"); 3561 show_detais(newBox, input_data, personal );3561 show_detais(newBox, input_data, personal, shared); 3562 3562 }else{ 3563 3563 $(newBox).find(".box-loading").remove(); … … 3855 3855 3856 3856 //MOSTRA OS DETALHES DAS CAIXA DE EMAIL NOS CAMPOS PARA - CC - CCO 3857 function show_detais(box, value, personal ){3857 function show_detais(box, value, personal, shared){ 3858 3858 var ldap_id = preferences.expressoMail_ldap_identifier_recipient; 3859 3859 var group = (personal != undefined ? (personal == "G" ? true : false) : false); 3860 3860 shared = shared ? shared : false; 3861 3861 if(group){ 3862 REST.get("/ group/"+value, {}, function(data){3862 REST.get("/"+ (shared ? "shared" : "") +"group/"+value, {}, function(data){ 3863 3863 if(!data.error){ 3864 3864 if(data.collection.error) … … 3886 3886 3887 3887 if(personal){ 3888 REST.get("/ contact/"+value, {}, function(data){3888 REST.get("/"+ (shared ? "shared" : "") +"contact/"+value, {}, function(data){ 3889 3889 if(!data.error){ 3890 3890 if(data.collection.error) … … 3989 3989 currentType = ""; 3990 3990 $.each( items, function( index, item ) { 3991 if ( item.type != currentType) {3992 if(item.type == "G" && $(ul).find(".dynamic-recent").length)3991 if ( item.typel != currentType) { 3992 if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length) 3993 3993 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 3994 if(item.type == "P" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length))3994 if(item.typel == "/contacts" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length)) 3995 3995 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 3996 currentType = item.type ;3996 currentType = item.typel; 3997 3997 } 3998 3998 self._renderItem( ul, item ); … … 4001 4001 half : true, 4002 4002 hints : ['','','','',''], 4003 score : (( parseInt(item.qtd)*5)/topContact),4003 score : ((item.number_of_messages*5)/topContact), 4004 4004 starOn : '../../prototype/plugins/jq-raty/img/star-on.png', 4005 4005 starOff : '../../prototype/plugins/jq-raty/img/star-off.png', … … 4007 4007 }); 4008 4008 }); 4009 if($(ul).find("li:last").hasClass("dynamic-separator")){ 4010 $(ul).find("li:last").remove(); 4011 } 4009 4012 } 4010 4013 }); … … 4013 4016 minLength: 1, 4014 4017 source: function(request, response){ 4015 response( $.ui.autocomplete.filter(dynamicContactList, request.term ) ); 4018 if ( request.term in cache ) { 4019 response( cache[ request.term ] ); 4020 return; 4021 } 4022 dynamicContacts = new Array(); 4023 REST.get("/usercontacts", false, function(data){ 4024 dynamicData = data.collection.itens; 4025 if(dynamicData){ 4026 $.each(dynamicData, function(index, value){ 4027 dynamic = {}; 4028 $.each(value.data, function(index, value){ 4029 dynamic[value.name] = value.value; 4030 }); 4031 dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; 4032 dynamic['type'] = value.dataType; 4033 dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ; 4034 dynamicContacts.push(dynamic); 4035 }); 4036 } 4037 var data = $.ui.autocomplete.filter(dynamicContacts, request.term ); 4038 cache[ request.term ] = data; 4039 response( data ); 4040 }); 4016 4041 }, 4017 4042 focus: function() { … … 4023 4048 event.preventDefault(); 4024 4049 $(this).val(""); 4025 if(ui.item.type == "P")4026 draw_email_box(""+ui.item.id, $(this), true );4027 else if(ui.item.type == "G")4028 draw_email_box(""+ui.item.id, $(this), "G" );4050 if(ui.item.typel == "/contacts") 4051 draw_email_box(""+ui.item.id, $(this), true, (ui.item.type.substring(0,7) == "/shared" ? true : false)); 4052 else if(ui.item.typel == "/groups") 4053 draw_email_box(""+ui.item.id, $(this), "G", (ui.item.type.substring(0,7) == "/shared" ? true : false)); 4029 4054 else 4030 draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item. email+">" : ui.item.email, $(this));4055 draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.mail+">" : ui.item.mail, $(this)); 4031 4056 return false; 4032 4057 }, … … 4041 4066 //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE 4042 4067 .data( "catcomplete" )._renderItem = function( ul, item ) { 4043 var autocomplete = $(this)[0].element; 4044 ul.css({"min-width":"400px", "width":"50%", "max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 4045 var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); 4046 return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ 4047 icons : { 4048 primary : "ui-icon-close" 4049 }, 4050 text: false 4051 }).click(function(event){ 4052 var removeLi = $(this).parents("li:first"); 4053 if(!event.keyCode) 4054 autocomplete.catcomplete( "close" ); 4055 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.email+'</b>?', { 4056 'type': 'question', 4057 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 4058 'title': 'Atenção', 4059 'buttons': ['Sim','Não'], 4060 'overlay_opacity': '0.5', 4061 'onClose': function(caption) { 4062 if(caption == 'Sim'){ 4063 $(removeLi).remove(); 4064 REST.delete("/dynamiccontact/"+item.id); 4065 updateDynamicContact(); 4066 updateDynamicContactList(); 4068 if($(ul).find("li").length < 50){ 4069 var autocomplete = $(this)[0].element; 4070 ul.css({"min-width":"500px", "width":"50%", "max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 4071 var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); 4072 return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ 4073 icons : { 4074 primary : "ui-icon-close" 4075 }, 4076 text: false 4077 }).click(function(event){ 4078 var removeLi = $(this).parents("li:first"); 4079 if(!event.keyCode) 4080 autocomplete.catcomplete( "close" ); 4081 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.email+'</b>?', { 4082 'type': 'question', 4083 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 4084 'title': 'Atenção', 4085 'buttons': ['Sim','Não'], 4086 'overlay_opacity': '0.5', 4087 'onClose': function(caption) { 4088 if(caption == 'Sim'){ 4089 $(removeLi).remove(); 4090 REST.delete("/dynamiccontact/"+item.id); 4091 updateDynamicContact(); 4092 updateDynamicContactList(); 4093 cache = new Array(); 4094 } 4067 4095 } 4068 }4096 }); 4069 4097 }); 4070 }); 4098 } 4099 return; 4071 4100 }; 4072 4101 }
Note: See TracChangeset
for help on using the changeset viewer.