summaryrefslogtreecommitdiff
path: root/program/js/app.js
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-02-15 21:00:48 +0000
committerthomascube <thomas@roundcube.net>2011-02-15 21:00:48 +0000
commit360bd3ea740073b83817183581893681e13a8570 (patch)
treedcbb1d856ceb50d1003fbe811aea07df26cb6096 /program/js/app.js
parentbfb7d6e6819c8453d3e7c5c6d4fb261af078b176 (diff)
Allow group identifiers to be changed upon renaming (used in LDAP)
Diffstat (limited to 'program/js/app.js')
-rw-r--r--program/js/app.js27
1 files changed, 24 insertions, 3 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 43be6ae8d..712400a68 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3948,6 +3948,7 @@ function rcube_webmail()
this.env.contactfolders[key] = this.env.contactgroups[key] = prop;
var link = $('<a>').attr('href', '#')
+ .attr('rel', prop.source+':'+prop.id)
.bind('click', function() { return rcmail.command('listgroup', prop, this);})
.html(prop.name);
var li = $('<li>').attr('id', 'rcmli'+key.replace(this.identifier_expr, '_'))
@@ -3963,13 +3964,33 @@ function rcube_webmail()
{
this.reset_add_input();
- var key = 'G'+prop.source+prop.id, link, li = this.get_folder_li(key);
+ var key = 'G'+prop.source+prop.id,
+ li = this.get_folder_li(key),
+ link;
- if (li && (link = li.firstChild) && link.tagName.toLowerCase() == 'a')
+ // group ID has changed, replace link node and identifiers
+ if (li && prop.newid) {
+ var newkey = 'G'+prop.source+prop.newid;
+ li.id = String('rcmli'+newkey).replace(this.identifier_expr, '_');
+ this.env.contactfolders[newkey] = this.env.contactfolders[key];
+ this.env.group = prop.newid;
+
+ var newprop = $.extend({}, prop);
+ newprop.id = prop.newid;
+ newprop.type = 'group';
+
+ link = $('<a>').attr('href', '#')
+ .attr('rel', prop.source+':'+prop.newid)
+ .bind('click', function() { return rcmail.command('listgroup', newprop, this);})
+ .html(prop.name);
+ $(li).children().replaceWith(link);
+ }
+ // update displayed group name
+ else if (li && (link = li.firstChild) && link.tagName.toLowerCase() == 'a')
link.innerHTML = prop.name;
this.env.contactfolders[key].name = this.env.contactgroups[key].name = prop.name;
- this.triggerEvent('group_update', { id:prop.id, source:prop.source, name:prop.name, li:li[0] });
+ this.triggerEvent('group_update', { id:prop.id, source:prop.source, name:prop.name, li:li[0], newid:prop.newid });
};