Changeset 1319


Ignore:
Timestamp:
08/13/09 11:34:34 (15 years ago)
Author:
amuller
Message:

Ticket #621 - Melhoria no desanexar marcando como lida/

Location:
trunk/expressoMail1_2
Files:
2 edited

Legend:

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

    r1270 r1319  
    315315                        $this->mbox = $this->open_mbox($params["folder"]); 
    316316                $return["status"] = true; 
    317                 $return["msg_num"] = $params["msg_num"]; 
    318317                $header = ""; 
    319318                 
     
    321320                foreach($headertemp as $head) {//Se eu colocar todo o header do email dá pau no append, então procuro apenas o que interessa. 
    322321                        $head1 = explode(":",$head); 
    323                         if ( (strtoupper($head1[0]) == strtoupper("to")) ||  
    324                                         (strtoupper($head1[0]) == strtoupper("from")) ||  
    325                                         (strtoupper($head1[0]) == strtoupper("subject")) || 
    326                                         (strtoupper($head1[0]) == strtoupper("date")) ) 
     322                        if ( (strtoupper($head1[0]) == "TO") ||  
     323                                        (strtoupper($head1[0]) == "FROM") ||  
     324                                        (strtoupper($head1[0]) == "SUBJECT") || 
     325                                        (strtoupper($head1[0]) == "DATE") ) 
    327326                                $header .= $head."\r\n"; 
    328327                } 
     
    333332                                                             para que o método decodeBody do expresso possa trazer tudo certinho*/ 
    334333                 
    335                 $status = @imap_append($this->mbox, 
     334                $status = imap_append($this->mbox, 
    336335                                "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$params["folder"], 
    337336                                        $header. 
     
    341340                                                        $msg->encoding[$params["msg_num"]][0], $msg->charset[$params["msg_num"]][0] 
    342341                                                        )                                        
    343                                         )); //Append do novo email, só com header e conteúdo sem anexos. 
    344                  
    345                 if(!$status) { 
     342                                        ), "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. 
     343                 
     344                if(!$status) 
     345                { 
    346346                        $return["status"] = false; 
    347347                        $return["msg"] = lang("error appending mail on delete attachments"); 
    348348                } 
    349          
    350                 @imap_delete($this->mbox, imap_msgno($this->mbox, $params["msg_num"])); //Insere o novo e-mail sem anexos. 
    351                 @imap_expunge($this->mbox); //Deleta o e-mail com anexos 
     349                else 
     350                { 
     351                        $status = imap_status($this->mbox, "{".$this->imap_server.":".$this->imap_port."}".$params['folder'], SA_UIDNEXT); 
     352                        $return['msg_no'] = $status->uidnext - 1;  
     353                        imap_delete($this->mbox, imap_msgno($this->mbox, $params["msg_num"])); 
     354                        imap_expunge($this->mbox); 
     355                } 
    352356                 
    353357                return $return; 
  • trunk/expressoMail1_2/js/main.js

    r1318 r1319  
    165165 
    166166        var call_back = function(data) { 
    167                                         if(!data.status) { //Em caso de erros, o status vem como false e o texto do erro vem em msg. 
    168                                                 alert(data.msg); 
    169                                         } 
    170                                         else { 
    171                                                 mail_msg = Element("tbody_box"); 
    172                                                 msg_to_delete = Element(data.msg_num); 
    173                                                 if (msg_to_delete) { 
    174                                                         if ( (msg_to_delete.style.backgroundColor != '') && (preferences.use_shortcuts == '1') ) 
    175                                                                 select_msg('null', 'down'); 
    176                                                         mail_msg.removeChild(msg_to_delete);                                                                                             
    177                                                 }//Remove o email com anexos da lista de emails. 
    178                                                 write_msg(get_lang("Attachments removed"));//indica que os anexos foram removidos 
    179                                                 refresh(); //dá um refresh na lista de emails, para que apareça o novo email sem anexos 
    180                                                 delete_border(data.msg_num+'_r','false');//fecha a tela do email já removido. 
    181                                         } 
    182                                 }; 
     167                if(!data.status) { 
     168                        alert(data.msg); 
     169                } 
     170                else { 
     171                        msg_to_delete = Element(msg_num); 
     172                        change_tr_properties(msg_to_delete, data.msg_no); 
     173                        msg_to_delete.childNodes[1].innerHTML = ""; 
     174                        write_msg(get_lang("Attachments removed")); 
     175                        delete_border(msg_num+'_r','false'); //close email tab 
     176                } 
     177        }; 
    183178        if (confirm(get_lang("delete all attachments confirmation"))) 
    184                 cExecute ("$this.imap_functions.remove_attachments&folder="+folder+"&msg_num="+msg_num, call_back); //chamada em ajax para a função de remover anexos. 
     179                cExecute ("$this.imap_functions.remove_attachments&folder=" 
     180                                +folder+"&msg_num="+msg_num, call_back); 
    185181} 
    186182function watch_changes_in_msg(border_id) 
     
    15901586} 
    15911587function change_tr_properties(tr_element, newUid, newSubject){ 
    1592         var td_who = document.getElementById('td_who_'+tr_element.id); 
    1593         td_who.nextSibling.innerHTML = newSubject; 
     1588        message_id=tr_element.id; 
     1589        var td_who = document.getElementById('td_who_'+message_id); 
     1590        if (typeof(newSubject) != 'undefined') 
     1591                td_who.nextSibling.innerHTML = newSubject; 
    15941592        tr_element.id = newUid; 
    15951593 
     
    15991597        }; 
    16001598        for (var i=2; i < 10; i++){ 
    1601                 tr_element.childNodes[i].id = tr_element.childNodes[i].id.replace(message_id,newUid); 
     1599                if (typeof(tr_element.childNodes[i].id) != "undefined") 
     1600                        tr_element.childNodes[i].id = tr_element.childNodes[i].id.replace(message_id,newUid); 
    16021601                tr_element.childNodes[i].onclick = openNewMessage; 
    16031602        } 
Note: See TracChangeset for help on using the changeset viewer.