Changeset 659


Ignore:
Timestamp:
02/04/09 13:59:41 (15 years ago)
Author:
eduardoalex
Message:

Correções de defeitos apontados por Nilton no envio de mensagens importantes.

Location:
trunk/expressoMail1_2
Files:
3 edited

Legend:

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

    r650 r659  
    15771577        } 
    15781578         
     1579        function messages_sort($sort_box_type,$sort_box_reverse, $search_box_type) 
     1580        { 
     1581                $sort = array(); 
     1582                $sort_uid = array(); 
     1583                 
     1584                $num_msgs = imap_num_msg($this->mbox); 
     1585                for ($i=1; $i<=$num_msgs; $i++) 
     1586                { 
     1587                        $header = $this->get_header(imap_uid($this->mbox,$i)); 
     1588                        // List UNSEEN messages. 
     1589                        if($search_box_type == "UNSEEN" &&  (!trim($header->Recent) && !trim($header->Unseen))){ 
     1590                                continue; 
     1591                        } 
     1592                        // List SEEN messages. 
     1593                        elseif($search_box_type == "SEEN" && (trim($header->Recent) || trim($header->Unseen))){ 
     1594                                continue; 
     1595                        } 
     1596                        // List ANSWERED messages.                       
     1597                        elseif($search_box_type == "ANSWERED" && !trim($header->Answered)){ 
     1598                                continue;                                
     1599                        } 
     1600                        // List FLAGGED messages.                        
     1601                        elseif($search_box_type == "FLAGGED" && !trim($header->Flagged)){ 
     1602                                continue; 
     1603                        } 
     1604                                                 
     1605                         
     1606                        if($sort_box_type=='SORTFROM') { 
     1607                                if (($header->from[0]->mailbox . "@" . $header->from[0]->host) == $_SESSION['phpgw_info']['expressomail']['user']['email'])                              
     1608                                        $from = $header->to; 
     1609                                else 
     1610                                        $from = $header->from; 
     1611                                 
     1612                                $tmp = imap_mime_header_decode($from[0]->personal);                      
     1613                                 
     1614                                if ($tmp[0]->text != "") 
     1615                                        $sort[$i] = $tmp[0]->text; 
     1616                                else 
     1617                                        $sort[$i] = $from[0]->mailbox . "@" . $from[0]->host; 
     1618                        } 
     1619                        else if($sort_box_type=='SORTSUBJECT') { 
     1620                                $sort[$i] = $header->subject; 
     1621                        } 
     1622                        else if($sort_box_type=='SORTSIZE') { 
     1623                                $sort[$i] = $header->Size; 
     1624                        } 
     1625                        else { 
     1626                                $sort[$i] = $header->udate; 
     1627                        } 
     1628                         
     1629                } 
     1630                 
     1631                natcasesort($sort); 
     1632                 
     1633                foreach($sort as $index => $header_msg) 
     1634                {        
     1635                        $sort_uid[] = imap_uid($this->mbox, $index); 
     1636                } 
     1637                 
     1638                if ($sort_box_reverse) 
     1639                        $sort_uid = array_reverse($sort_uid); 
     1640                 
     1641                return $sort_uid; 
     1642 
     1643        } 
     1644         
     1645        /** 
     1646         * Deprecated 
     1647         *  
     1648         * Replaced for the method messages_sort 
     1649         */ 
    15791650        function imap_sortfrom($sort_box_reverse, $search_box_type) 
    15801651        { 
     
    19872058                        $flag_importance = false; 
    19882059                        $msgs_number = explode(",",$msgs_to_set); 
     2060                        $unflagged_msgs = ""; 
    19892061                        foreach($msgs_number as $msg_number) { 
    19902062                                preg_match('/importance *: *(.*)\r/i', 
     
    19932065                                if(strtolower($importance[1])=="high") { 
    19942066                                        $flag_importance=true; 
    1995                                         break; 
    1996                                 } 
    1997                                  
    1998                         } 
    1999  
    2000                         if(!$flag_importance)                    
    2001                         $return["status"] = imap_clearflag_full($this->mbox, $msgs_to_set, "\\Flagged", ST_UID); 
    2002                         else{ 
     2067                                } 
     2068                                else { 
     2069                                        $unflagged_msgs.=$msg_number.","; 
     2070                                }                                
     2071                        } 
     2072 
     2073                        if($unflagged_msgs!="") { 
     2074                                imap_clearflag_full($this->mbox,substr($unflagged_msgs,0,strlen($unflagged_msgs)-1), "\\Flagged", ST_UID); 
     2075                                $return["msgs_unflageds"] = substr($unflagged_msgs,0,strlen($unflagged_msgs)-1); 
     2076                        } 
     2077                        else { 
     2078                                $return["msgs_unflageds"] = false; 
     2079                        } 
     2080 
     2081                        if($flag_importance) { 
    20032082                                $return["status"] = false; 
    20042083                                $return["msg"] = $this->functions->getLang("At least one of selected message cant be marked as normal"); 
     2084                        } 
     2085                        else { 
     2086                                $return["status"] = true; 
    20052087                        } 
    20062088                } 
     
    20982180                } 
    20992181 
    2100                 switch($sort_box_type){ 
     2182                return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type); 
     2183                /*switch($sort_box_type){ 
    21012184                        case 'SORTFROM': 
    21022185                                return $this->imap_sortfrom($sort_box_reverse, $search_box_type);                                
     
    21072190                        default: 
    21082191                                return imap_sort($this->mbox, SORTARRIVAL, $sort_box_reverse, SE_UID, $search_box_type);                                                 
    2109                 }                
     2192                }*/ 
    21102193        }        
    21112194         
     
    27322815                $pdate = date_parse($header->MailDate); 
    27332816                $header->udate +=  $pdate['zone']*(-60); 
     2817                 
     2818                if($header->Flagged!="F") { 
     2819                        $flag = preg_match('/importance *: *(.*)\r/i', 
     2820                                                imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
     2821                                                ,$importance);           
     2822                        $header->Flagged = $flag==0?false:strtolower($importance[1])=="high"?"F":false; 
     2823                } 
     2824                 
    27342825                return $header; 
    27352826        } 
  • trunk/expressoMail1_2/js/draw_api.js

    r652 r659  
    589589                _img_important.src = "templates/default/images/important.gif"; 
    590590 
    591                 if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.indexOf("high")!=-1)) 
     591                if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.toLowerCase().indexOf("high")!=-1)) 
    592592                        td_element22.innerHTML += "<img src ='templates/default/images/important.gif' title='"+get_lang('Important')+"'>"; 
    593593                else 
  • trunk/expressoMail1_2/js/main.js

    r649 r659  
    12301230                                remove_className(Element(msgs_to_set[i]), 'selected_msg'); 
    12311231                        } 
    1232                         return; 
     1232                        if(!data.msgs_unflageds) 
     1233                                return; 
     1234                        else 
     1235                                msgs_to_set = data.msgs_unflageds.split(","); 
    12331236                } 
    12341237                 
Note: See TracChangeset for help on using the changeset viewer.