Changeset 614 for trunk


Ignore:
Timestamp:
01/15/09 19:06:49 (15 years ago)
Author:
eduardoalex
Message:

Ticket #401

Location:
trunk/expressoMail1_2
Files:
5 edited

Legend:

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

    r613 r614  
    8282                        $msg_number = $sort_array_msg[$msg_range_begin-1]; 
    8383 
     84                        /*A função imap_headerinfo não traz o cabeçalho completo, e sim alguns 
     85                        * atributos do cabeçalho. Como eu preciso do atributo Importance  
     86                        * para saber se o email é importante ou não, uso abaixo a função 
     87                        * imap_fetchheader e busco o atributo importance nela para passar 
     88                        * para as funções ajax. Isso faz com que eu acesse o cabeçalho 
     89                        * duas vezes e de duas formas diferentes, mas em contrapartida, eu 
     90                        * não preciso reimplementar o método utilizando o fetchheader. 
     91                        * Como as mensagens são renderizadas em um número pequeno por vez, 
     92                        * não parece ter perda considerável de performance. 
     93                        */ 
     94                        $flag = preg_match('/importance *: *(.*)\r/i', 
     95                                        imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
     96                                        ,$importance);           
     97                        $return[$i]['Importance'] = $flag==0?"":$importance[1]; 
     98                         
     99                         
    84100                        $header = $this->get_header($msg_number); 
    85101                        if (!is_object($header)) 
     
    9931009                foreach($msgs_to_exec as $msg_number => $command) 
    9941010                { 
     1011                        /*A função imap_headerinfo não traz o cabeçalho completo, e sim alguns 
     1012                        * atributos do cabeçalho. Como eu preciso do atributo Importance  
     1013                        * para saber se o email é importante ou não, uso abaixo a função 
     1014                        * imap_fetchheader e busco o atributo importance nela para passar 
     1015                        * para as funções ajax. Isso faz com que eu acesse o cabeçalho 
     1016                        * duas vezes e de duas formas diferentes, mas em contrapartida, eu 
     1017                        * não preciso reimplementar o método utilizando o fetchheader. 
     1018                        * Como na atualização são poucas as mensagens que devem ser renderizadas, 
     1019                        * a perda em performance é insignificante. 
     1020                        */ 
     1021                        $flag = preg_match('/importance *: *(.*)\r/i', 
     1022                                        imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
     1023                                        ,$importance);           
     1024                        $return[$i]['Importance'] = $flag==0?"":$importance[1]; 
     1025                         
    9951026                        $header = $this->get_header($msg_number); 
    9961027                        if (!is_object($header)) 
     
    12351266                $msg_uid = $params['msg_id']; 
    12361267                $return_receipt = $params['input_return_receipt']; 
     1268                $is_important = $params['input_important_message']; 
    12371269                $body = $params['body']; 
    12381270                //echo "<script language=\"javascript\">javascript:alert('".$body."');</script>"; 
     
    13591391                        } 
    13601392                } 
     1393 
     1394//////////////////////////////////////////////////////////////////////////////////////////////////// 
     1395                // Important message 
     1396                if($is_important) 
     1397                        $mail->isImportant(); 
    13611398 
    13621399//////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    18711908                elseif ($flag == "flagged") 
    18721909                        $return["status"] = imap_setflag_full($this->mbox, $msgs_to_set, "\\Flagged", ST_UID); 
    1873                 elseif ($flag == "unflagged") 
    1874                         $return["status"] = imap_clearflag_full($this->mbox, $msgs_to_set, "\\Flagged", ST_UID); 
     1910                elseif ($flag == "unflagged") { 
     1911                        $flag_importance = false; 
     1912                        $msgs_number = explode(",",$msgs_to_set); 
     1913                        foreach($msgs_number as $msg_number) { 
     1914                                preg_match('/importance *: *(.*)\r/i', 
     1915                                        imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
     1916                                        ,$importance);           
     1917                                if(strtolower($importance[1])=="high") { 
     1918                                        $flag_importance=true; 
     1919                                        break; 
     1920                                } 
     1921                                 
     1922                        } 
     1923 
     1924                        if(!$flag_importance)                    
     1925                                $return["status"] = imap_clearflag_full($this->mbox, $msgs_to_set, "\\Flagged", ST_UID); 
     1926                        else{ 
     1927                                $return["status"] = false; 
     1928                                $return["msg"] = $this->functions->getLang("At least one of selected message cant be marked as normal"); 
     1929                        } 
     1930                } 
    18751931                 
    18761932                if($this->mbox && is_resource($this->mbox)) 
  • trunk/expressoMail1_2/inc/class.phpmailer.php

    r504 r614  
    2929     */ 
    3030    var $Priority          = 3; 
     31        /** 
     32         * Email Importance. 
     33         */ 
     34        var $Importance        = ""; 
    3135 
    3236    /** 
     
    231235    ///////////////////////////////////////////////// 
    232236 
     237        function isImportant() { 
     238                $this->Importance = "High"; 
     239        } 
     240         
    233241    /** 
    234242     * Sets message type to HTML.   
     
    860868        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); 
    861869        $result .= $this->HeaderLine("X-Priority", $this->Priority); 
     870        $result .= $this->HeaderLine("Importance", $this->Importance); 
    862871        $result .= $this->HeaderLine("X-Mailer", "ExpressoMail [version " . $this->Version . "]"); 
    863872         
  • trunk/expressoMail1_2/js/draw_api.js

    r613 r614  
    535535                tr_element.id = headers_msgs.msg_number; 
    536536 
    537                 if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) 
     537                if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){ 
     538                        if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.indexOf("high")!=-1)) 
     539                                add_className(tr_element, 'flagged_msg'); 
    538540                        add_className(tr_element, 'tr_msg_unread'); 
    539                 else 
     541                } 
     542                else{ 
     543                        if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.indexOf("high")!=-1)) 
     544                                add_className(tr_element,'flagged_msg'); 
    540545                        add_className(tr_element, 'tr_msg_read'); 
    541                  
    542                 if (headers_msgs.Flagged == 'F') 
    543                         add_className(tr_element,'flagged_msg'); 
     546                } 
    544547 
    545548                td_element1 = document.createElement("TD"); 
     
    585588                _img_important.src = "templates/default/images/important.gif"; 
    586589 
    587                 if (headers_msgs.Flagged == 'F') 
     590                if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.indexOf("high")!=-1)) 
    588591                        td_element22.innerHTML += "<img src ='templates/default/images/important.gif' title='"+get_lang('Important')+"'>"; 
    589592                else 
     
    13641367        info_msg.body = info_msg.body.replace("<body","<span"); 
    13651368        info_msg.body = info_msg.body.replace("<BODY","<span"); 
     1369 
    13661370        div.innerHTML+= "<span id='body_"+ID+"'>"+info_msg.body+"</span><br><br>"; 
    13671371        //////////////////////////////////////////////////////////////////////////////////////////////////////   
     
    18041808        tbody_message.appendChild(tr5); 
    18051809////////////////////////////////////////////////////////////////////////////////////////////////////// 
     1810        var trn = document.createElement("TR"); 
     1811        var tdn = document.createElement("TD"); 
     1812        tdn.innerHTML = "&nbsp;"; 
     1813        var td_important_msg = document.createElement("TD"); 
     1814        td_important_msg.setAttribute("noWrap","true"); 
     1815        td_important_msg.innerHTML = get_lang("Important message")+":"; 
     1816        var input_important_message = document.createElement('input'); 
     1817        input_important_message.type = "checkbox"; 
     1818        input_important_message.className = "checkbox"; 
     1819        input_important_message.id = "important_message_"+ID; 
     1820        input_important_message.name = "input_important_message"; 
     1821        input_important_message.setAttribute("tabIndex","-1"); 
     1822        td_important_msg.appendChild(input_important_message);   
     1823        trn.appendChild(tdn); 
     1824        trn.appendChild(td_important_msg); 
     1825        tbody_message.appendChild(trn); 
     1826 
     1827////////////////////////////////////////////////////////////////////////////////////////////////////// 
    18061828        var add_files = document.createElement("A"); 
    18071829        add_files.setAttribute("href", "javascript:void(0)"); 
  • trunk/expressoMail1_2/js/main.js

    r613 r614  
    12191219                        return; 
    12201220                var msgs_to_set = data.msgs_to_set.split(","); 
     1221                 
     1222                if(!data.status) { 
     1223                        alert(data.msg); 
     1224                        Element('chk_box_select_all_messages').checked = false; 
     1225                        for (var i = 0; i < msgs_to_set.length; i++) { 
     1226                                Element("check_box_message_" + msgs_to_set[i]).checked = false; 
     1227                                remove_className(Element(msgs_to_set[i]), 'selected_msg'); 
     1228                        } 
     1229                        return; 
     1230                } 
     1231                 
    12211232 
    12221233                for (var i=0; i<msgs_to_set.length; i++){ 
Note: See TracChangeset for help on using the changeset viewer.