Changeset 4847


Ignore:
Timestamp:
07/21/11 16:29:18 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #2137 - Pesquisa local em pasta não selecionada.

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

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/js/local_messages.js

    r4831 r4847  
    88    this.store = null; 
    99    this.filterSerch = ""; 
     10    this.folders = []; 
    1011    this.sortType = ""; 
    1112} 
     
    934935} 
    935936 
     937local_messages.prototype.setFolders = function(sFolders) 
     938{ 
     939    this.folders = sFolders; 
     940} 
     941 
     942local_messages.prototype.getFolders = function() 
     943{ 
     944    return this.folders; 
     945} 
     946 
    936947local_messages.prototype.setFilter = function(sFilter) 
    937948{ 
     
    959970    this.init_local_messages(); 
    960971    this.setFilter(sFilter); 
     972    this.setFolders(folders); 
    961973    var filters = sFilter.replace(/^##|##$/g,"").split('##'); 
    962974    var friendly_filters = new Array(); 
  • branches/2.3/expressoMail1_2/js/search.js

    r4782 r4847  
    380380                        if ( local_folders.length > 0 ){ 
    381381                            expresso_local_messages.setSortType(sortType); 
    382                             gears = expresso_local_messages.search( local_folders, expresso_local_messages.getFilter() ); 
     382                            gears = expresso_local_messages.search( expresso_local_messages.getFolders(), expresso_local_messages.getFilter() ); 
    383383                        } 
    384384                } 
     
    428428 
    429429                        if ( local_folders.length > 0 ) 
    430                                 gears = expresso_local_messages.search( local_folders, expresso_local_messages.getFilter() ); 
     430                                gears = expresso_local_messages.search( expresso_local_messages.getFolders(), expresso_local_messages.getFilter() ); 
    431431 
    432432                        data['data_gears']      = gears; 
     
    923923                table_element.appendChild(colgr_element); 
    924924 
    925                 if( parseInt( Data['gears_num_msgs'] ) > 0 ) 
     925                if( parseInt( Data['gears_num_msgs'] ) > 0 && !Data['data_gears']) 
    926926                { 
    927927                        var _div_gears = document.createElement("div"); 
     
    12231223                } 
    12241224                 
    1225                 var handler = function( data ) 
    1226                 { 
    1227                 var allMsg      = [3]; 
    1228                 var count       = ( data['num_msgs'] ) ?  data['num_msgs'] : "0"; 
    1229                         var tmp         = []; 
    1230  
    1231                         // Gears - local 
    1232                         if ( local_folders.length > 0 ){ 
    1233                             expresso_local_messages.setSortType('SORTDATE'); 
    1234                             tmp = expresso_local_messages.search( local_folders, fields ); 
    1235                         } 
    1236  
    1237             if( data['num_msgs'] ) 
     1225            var handler = function( data ) 
    12381226            { 
    1239                 allMsg['data']          = data['data']; 
    1240                 allMsg['num_msgs']      = data['num_msgs']; 
    1241             }  
    1242  
    1243                 if( tmp.length > 0 )     
    1244             { 
    1245                         allMsg['gears_num_msgs'] = tmp.length ; 
     1227                var allMsg      = [3]; 
     1228                var tmp         = []; 
     1229 
     1230                // Gears - local 
     1231                if ( local_folders.length > 0 ){ 
     1232                    expresso_local_messages.setSortType('SORTDATE'); 
     1233                    tmp = expresso_local_messages.search( local_folders, fields ); 
     1234                } 
     1235                var count = data['num_msgs'] ?  data['num_msgs'] : tmp.length > 0 ? tmp.length : "0"; 
     1236 
     1237                if( data['num_msgs'] ) 
     1238                { 
     1239                    allMsg['data']              = data['data']; 
     1240                    allMsg['num_msgs']  = data['num_msgs']; 
     1241                } 
     1242 
     1243                if( tmp.length > 0 ) 
     1244                { 
     1245                    allMsg['gears_num_msgs'] = tmp.length ; 
     1246                } 
     1247 
     1248                if( data['num_msgs'] == 0 && tmp.length < 0) 
     1249                { 
     1250                    alert( get_lang("None result was found.") ); 
     1251                } 
     1252                else 
     1253                { 
     1254                    if(tmp.length > 0 && !data['num_msgs']) 
     1255                    { 
     1256                        allMsg['data_gears'] = tmp; 
     1257                    } 
     1258 
     1259                    write_msg( count + " " + get_lang("results found") ); 
     1260                    EsearchE.mount_result( allMsg, 'SORTDATE' ); 
     1261                } 
    12461262            } 
     1263 
     1264            this.condition      = nm_box; 
     1265            this.page           = 0; 
     1266            var args            = "$this.imap_functions.search_msg"; 
     1267            var params          = "condition=" + nm_box+ "&page=0"+ "&sort_type=SORTDATE"; 
     1268 
     1269            if( expresso_offline ) 
     1270                    handler('none'); 
     1271            else 
     1272                    cExecute( args, handler, params); 
    12471273             
    1248                 if( ( data['num_msgs'] ) == 0 ) 
    1249                 { 
    1250                 alert( get_lang("None result was found.") ); 
    1251                 } 
    1252             else 
    1253             { 
    1254                 if( (tmp.length > 0) && (!data['num_msgs']) )  
    1255                 { 
    1256                         EsearchE.viewLocalMessage(); 
    1257                 } 
    1258                 else 
    1259                 { 
    1260                         write_msg( count + " " + get_lang("results found") ); 
    1261                         EsearchE.mount_result( allMsg, 'SORTDATE' ); 
    1262                 } 
    1263             } 
    1264                 } 
    1265  
    1266                 this.condition  = nm_box; 
    1267                 this.page               = 0; 
    1268                 var args                = "$this.imap_functions.search_msg"; 
    1269                 var params              = "condition=" + nm_box+ "&page=0"+ "&sort_type=SORTDATE"; 
    1270                  
    1271                 if( expresso_offline ) 
    1272                         handler('none'); 
    1273                 else 
    1274                         cExecute( args, handler, params); 
    1275         } 
     1274        } 
    12761275        // clean; 
    12771276        searchE.prototype.func_clean = function() 
Note: See TracChangeset for help on using the changeset viewer.