Changeset 3735


Ignore:
Timestamp:
02/07/11 15:28:44 (9 years ago)
Author:
eduardoalex
Message:

Ticket #1518 - Correção para remoção de pastas locais com sub-pastas.

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

Legend:

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

    r3722 r3735  
    158158        } 
    159159        catch (ex) { 
    160                                 if(new Date.getTime()-start_trying>10000) { //too much time trying, throw an exception 
     160                                if(new Date().getTime()-start_trying>10000) { //too much time trying, throw an exception 
    161161                                        throw ex; 
    162162        } 
     
    851851 
    852852    if(sons == 0){ 
    853         var rs = this.dbGears.execute("select rowid from folder where folder=? and uid_usuario=?",[folder,account_id]); 
    854         var folder_id = rs.field(0); 
    855         rs.close(); 
    856         this.dbGears.execute("delete from folder where rowid=?",[folder_id]); 
    857         rs = this.dbGears.execute("select rowid,mail from mail where id_folder=?",[folder_id]); 
    858         while(rs.isValidRow()) { 
    859             var rs2 = this.dbGears.execute("select url from anexo where id_mail=?",[rs.field(0)]); 
    860             while(rs2.isValidRow()) { 
    861                 this.store.remove(rs2.field(0)); 
    862                 rs2.next(); 
    863             } 
    864             rs2.close(); 
    865             this.dbGears.execute("delete from anexo where id_mail=?",[rs.field(0)]); 
    866             var mail = connector.unserialize(rs.field(1)); 
    867             this.store.remove(mail.url_export_file); 
    868             rs.next(); 
    869         } 
    870         rs.close(); 
    871         this.dbGears.execute("delete from mail where id_folder=?",[folder_id]); 
    872         return true 
    873         this.finalize(); 
     853                var rs = this.dbGears.execute("select rowid from folder where folder=? and uid_usuario=?",[folder,account_id]); 
     854                var folder_id = rs.field(0); 
     855                rs.close(); 
     856                this.dbGears.execute("delete from folder where rowid=?",[folder_id]); 
     857                rs = this.dbGears.execute("select rowid,mail from mail where id_folder=?",[folder_id]); 
     858                while(rs.isValidRow()) { 
     859                    var rs2 = this.dbGears.execute("select url from anexo where id_mail=?",[rs.field(0)]); 
     860                    while(rs2.isValidRow()) { 
     861                        this.store.remove(rs2.field(0)); 
     862                        rs2.next(); 
     863                    } 
     864                    rs2.close(); 
     865                    this.dbGears.execute("delete from anexo where id_mail=?",[rs.field(0)]); 
     866                    var mail = connector.unserialize(rs.field(1)); 
     867                    this.store.remove(mail.url_export_file); 
     868                    rs.next(); 
     869                } 
     870                rs.close(); 
     871                this.dbGears.execute("delete from mail where id_folder=?",[folder_id]); 
     872                this.finalize(); 
     873                return true; 
    874874    }else  { 
    875         return false 
    876         this.finalize(); 
     875                this.finalize(); 
     876                return false; 
    877877    } 
    878878 
  • branches/2.2/expressoMail1_2/js/messages_controller.js

    r3390 r3735  
    176176 
    177177                        if (confirm(string_confirm)) { 
    178                                 expresso_local_messages.remove_folder(ttree.FOLDER.substr(6)); 
    179                                 alert(get_lang("The folder %1 was successfully removed", new_caption)); 
    180                                 draw_tree_local_folders(); 
     178                                var flag = expresso_local_messages.remove_folder(ttree.FOLDER.substr(6)); 
     179                                if (flag) { 
     180                                        alert(get_lang("The folder %1 was successfully removed", new_caption)); 
     181                                        draw_tree_local_folders(); 
     182                                } 
     183                                else  
     184                                        alert(get_lang("Delete your sub-folders first")); 
     185                                 
    181186                        } 
    182187                } 
Note: See TracChangeset for help on using the changeset viewer.