Ignore:
Timestamp:
04/30/08 17:11:15 (16 years ago)
Author:
niltonneto
Message:

Fechamento de versão: 1.2211
Tickets:

#50 Criar uma funcionalidade para inserir imagens embutidas no corpo da mensagem.
#174 Implementar rascunho com anexos
#182 Criar funcionalidade de salvar automaticamente os emails em rascunhos
#183 Funcionalidade de drag and drop na busca
#185 Adicionar tabela na edição de email
#186 Correção do problema com nomes de anexos com caracteres especiais
#188 Definir aspectos de QA do ExpressoMail?
#190 Problema ao salvar informações de filtros no IE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.ldap_functions.inc.php

    r243 r271  
    7676                        if (($field != 'null') && ($ID != 'null')) 
    7777                        { 
    78                                 $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|(cn=*$search_for*)(mail=$search_for*)))"; 
     78                                $filter="(& (|(phpgwAccountType=u)(phpgwAccountType=l)) (|(cn=*$search_for*)(mail=$search_for*)) (!(phpgwaccountvisible=-1)) )"; 
    7979                                $justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible", "uid"); 
    8080                        } 
    8181                        else 
    8282                        { 
    83                                 $filter="(& (phpgwAccountType=u)(cn=*$search_for*) )"; 
     83                                $filter="(& (phpgwAccountType=u)(cn=*$search_for*) (!(phpgwaccountvisible=-1)) )"; 
    8484                                $justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible", "jpegPhoto", "uid"); 
    8585                        } 
     
    8787                        $sr=ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 
    8888                        $count_entries = ldap_count_entries($this->ds,$sr); 
    89                          
     89 
     90                        // Get user org dn.                      
     91                        $user_dn = $_SESSION['phpgw_info']['expressomail']['user']['account_dn']; 
     92                        $user_sector_dn = ldap_explode_dn ( $user_dn, false ); 
     93                        array_shift($user_sector_dn); 
     94                        array_shift($user_sector_dn); 
     95                        $user_sector_dn = implode(",", $user_sector_dn); 
     96                         
     97                        // New search only on user sector 
    9098                        if ($count_entries > 200) 
    9199                        { 
     
    96104                                $this->ldapRootConnect(true); 
    97105                                 
    98                                 $user_dn = $_SESSION['phpgw_info']['expressomail']['user']['account_dn']; 
    99                                 $user_sector_dn = ldap_explode_dn ( $user_dn, false ); 
    100                                 array_shift($user_sector_dn); 
    101                                 array_shift($user_sector_dn); 
    102                                 $user_sector_dn = implode(",", $user_sector_dn); 
    103                                  
    104                                 // New search only on user sector 
    105106                                $sr=ldap_search($this->ds, $user_sector_dn, $filter, $justthese); 
    106107                                $count_entries = ldap_count_entries($this->ds,$sr); 
     
    117118                                } 
    118119                        } 
     120                         
    119121                        $info = ldap_get_entries($this->ds, $sr); 
    120  
     122                         
    121123                        $tmp = array(); 
     124                        $tmp_users_from_user_org = array(); 
    122125                        for ($i=0; $i<$info["count"]; $i++) 
    123126                        { 
    124                                 if ($info[$i]["phpgwaccountvisible"][0] == '-1') 
    125                                         continue; 
    126                                 $tmp[$info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count']] = $info[$i]["cn"][0]; 
    127                         } 
     127                                // Usuario sempre serao da minha org. 
     128                                if ($quickSearch_only_in_userSector) 
     129                                { 
     130                                        $tmp[$info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count']] = $info[$i]["cn"][0]; 
     131                                } 
     132                                else 
     133                                { 
     134                                        if (preg_match("/$user_sector_dn/i", $info[$i]['dn'])) 
     135                                        { 
     136                                                $tmp_users_from_user_org[$info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count']] = $info[$i]["cn"][0]; 
     137                                        } 
     138                                        else 
     139                                        { 
     140                                                $tmp[$info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count']] = $info[$i]["cn"][0]; 
     141                                        } 
     142                                } 
     143                        } 
     144                        natcasesort($tmp_users_from_user_org); 
    128145                        natcasesort($tmp); 
    129146                         
    130                         $i = 0; 
    131147                        if (($field != 'null') && ($ID != 'null')) 
    132148                        { 
     149                                $i = 0; 
     150                                 
     151                                $tmp = array_merge($tmp, $tmp_users_from_user_org); 
     152                                natcasesort($tmp); 
     153                                 
    133154                                foreach ($tmp as $info => $cn) 
    134155                                { 
     
    142163                        else 
    143164                        { 
     165                                $options_users_from_user_org = ''; 
    144166                                $options = ''; 
    145                                  
     167 
     168                                /* List of users from user org */ 
     169                                $i = 0; 
     170                                foreach ($tmp_users_from_user_org as $info => $cn) 
     171                                { 
     172                                        $contacts_result[$i] = array(); 
     173                                        $options_users_from_user_org .= $this->make_quicksearch_card($info, $cn); 
     174                                        $i++; 
     175                                } 
     176 
     177                                /* List of users from others org */ 
    146178                                foreach ($tmp as $info => $cn) 
    147179                                { 
    148180                                        $contacts_result[$i] = array(); 
    149                                         $contacts_result[$i]["cn"] = $cn; 
    150                                         list ($contacts_result[$i]["mail"], $contacts_result[$i]["phone"], $contacts_result[$i]["mobile"], $contacts_result[$i]["uid"], $contacts_result[$i]["jpegphoto"]) = split ('%', $info); 
    151                                          
    152                                         if ($contacts_result[$i]['jpegphoto']) 
    153                                                 $photo_link = '<img src="./inc/show_user_photo.php?mail='.$contacts_result[$i]['mail'].'">'; 
    154                                         else 
    155                                                 $photo_link = '<img src="./templates/default/images/photo.png">'; 
    156                                          
    157                                         // '<tr class="quicksearchcontacts_unselected" onClick="javascript:QuickSearchUser.select_cc(this)">' . 
    158                                         $phoneUser = $contacts_result[$i]['phone']; 
    159                                          
    160                                         if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_enabled'] && $phoneUser) { 
    161                                                 $phoneUser = '<a title="'.$functions->getLang("Call to Comercial Number").'" href="#" onclick="InfoContact.connectVoip(\''.$phoneUser.'\',\'com\')">'.$phoneUser.'</a>'; 
    162                                                 if($contacts_result[$i]['mobile']){ 
    163                                                 $phoneUser .= ' / <a title="'.$functions->getLang("Call to Mobile Number").'" href="#" onclick="InfoContact.connectVoip(\''.$contacts_result[$i]['mobile'].'\',\'mob\')">'.$contacts_result[$i]['mobile'].'</a>'; 
    164                                                 } 
    165                                         } 
    166                                         $options .= 
    167                                                 '<tr class="quicksearchcontacts_unselected">' . 
    168                                                         '<td class="cc" width="1%">' . 
    169                                                                 '<a title="'.$functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result[$i]["cn"].'\', \''.$contacts_result[$i]["mail"].'\')">' . 
    170                                                                         $photo_link . 
    171                                                                 '</a>' . 
    172                                                         '</td>' . 
    173                                                         '<td class="cc">' . 
    174                                                                 '<span name="cn">' . $contacts_result[$i]['cn'] . '</span>' . '<br>' . 
    175                                                                 '<a title="'.$functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result[$i]["cn"].'\', \''.$contacts_result[$i]["mail"].'\')">' . 
    176                                                                         '<font color=blue>' . 
    177                                                                                 '<span name="mail">' . $contacts_result[$i]['mail'] . '</span>' . '<br>' . 
    178                                                                         '</font>' . 
    179                                                                 '</a>' . 
    180                                                                 $phoneUser . 
    181                                                         '</td>' . 
    182                                                 '</tr>'; 
     181                                        $options .= $this->make_quicksearch_card($info, $cn); 
    183182                                        $i++; 
    184183                                } 
    185                                 $contacts_result = $options; 
    186184                                 
    187185                                if ($quickSearch_only_in_userSector) 
    188186                                { 
    189                                         $head_option = 
    190                                                 '<tr class="quicksearchcontacts_unselected">' . 
    191                                                         '<td colspan="2" width="100%" align="center">' . 
    192                                                                 $functions->getLang('More than 200 results were found') . '.<br>' . 
    193                                                                 $functions->getLang('Showing only the results found in your organization') . '.'; 
    194                                                         '</td>' . 
    195                                                 '</tr>'; 
    196                                         $contacts_result = $head_option . $contacts_result; 
     187                                        if ($options != '') 
     188                                        { 
     189                                                $head_option = 
     190                                                        '<tr class="quicksearchcontacts_unselected">' . 
     191                                                                '<td colspan="2" width="100%" align="center">' . 
     192                                                                        $functions->getLang('More than 200 results were found') . '.<br>' . 
     193                                                                        $functions->getLang('Showing only the results found in your organization') . '.'; 
     194                                                                '</td>' . 
     195                                                        '</tr>'; 
     196                                                $contacts_result = $head_option . $options_users_from_user_org . $options; 
     197                                        } 
     198                                        else 
     199                                        { 
     200                                                $return = array(); 
     201                                                $return['status'] = false; 
     202                                                $return['error'] = "many results"; 
     203                                                return $return; 
     204                                        } 
     205                                } 
     206                                else 
     207                                { 
     208                                        if (($options_users_from_user_org != '') && ($options != '')) 
     209                                        { 
     210                                                $head_option0 = 
     211                                                        '<tr class="quicksearchcontacts_unselected">' . 
     212                                                                '<td colspan="2" width="100%" align="center" style="background:#EEEEEE"><B>' . 
     213                                                                        $functions->getLang('Users from your organization') . '.'; 
     214                                                                '</B></td>' . 
     215                                                        '</tr>'; 
     216 
     217                                                $head_option1 = 
     218                                                        '<tr class="quicksearchcontacts_unselected">' . 
     219                                                                '<td colspan="2" width="100%" align="center" style="background:#EEEEEE"><B>' . 
     220                                                                        $functions->getLang('Users from others organizations') . '.'; 
     221                                                                '</B></td>' . 
     222                                                        '</tr>'; 
     223                                        } 
     224                                        $contacts_result = $head_option0 . $options_users_from_user_org . $head_option1 . $options; 
    197225                                } 
    198226                        } 
     
    200228                ldap_close($this->ds); 
    201229                return $contacts_result; 
     230        } 
     231 
     232        function make_quicksearch_card($info, $cn) 
     233        { 
     234                include_once("class.functions.inc.php"); 
     235                $functions = new functions;                                              
     236                 
     237                $contacts_result = array(); 
     238                $contacts_result["cn"] = $cn; 
     239                list ($contacts_result["mail"], $contacts_result["phone"], $contacts_result["mobile"], $contacts_result["uid"], $contacts_result["jpegphoto"]) = split ('%', $info); 
     240                                         
     241                if ($contacts_result['jpegphoto']) 
     242                        $photo_link = '<img src="./inc/show_user_photo.php?mail='.$contacts_result['mail'].'">'; 
     243                else 
     244                        $photo_link = '<img src="./templates/default/images/photo.png">'; 
     245                                         
     246                $phoneUser = $contacts_result['phone']; 
     247                                         
     248                if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_enabled'] && $phoneUser) { 
     249                        $phoneUser = '<a title="'.$functions->getLang("Call to Comercial Number").'" href="#" onclick="InfoContact.connectVoip(\''.$phoneUser.'\',\'com\')">'.$phoneUser.'</a>'; 
     250                        if($contacts_result['mobile']){ 
     251                                $phoneUser .= ' / <a title="'.$functions->getLang("Call to Mobile Number").'" href="#" onclick="InfoContact.connectVoip(\''.$contacts_result['mobile'].'\',\'mob\')">'.$contacts_result['mobile'].'</a>'; 
     252                        } 
     253                } 
     254                $option = 
     255                        '<tr class="quicksearchcontacts_unselected">' . 
     256                                '<td class="cc" width="1%">' . 
     257                                        '<a title="'.$functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result["cn"].'\', \''.$contacts_result["mail"].'\')">' . 
     258                                                $photo_link . 
     259                                        '</a>' . 
     260                                '</td>' . 
     261                                '<td class="cc">' . 
     262                                        '<span name="cn">' . $contacts_result['cn'] . '</span>' . '<br>' . 
     263                                        '<a title="'.$functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result["cn"].'\', \''.$contacts_result["mail"].'\')">' . 
     264                                                '<font color=blue>' . 
     265                                                        '<span name="mail">' . $contacts_result['mail'] . '</span>' . '<br>' . 
     266                                                '</font>' . 
     267                                        '</a>' . 
     268                                        $phoneUser . 
     269                                '</td>' . 
     270                        '</tr>'; 
     271                return $option; 
    202272        } 
    203273 
Note: See TracChangeset for help on using the changeset viewer.