Changeset 4698


Ignore:
Timestamp:
07/12/11 09:47:31 (13 years ago)
Author:
brunocosta
Message:

Ticket #2060 - Criada função update_local_box() que atualiza caixas de email locais.

Location:
branches/2.2.0.1/expressoMail1_2/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.0.1/expressoMail1_2/js/draw_api.js

    r4686 r4698  
    346346         * Pastas locais 
    347347         */ 
    348         if(preferences.use_local_messages==1 || expresso_offline) { 
    349                 var local_folders = expresso_local_messages.list_local_folders(); 
    350                 var has_changes = false; 
    351                 for (var i in local_folders) { //Coloca as pastas locais. 
    352  
    353                         var new_caption = local_folders[i][0]; 
    354                         if(local_folders[i][0].indexOf("/")!="-1") { 
    355                                 final_pos = local_folders[i][0].lastIndexOf("/"); 
    356                                 new_caption = local_folders[i][0].substr(final_pos+1); 
    357                         } 
    358  
    359                         var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen'); 
    360  
    361                         if ((folder_unseen) && (local_folders[i][1] > 0)) 
    362                         { 
    363                                 folder_unseen.innerHTML = local_folders[i][1]; 
    364                                 has_changes = true; 
    365                         } 
    366                         else if (local_folders[i][1] > 0) 
    367                         { 
    368                                 tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption) + '<font style=color:red>&nbsp(</font><span id="dftree_local_'+local_folders[i][0]+'_unseen" style=color:red>'+local_folders[i][1]+'</span><font style=color:red>)</font>'}); 
    369                                 tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); 
    370                                 has_changes = true; 
    371                         } 
    372                         else if (local_folders[i][1] <= 0) 
    373                         { 
    374                                 tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption)}); 
    375                                 tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); 
    376                                 has_changes = true; 
    377                         } 
     348                if(preferences.use_local_messages==1 || expresso_offline) { 
     349                        var local_folders = expresso_local_messages.list_local_folders(); 
     350                        var has_changes = false; 
     351                        for (var i in local_folders) { //Coloca as pastas locais. 
     352 
     353                                var new_caption = local_folders[i][0]; 
     354                                if(local_folders[i][0].indexOf("/")!="-1") { 
     355                                        final_pos = local_folders[i][0].lastIndexOf("/"); 
     356                                        new_caption = local_folders[i][0].substr(final_pos+1); 
     357                                } 
     358 
     359                                var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen'); 
     360 
     361                                if ((folder_unseen) && (local_folders[i][1] > 0)) 
     362                                { 
     363                                        folder_unseen.innerHTML = local_folders[i][1]; 
     364                                        has_changes = true; 
     365                                } 
     366                                else if (local_folders[i][1] > 0) 
     367                                { 
     368                                        tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption) + '<font style=color:red>&nbsp(</font><span id="dftree_local_'+local_folders[i][0]+'_unseen" style=color:red>'+local_folders[i][1]+'</span><font style=color:red>)</font>'}); 
     369                                        tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); 
     370                                        has_changes = true; 
     371                                } 
     372                                else if (local_folders[i][1] <= 0) 
     373                                { 
     374                                        tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption)}); 
     375                                        tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); 
     376                                        has_changes = true; 
     377                                } 
    378378 
    379379                        if("local_"+local_folders[i][0] == get_current_folder()){ 
    380                                 var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); 
    381                                 if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){ 
    382                                         Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m); 
    383                                 } 
    384                                 Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0; 
    385                                 draw_paging(Element('tot_m').innerHTML); 
    386                                 has_changes = true; 
    387                         } 
    388                 } 
    389                 if(has_changes) 
    390                         tree_folders.getNodeById("local_root").open(); 
    391  
    392         } 
     380                                        var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); 
     381                                        if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){ 
     382                                                Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m); 
     383                                        } 
     384                                        Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0; 
     385                                        draw_paging(Element('tot_m').innerHTML); 
     386                                        has_changes = true; 
     387                        } 
     388                } 
     389                        if(has_changes) 
     390                                tree_folders.getNodeById("local_root").open(); 
     391        } 
     392} 
     393 
     394 
     395function update_local_box(){ 
     396    msg_range_end = (current_page*preferences.max_email_per_page); 
     397    msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); 
     398    folder=get_current_folder(); 
     399    var msgs  = expresso_local_messages.get_local_range_msgs(folder.substr(6),msg_range_begin,preferences.max_email_per_page,sort_box_type,sort_box_reverse,search_box_type,preferences.preview_msg_subject,preferences.preview_msg_tip); 
     400    alternate_border(0); 
     401    draw_box(msgs, folder, true); 
     402    draw_paging(msgs.num_msgs); 
     403    Element("tot_m").innerHTML = msgs.num_msgs; 
     404    update_menu(); 
    393405} 
    394406 
     
    13901402                                var spanSender = document.createElement("SPAN"); 
    13911403                                spanSender.onmouseover = function (event) {this.style.textDecoration = "underline";try {InfoContact.begin(this,headers_msgs.from.email)} catch(e){};}; 
    1392                                 spanSender.onmouseout = function (){ try {this.style.textDecoration = "none"; clearTimeout(InfoContact.timeout);} catch(e){}}; 
     1404                                spanSender.onmouseout = function (){try {this.style.textDecoration = "none";clearTimeout(InfoContact.timeout);} catch(e){}}; 
    13931405                                spanSender.innerHTML =  headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email; 
    13941406                                if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){ 
     
    17191731        var option_hide_more = document.createElement("SPAN"); 
    17201732        option_hide_more.className = 'message_options'; 
    1721         option_hide_more.onmouseover=function () { this.className='message_options_active'; }; 
    1722         option_hide_more.onmouseout=function () { this.className='message_options' }; 
     1733        option_hide_more.onmouseover=function () {this.className='message_options_active';}; 
     1734        option_hide_more.onmouseout=function () {this.className='message_options'}; 
    17231735        options.align = 'right'; 
    17241736        option_hide_more.value = 'more_options'; 
     
    17431755        var option_mark_as_unseen = document.createElement("SPAN"); 
    17441756        option_mark_as_unseen.className = "message_options"; 
    1745         option_mark_as_unseen.onclick = function () { changeLinkState(this,'seen'); 
     1757        option_mark_as_unseen.onclick = function () {changeLinkState(this,'seen'); 
    17461758                proxy_mensagens.proxy_set_message_flag(folder_id,'unseen'); 
    17471759                write_msg(get_lang('Message marked as ')+get_lang("Unseen")); 
    17481760        }; 
    1749         option_mark_as_unseen.onmouseover=function () { this.className='message_options_active'; }; 
    1750         option_mark_as_unseen.onmouseout=function () { this.className='message_options' }; 
     1761        option_mark_as_unseen.onmouseover=function () {this.className='message_options_active';}; 
     1762        option_mark_as_unseen.onmouseout=function () {this.className='message_options'}; 
    17511763        option_mark_as_unseen.innerHTML = get_lang("Unseen"); 
    17521764 
     
    17541766        option_mark_important.className = 'message_options'; 
    17551767        option_mark_important.style.paddingLeft = "10px"; 
    1756         option_mark_important.onmouseover=function () { this.className='message_options_active'; }; 
    1757         option_mark_important.onmouseout=function () { this.className='message_options' }; 
     1768        option_mark_important.onmouseover=function () {this.className='message_options_active';}; 
     1769        option_mark_important.onmouseout=function () {this.className='message_options'}; 
    17581770 
    17591771        if (info_msg.Flagged == "F"){ 
     
    17711783        } 
    17721784        else{ 
    1773                 option_mark_important.onclick = function() { changeLinkState(this,'normal'); 
     1785                option_mark_important.onclick = function() {changeLinkState(this,'normal'); 
    17741786                        proxy_mensagens.proxy_set_message_flag(folder_id,'flagged'); 
    17751787                        write_msg(get_lang('Message marked as ')+get_lang("Important")); 
     
    17941806        option_forward.className = 'message_options'; 
    17951807        option_forward.onclick = function(){new_message('forward', ID);}; 
    1796         option_forward.onmouseover=function () { this.className='message_options_active'; }; 
    1797         option_forward.onmouseout=function () { this.className='message_options' }; 
     1808        option_forward.onmouseover=function () {this.className='message_options_active';}; 
     1809        option_forward.onmouseout=function () {this.className='message_options'}; 
    17981810        option_forward.innerHTML = get_lang('Forward'); 
    17991811        options.appendChild(space1); 
     
    18041816        option_reply.onclick = function(){new_message('reply_with_history', ID);}; 
    18051817        option_reply.innerHTML = get_lang('Reply'); 
    1806         option_reply.onmouseover=function () { this.className='message_options_active'; }; 
    1807         option_reply.onmouseout=function () { this.className='message_options' }; 
     1818        option_reply.onmouseover=function () {this.className='message_options_active';}; 
     1819        option_reply.onmouseout=function () {this.className='message_options'}; 
    18081820 
    18091821        options.appendChild(space2); 
     
    24962508                case 'important': 
    24972509                        { 
    2498                                 el.onclick = function(){changeLinkState(el,'normal');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'flagged'); write_msg(get_lang('Message marked as ')+get_lang("Important"))} 
     2510                                el.onclick = function(){changeLinkState(el,'normal');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'flagged');write_msg(get_lang('Message marked as ')+get_lang("Important"))} 
    24992511                                break; 
    25002512                        } 
     
    25142526                case 'unseen': 
    25152527                        { 
    2516                                 el.onclick = function(){  changeLinkState(el,'seen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unseen');write_msg(get_lang('Message marked as ')+get_lang("unseen"))} 
     2528                                el.onclick = function(){changeLinkState(el,'seen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unseen');write_msg(get_lang('Message marked as ')+get_lang("unseen"))} 
    25172529                                break; 
    25182530 
     
    25202532                case 'seen': 
    25212533                        { 
    2522                                 el.onclick = function(){  changeLinkState(el,'unseen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'seen');write_msg(get_lang('Message marked as ')+get_lang("seen"))} 
     2534                                el.onclick = function(){changeLinkState(el,'unseen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'seen');write_msg(get_lang('Message marked as ')+get_lang("seen"))} 
    25232535                                break; 
    25242536 
     
    26502662        input_replyto.style.width = "100%"; 
    26512663        input_replyto.setAttribute("wrap","soft"); 
    2652         input_replyto.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);}; 
     2664        input_replyto.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus', this.id);}; 
    26532665        input_replyto.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    26542666 
     
    27332745        input_to.style.width = "100%"; 
    27342746        input_to.setAttribute("wrap","soft"); 
    2735         input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);}; 
     2747        input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus', this.id);}; 
    27362748        input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    27372749        if (!is_ie) 
     
    28292841        input_cc.setAttribute("tabIndex","1"); 
    28302842        input_cc.style.width = "100%"; 
    2831         input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; 
     2843        input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus',this.id);}; 
    28322844        input_cc.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    28332845        if (!is_ie) 
     
    29112923        input_cco.setAttribute("tabIndex","1"); 
    29122924        input_cco.style.width = "100%"; 
    2913         input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; 
     2925        input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus',this.id);}; 
    29142926        input_cco.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    29152927 
     
    29872999        a_cc_link.setAttribute("href","javascript:void(0)"); 
    29883000        a_cc_link.setAttribute("tabIndex","-1"); 
    2989         a_cc_link.onclick = function () {this.style.display='none';document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cc.focus(); return false;} 
     3001        a_cc_link.onclick = function () {this.style.display='none';document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cc.focus();return false;} 
    29903002        td2_link.appendChild(a_cc_link); 
    29913003        var space = document.createElement("span"); 
     
    29983010        a_cco_link.setAttribute("href","javascript:void(0)"); 
    29993011        a_cco_link.setAttribute("tabIndex","-1"); 
    3000         a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus(); return false;} 
     3012        a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus();return false;} 
    30013013        td2_link.appendChild(a_cco_link); 
    30023014        var space = document.createElement("span"); 
     
    30093021        a_replyto_link.setAttribute("href","javascript:void(0)"); 
    30103022        a_replyto_link.setAttribute("tabIndex","-1"); 
    3011         a_replyto_link.onclick = function () {this.style.display='none';document.getElementById('tr_replyto_'+ID).style.display='';document.getElementById('space_link_2_'+ID).style.display='none';input_replyto.focus(); return false;} 
     3023        a_replyto_link.onclick = function () {this.style.display='none';document.getElementById('tr_replyto_'+ID).style.display='';document.getElementById('space_link_2_'+ID).style.display='none';input_replyto.focus();return false;} 
    30123024        td2_link.appendChild(a_replyto_link); 
    30133025        tr_link.appendChild(td1_link); 
  • branches/2.2.0.1/expressoMail1_2/js/messages_controller.js

    r4642 r4698  
    4444                        expresso_local_messages.delete_msgs(msgs_number, border_ID); 
    4545                        draw_tree_local_folders(); 
     46                         update_local_box(); 
    4647                } 
    4748        } 
     
    227228                                this.aux_interface_remove_mails(msgs_number, new_folder_name, border_ID); 
    228229                                draw_tree_local_folders(); 
     230                                update_local_box(); 
    229231                        } 
    230232                        else  
Note: See TracChangeset for help on using the changeset viewer.