Changeset 1330


Ignore:
Timestamp:
08/17/09 14:51:21 (15 years ago)
Author:
niltonneto
Message:

Ticket #605 - Opção de mostrar pastas compartilhadas por nome (CN) ou login (uid).

Location:
trunk/expressoMail1_2
Files:
7 edited

Legend:

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

    r1319 r1330  
    14241424                                $result[$i]['folder_name'] = array_pop($tmp_folder_parent); 
    14251425                                $result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name']; 
    1426                                 if (is_numeric($result[$i]['folder_name']))     { 
    1427                                         //$this->ldap = new ldap_functions(); 
     1426                                if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']){ 
     1427                                        $this->ldap = new ldap_functions(); 
    14281428                                        if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])){ 
    14291429                                                $result[$i]['folder_name'] = $cn; 
     
    21532153        } 
    21542154        //Este bloco tem a finalidade de transformar o CPF das pastas compartilhadas em common name 
    2155         if (substr($new_folder_name,0,4) == 'user'){ 
    2156                 $this->ldap = new ldap_functions(); 
    2157                 $tmp_folder_name = explode($this->imap_delimiter, $new_folder_name); 
    2158                         $return['new_folder_name'] = array_pop($tmp_folder_name); 
    2159                         if (is_numeric($return['new_folder_name'])) 
     2155        if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']){ 
     2156                if (substr($new_folder_name,0,4) == 'user'){ 
     2157                        $this->ldap = new ldap_functions(); 
     2158                        $tmp_folder_name = explode($this->imap_delimiter, $new_folder_name); 
     2159                                $return['new_folder_name'] = array_pop($tmp_folder_name); 
    21602160                                if( $cn = $this->ldap->uid2cn($return['new_folder_name'])) 
    21612161                                        $return['new_folder_name'] = $cn; 
     2162                } 
    21622163        } 
    21632164                 
     
    29172918                                $filter = $this->remove_accents($filter); 
    29182919                                //Este bloco tem a finalidade de transformar o login (quando numerico) das pastas compartilhadas em common name 
    2919                                 $folder_name = explode($this->imap_delimiter,$name_box); 
    2920                                 if (is_numeric($folder_name[1])) { 
     2920                                if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']){ 
     2921                                        $folder_name = explode($this->imap_delimiter,$name_box); 
    29212922                                        $this->ldap = new ldap_functions(); 
    2922                                         if ($cn = $this->ldap->uid2cn($folder_name[1])) { 
     2923                                        if ($cn = $this->ldap->uid2cn($folder_name[1])){ 
    29232924                                                $folder_name[1] = $cn; 
    29242925                                        } 
    2925                                 } 
    2926                                 $folder_name = implode($this->imap_delimiter,$folder_name); 
     2926                                        $folder_name = implode($this->imap_delimiter,$folder_name); 
     2927                                } 
     2928                                else 
     2929                                        $folder_name = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO_8859-1" ); 
    29272930                                 
    29282931                                if(!is_resource($mbox_stream)) 
     
    29432946                                                { 
    29442947                                                        foreach($search_criteria as $new_search){ 
    2945                                                                 $m_token = trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--".$new_search."##"."\n"); 
     2948                                                                $m_token = trim("##". mb_convert_encoding( $folder_name, "ISO_8859-1", "UTF7-IMAP" ) . "--" . mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--".$new_search."##"."\n"); 
    29462949                                                                if(!@strstr($retorno,$m_token)) 
    29472950                                                                        $retorno .= $m_token; 
     
    29572960                                        { 
    29582961                                                foreach($search_criteria as $new_search) 
    2959                                                         $retorno .= trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--" . $new_search."##"."\n"); 
     2962                                                        $retorno .= trim("##". mb_convert_encoding( $folder_name, "ISO_8859-1", "UTF7-IMAP" ) . "--" . mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--" . $new_search."##"."\n"); 
    29602963                                        } 
    29612964                                } 
  • trunk/expressoMail1_2/inc/hook_settings.inc.php

    r1316 r1330  
    6464'</script>'); 
    6565//} 
     66 
     67$default = false; 
     68create_check_box('Do you want to show common name instead of UID?','uid2cn',$default, 
     69        'Do you want to show common name instead of UID?');  
    6670 
    6771$default = array( 
  • trunk/expressoMail1_2/js/local_messages.js

    r1121 r1330  
    569569                while(rs.isValidRow()) { 
    570570                        var header = connector.unserialize(rs.field(0)); 
    571                         retorno+="##"+"local_"+rs.field(1)+"--"+header["from"]["name"]+"--"+header["subject"]+"--"+header["udate"]+"--"+this.aux_convert_size(rs.field(3))+"--"+header["Unseen"]+header["Recent"]+header["Flagged"]+header["Draft"]+"--"+rs.field(2)+"##"; 
     571                        retorno+="##"+"local_"+rs.field(1)+"--"+"local_"+rs.field(1)+"--"+header["from"]["name"]+"--"+header["subject"]+"--"+header["udate"]+"--"+this.aux_convert_size(rs.field(3))+"--"+header["Unseen"]+header["Recent"]+header["Flagged"]+header["Draft"]+"--"+rs.field(2)+"##"; 
    572572                        rs.next(); 
    573573                } 
     
    701701    } 
    702702 
    703     local_messages.prototype.get_msg_date = function (original_id, is_local){ 
     703    local_messages.prototype.get_msg_date = function (original_id){ 
    704704 
    705705        this.init_local_messages(); 
    706706 
    707         if (typeof(is_local) == 'undefined') 
    708         { 
    709             is_local = false; 
    710         } 
    711  
    712         var rs; 
    713  
    714         if (is_local) 
    715         { 
    716             rs = this.dbGears.execute("select mail from mail where rowid="+original_id); 
    717         } 
    718         else 
    719         { 
    720             rs = this.dbGears.execute("select mail from mail where original_id="+original_id); 
    721         } 
     707        var rs = this.dbGears.execute("select mail from mail where rowid="+original_id); 
     708        // rs = this.dbGears.execute("select mail from mail where original_id="+original_id); 
    722709        var tmp = connector.unserialize(rs.field(0)); 
    723710        var ret = new Array(); 
  • trunk/expressoMail1_2/js/main.js

    r1319 r1330  
    14691469                        if(data.msg_day == '') 
    14701470                        { 
    1471                 header=expresso_local_messages.get_msg_date(data.original_ID, proxy_mensagens.is_local_folder(get_current_folder())); 
     1471                header=expresso_local_messages.get_msg_date(data.original_ID); 
    14721472 
    14731473                                data.fulldate=header.fulldate; 
  • trunk/expressoMail1_2/js/search.js

    r1294 r1330  
    334334                                aux[0] = nw_array[i].substr(0, nw_array[i].indexOf('--')); 
    335335                                nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2); 
     336                                aux[3] = nw_array[i].substr(0, nw_array[i].indexOf('--')); 
     337                                nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2); 
    336338                                aux[1] = nw_array[i].substr(0, nw_array[i].indexOf('--')); 
    337339                                aux[2] = nw_array[i].substr(nw_array[i].indexOf('--')+2); 
     
    341343                        { 
    342344                                var aux = nw_array[i].split("--"); 
    343                         } 
    344  
    345                         var mailbox = aux[0]; 
    346                         var uid_msg = aux[6]; 
     345                                aux.splice(4,0,aux[1]); 
     346                                var mailbox = aux.shift(); 
     347                                aux.splice(0,1,mailbox); 
     348                        } 
     349                         
     350                        var mailbox_name = aux[0]; 
     351                        var mailbox_id = aux[3]; 
     352                        var uid_msg = aux[7]; 
    347353                        var subject = aux[2]; 
    348354                        tr.id = uid_msg; 
    349                         tr.setAttribute('name',mailbox); 
    350                         if (aux[5].match("U")) 
     355                        tr.setAttribute('name',mailbox_id); 
     356                        if (aux[6].match("U")) 
    351357                                add_className(tr,'tr_msg_unread'); 
    352358                        add_className(tr, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); 
     
    364370                                { 
    365371                                        td.style.width = "2%"; 
    366                                         if (aux[5].match('T')) 
     372                                        if (aux[6].match('T')) 
    367373                                        { 
    368                                                 attachNum = parseInt(aux[5].substr(aux[5].indexOf('T')+1)); 
     374                                                attachNum = parseInt(aux[6].substr(aux[6].indexOf('T')+1)); 
    369375                                                td1 = "<img src='templates/"+template+"/images/clip.gif' title='"+attachNum +' '+ get_lang('attachment(s)')+"'>"; 
    370376                                        } 
     
    376382                                        td.style.width = "1%"; 
    377383                                        td.id = "td_message_answered_"+uid_msg; 
    378                                         if (aux[5].match('X')) 
     384                                        if (aux[6].match('X')) 
    379385                                                td1 = '<img src=templates/'+template+'/images/forwarded.gif title=Forwarded>'; 
    380386                                        else 
    381                                                 if (aux[5].match('A')) 
     387                                                if (aux[6].match('A')) 
    382388                                                        td1 = '<img src=templates/'+template+'/images/answered.gif>'; 
    383389                                                else 
     
    388394                                        td.style.width = "1%"; 
    389395                                        td.id = "td_message_important_"+uid_msg; 
    390                                         if (aux[5].match("F")) 
     396                                        if (aux[6].match("F")) 
    391397                                        { 
    392398                                                add_className(tr, 'flagged_msg'); 
     
    404410                                if (j == 5) 
    405411                                { 
    406                                         td.style.width = "14%"; 
     412                                        td.style.width = "20%"; 
    407413                                        td.onclick = _onclick; 
    408414                                        var nm_box = aux[0].split(cyrus_delimiter); 
     
    412418                                        td.style.color = "#42795b"; 
    413419                                        td.style.fontWeight = "bold"; 
    414  
    415                                         if(td1 == "INBOX"){ 
    416                                                 var td1  = get_lang("Inbox"); 
     420                                        if(proxy_mensagens.is_local_folder(td1)) { 
     421                                                var td1 = this.aux_local_folder_display(td1); 
     422                                                aux[2] = tr.name = aux[0]; // precisa trocar pelo nome real no banco do gears. 
     423                                        } else { 
     424                                                if(td1 == "INBOX"){ 
     425                                                        var td1  = get_lang("Inbox"); 
     426                                                }  
     427                                                else if (nm_box[0] == 'user')  
     428                                                        if (nm_box.length > 1)  
     429                                                                var td1 = nm_box[1] + '/' + lang_folder(td1); 
     430                                                        else  
     431                                                                var td1 = td1; 
     432                                                else  
     433                                                        var td1 = lang_folder(td1); 
    417434                                        } 
    418435 
     
    423440                                if( j == 6) 
    424441                                { 
    425                                         if (aux[1].length > 29) 
    426                                                 aux[1] = aux[1].substr(0,29) + "..."; 
     442                                        if (aux[2].length > 29) 
     443                                                aux[2] = aux[2].substr(0,29) + "..."; 
    427444                                        td.style.width = "20%"; 
    428445                                        td.onclick = _onclick; 
     
    436453                                        if (! subject_encode) 
    437454                                                aux[2] = get_lang("no subject") + "..."; 
    438                                         if (aux[2].length > 70) 
     455                                        if (aux[2] > 70) 
    439456                                                aux[2] = aux[2].substr(0,70) + "..."; 
    440457                                        td.style.width = "35%"; 
     
    442459                                        td.setAttribute("NoWrap","true"); 
    443460                                        td.style.overflow = "hidden"; 
    444                                         var td1  = aux[2]; 
     461                                        var td1  = subject; 
    445462 
    446463                                } 
     
    450467                                        td.align = "center"; 
    451468                                        td.onclick = _onclick; 
    452                                         var td1  = aux[3]; 
     469                                        var td1  = aux[4]; 
    453470                                } 
    454471                                if( j == 9) 
     
    457474                                        td.align = "center"; 
    458475                                        td.onclick = _onclick; 
    459                                         var td1  = aux[4]; 
     476                                        var td1  = aux[5]; 
    460477                                } 
    461478                                if (j == 10) 
    462479                                { 
    463                                         if (aux[5].match("U")) 
     480                                        if (aux[6].match("U")) 
    464481                                                add_className(tr, 'tr_msg_unread'); 
    465                                         if (aux[5].match("F")) 
     482                                        if (aux[7].match("F")) 
    466483                                                add_className(tr, 'flagged_msg'); 
    467484                                        var td1 = ''; 
     
    472489                        aux.splice(0,(aux.length)); 
    473490 
    474                 _dragArea.makeDragged(tr, uid_msg, subject, true, mailbox); 
     491                _dragArea.makeDragged(tr, uid_msg, subject, true, mailbox_id); 
    475492                tbody.appendChild(tr); 
    476493                } 
     
    507524                tr_element.className = "message_header"; 
    508525                td_element0 = document.createElement("TD"); 
    509                 td_element0.setAttribute("width", "1%"); 
     526                td_element0.setAttribute("width", "6%"); 
    510527                chk_box_element = document.createElement("INPUT"); 
    511528                chk_box_element.id  = "chk_box_select_all_messages"; 
     
    641658        } 
    642659 
    643         searchE.prototype.open_msg = function(mailbox, uid_msg, subject){ 
     660        searchE.prototype.open_msg = function(mailbox_id, uid_msg, subject){ 
    644661                var handler_get_msg = function(data){ 
    645662                        if(Element("border_id_" + uid_msg + "_r")){alert(get_lang("This message is already opened!"));} 
     
    647664                        //set_msg_as_read(msgs_to_set[i], false); 
    648665                } 
    649                 proxy_mensagens.get_msg(uid_msg,mailbox,false,handler_get_msg); 
     666                proxy_mensagens.get_msg(uid_msg,mailbox_id,false,handler_get_msg); 
    650667                /*var args   = "$this.imap_functions.get_info_msg"; 
    651668                var params = "msg_number=" + uid_msg + "&msg_folder=" + mailbox; 
  • trunk/expressoMail1_2/setup/phpgw_en.lang

    r1035 r1330  
    8080Do you want to block this e-mail?       expressoMail1_2 en      Do you want to block this e-mail? 
    8181Do you want to log the sent messages?   admin   en      Do you want to log the sent messages? 
     82Do you want to show common name instead of UID? expressoMail1_2 en      Do you want to show common name instead of UID? 
    8283Do you want to use the spam filter?     admin   en      Do you want to use the spam filter? 
    8384Do you wish to exclude the folder       expressoMail1_2 en      Do you wish to exclude the folder  
Note: See TracChangeset for help on using the changeset viewer.