- Timestamp:
- 10/17/12 17:40:10 (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/calendar/templates/default/app.css
r5132 r7437 289 289 font-style: italic; 290 290 } 291 292 div.line-separator{ 293 background: url("../../../expressoMail1_2/templates/default/images/linha.png") repeat-x scroll 0 8px transparent; 294 clear: both; 295 } -
trunk/calendar/templates/default/js/edit_exmail.js
r7336 r7437 323 323 div.bind('keydown',function(e){ 324 324 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 325 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( " catcomplete" ).menu.active ) {325 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { 326 326 e.preventDefault(); 327 327 return false; … … 329 329 330 330 //FECHA OS CONTATOS DINÂMICOS 331 if( (e.keyCode == 27) && $( this ).data( " catcomplete" ).menu.active ){331 if( (e.keyCode == 27) && $( this ).data( "autocomplete" ).menu.active ){ 332 332 e.stopPropagation(); 333 333 e.preventDefault(); … … 335 335 336 336 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 337 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( " catcomplete" ).menu.active){337 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "autocomplete" ).menu.active){ 338 338 e.preventDefault(); 339 339 return false; … … 361 361 } 362 362 363 function updateDynamicContact(){ 364 dynamicContacts = new Array(); 365 var dynamicUsers = REST.get("/dynamiccontacts"); 366 if(dynamicUsers.collection && !dynamicUsers.collection.error){ 367 var dynamicData = normalizeContacts(dynamicUsers.collection.itens) 368 369 $.each(dynamicData, function(index, value){ 370 if(index ==0){ 371 topContact = parseInt(value['number_of_messages']); 372 } 373 var dynamic = { 374 name : value.name, 375 mail : value.mail, 376 value: value.name + " - " + value.mail, 377 type: "", 378 id: value.id, 379 qtd : value['number_of_messages'] 380 }; 381 dynamicContacts.push(dynamic); 382 }); 383 } 363 function updateDynamicContact(userContacts){ 364 if(!userContacts) 365 userContacts = REST.get("/usercontacts", false); 366 367 if(userContacts.collection && !userContacts.collection.error){ 368 dynamicData = normalizeContacts(userContacts.collection.itens); 369 }else{ 370 dynamicData = []; 371 } 372 373 if(dynamicData){ 374 var dynamicContactsList = []; 375 $.each(dynamicData, function(index, dynamic){ 376 377 var dataType = userContacts.collection.itens[index].dataType; 378 379 dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; 380 dynamic['type'] = dataType 381 dynamic['typel'] = (dataType.substring(0,7) == "/shared" ? "/"+dataType.substring(7,dataType.length)+"s" : dataType) ; 382 dynamicContactsList.push(dynamic); 383 }); 384 } 385 386 dynamicData = dynamicContactsList; 384 387 } 385 388 … … 469 472 470 473 function showExParticipants(el,path){ 471 updateDynamicContact(); 472 updateDynamicPersonalContacts(); 473 REST.load(""); 474 //updateDynamicPersonalContacts(); 475 //REST.load(""); 474 476 controlInputBinds(); 475 477 Element('tbl_ext_participants').style.display=''; 476 478 el.style.display='none'; 477 $.widget( "custom.catcomplete", $.ui.autocomplete, { 478 _renderMenu: function( ul, items ) { 479 var self = this, 480 currentType = ""; 481 $.each( items, function( index, item ) { 482 if ( item.typel != currentType) { 483 if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length) 484 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 485 if(item.typel == "/contacts" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length)) 486 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 487 currentType = item.typel; 488 } 489 self._renderItem( ul, item ); 490 $(ul).find("li:last").find(".dynamic-stars").raty({ 491 readOnly : true, 492 half : true, 493 hints : ['','','','',''], 494 score : ((item.number_of_messages*5)/topContact) > 0.5 ? ((item.number_of_messages*5)/topContact) : 0.5, 495 starOn : '../prototype/plugins/jq-raty/img/star-on.png', 496 starOff : '../prototype/plugins/jq-raty/img/star-off.png', 497 starHalf : '../prototype/plugins/jq-raty/img/star-half.png' 498 }); 499 }); 500 501 if($(ul).find("li:last").hasClass("dynamic-separator")){ 502 $(ul).find("li:last").remove(); 503 } 504 $(ul).scroll(function(){ 505 canMakeBox = false; 506 }); 507 } 508 }); 509 $('#tbl_ext_participants').find('textarea').catcomplete({ 510 minLength: 1, 511 source: function(request, response){ 512 request.term = extractLast( request.term ); 513 if ( request.term in cache ) { 514 response( cache[ request.term ] ); 515 return; 516 } 517 dynamicContactsList = new Array(); 518 REST.get("/usercontacts", false, function(data){ 519 dynamicData = data.collection.itens; 520 if(dynamicData){ 521 $.each(dynamicData, function(index, value){ 522 dynamic = {}; 523 $.each(value.data, function(index, value){ 524 dynamic[value.name] = value.value; 525 }); 526 dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; 527 dynamic['type'] = value.dataType; 528 dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ; 529 dynamicContactsList.push(dynamic); 530 }); 531 } 532 var data = $.ui.autocomplete.filter(dynamicContactsList, request.term ); 533 cache[ request.term ] = data; 534 response( data ); 535 }); 536 }, 537 focus: function() { 538 return false; 539 }, 540 541 //EVENTO AO SELECIONAR UM CONTATO DINÂMICO 542 select: function( event, ui ) { 543 event.preventDefault(); 544 update_mailField((ui.item.name ? ui.item.name : ""),ui.item.mail); 545 }, 546 position : { my: "left top", at: "left bottom", collision: "fit" } 547 }).bind('catcompleteopen', function(event, ui) { 548 $(this).data('is_open',true); 549 }).bind('catcompleteclose', function(event, ui) { 550 $(this).data('is_open',false); 551 }) 552 553 //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE 554 .data( "catcomplete" )._renderItem = function( ul, item ) { 555 if($(ul).find("li").length < 50){ 556 var autocomplete = $(this)[0].element; 557 //cálculo dinâmico da largura da lista 558 var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.email ? item.email.length : 20 ))); 559 width = width*5 + (is_ie ? 170 : 200) + 16; 560 if (width < $(ul).width()) 561 width = $(ul).width(); 562 ul.css({"min-width":width,"max-width":$('#tbl_ext_participants').find('textarea').width(),"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 563 var listContacts = DataLayer.render("calendar/templates/default/listContacts.ejs", item); 564 return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ 565 icons : { 566 primary : "ui-icon-close" 567 }, 568 text: false 569 }).click(function(event){ 570 var removeLi = $(this).parents("li:first"); 571 if(!event.keyCode) 572 autocomplete.catcomplete( "close" ); 573 canMakeBox = false; 574 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.mail+'</b>?', { 575 'type': 'question', 576 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 577 'title': 'Atenção', 578 'buttons': ['Sim','Não'], 579 'overlay_opacity': '0.5', 580 'onClose': function(caption) { 581 if(caption == 'Sim'){ 582 $(removeLi).remove(); 583 REST['delete']("/dynamiccontact/"+item.id); 584 updateDynamicContact(); 585 cache = new Array(); 586 }else if(caption == 'Não'){ 587 $(focusIn).focus(); 588 } 589 } 590 }); 591 }); 592 } 593 return; 594 }; 595 } 479 480 //PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS 481 482 var decodeType = { 483 '/dynamiccontacts': { 484 css: 'recent', 485 img: 'recent', 486 text: 'Contato Recente' 487 }, 488 '/personalContact':{ 489 css: 'personal', 490 img: 'personal', 491 text: 'Contato pessoal' 492 }, 493 '/sharedcontact':{ 494 css: 'personal', 495 img: 'sharedcontact', 496 text: 'Contato compartilhado' 497 }, 498 '/groups':{ 499 css: 'group', 500 img: 'group', 501 text: 'Grupo pessoal' 502 }, 503 '/sharedgroup':{ 504 css: 'group', 505 img: 'sharedgroup', 506 text: 'Grupo compartilhado' 507 } 508 } 509 510 $('#tbl_ext_participants').find('textarea').autocomplete({ 511 source: function(request, response){ 512 if ( request.term in cache ) { 513 response( cache[ request.term ] ); 514 return; 515 } 516 517 if(dynamicData === false){ 518 updateDynamicContact(); 519 } 520 521 var data = $.ui.autocomplete.filter(dynamicData, extractLast( request.term ) ).slice(0, 50); 522 cache[ request.term ] = data; 523 response( data ); 524 }, 525 focus: function() { 526 return false; 527 }, 528 529 //EVENTO AO SELECIONAR UM CONTATO DINÂMICO 530 select: function( event, ui ) { 531 event.preventDefault(); 532 update_mailField((ui.item.name ? ui.item.name : ""),ui.item.mail); 533 }, 534 autoFocus: true, 535 position : { my: "left top", at: "left bottom", collision: "fit" }, 536 delay : 120, 537 minLength: 0 538 }).bind('autocompleteopen', function(event, ui) { 539 540 $(this).data('is_open',true); 541 542 }).bind('autocompleteclose', function(event, ui) { 543 544 canMakeBox = true; 545 $(this).data('is_open',false); 546 547 }).data( "autocomplete" )._renderItem = function( ul, item ) { 548 549 if(item.typel == "/groups") 550 return true; 551 552 var autocomplete = $(this)[0].element; 553 554 //cálculo dinâmico da largura da lista 555 var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.mail ? item.mail.length : 20 ))); 556 width = width*5 + (is_ie ? 170 : 200) + 16; 557 558 width = (width < $(ul).width()) ? $(ul).width() : width; 559 560 ul.css({"min-width":width,"max-width":$('#tbl_ext_participants').find('textarea').width(),"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 561 562 item.raty = ((item.number_of_messages*10)/topContact) > 1 ? ((item.number_of_messages*10)/topContact) : 1; 563 564 if ( item.typel != currentTypeContact) { 565 if((item.typel == "/groups" && $(ul).find(".dynamic-recent").length) || (item.typel == "/personalContact" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length))){ 566 currentTypeContact = item.typel; 567 item.asDiv = true; 568 }else{ 569 currentTypeContact = item.typel; 570 } 571 } 572 573 var li = ''; 574 if(item.asDiv){ 575 li = '<li class="dynamic-separator"><div class="line-separator"> </div></li>'; 576 } 577 li += '<li class="dynamic-'+ decodeType[item.type].css +'">'; 578 li += '<a style="width:'+(item.type == '/dynamiccontacts' ? '91%' : '97.5%')+'; display: inline-block; background: none;">'; 579 li += '<img style="position:relative; top:2px; "src="prototype/modules/mail/img/'+ decodeType[item.type].img +'.png" title="'+ decodeType[item.type].text +'"/>'; 580 li += ($.trim(item.name) != "" ? ((item.name.length > 20 ? item.name.substring(0,17)+"..." : item.name) + " - " ) : '') + item.mail; 581 li += item.type == '/dynamiccontacts' ? '<div class="dynamic-stars" style="display: inline-block;float: right;" id="'+item.raty+'_'+item.id+'"/>' : '' 582 li += '</a>'; 583 li += '<span style="width:16px; height:16px; top:1px; left:7px; '+ (item.type == '/dynamiccontacts' ? '': 'display:none') +'">Excluir contato recente</span>'; 584 li += '</li>'; 585 586 587 li = $( li ) 588 .data( "item.autocomplete", item ) 589 //.append( li ) 590 .appendTo( ul ); 591 592 li.find("span").button({ 593 icons : { 594 primary : "ui-icon-close" 595 }, 596 text: false 597 }).click(function(event){ 598 if(!event.keyCode) 599 autocomplete.autocomplete( "close" ); 600 601 canMakeBox = false; 602 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? (item.name.length <= 30 ? item.name: item.name.substr(0,27)+"...")+" - " : "")+ item.mail+'</b>?', { 603 'type': 'question', 604 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 605 'buttons': ['Sim','Não'], 606 'overlay_opacity': '0.5', 607 'onClose': function(caption) { 608 if(caption == 'Sim'){ 609 610 REST['delete']("/dynamiccontact/"+item.id); 611 updateDynamicContact(); 612 cache = new Array(); 613 }else if(caption == 'Não'){ 614 $(focusIn).focus(); 615 } 616 } 617 }); 618 }); 619 620 li.find(".dynamic-stars").jRating({ 621 step:true, 622 length : 5, // nb of stars 623 decimalLength: 2, // number of decimal in the rate 624 rateMax: 10, 625 isDisabled:true, 626 bigStarsPath : 'prototype/plugins/jquery.jrating/icons/stars.png', // path of the icon stars.png 627 smallStarsPath : 'prototype/plugins/jquery.jrating/icons/small.png' // path of the icon small.png 628 }); 629 630 if($(ul).find("li:last").hasClass("dynamic-separator")){ 631 $(ul).find("li:last").remove(); 632 } 633 634 $(ul).scroll(function(){ 635 canMakeBox = false; 636 }); 637 638 return li; 639 }; 640 } 596 641 597 642 function hideExParticipants(el,path){ -
trunk/expressoMail1_2/index.php
r7420 r7437 32 32 <link rel="stylesheet" type="text/css" href="../prototype/plugins/fullcalendar/fullcalendar.print.css"></link> 33 33 <link rel="stylesheet" type="text/css" href="../prototype/plugins/icalendar/jquery.icalendar.css"></link> 34 34 <link rel="stylesheet" type="text/css" href="../prototype/plugins/jquery.jrating/jRating.jquery.css"></link> 35 35 36 <script type="text/javascript" src="../prototype/plugins/jquery/jquery.min.js"></script> 36 37 <link href="../prototype/modules/filters/filters.css" rel="stylesheet" type="text/css"> … … 66 67 <script type="text/javascript" src="../prototype/plugins/datejs/parser.js"></script> 67 68 <script type="text/javascript" src="../prototype/plugins/jq-raty/js/jquery.raty.min.js"></script> 69 <script type="text/javascript" src="../prototype/plugins/jquery.jrating/jRating.jquery.js"></script> 68 70 69 71 <script type="text/javascript" src="../prototype/plugins/watermark/jquery.watermarkinput.js"></script> … … 346 348 347 349 '; 348 350 349 351 350 352 // End Set Imap Folder names options -
trunk/expressoMail1_2/js/draw_api.js
r7422 r7437 4050 4050 if(parseInt(preferences.use_dynamic_contacts) && !input.hasClass("box-input")){ 4051 4051 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 4052 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( " catcomplete" ).menu.active ) {4052 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { 4053 4053 e.preventDefault(); 4054 4054 return false; … … 4056 4056 4057 4057 //FECHA OS CONTATOS DINÂMICOS 4058 if( (e.keyCode == 27) && $( this ).data( " catcomplete" ).menu.active ){4058 if( (e.keyCode == 27) && $( this ).data( "autocomplete" ).menu.active ){ 4059 4059 e.stopPropagation(); 4060 4060 e.preventDefault(); … … 4062 4062 4063 4063 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 4064 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( " catcomplete" ).menu.active){4064 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "autocomplete" ).menu.active){ 4065 4065 e.preventDefault(); 4066 4066 return false; 4067 4067 } 4068 4068 4069 if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( " catcomplete" ).menu.active){4070 if($($( this ).data( " catcomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent"))4071 $($( this ).data( " catcomplete" ).menu.element).find(".ui-state-hover").next().trigger("click");4069 if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( "autocomplete" ).menu.active){ 4070 if($($( this ).data( "autocomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent")) 4071 $($( this ).data( "autocomplete" ).menu.element).find(".ui-state-hover").next().trigger("click"); 4072 4072 return false; 4073 4073 } … … 4443 4443 } 4444 4444 4445 dynamicData = false; 4446 currentTypeContact = ''; 4445 4447 4446 4448 //FUNÇÃO QUE "SETA" OS BINDS DOS CAMPOS PARA - CC - CCO … … 4488 4490 //VERIFICA PREFERENCIA DE CONTATOS DINÂMICOS ESTA ATIVA 4489 4491 if(parseInt(preferences.use_dynamic_contacts)){ 4492 4493 REST.get("/usercontacts", false, updateDynamicContact); 4494 4490 4495 //PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS 4491 4496 4492 $.widget( "custom.catcomplete", $.ui.autocomplete, { 4493 _renderMenu: function( ul, items ) { 4494 var self = this, 4495 currentType = ""; 4496 $.each( items, function( index, item ) { 4497 if ( item.typel != currentType) { 4498 if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length) 4499 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 4500 if(item.typel == "/personalContact" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length)) 4501 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 4502 currentType = item.typel; 4503 } 4504 self._renderItem( ul, item ); 4505 $(ul).find("li:last").find(".dynamic-stars").raty({ 4506 readOnly : true, 4507 half : true, 4508 hints : ['','','','',''], 4509 score : ((item.number_of_messages*5)/topContact) > 0.5 ? ((item.number_of_messages*5)/topContact) : 0.5, 4510 starOn : '../../prototype/plugins/jq-raty/img/star-on.png', 4511 starOff : '../../prototype/plugins/jq-raty/img/star-off.png', 4512 starHalf : '../../prototype/plugins/jq-raty/img/star-half.png' 4513 }); 4514 }); 4515 if($(ul).find("li:last").hasClass("dynamic-separator")){ 4516 $(ul).find("li:last").remove(); 4517 } 4518 $(ul).scroll(function(){ 4519 canMakeBox = false; 4520 }); 4521 } 4522 }); 4523 //INSERÇÃO DO AUTO COMPLETE AO INPUT 4524 div.find("textarea").catcomplete({ 4525 minLength: 1, 4526 source: function(request, response){ 4527 if ( request.term in cache ) { 4528 response( cache[ request.term ] ); 4529 return; 4530 } 4531 dynamicContactsList = new Array(); 4532 REST.get("/usercontacts", false, function(data){ 4533 dynamicData = data.collection.itens; 4534 if(dynamicData){ 4535 $.each(dynamicData, function(index, value){ 4536 dynamic = {}; 4537 $.each(value.data, function(index, value){ 4538 dynamic[value.name] = value.value; 4539 }); 4540 dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; 4541 dynamic['type'] = value.dataType; 4542 dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ; 4543 dynamicContactsList.push(dynamic); 4544 }); 4545 } 4546 var data = $.ui.autocomplete.filter(dynamicContactsList, request.term ); 4547 cache[ request.term ] = data; 4548 response( data ); 4549 }); 4550 }, 4551 focus: function() { 4552 return false; 4553 }, 4554 4555 //EVENTO AO SELECIONAR UM CONTATO DINÂMICO 4556 select: function( event, ui ) { 4557 canMakeBox = false; 4558 event.preventDefault(); 4559 $(this).val(""); 4560 if(ui.item.typel == "/personalContact") 4561 draw_email_box(""+ui.item.id, $(this), true, (ui.item.type.substring(0,7) == "/shared" ? true : false)); 4562 else if(ui.item.typel == "/groups") 4563 draw_email_box(""+ui.item.id, $(this), "G", (ui.item.type.substring(0,7) == "/shared" ? true : false)); 4564 else 4565 draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.mail+">" : ui.item.mail, $(this)); 4566 return false; 4567 }, 4568 autoFocus: true, 4569 position : { my: "left top", at: "left bottom", collision: "fit" }, 4570 delay : 400 4571 }).bind('catcompleteopen', function(event, ui) { 4572 $(this).data('is_open',true); 4573 }).bind('catcompleteclose', function(event, ui) { 4574 canMakeBox = true; 4575 $(this).data('is_open',false); 4576 }) 4577 4578 //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE 4579 .data( "catcomplete" )._renderItem = function( ul, item ) { 4580 if($(ul).find("li").length < 50){ 4581 var autocomplete = $(this)[0].element; 4582 //cálculo dinâmico da largura da lista 4583 var minwidth = 450; 4584 var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.mail ? item.mail.length : 30 ))); 4585 width = (is_ie ? width*2 : (is_webkit && !is_mozilla ? width*4 : width*5)) + 30; 4586 if (width < minwidth) 4587 width = minwidth; 4588 ul.css({"min-width":width,"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 4589 var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); 4590 return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ 4591 icons : { 4592 primary : "ui-icon-close" 4593 }, 4594 text: false 4595 }).click(function(event){ 4596 var removeLi = $(this).parents("li:first"); 4597 if(!event.keyCode) 4598 autocomplete.catcomplete( "close" ); 4599 canMakeBox = false; 4600 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? (item.name.length <=30 ? item.name: item.name.substr(0,27)+"...")+" - " : "")+ item.mail+'</b>?', { 4601 'type': 'question', 4602 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 4603 'title': 'Atenção', 4604 'buttons': ['Sim','Não'], 4605 'overlay_opacity': '0.5', 4606 'onClose': function(caption) { 4607 if(caption == 'Sim'){ 4608 $(removeLi).remove(); 4609 REST['delete']("/dynamiccontact/"+item.id); 4610 updateDynamicContact(); 4611 cache = new Array(); 4612 }else if(caption == 'Não'){ 4613 $(focusIn).focus(); 4614 } 4615 } 4616 }); 4617 }); 4618 } 4619 return; 4620 }; 4621 } 4622 4497 var decodeType = { 4498 '/dynamiccontacts': { 4499 css: 'recent', 4500 img: 'recent', 4501 text: 'Contato Recente' 4502 }, 4503 '/personalContact':{ 4504 css: 'personal', 4505 img: 'personal', 4506 text: 'Contato pessoal' 4507 }, 4508 '/sharedcontact':{ 4509 css: 'personal', 4510 img: 'sharedcontact', 4511 text: 'Contato compartilhado' 4512 }, 4513 '/groups':{ 4514 css: 'group', 4515 img: 'group', 4516 text: 'Grupo pessoal' 4517 }, 4518 '/sharedgroup':{ 4519 css: 'group', 4520 img: 'sharedgroup', 4521 text: 'Grupo compartilhado' 4522 } 4523 } 4524 4525 div.find("textarea").autocomplete({ 4526 source: function(request, response){ 4527 if ( request.term in cache ) { 4528 response( cache[ request.term ] ); 4529 return; 4530 } 4531 4532 if(dynamicData === false){ 4533 updateDynamicContact(); 4534 } 4535 4536 var data = $.ui.autocomplete.filter(dynamicData, request.term ).slice(0, 50); 4537 cache[ request.term ] = data; 4538 response( data ); 4539 4540 }, 4541 focus: function() { 4542 return false; 4543 }, 4544 4545 //EVENTO AO SELECIONAR UM CONTATO DINÂMICO 4546 select: function( event, ui ) { 4547 canMakeBox = false; 4548 4549 event.preventDefault(); 4550 $(this).val(""); 4551 4552 var isShared = (ui.item.type.substring(0,7) == "/shared"); 4553 4554 switch (ui.item.typel){ 4555 case '/personalContact': 4556 draw_email_box(""+ui.item.id, $(this), true, isShared); 4557 break; 4558 case '/groups': 4559 draw_email_box(""+ui.item.id, $(this), "G", isShared); 4560 break; 4561 default: 4562 draw_email_box(ui.item.name ? ("\""+ui.item.name+"\" <"+ui.item.mail+">") : ui.item.mail, $(this)); 4563 } 4564 4565 return false; 4566 }, 4567 autoFocus: true, 4568 position : { my: "left top", at: "left bottom", collision: "fit" }, 4569 delay : 120, 4570 minLength: 0 4571 }).bind('catcompleteopen', function(event, ui) { 4572 4573 $(this).data('is_open',true); 4574 4575 }).bind('catcompleteclose', function(event, ui) { 4576 4577 canMakeBox = true; 4578 $(this).data('is_open',false); 4579 4580 }).data( "autocomplete" )._renderItem = function( ul, item ) { 4581 var autocomplete = $(this)[0].element; 4582 4583 //cálculo dinâmico da largura da lista 4584 var minwidth = 450; 4585 var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.mail ? item.mail.length : 30 ))); 4586 width = (is_ie ? width*2 : (is_webkit && !is_mozilla ? width*4 : width*5)) + 30; 4587 if (width < minwidth) 4588 width = minwidth; 4589 4590 ul.css({"min-width":width, "max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 4591 4592 item.raty = ((item.number_of_messages*10)/topContact) > 1 ? ((item.number_of_messages*10)/topContact) : 1; 4593 4594 if ( item.typel != currentTypeContact) { 4595 if((item.typel == "/groups" && $(ul).find(".dynamic-recent").length) || (item.typel == "/personalContact" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length))){ 4596 currentTypeContact = item.typel; 4597 item.asDiv = true; 4598 }else{ 4599 currentTypeContact = item.typel; 4600 } 4601 } 4602 4603 var li = ''; 4604 if(item.asDiv){ 4605 li = '<li class="dynamic-separator"><div class="line-separator"> </div></li>'; 4606 } 4607 li += '<li class="dynamic-'+ decodeType[item.type].css +'">'; 4608 li += '<a style="width:'+(item.type == '/dynamiccontacts' ? '91%' : '97.5%')+'; display: inline-block; background: none;">'; 4609 li += '<img style="position:relative; top:2px; "src="../prototype/modules/mail/img/'+ decodeType[item.type].img +'.png" title="'+ decodeType[item.type].text +'"/>'; 4610 li += ($.trim(item.name) != "" ? ((item.name.length > 20 ? item.name.substring(0,17)+"..." : item.name) + " - " ) : '') + item.mail; 4611 li += item.type == '/dynamiccontacts' ? '<div class="dynamic-stars" style="display: inline-block;float: right;" id="'+item.raty+'_'+item.id+'"/>' : '' 4612 li += '</a>'; 4613 li += '<span style="width:16px; height:16px; top:1px; left:7px; '+ (item.type == '/dynamiccontacts' ? '': 'display:none') +'">Excluir contato recente</span>'; 4614 li += '</li>'; 4615 4616 4617 li = $( li ) 4618 .data( "item.autocomplete", item ) 4619 //.append( li ) 4620 .appendTo( ul ); 4621 4622 li.find("span").button({ 4623 icons : { 4624 primary : "ui-icon-close" 4625 }, 4626 text: false 4627 }).click(function(event){ 4628 if(!event.keyCode) 4629 autocomplete.autocomplete( "close" ); 4630 4631 canMakeBox = false; 4632 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? (item.name.length <= 30 ? item.name: item.name.substr(0,27)+"...")+" - " : "")+ item.mail+'</b>?', { 4633 'type': 'question', 4634 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 4635 'buttons': ['Sim','Não'], 4636 'overlay_opacity': '0.5', 4637 'onClose': function(caption) { 4638 if(caption == 'Sim'){ 4639 4640 REST['delete']("/dynamiccontact/"+item.id); 4641 updateDynamicContact(); 4642 cache = new Array(); 4643 }else if(caption == 'Não'){ 4644 $(focusIn).focus(); 4645 } 4646 } 4647 }); 4648 }); 4649 4650 li.find(".dynamic-stars").jRating({ 4651 step:true, 4652 length : 5, // nb of stars 4653 decimalLength: 2, // number of decimal in the rate 4654 rateMax: 10, 4655 isDisabled:true, 4656 bigStarsPath : '../prototype/plugins/jquery.jrating/icons/stars.png', // path of the icon stars.png 4657 smallStarsPath : '../prototype/plugins/jquery.jrating/icons/small.png' // path of the icon small.png 4658 }); 4659 4660 if($(ul).find("li:last").hasClass("dynamic-separator")){ 4661 $(ul).find("li:last").remove(); 4662 } 4663 4664 $(ul).scroll(function(){ 4665 canMakeBox = false; 4666 }); 4667 4668 return li; 4669 }; 4670 } 4671 4623 4672 //FUNÇÃO DOS BOTÕES PARA - CC - CCO 4624 4673 div.parents("tr:first").find("button").button().click(function(){ -
trunk/expressoMail1_2/js/main.js
r7427 r7437 39 39 } 40 40 41 function updateDynamicContact(){ 42 dynamicContacts = new Array(); 41 function updateDynamicContact(userContacts){ 42 43 if(!userContacts) 44 userContacts = REST.get("/usercontacts", false); 45 46 if(userContacts.collection && !userContacts.collection.error){ 47 dynamicData = normalizeContacts(userContacts.collection.itens); 48 }else{ 49 dynamicData = []; 50 } 51 52 if(dynamicData){ 53 var dynamicContactsList = []; 54 $.each(dynamicData, function(index, dynamic){ 55 56 var dataType = userContacts.collection.itens[index].dataType; 57 58 dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; 59 dynamic['type'] = dataType 60 dynamic['typel'] = (dataType.substring(0,7) == "/shared" ? "/"+dataType.substring(7,dataType.length)+"s" : dataType); 61 62 topContact = dynamic.number_of_messages > topContact ? dynamic.number_of_messages : topContact; 63 64 dynamicContactsList.push(dynamic); 65 }); 66 } 67 68 dynamicData = dynamicContactsList; 69 70 71 /*dynamicContacts = new Array(); 43 72 44 73 var dynamicUsers = REST.get("/dynamiccontacts"); … … 61 90 dynamicContacts.push(dynamic); 62 91 }); 63 } 92 }*/ 64 93 } 65 94 … … 2907 2936 if(!stop){ 2908 2937 var exist = 0; 2909 $.each(dynamic Contacts, function(x, valuex){2938 $.each(dynamicData, function(x, valuex){ 2910 2939 if(valuex.mail == $(value).find("input").val().match(reComplexEmail)[1]){ 2911 2940 exist = valuex.id; -
trunk/index.php
r7188 r7437 154 154 <script type="text/javascript" src="prototype/api/rest.js"></script> 155 155 <script src="prototype/api/datalayer.js" language="javascript"></script> 156 <script type="text/javascript" src="prototype/plugins/jq-raty/js/jquery.raty.min.js"></script>157 156 <script type="text/javascript">DataLayer.dispatchPath = "/"; REST.dispatchPath = "prototype/";REST.load("")</script> 158 157 <link rel="stylesheet" type="text/css" href="prototype/plugins/zebradialog/css/zebra_dialog.css"></link> … … 161 160 <script src="expressoMail1_2/js/ccQuickAdd.js" type="text/javascript"></script> 162 161 '; 163 if($modulo[0] == 'calendar') 164 echo '<script src="expressoMail1_2/js/common_functions.js" type="text/javascript"></script>'; 162 if($modulo[0] == 'calendar'){ 163 echo '<link rel="stylesheet" href="prototype/plugins/jquery.jrating/jRating.jquery.css" type="text/css" /> 164 <script type="text/javascript" src="prototype/plugins/jquery.jrating/jRating.jquery.js"></script> 165 <script src="expressoMail1_2/js/common_functions.js" type="text/javascript"></script> 166 <script type="text/javascript">userContacts = false; currentTypeContact = ""; REST.get("/usercontacts", false, updateDynamicContact);</script>'; 167 } 168 165 169 } 166 170 }
Note: See TracChangeset
for help on using the changeset viewer.