dashes = /\//gi; var Folder = { open : 'INBOX', remove : function(id, callback){ DataLayer.remove("folder", id); DataLayer.commit(false, false, callback); }, rename : function(id, value, callback){ DataLayer.put("folder", {id:id, new:value}); DataLayer.commit(false, false, callback); }, create : function(id, path,callback){ DataLayer.put("folder", {name:id, path:path}); DataLayer.commit(false, false, callback); }, move : function (id, value){ }, exportMessages : function(id, callback){ }, change : function(id, title){ var data = DataLayer.get("folder", {criteria:{folder:id} }, true)[0]; Tab.setFolderTotal(data.messageCount.total); Tab.setFolderUnread(data.messageCount.unseen); Tab.setFolderName(title ? title : data.commonName); Folder.open = id; Grid.jqGrid('clearGridData') .jqGrid('setGridParam', { url: BASE_PATH+'REST.php?q=folder/'+id.replace(dashes, '.')+'/message' }) .trigger('reloadGrid', [{ page: 1 }] ); }, acl : function(id){ }, info : function(id){ return DataLayer.get("folder", {criteria:{folder:(id ? id : Folder.open)} }, true)[0]; }, special : {}, init: function(){ this.special[imap_configs.imapDefaultDraftsFolder] = "Rascunhos"; this.special[imap_configs.imapDefaultSentFolder] = "Enviados"; this.special[imap_configs.imapDefaultSpamFolder] = "Spam"; this.special[imap_configs.imapDefaultTrashFolder] = "Lixeira"; }, delimiter : imap_configs.imapDelimiter } Folder.init();