diff options
author | svncommit <devs@roundcube.net> | 2007-02-21 08:34:23 +0000 |
---|---|---|
committer | svncommit <devs@roundcube.net> | 2007-02-21 08:34:23 +0000 |
commit | 9bebdfcb6ad7e91a218e5811f6fce9e1a956ecc8 (patch) | |
tree | 62192ed9bd113edaf9fc8e462422e0aea8515a8b /program/js/app.js | |
parent | 156dc40f8dc329fd8204d41a80fc49a88c8ddf44 (diff) |
Sort subscription folder list after adding or renaming a folder.
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/program/js/app.js b/program/js/app.js index 0a1afe8af..34fa68572 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2585,6 +2585,7 @@ function rcube_webmail() form.elements['_folder_name'].value = ''; } + this.sort_subscription_list(); }; @@ -2733,6 +2734,33 @@ function rcube_webmail() return new_row; }; + // sort subscription folder list + this.sort_subscription_list = function() + { + var tbody = this.gui_objects.subscriptionlist.tBodies[0]; + for (var i = 0; i<(tbody.childNodes.length-1); i++) + { + if (this.env.subscriptionrows[tbody.childNodes[i].id]!=null) + { + var swapped = false; + for (var j = i+1; j<(tbody.childNodes.length); j++) + { + if ((this.env.subscriptionrows[tbody.childNodes[j].id]!=null) && + (this.env.subscriptionrows[tbody.childNodes[i].id][0]> + this.env.subscriptionrows[tbody.childNodes[j].id][0])) + { + var swap = tbody.replaceChild(tbody.childNodes[i], tbody.childNodes[j]); + if (typeof(tbody.childNodes[i]) != 'undefined') + tbody.insertBefore(swap, tbody.childNodes[i]) + else + tbody.appendChild(swap); + swapped = true; + } + } + } + } + }; + /*********************************************************/ /********* GUI functionality *********/ |