Ignore:
Timestamp:
11/12/08 10:59:07 (16 years ago)
Author:
niltonneto
Message:

resolve #358, #363, #365, #366

Location:
trunk/jabberit_messenger/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/js/ldap.js

    r526 r551  
    2020                        'lang5':jabberitGetLang('group'), 
    2121                        'lang6':jabberitGetLang('add'), 
    22                         'lang7':jabberitGetLang('close') 
     22                        'lang7':jabberitGetLang('close'), 
     23                        'lang8':jabberitGetLang('External Participants')                         
    2324                }; 
    2425 
     
    2728 
    2829                _win_add.content( _xtools.parse(_xtools.xml('adduser'), 'add_user.xsl', _params)); 
     30 
     31                _conn.go('$this.contacts_im.getParticipantsExternal', 
     32                                function(data) 
     33                                { 
     34                                        var data = eval(data); 
     35                                        var elementDiv =  document.getElementById('external_Participants_Jabberit');                                     
     36                                         
     37                                        if( data )  
     38                                                elementDiv.style.display = 'block'; 
     39                                }); 
    2940 
    3041                _config( _win_add.wc.childNodes[2].childNodes[0], 
     
    133144                var _loading = document.getElementById('__span_load_im'); 
    134145                var _target = document.getElementById('im_ldap_user'); 
    135                  
     146                var _particiExt = document.getElementById('external_Participants_Jabberit').firstChild; 
     147 
     148                function getUsersLdap(_data) 
     149                { 
     150                        var _params = { 
     151                                'many_results' : jabberitGetLang('More than 50 results. Please, try to refine your search.'), 
     152                                'empty' : jabberitGetLang('None result was found.') 
     153                         }; 
     154                 
     155                        _target.innerHTML = _xtools.parse(_data,'list_ldap_contacts.xsl', _params); 
     156                         
     157                        function _show(m) 
     158                        { 
     159                                m = ( m.target ) ? m.target : m.srcElement; 
     160                                if ( m.getAttribute('value')) 
     161                                        m = m.getAttribute('value'); 
     162                                else 
     163                                        m = m.parentNode.getAttribute('value'); 
     164                                 
     165                                if ( !m ) 
     166                                        return false; 
     167 
     168                                document.getElementById('__span_load_im_group').style.display = 'block'; 
     169                                document.getElementById('im_jid').value = m.substr(0, m.indexOf(';')); 
     170                                document.getElementById('im_uid').value = m.substr((m.indexOf(';')+1)); 
     171                                 
     172                                var _name = document.getElementById('im_name'); 
     173 
     174                                var first_name = document.getElementById(m).innerHTML; 
     175                                        first_name = first_name.substr(0, first_name.indexOf(' ')); 
     176                                         
     177                                        _name.value = first_name;                                                        
     178                                        _name.previousSibling.style.color = "#000"; 
     179                                        _name.parentNode.style.display = 'block'; 
     180                                        _name.parentNode.nextSibling.style.display = 'block'; 
     181                                        _name.parentNode.nextSibling.nextSibling.innerHTML = ''; 
     182                                 
     183                                _conn.go('$this.ujabber.getGroupsJabber', 
     184                                                function(data) 
     185                                                { 
     186                                                        if( data = data.replace(/(^\s*)|(\s*$)/g,'')) 
     187                                                        { 
     188                                                                var _group = document.getElementById('im_group'); 
     189                                                                var _groupOptions = ''; 
     190 
     191                                                                _group.setAttribute('selectBoxOptions', data); 
     192                                                                if( document.getElementById('selectBox0') == null) 
     193                                                                        editS.create(document.getElementById('im_group')); 
     194                                                        } 
     195                                                        document.getElementById('__span_load_im_group').style.display = 'none'; 
     196                                                }); 
     197 
     198                                document.getElementById('im_group').value = ''; 
     199                                document.getElementById('im_group').focus(); 
     200                        } 
     201 
     202                        var _member = _target.firstChild; 
     203                         
     204                        while ( _member ) 
     205                        { 
     206                                if( _member.getAttribute('photo') === '1' ) 
     207                                { 
     208                                        var uid = _member.getAttribute('value');  
     209                                        uid = uid.substr(uid.indexOf(';') + 1); 
     210                                        _member.style.backgroundImage = 'url(' + path_jabberit + 'inc/getphoto.php?uid=' + uid + ')'; 
     211                                } 
     212                                _config(_member, 'onclick', _show); 
     213                                 
     214                                _member = _member.nextSibling; 
     215                        } 
     216                 
     217                } 
     218 
    136219                _loading.style.display = "block";        
    137  
    138                 _conn.go( 
    139                                 '$this.contacts_im.list_contacts',               
    140                                 function(_data) 
    141                                 { 
    142                                         var _params = { 
    143                                                 'many_results' : jabberitGetLang('More than 50 results. Please, try to refine your search.'), 
    144                                                 'empty' : jabberitGetLang('None result was found.') 
    145                                          }; 
    146                                  
    147                                         _target.innerHTML = _xtools.parse(_data,'list_ldap_contacts.xsl', _params); 
    148                                          
    149                                         function _show(m) 
    150                                         { 
    151                                                 m = ( m.target ) ? m.target : m.srcElement; 
    152                                                 if ( m.getAttribute('value')) 
    153                                                         m = m.getAttribute('value'); 
    154                                                 else 
    155                                                         m = m.parentNode.getAttribute('value'); 
    156                                                  
    157                                                 if ( !m ) 
    158                                                         return false; 
    159  
    160                                                 document.getElementById('__span_load_im_group').style.display = 'block'; 
    161                                                 document.getElementById('im_jid').value = m.substr(0, m.indexOf(';')); 
    162                                                 document.getElementById('im_uid').value = m.substr((m.indexOf(';')+1)); 
    163                                                  
    164                                                 var _name = document.getElementById('im_name'); 
    165  
    166                                                 var first_name = document.getElementById(m).innerHTML; 
    167                                                         first_name = first_name.substr(0, first_name.indexOf(' ')); 
    168                                                          
    169                                                         _name.value = first_name;                                                        
    170                                                         _name.previousSibling.style.color = "#000"; 
    171                                                         _name.parentNode.style.display = 'block'; 
    172                                                         _name.parentNode.nextSibling.style.display = 'block'; 
    173                                                         _name.parentNode.nextSibling.nextSibling.innerHTML = ''; 
    174                                                  
    175                                                 _conn.go('$this.ujabber.getGroupsJabber', 
    176                                                                 function(data) 
    177                                                                 { 
    178                                                                         if( data = data.replace(/(^\s*)|(\s*$)/g,'')) 
    179                                                                         { 
    180                                                                                 var _group = document.getElementById('im_group'); 
    181                                                                                 var _groupOptions = ''; 
    182  
    183                                                                                 _group.setAttribute('selectBoxOptions', data); 
    184                                                                                 if( document.getElementById('selectBox0') == null) 
    185                                                                                         editS.create(document.getElementById('im_group')); 
    186                                                                         } 
    187                                                                         document.getElementById('__span_load_im_group').style.display = 'none'; 
    188                                                                 }); 
    189  
    190                                                 document.getElementById('im_group').value = ''; 
    191                                                 document.getElementById('im_group').focus(); 
    192                                         } 
    193  
    194                                         var _member = _target.firstChild; 
    195                                          
    196                                         while ( _member ) 
    197                                         { 
    198                                                 if( _member.getAttribute('photo') === '1' ) 
    199                                                 { 
    200                                                         var uid = _member.getAttribute('value');  
    201                                                         uid = uid.substr(uid.indexOf(';') + 1); 
    202                                                         _member.style.backgroundImage = 'url(' + path_jabberit + 'inc/getphoto.php?uid=' + uid + ')'; 
    203                                                 } 
    204                                                 _config(_member, 'onclick', _show); 
    205                                                  
    206                                                 _member = _member.nextSibling; 
    207                                         } 
    208                                         _loading.style.display = "none"; 
    209                                 }, 
    210                                 'name='+ arguments[0] 
    211                             ); 
     220                 
     221                if(!_particiExt.checked) 
     222                { 
     223                        _conn.go( 
     224                                        '$this.contacts_im.list_contacts',               
     225                                        function(_data) 
     226                                        { 
     227                                                getUsersLdap(_data); 
     228                                                _loading.style.display = "none";                                                 
     229                                        }, 
     230                                        'name='+ arguments[0] 
     231                                    ); 
     232                } 
     233                else 
     234                { 
     235 
     236                        function checkMail(pMail) 
     237                        { 
     238                                var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/); 
     239                                if(er.test(pMail)) 
     240                                        return true; 
     241                                else 
     242                                        return false; 
     243                        } 
     244                         
     245                        if( checkMail(arguments[0]) )                    
     246                        {                        
     247                                _conn.go( 
     248                                        '$this.ldap_im.list_participants_externals',             
     249                                        function(data) 
     250                                        { 
     251                                                getUsersLdap(data); 
     252                                                _loading.style.display = "none"; 
     253                                        }, 
     254                                        'mail=' + arguments[0] 
     255                                        ); 
     256                        } 
     257                        else 
     258                                alert(jabberitGetLang('Inform a valid e-mail!')); 
     259                } 
     260                                 
    212261        } 
    213262 
  • trunk/jabberit_messenger/js/load.js

    r439 r551  
    169169        } 
    170170 
     171        function changeLabel() 
     172        { 
     173                if( arguments.length > 0 ) 
     174                { 
     175                        var element = arguments[0].parentNode.parentNode.firstChild; 
     176 
     177                        if(arguments[0].checked) 
     178                                element.innerHTML = "Digite o Email .:"; 
     179                        else 
     180                                element.innerHTML = "Nome do Contato .:"; 
     181                } 
     182        } 
     183 
    171184        function configEvents(pObj, pEvent, pHandler) 
    172185        { 
     
    243256                        _win_contacts.size(215,400); 
    244257                }                                        
    245                 else _win_contacts.size(1,1); 
     258                else 
     259                {  
     260                        _win_contacts.size(1,1);  
     261                        _win_contacts.wm.style.visibility = 'hidden'; 
     262                } 
    246263 
    247264                _win_contacts.position(50,50); 
     
    399416                { 
    400417                        if ( _win_contacts ) 
    401                         { 
     418                        {        
    402419                                _win_contacts.wm.style.visibility = "visible"; 
    403420                                _win_contacts.title('.:: Expresso - JMessenger ::.'); 
     
    423440        Load.prototype.setPrefe = setPreferences; 
    424441        Load.prototype.closeW = closeWindow; 
     442        Load.prototype.cLabel = changeLabel; 
    425443        Load.prototype.adIcon = addIcon; 
    426444        window.loadscript = new Load; 
Note: See TracChangeset for help on using the changeset viewer.