Changeset 7455


Ignore:
Timestamp:
10/24/12 10:55:51 (8 years ago)
Author:
marcosw
Message:

Ticket #3088 - Correção na aba de contadores de mensagens e paginação

Location:
trunk/expressoMail1_2/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/draw_api.js

    r7437 r7455  
    681681        if (/^local_messages/.test(current_folder)) { 
    682682            $(".folders-loading").removeClass("folders-loading"); //remove o icone de loading ao clicar nas pastas locais 
    683             selectAllFolderMsgs(false); 
    684             //Método chamado para retornar todos os ids de mensagens por folder 
    685             expresso_mail_archive.listAllMessagesByFolder(folder.replace("local_messages_","")); 
    686             populateSelectedMsgs(expresso_mail_archive.allmessagesbyfolder); 
    687683        } 
    688684        else { //se não, processamento normal da pasta 
     
    23102306        sort_box_type = sort; 
    23112307        search_box_type = search; 
     2308 
    23122309        if (typeof(clean_selected) == "undefined"){      
    2313                  
    23142310        $.ajax({                         
    23152311                        url: "controller.php?" + $.param( {action: "$this.imap_functions.getMessagesIds",  
     
    23382334                        } 
    23392335                }); 
    2340          
    23412336        }        
     2337 
    23422338        proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort,search,sort_box_reverse,preferences.preview_msg_subject,preferences.preview_msg_tip,handler_draw_box); 
    23432339        current_page = 1; 
     
    57535749        answer+ 
    57545750        '<span ' + change_font_color + ' id="span_flag_FLAGGED" class="'+(search_box_type == 'FLAGGED' ? 'message_options_over' : 'message_options')+'" title="'+get_lang("l_important")+'" onclick="if(\'FLAGGED\' == \''+search_box_type+'\') return false;sort_box(\'FLAGGED\',\''+sort_box_type+'\')">'+get_lang("l_important")+'</span>&nbsp;&nbsp;'; 
    5755         draw_paging(num_msgs); 
    5756         Element("tot_m").innerHTML = num_msgs; 
    5757 } 
     5751    if(!proxy_mensagens.is_local_folder(current_folder)){ 
     5752        draw_paging(num_msgs); 
     5753        Element("tot_m").innerHTML = num_msgs; 
     5754    } 
     5755} 
  • trunk/expressoMail1_2/js/mail_archiver.js

    r7450 r7455  
    172172    this.allmessagesbyfolder = new Array(); 
    173173    this.isArchiveOperation = false; //Se estiver em andamento uma operação de arquivamento/desarquivamento. 
     174    //Contadores da aba de listagem de mensagem 
     175    this.tot_msgs_tab = 0; 
     176    this.tot_unseen_msgs_tab = 0; 
    174177} 
    175178 
     
    13571360                                      +'\n->ID ' + returnService.getReturn()[0].getId()); 
    13581361    */ 
    1359     var msg_unseen_count = 0; 
    13601362    for(var i=0; i< returnService.getReturn().length; i++){ 
    13611363        var ExpSerialized = expresso_mail_archive.pattern.toExpressoHeader(returnService.getReturn()[i]); 
    13621364        var msgitem = connector.unserialize(ExpSerialized); 
    1363         //counts unseen messages 
    1364         if(msgitem.Unseen == 'U') 
    1365             msg_unseen_count++; 
    1366        
    13671365        // correção para por no padrao certo, se nao fizer isso buga a listagem 
    13681366        msgitem_temp = msgitem.msg_sample; 
     
    13711369        expresso_mail_archive.ServiceReturnObjectList.push(returnService.getReturn()[i]); //add each one service return data into this embeded object array 
    13721370    } 
    1373     var tab_counters = expresso_mail_archive.getFolderCounters(); 
    1374      
    13751371    //msglist["num_msgs"] = returnService.getReturn().length; 
    13761372    //window.alert('service return length = ' + returnService.getReturn().length + '\nfolder.nummessages = ' + expresso_mail_archive.folder.nummessages); 
     
    13791375 
    13801376    //msglist["num_msgs"] = expresso_mail_archive.folder.nummessages; 
    1381     msglist["num_msgs"] = tab_counters[0]; 
    13821377    //window.alert('num msgs'); 
    13831378    //(expresso_mail_archive.folder.unseen) ? msglist["tot_unseen"] = expresso_mail_archive.folder.unseen : msglist["tot_unseen"] = 0; 
    1384     (tab_counters[1] != 0) ? msglist["tot_unseen"] = tab_counters[1] : msglist["tot_unseen"] = 0; 
    13851379//    window.alert('num unseen'); 
    13861380    //window.alert('print_r\n\n' + print_r(msglist)); 
     
    13891383    expresso_mail_archive.messageslisted = msglist; 
    13901384    expresso_mail_archive.drawdata = {messagesList:msglist}; 
    1391     //expresso_mail_archive.drawMessagesList(); 
     1385    expresso_mail_archive.drawMessagesList(); 
    13921386    //expresso_mail_archive.drawMessagesList(returnService.getReturn().length, msg_unseen_count); 
    13931387    //expresso_mail_archive.drawMessagesList(msglist["num_msgs"], msg_unseen_count); 
    1394     expresso_mail_archive.drawMessagesList(msglist["num_msgs"], msglist['tot_unseen']); 
     1388    //expresso_mail_archive.drawMessagesList(expresso_mail_archive.tot_msgs_tab, expresso_mail_archive.tot_unseen_msgs_tab); 
    13951389    connector.hideProgressBar(); 
    13961390} 
     
    14021396 
    14031397//List all messages by folder given and set a array with all messages ids 
    1404 MailArchiver.prototype.listAllMessagesByFolder = function(folderid){ 
    1405     try{ 
    1406         var query_messages = '{"query":{"folder":[{"@id":"'+folderid+'"}], "order":[{"@asc":"date"}]}}'; 
     1398MailArchiver.prototype.listAllMessagesByFolder = function(folderid, searchType){ 
     1399    try{ 
     1400        //Marcosw 
     1401        if(searchType == "ALL") 
     1402            var query_messages = '{"query":{"folder":[{"@id":"'+folderid+'"}], "order":[{"@asc":"date"}]}}'; 
     1403        else 
     1404            var query_messages = '{"query":{"folder":[{"@id":"'+folderid+'"}], "tags":[{"@contains":"'+searchType+'"}], "order":[{"@asc":"date"}]}}'; 
     1405        console.log(query_messages); 
    14071406        ArchiveServices.listMessages(expresso_mail_archive.listAllMessagesByFolderOperationOK, expresso_mail_archive.listAllMessagesByFolderOperationFailure, expresso_mail_archive.session.id, query_messages); 
    14081407    } 
     
    14171416    for(var i=0; i< returnService.getReturn().length; i++){ 
    14181417        msglist.push(returnService.getReturn()[i]._id); 
    1419     } 
     1418        //Marcosw 
     1419        if(returnService.getReturn()[i]._tags.indexOf("unseen") != -1){ 
     1420            expresso_mail_archive.tot_unseen_msgs_tab++; 
     1421        } 
     1422        expresso_mail_archive.tot_msgs_tab++; 
     1423        //console.log(returnService.getReturn()[i]); 
     1424    } 
     1425    //console.log(msglist); 
    14201426    expresso_mail_archive.allmessagesbyfolder = msglist; 
    14211427} 
     
    14361442} 
    14371443 
    1438 MailArchiver.prototype.drawMessagesList = function(msgtot, msgunseen){ 
     1444MailArchiver.prototype.drawMessagesList = function(){ 
    14391445    //window.alert('no drawMessagesList com folder = ' + expresso_mail_archive.currentfolder  + '\nudatecounters = ' + expresso_mail_archive.udatecounters); 
    14401446    var data_to_draw = expresso_mail_archive.drawdata.messagesList;   
     
    14671473    //draw_paging(expresso_mail_archive.drawdata.messagesList.length); 
    14681474    //draw_paging(preferences.max_email_per_page); 
    1469     draw_paging(folder_num_msgs);     
    1470     if(((msgtot) && (msgunseen)) || ((parseInt(msgtot)==0)&&(parseInt(msgunseen)==0))){ 
    1471         Element('new_m').innerHTML = '<font color="RED">'+$(".tr_msg_unread").length+'</font>'; 
    1472     } 
    1473     else{ 
    1474         Element("tot_m").innerHTML = folder_num_msgs; 
    1475         Element('new_m').innerHTML = data_to_draw['tot_unseen'] ? '<font color="RED">'+data_to_draw['tot_unseen']+'</font>' : 0; 
    1476     } 
     1475    draw_paging(expresso_mail_archive.tot_msgs_tab);     
     1476    Element("tot_m").innerHTML = expresso_mail_archive.tot_msgs_tab; //folder_num_msgs; 
     1477    Element('new_m').innerHTML = '<font color="RED">'+expresso_mail_archive.tot_unseen_msgs_tab+'</font>'; 
    14771478} 
    14781479 
  • trunk/expressoMail1_2/js/messages_controller.js

    r7426 r7455  
    3434                    var exp_dfs = new Array(baseFolder,msg_range_begin,emails_per_page,sort_box_type,search_box_type,sort_box_reverse,preview_msg_subject,preview_msg_tip); 
    3535                    expresso_mail_archive.queryconfig.setExpressoDefaults(exp_dfs); 
     36                    //Para recontagem de mensagens para aba e paginação. 
     37                    expresso_mail_archive.tot_msgs_tab = 0; 
     38                    expresso_mail_archive.tot_unseen_msgs_tab = 0; 
     39                    expresso_mail_archive.listAllMessagesByFolder(folder.replace("local_messages_",""), search_box_type); 
     40                    selectAllFolderMsgs(false); 
     41                    populateSelectedMsgs(expresso_mail_archive.allmessagesbyfolder); 
    3642                    expresso_mail_archive.listMessages(); 
    3743                } 
Note: See TracChangeset for help on using the changeset viewer.