Changeset 6592 for trunk


Ignore:
Timestamp:
06/22/12 18:01:36 (12 years ago)
Author:
gustavo
Message:

Ticket #2766 - Arrumado a configuracao de limite de contatos dinamicos

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/draw_api.js

    r6580 r6592  
    99 */ 
    1010onceOpenedHeadersMessages = {}; 
    11  
     11var cache = new Array(); 
    1212var openTab = { 
    1313        'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao 
     
    35513551 
    35523552//DESENHO DAS CAIXA DE EMAIL 
    3553 function draw_email_box(input_data, location, personal){ 
     3553function draw_email_box(input_data, location, personal, shared){ 
    35543554        if($.trim(input_data) != ""){ 
    35553555                var box_data = valid_emails(input_data); 
     
    35593559                        if((preferences.expressoMail_ldap_identifier_recipient || personal)&& $(newBox).hasClass("invalid-email-box")){ 
    35603560                                //$(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); 
    35623562                        }else{ 
    35633563                                $(newBox).find(".box-loading").remove(); 
     
    38553855 
    38563856//MOSTRA OS DETALHES DAS CAIXA DE EMAIL NOS CAMPOS PARA - CC - CCO 
    3857 function show_detais(box, value, personal){ 
     3857function show_detais(box, value, personal, shared){ 
    38583858        var ldap_id = preferences.expressoMail_ldap_identifier_recipient; 
    38593859        var group = (personal != undefined ? (personal == "G" ? true : false) : false); 
    3860          
     3860        shared = shared ? shared : false; 
    38613861        if(group){ 
    3862                 REST.get("/group/"+value, {}, function(data){ 
     3862                REST.get("/"+ (shared ? "shared" : "") +"group/"+value, {}, function(data){ 
    38633863                        if(!data.error){ 
    38643864                                if(data.collection.error) 
     
    38863886         
    38873887        if(personal){ 
    3888                 REST.get("/contact/"+value, {}, function(data){ 
     3888                REST.get("/"+ (shared ? "shared" : "") +"contact/"+value, {}, function(data){ 
    38893889                        if(!data.error){ 
    38903890                                if(data.collection.error) 
     
    39893989                                currentType = ""; 
    39903990                                $.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) 
    39933993                                                        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)) 
    39953995                                                        self._renderItem( ul, {name:"", value:"", type:"linha"} );       
    3996                                                 currentType = item.type; 
     3996                                                currentType = item.typel; 
    39973997                                        } 
    39983998                                        self._renderItem( ul, item ); 
     
    40014001                                                half : true, 
    40024002                                                hints : ['','','','',''], 
    4003                                                 score    : ((parseInt(item.qtd)*5)/topContact), 
     4003                                                score    : ((item.number_of_messages*5)/topContact), 
    40044004                                                starOn  : '../../prototype/plugins/jq-raty/img/star-on.png', 
    40054005                                                starOff : '../../prototype/plugins/jq-raty/img/star-off.png', 
     
    40074007                                        }); 
    40084008                                }); 
     4009                                if($(ul).find("li:last").hasClass("dynamic-separator")){ 
     4010                                        $(ul).find("li:last").remove(); 
     4011                                } 
    40094012                        } 
    40104013                }); 
     
    40134016                        minLength: 1,                    
    40144017                        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                                }); 
    40164041                        }, 
    40174042                        focus: function() { 
     
    40234048                                event.preventDefault(); 
    40244049                                $(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)); 
    40294054                                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)); 
    40314056                                return false; 
    40324057                        }, 
     
    40414066                //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE 
    40424067                .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                                                                } 
    40674095                                                        } 
    4068                                                 } 
     4096                                        }); 
    40694097                                }); 
    4070                         }); 
     4098                        } 
     4099                        return; 
    40714100                }; 
    40724101        } 
  • trunk/expressoMail1_2/js/main.js

    r6587 r6592  
    1414var dynamicContactList = new Array(); 
    1515var topContact = 0; 
     16DataLayer.get("folder", true); 
    1617 
    1718//Os IE's < 9 não possui suporte a trim() introduzida no JavaScript 1.8.1 
     
    235236        }); 
    236237 
     238        DataLayer.get("folder", true); 
     239        cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);      
     240         
    237241        setTimeout('auto_refresh()', time_refresh); 
    238242         
     
    24382442                var arrayCCo = content.find(".cco-tr").find(".box").clone(); 
    24392443                save_dynamic_contacts(arrayCCo); 
     2444                cache = new Array(); 
    24402445        } 
    24412446        else{ 
     
    24822487/*Função que grava o destinatário nos contatos dinâmicos*/ 
    24832488function save_dynamic_contacts(array){ 
    2484                 if(parseInt(preferences.use_dynamic_contacts)){ 
     2489        if(parseInt(preferences.use_dynamic_contacts)){ 
     2490                 
    24852491                $.each(array, function(i, value){ 
    24862492                        var stop = false; 
     
    24942500                                var exist = 0; 
    24952501                                $.each(dynamicContacts, function(x, valuex){ 
    2496                                         if(valuex.email == $(value).find("input").val().match(reComplexEmail)[1]){ 
     2502                                        if(valuex.mail == $(value).find("input").val().match(reComplexEmail)[1]){ 
    24972503                                                exist = valuex.id; 
    24982504                                                return false; 
  • trunk/prototype/modules/mail/templates/listContacts.ejs

    r6528 r6592  
     1<%  
     2        var decodeType = { 
     3                '/dynamiccontacts': { 
     4                        css: 'recent',  
     5                        img: 'recent',  
     6                        text: 'Contato dinâmico' 
     7                }, 
     8                '/contacts':{ 
     9                        css: 'personal', 
     10                        img: 'personal', 
     11                        text: 'Contato pessoal', 
     12                }, 
     13                '/sharedcontact':{ 
     14                        css: 'personal', 
     15                        img: 'sharedcontact', 
     16                        text: 'Contato compartilhado', 
     17                }, 
     18                '/groups':{ 
     19                        css: 'group', 
     20                        img: 'group', 
     21                        text: 'Grupo pessoal', 
     22                }, 
     23                '/sharedgroup':{ 
     24                        css: 'group', 
     25                        img: 'sharedgroup', 
     26                        text: 'Grupo compartilhado', 
     27                } 
     28        }  
     29%> 
    130<%if (data.type == 'linha'){%> 
    2 <li> 
     31<li class="dynamic-separator"> 
    332        <div class="line-separator"> 
    433                &nbsp; 
    534        </div> 
    635<%}else{%> 
    7 <li class="dynamic-<%=(data.type =='' ? 'recent' : (data.type == 'P' ? 'personal' : 'group'))%>"> 
    8         <a style="width:<%= (data.type == '' ? '91%' : '97.5%')%>; display: inline-block;"> 
    9                 <img style="position:relative; top:2px; "src="../prototype/modules/mail/img/<%=data.type == '' ? 'recent' : (data.type== 'P' ? 'personal' : 'group')%>.png" title="<%=data.type == '' ? 'Contato Recente' : (data.type== 'P' ? 'Contato Pessoal' : 'Grupo de Contatos')%>"/> 
    10                 <%= (data.name ? data.name + " - " : "") %><%= data.email %> 
    11                 <% if(data.type == ''){ %> 
     36<li class="dynamic-<%=decodeType[data.type].css%>"> 
     37        <a style="width:<%= (data.type == '/dynamiccontacts' ? '91%' : '97.5%')%>; display: inline-block;"> 
     38                <img style="position:relative; top:2px; "src="../prototype/modules/mail/img/<%=decodeType[data.type].img%>.png" title="<%=decodeType[data.type].text%>"/> 
     39                <%= (data.name ? (data.name.length > 20? data.name.substring(0,17)+"..." : data.name)+ " - " : "") %><%= data.mail %> 
     40                <% if(data.type == '/dynamiccontacts'){ %> 
    1241                        <div class="dynamic-stars" style="display: inline-block;float: right;"/> 
    1342                <% } %> 
    1443        </a> 
    15         <span style="width:16px; height:16px; top:5px; <%=data.type == '' ?  '': 'display:none'%>">Excluir contato recente</span>        
     44        <span style="width:16px; height:16px; top:5px; <%=data.type == '/dynamiccontacts' ?  '': 'display:none'%>">Excluir contato recente</span>        
    1645<%}%> 
    1746</li> 
  • trunk/prototype/rest/catalog/UserContactsResource.php

    r6572 r6592  
    150150                    if (($value['user'] == Config::me("uidNumber")) || ($acl[$value['user']]['read'])) { 
    151151 
    152                         $i = new Item($request->resources, ($value['user'] == Config::me("uidNumber") ? 'GroupsResource' : 'SharedGroupsResource'), $value['id']); 
     152                        $i = new Item($request->resources, ($value['user'] == Config::me("uidNumber") ? 'GroupsResource' : 'SharedGroupResource'), $value['id']); 
    153153 
    154154                        $d = new Data(); 
     
    183183 
    184184                        $d = new Data(); 
    185                         $d->setName('email'); 
     185                        $d->setName('mail'); 
    186186                        $d->setValue($value['email']); 
    187187                        $d->setPrompt('Email do Grupo'); 
     
    275275 
    276276                        $d = new Data(); 
    277                         $i = new Item($request->resources, (($value['user'] == Config::me("uidNumber")) ? 'ContactsResource' : 'SharedContactsResource'), $value['id']); 
     277                        $i = new Item($request->resources, (($value['user'] == Config::me("uidNumber")) ? 'ContactsResource' : 'SharedContactResource'), $value['id']); 
    278278                        $d->setName('id'); 
    279279                        $d->setValue($value['id']); 
     
    309309 
    310310                        $d = new Data(); 
    311                         $d->setName('email'); 
     311                        $d->setName('mail'); 
    312312                        $d->setValue(isset($value['email']) ? $value['email'] : null); 
    313313                        $d->setPrompt('Email do Contato'); 
Note: See TracChangeset for help on using the changeset viewer.