Changeset 7444 for branches/2.4
- Timestamp:
- 10/18/12 18:14:14 (12 years ago)
- Location:
- branches/2.4
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4/calendar/templates/default/app.css
r5132 r7444 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 } -
branches/2.4/calendar/templates/default/js/edit_exmail.js
r7339 r7444 322 322 div.bind('keydown',function(e){ 323 323 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 324 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( " catcomplete" ).menu.active ) {324 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { 325 325 e.preventDefault(); 326 326 return false; … … 328 328 329 329 //FECHA OS CONTATOS DINÂMICOS 330 if( (e.keyCode == 27) && $( this ).data( " catcomplete" ).menu.active ){330 if( (e.keyCode == 27) && $( this ).data( "autocomplete" ).menu.active ){ 331 331 e.stopPropagation(); 332 332 e.preventDefault(); … … 334 334 335 335 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 336 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( " catcomplete" ).menu.active){336 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "autocomplete" ).menu.active){ 337 337 e.preventDefault(); 338 338 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){ -
branches/2.4/expressoMail1_2/index.php
r7228 r7444 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> 68 69 <script type="text/javascript" src="../prototype/plugins/jquery.jrating/jRating.jquery.js"></script> 70 69 71 <script type="text/javascript" src="../prototype/plugins/watermark/jquery.watermarkinput.js"></script> 70 72 <script type="text/javascript" src="../prototype/plugins/mask/jquery.maskedinput.js"></script> -
branches/2.4/expressoMail1_2/js/draw_api.js
r7380 r7444 3886 3886 if(parseInt(preferences.use_dynamic_contacts) && !input.hasClass("box-input")){ 3887 3887 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 3888 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( " catcomplete" ).menu.active ) {3888 if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { 3889 3889 e.preventDefault(); 3890 3890 return false; … … 3892 3892 3893 3893 //FECHA OS CONTATOS DINÂMICOS 3894 if( (e.keyCode == 27) && $( this ).data( " catcomplete" ).menu.active ){3894 if( (e.keyCode == 27) && $( this ).data( "autocomplete" ).menu.active ){ 3895 3895 e.stopPropagation(); 3896 3896 e.preventDefault(); … … 3898 3898 3899 3899 //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 3900 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( " catcomplete" ).menu.active){3900 if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "autocomplete" ).menu.active){ 3901 3901 e.preventDefault(); 3902 3902 return false; 3903 3903 } 3904 3904 3905 if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( " catcomplete" ).menu.active){3906 if($($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent")) 3907 $($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").next().trigger("click");3905 if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( "autocomplete" ).menu.active){ 3906 if($($( this ).data( "autocomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent")) 3907 $($( this ).data( "autocomplete" ).menu.element).find(".ui-state-hover").next().trigger("click"); 3908 3908 return false; 3909 3909 } … … 4279 4279 } 4280 4280 4281 dynamicData = false; 4282 currentTypeContact = ''; 4281 4283 4282 4284 //FUNÇÃO QUE "SETA" OS BINDS DOS CAMPOS PARA - CC - CCO … … 4324 4326 //VERIFICA PREFERENCIA DE CONTATOS DINÂMICOS ESTA ATIVA 4325 4327 if(parseInt(preferences.use_dynamic_contacts)){ 4328 4329 REST.get("/usercontacts", false, updateDynamicContact); 4330 4326 4331 //PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS 4327 4332 4328 $.widget( "custom.catcomplete", $.ui.autocomplete, { 4329 _renderMenu: function( ul, items ) { 4330 var self = this, 4331 currentType = ""; 4332 $.each( items, function( index, item ) { 4333 if ( item.typel != currentType) { 4334 if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length) 4335 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 4336 if(item.typel == "/personalContact" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length)) 4337 self._renderItem( ul, {name:"", value:"", type:"linha"} ); 4338 currentType = item.typel; 4339 } 4340 self._renderItem( ul, item ); 4341 $(ul).find("li:last").find(".dynamic-stars").raty({ 4342 readOnly : true, 4343 half : true, 4344 hints : ['','','','',''], 4345 score : ((item.number_of_messages*5)/topContact) > 0.5 ? ((item.number_of_messages*5)/topContact) : 0.5, 4346 starOn : '../../prototype/plugins/jq-raty/img/star-on.png', 4347 starOff : '../../prototype/plugins/jq-raty/img/star-off.png', 4348 starHalf : '../../prototype/plugins/jq-raty/img/star-half.png' 4349 }); 4350 }); 4351 if($(ul).find("li:last").hasClass("dynamic-separator")){ 4352 $(ul).find("li:last").remove(); 4353 } 4354 $(ul).scroll(function(){ 4355 canMakeBox = false; 4356 }); 4357 } 4358 }); 4359 //INSERÇÃO DO AUTO COMPLETE AO INPUT 4360 div.find("textarea").catcomplete({ 4361 minLength: 1, 4362 source: function(request, response){ 4363 if ( request.term in cache ) { 4364 response( cache[ request.term ] ); 4365 return; 4366 } 4367 dynamicContactsList = new Array(); 4368 REST.get("/usercontacts", false, function(data){ 4369 dynamicData = data.collection.itens; 4370 if(dynamicData){ 4371 $.each(dynamicData, function(index, value){ 4372 dynamic = {}; 4373 $.each(value.data, function(index, value){ 4374 dynamic[value.name] = value.value; 4375 }); 4376 dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; 4377 dynamic['type'] = value.dataType; 4378 dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ; 4379 dynamicContactsList.push(dynamic); 4380 }); 4381 } 4382 var data = $.ui.autocomplete.filter(dynamicContactsList, request.term ); 4383 cache[ request.term ] = data; 4384 response( data ); 4385 }); 4386 }, 4387 focus: function() { 4388 return false; 4389 }, 4390 4391 //EVENTO AO SELECIONAR UM CONTATO DINÂMICO 4392 select: function( event, ui ) { 4393 canMakeBox = false; 4394 event.preventDefault(); 4395 $(this).val(""); 4396 if(ui.item.typel == "/personalContact") 4397 draw_email_box(""+ui.item.id, $(this), true, (ui.item.type.substring(0,7) == "/shared" ? true : false)); 4398 else if(ui.item.typel == "/groups") 4399 draw_email_box(""+ui.item.id, $(this), "G", (ui.item.type.substring(0,7) == "/shared" ? true : false)); 4400 else 4401 draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.mail+">" : ui.item.mail, $(this)); 4402 return false; 4403 }, 4404 autoFocus: true, 4405 position : { my: "left top", at: "left bottom", collision: "fit" }, 4406 delay : 400 4407 }).bind('catcompleteopen', function(event, ui) { 4408 $(this).data('is_open',true); 4409 }).bind('catcompleteclose', function(event, ui) { 4410 canMakeBox = true; 4411 $(this).data('is_open',false); 4412 }) 4413 4414 //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE 4415 .data( "catcomplete" )._renderItem = function( ul, item ) { 4416 if($(ul).find("li").length < 50){ 4417 var autocomplete = $(this)[0].element; 4418 //cálculo dinâmico da largura da lista 4419 var minwidth = 450; 4420 var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.mail ? item.mail.length : 30 ))); 4421 width = (is_ie ? width*2 : (is_webkit && !is_mozilla ? width*4 : width*5)) + 30; 4422 if (width < minwidth) 4423 width = minwidth; 4424 ul.css({"min-width":width,"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 4425 var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); 4426 return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ 4427 icons : { 4428 primary : "ui-icon-close" 4429 }, 4430 text: false 4431 }).click(function(event){ 4432 var removeLi = $(this).parents("li:first"); 4433 if(!event.keyCode) 4434 autocomplete.catcomplete( "close" ); 4435 canMakeBox = false; 4436 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? (item.name.length <=30 ? item.name: item.name.substr(0,27)+"...")+" - " : "")+ item.mail+'</b>?', { 4437 'type': 'question', 4438 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 4439 'title': 'Atenção', 4440 'buttons': ['Sim','Não'], 4441 'overlay_opacity': '0.5', 4442 'onClose': function(caption) { 4443 if(caption == 'Sim'){ 4444 $(removeLi).remove(); 4445 REST['delete']("/dynamiccontact/"+item.id); 4446 updateDynamicContact(); 4447 cache = new Array(); 4448 }else if(caption == 'Não'){ 4449 $(focusIn).focus(); 4450 } 4451 } 4452 }); 4453 }); 4454 } 4455 return; 4456 }; 4457 } 4333 var decodeType = { 4334 '/dynamiccontacts': { 4335 css: 'recent', 4336 img: 'recent', 4337 text: 'Contato Recente' 4338 }, 4339 '/personalContact':{ 4340 css: 'personal', 4341 img: 'personal', 4342 text: 'Contato pessoal' 4343 }, 4344 '/sharedcontact':{ 4345 css: 'personal', 4346 img: 'sharedcontact', 4347 text: 'Contato compartilhado' 4348 }, 4349 '/groups':{ 4350 css: 'group', 4351 img: 'group', 4352 text: 'Grupo pessoal' 4353 }, 4354 '/sharedgroup':{ 4355 css: 'group', 4356 img: 'sharedgroup', 4357 text: 'Grupo compartilhado' 4358 } 4359 } 4360 4361 div.find("textarea").autocomplete({ 4362 source: function(request, response){ 4363 if ( request.term in cache ) { 4364 response( cache[ request.term ] ); 4365 return; 4366 } 4367 4368 if(dynamicData === false){ 4369 updateDynamicContact(); 4370 } 4371 4372 var data = $.ui.autocomplete.filter(dynamicData, request.term ).slice(0, 50); 4373 cache[ request.term ] = data; 4374 response( data ); 4375 4376 }, 4377 focus: function() { 4378 return false; 4379 }, 4380 4381 //EVENTO AO SELECIONAR UM CONTATO DINÂMICO 4382 select: function( event, ui ) { 4383 canMakeBox = false; 4384 4385 event.preventDefault(); 4386 $(this).val(""); 4387 4388 var isShared = (ui.item.type.substring(0,7) == "/shared"); 4389 4390 switch (ui.item.typel){ 4391 case '/personalContact': 4392 draw_email_box(""+ui.item.id, $(this), true, isShared); 4393 break; 4394 case '/groups': 4395 draw_email_box(""+ui.item.id, $(this), "G", isShared); 4396 break; 4397 default: 4398 draw_email_box(ui.item.name ? ("\""+ui.item.name+"\" <"+ui.item.mail+">") : ui.item.mail, $(this)); 4399 } 4400 4401 return false; 4402 }, 4403 autoFocus: true, 4404 position : { my: "left top", at: "left bottom", collision: "fit" }, 4405 delay : 120, 4406 minLength: 0 4407 }).bind('catcompleteopen', function(event, ui) { 4408 4409 $(this).data('is_open',true); 4410 4411 }).bind('catcompleteclose', function(event, ui) { 4412 4413 canMakeBox = true; 4414 $(this).data('is_open',false); 4415 4416 }).data( "autocomplete" )._renderItem = function( ul, item ) { 4417 var autocomplete = $(this)[0].element; 4418 4419 //cálculo dinâmico da largura da lista 4420 var minwidth = 450; 4421 var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.mail ? item.mail.length : 30 ))); 4422 width = (is_ie ? width*2 : (is_webkit && !is_mozilla ? width*4 : width*5)) + 30; 4423 if (width < minwidth) 4424 width = minwidth; 4425 4426 ul.css({"min-width":width, "max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 4427 4428 item.raty = ((item.number_of_messages*10)/topContact) > 1 ? ((item.number_of_messages*10)/topContact) : 1; 4429 4430 if ( item.typel != currentTypeContact) { 4431 if((item.typel == "/groups" && $(ul).find(".dynamic-recent").length) || (item.typel == "/personalContact" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length))){ 4432 currentTypeContact = item.typel; 4433 item.asDiv = true; 4434 }else{ 4435 currentTypeContact = item.typel; 4436 } 4437 } 4438 4439 var li = ''; 4440 if(item.asDiv){ 4441 li = '<li class="dynamic-separator"><div class="line-separator"> </div></li>'; 4442 } 4443 li += '<li class="dynamic-'+ decodeType[item.type].css +'">'; 4444 li += '<a style="width:'+(item.type == '/dynamiccontacts' ? '91%' : '97.5%')+'; display: inline-block; background: none;">'; 4445 li += '<img style="position:relative; top:2px; "src="../prototype/modules/mail/img/'+ decodeType[item.type].img +'.png" title="'+ decodeType[item.type].text +'"/>'; 4446 li += ($.trim(item.name) != "" ? ((item.name.length > 20 ? item.name.substring(0,17)+"..." : item.name) + " - " ) : '') + item.mail; 4447 li += item.type == '/dynamiccontacts' ? '<div class="dynamic-stars" style="display: inline-block;float: right;" id="'+item.raty+'_'+item.id+'"/>' : '' 4448 li += '</a>'; 4449 li += '<span style="width:16px; height:16px; top:1px; left:7px; '+ (item.type == '/dynamiccontacts' ? '': 'display:none') +'">Excluir contato recente</span>'; 4450 li += '</li>'; 4451 4452 4453 li = $( li ) 4454 .data( "item.autocomplete", item ) 4455 //.append( li ) 4456 .appendTo( ul ); 4457 4458 li.find("span").button({ 4459 icons : { 4460 primary : "ui-icon-close" 4461 }, 4462 text: false 4463 }).click(function(event){ 4464 if(!event.keyCode) 4465 autocomplete.autocomplete( "close" ); 4466 4467 canMakeBox = false; 4468 $.Zebra_Dialog('Deseja remover <b>'+(item.name ? (item.name.length <= 30 ? item.name: item.name.substr(0,27)+"...")+" - " : "")+ item.mail+'</b>?', { 4469 'type': 'question', 4470 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 4471 'buttons': ['Sim','Não'], 4472 'overlay_opacity': '0.5', 4473 'onClose': function(caption) { 4474 if(caption == 'Sim'){ 4475 4476 REST['delete']("/dynamiccontact/"+item.id); 4477 updateDynamicContact(); 4478 cache = new Array(); 4479 }else if(caption == 'Não'){ 4480 $(focusIn).focus(); 4481 } 4482 } 4483 }); 4484 }); 4485 4486 li.find(".dynamic-stars").jRating({ 4487 step:true, 4488 length : 5, // nb of stars 4489 decimalLength: 2, // number of decimal in the rate 4490 rateMax: 10, 4491 isDisabled:true, 4492 bigStarsPath : '../prototype/plugins/jquery.jrating/icons/stars.png', // path of the icon stars.png 4493 smallStarsPath : '../prototype/plugins/jquery.jrating/icons/small.png' // path of the icon small.png 4494 }); 4495 4496 if($(ul).find("li:last").hasClass("dynamic-separator")){ 4497 $(ul).find("li:last").remove(); 4498 } 4499 4500 $(ul).scroll(function(){ 4501 canMakeBox = false; 4502 }); 4503 4504 return li; 4505 }; 4506 } 4458 4507 4459 4508 //FUNÇÃO DOS BOTÕES PARA - CC - CCO -
branches/2.4/expressoMail1_2/js/main.js
r7396 r7444 31 31 } 32 32 33 function updateDynamicContact(){ 34 dynamicContacts = new Array(); 33 function updateDynamicContact(userContacts){ 34 35 if(!userContacts) 36 userContacts = REST.get("/usercontacts", false); 37 38 if(userContacts.collection && !userContacts.collection.error){ 39 dynamicData = normalizeContacts(userContacts.collection.itens); 40 }else{ 41 dynamicData = []; 42 } 43 44 if(dynamicData){ 45 var dynamicContactsList = []; 46 $.each(dynamicData, function(index, dynamic){ 47 48 var dataType = userContacts.collection.itens[index].dataType; 49 50 dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; 51 dynamic['type'] = dataType 52 dynamic['typel'] = (dataType.substring(0,7) == "/shared" ? "/"+dataType.substring(7,dataType.length)+"s" : dataType); 53 54 topContact = dynamic.number_of_messages > topContact ? dynamic.number_of_messages : topContact; 55 56 dynamicContactsList.push(dynamic); 57 }); 58 } 59 60 dynamicData = dynamicContactsList; 61 62 63 /*dynamicContacts = new Array(); 35 64 36 65 var dynamicUsers = REST.get("/dynamiccontacts"); … … 53 82 dynamicContacts.push(dynamic); 54 83 }); 55 } 84 }*/ 56 85 } 57 86 … … 2754 2783 if(!stop){ 2755 2784 var exist = 0; 2756 $.each(dynamic Contacts, function(x, valuex){2785 $.each(dynamicData, function(x, valuex){ 2757 2786 if(valuex.mail == $(value).find("input").val().match(reComplexEmail)[1]){ 2758 2787 exist = valuex.id; -
branches/2.4/index.php
r7191 r7444 153 153 <script src="prototype/plugins/store/jquery.store.js" language="javascript"></script> 154 154 <script type="text/javascript" src="prototype/api/rest.js"></script> 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> 155 <script src="prototype/api/datalayer.js" language="javascript"></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 } 165 168 } 166 169 }
Note: See TracChangeset
for help on using the changeset viewer.