From d0de4eb506707f334568ac045230bd3df35991f6 Mon Sep 17 00:00:00 2001 From: alecpl Date: Thu, 4 Aug 2011 10:52:17 +0000 Subject: [PATCH] - Fix moving folder to root, it wasn't working with IMAP delimiter different that a dot --- program/js/app.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 62e0fb0a7..c527ac60a 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4548,7 +4548,6 @@ function rcube_webmail() $('#mailboxroot') .mouseover(function(){ p.focus_subscription(this.id); }) .mouseout(function(){ p.unfocus_subscription(this.id); }) - .mouseup(function(){ if (p.drag_active) p.subscription_move_folder(); }); }; this.focus_subscription = function(id) @@ -4559,23 +4558,17 @@ function rcube_webmail() if (this.drag_active && this.env.mailbox && (row = document.getElementById(id))) if (this.env.subscriptionrows[id] && - (folder = this.env.subscriptionrows[id][0])) { + (folder = this.env.subscriptionrows[id][0]) !== null + ) { if (this.check_droptarget(folder) && !this.env.subscriptionrows[this.get_folder_row_id(this.env.mailbox)][2] && (folder != this.env.mailbox.replace(reg, '')) && - (!folder.match(new RegExp('^'+RegExp.escape(this.env.mailbox+this.env.delimiter))))) { + (!folder.match(new RegExp('^'+RegExp.escape(this.env.mailbox+this.env.delimiter)))) + ) { this.set_env('dstfolder', folder); $(row).addClass('droptarget'); } } - else if (id == 'mailboxroot') { - this.set_env('dstfolder', ''); - $(row).addClass('droptarget'); - } - else if (this.env.mailbox.match(new RegExp(delim))) { - this.set_env('dstfolder', this.env.delimiter); - $(this.subscription_list.frame).addClass('droptarget'); - } }; this.unfocus_subscription = function(id) @@ -4612,12 +4605,12 @@ function rcube_webmail() var delim = RegExp.escape(this.env.delimiter), reg = RegExp('['+delim+']?[^'+delim+']+$'); - if (this.env.mailbox && this.env.dstfolder && (this.env.dstfolder != this.env.mailbox) && + if (this.env.mailbox && this.env.dstfolder !== null && (this.env.dstfolder != this.env.mailbox) && (this.env.dstfolder != this.env.mailbox.replace(reg, '')) ) { reg = new RegExp('[^'+delim+']*['+delim+']', 'g'); var basename = this.env.mailbox.replace(reg, ''), - newname = this.env.dstfolder==this.env.delimiter ? basename : this.env.dstfolder+this.env.delimiter+basename; + newname = this.env.dstfolder === '' ? basename : this.env.dstfolder+this.env.delimiter+basename; if (newname != this.env.mailbox) { this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.mailbox)+'&_folder_newname='+urlencode(newname), this.set_busy(true, 'foldermoving'));