Changeset 4685 for branches


Ignore:
Timestamp:
07/08/11 16:02:16 (13 years ago)
Author:
roberto.santosjunior
Message:

Ticket #2068 - Adicionar e-mail externo nas listas do Expresso

Location:
branches/2.2/expressoAdmin1_2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoAdmin1_2/inc/class.uimaillists.inc.php

    r4216 r4685  
    271271                                        else 
    272272                                        { 
    273                                                 $mail_not_found .= "<option value=" . $mail . ">" . $cn .  " [" . $array_users_uid[$mail] . "]</option>"; 
     273                                                $mail_not_found .= "<option value=" . $mail . ">"  . $array_users_uid[$mail] . "</option>"; 
    274274                                        } 
    275275                                } 
     
    277277                                if ($mail_not_found != '') 
    278278                                { 
    279                                         $opt_tmp_mail_not_found = '<option  value="-1" disabled>--------------------&nbsp;&nbsp;&nbsp;&nbsp;'.lang('emails did not find').'&nbsp;&nbsp;&nbsp;&nbsp;------------------ </option>'."\n"; 
     279                                        $opt_tmp_mail_not_found = '<option  value="-1" disabled>--------------------&nbsp;&nbsp;&nbsp;&nbsp;'.lang('external users').'&nbsp;&nbsp;&nbsp;&nbsp;------------------ </option>'."\n"; 
    280280                                        $ea_select_usersInMaillist .= $opt_tmp_mail_not_found . $mail_not_found; 
    281281                                } 
  • branches/2.2/expressoAdmin1_2/js/jscode/maillists.js

    r3351 r4685  
    460460        return ufn.substring(0,(ufn.length-1)); 
    461461} 
     462function LTrim(value) 
     463{ 
     464        var w_space = String.fromCharCode(32); 
     465        var strTemp = ""; 
     466        var iTemp = 0; 
     467 
     468        var v_length = value ? value.length : 0; 
     469        if(v_length < 1) 
     470                return ""; 
     471 
     472        while(iTemp < v_length){ 
     473                if(value && value.charAt(iTemp) != w_space){ 
     474                        strTemp = value.substring(iTemp,v_length); 
     475                        break; 
     476                } 
     477                iTemp++; 
     478        } 
     479        return strTemp; 
     480} 
     481 
     482function validateEmail() 
     483{ 
     484 
     485        externalEmail = document.getElementById('ea_input_externalUser'); 
     486 
     487        if( externalEmail.value ) 
     488        { 
     489                //var element = arguments[0]; 
     490                var validate = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 
     491 
     492                if(this.LTrim(externalEmail.value) != "" && externalEmail.value != "") 
     493                { 
     494                        if(!validate.test(externalEmail.value)) 
     495                        { 
     496                                alert(get_lang('Email address is not valid') + '.'); 
     497                                externalEmail.focus(); 
     498                                return false; 
     499                        }else { 
     500                                this.add_externalUser2maillist(externalEmail.value); 
     501                        } 
     502                } 
     503 
     504        } 
     505} 
     506 
     507function add_externalUser2maillist(mailAddress) 
     508{ 
     509        input_externalUsers = mailAddress.toLowerCase(); //document.getElementById('ea_input_externalUser').value; 
     510        select_usersInMaillist = document.getElementById('ea_select_usersInMaillist'); 
     511 
     512        var count_externalUsers = input_externalUsers.length; 
     513        var count_usersInMaillist = select_usersInMaillist.options.length; 
     514        var new_options = ''; 
     515 
     516        var teste = ''; //Variavel que ira receber mensagem de alerta ao usuario; 
     517        var alerta = new Boolean(0); //Variavel que sera usada para verificar se o alerta ao usuario sera exibido ou nao; 
     518 
     519        //Laco abaixo compara se o valor escolhido em select_available_users ja existe em select_usersInMaillist 
     520        //se existir, adiciona o valor em teste e muda a variavel alerta para true; teste sera exibido em tela 
     521        //apenas de alerta  true; ver if no fim da funcao; 
     522        for(j = 0; j < count_usersInMaillist; j++) 
     523        { 
     524                var tmp = select_usersInMaillist.options[j].text 
     525 
     526                if(tmp.match(input_externalUsers)) 
     527                { 
     528                        teste = get_lang("User already belongs to the list") + "\n" + input_externalUsers + "\n"; 
     529                        alerta = new Boolean(1); 
     530                } 
     531        } 
     532 
     533        if(alerta != true) 
     534        { 
     535                if(document.all) 
     536                { 
     537                        if ( (select_usersInMaillist.innerHTML.indexOf('value='+input_externalUsers)) == '-1' ) 
     538                        { 
     539                                new_options +=  "<option value=" 
     540                                                        + input_externalUsers 
     541                                                        + ">" 
     542                                                        + input_extenalUsers 
     543                                                        + "</options>"; 
     544                        } 
     545                } 
     546                else 
     547                { 
     548                        if ( (select_usersInMaillist.innerHTML.indexOf('value="'+input_externalUsers+'"')) == '-1' ) 
     549                        { 
     550                                new_options +=  "<option value=" 
     551                                                        + input_externalUsers 
     552                                                        + ">" 
     553                                                        + input_externalUsers 
     554                                                        + "</options>"; 
     555                        } 
     556                } 
     557        } 
     558 
     559        if(alerta == true) 
     560        { 
     561                alert(teste); 
     562        } 
     563 
     564 
     565        if (new_options != '') 
     566        { 
     567                select_usersInMaillist.innerHTML = new_options + select_usersInMaillist.innerHTML; 
     568                select_usersInMaillist.outerHTML = select_usersInMaillist.outerHTML; 
     569        } 
     570 
     571        document.getElementById('ea_input_externalUser').value = ''; 
     572} 
  • branches/2.2/expressoAdmin1_2/templates/default/maillists_form.tpl

    r3351 r4685  
    7575                                                        <b>{lang_users}:</b><br> 
    7676                                                        <select id="ea_select_available_users" style="width:400px; height:200px" multiple size="13"></select> 
     77                                                        <br/><br/>  
     78                                                        <b>{lang_external_user}:</b>  
     79                                                        <br/>  
     80                                                        <input id="ea_input_externalUser" size="35" type="text">  
     81                                                        <input id="input_user" value="Adicionar" onclick="javascript:validateEmail();" type="button">  
     82                                                        <br/>  
    7783                                                </td> 
    7884                                        </tr> 
Note: See TracChangeset for help on using the changeset viewer.