From e83f035887e3a463568465673ae92f365788c2a5 Mon Sep 17 00:00:00 2001 From: alecpl Date: Sat, 29 Aug 2009 18:41:17 +0000 Subject: - Fix LDAP contact update when RDN field is changed (#1485788) --- program/js/app.js | 73 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 32 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 6adc7f4e6..2d0be0f31 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2926,7 +2926,7 @@ function rcube_webmail() }; // update a contact record in the list - this.update_contact_row = function(cid, cols_arr) + this.update_contact_row = function(cid, cols_arr, newcid) { var row; if (this.contact_list.rows[cid] && (row = this.contact_list.rows[cid].obj)) { @@ -2934,12 +2934,51 @@ function rcube_webmail() if (row.cells[c]) $(row.cells[c]).html(cols_arr[c]); + // cid change + if (newcid) { + row.id = 'rcmrow' + newcid; + this.contact_list.remove_row(cid); + this.contact_list.init_row(row); + this.contact_list.selection[0] = newcid; + row.style.display = ''; + } + return true; } return false; }; + // add row to contacts list + this.add_contact_row = function(cid, cols, select) + { + if (!this.gui_objects.contactslist || !this.gui_objects.contactslist.tBodies[0]) + return false; + + var tbody = this.gui_objects.contactslist.tBodies[0]; + var rowcount = tbody.rows.length; + var even = rowcount%2; + + var row = document.createElement('tr'); + row.id = 'rcmrow'+cid; + row.className = 'contact '+(even ? 'even' : 'odd'); + + if (this.contact_list.in_selection(cid)) + row.className += ' selected'; + + // add each submitted col + for (var c in cols) { + col = document.createElement('td'); + col.className = String(c).toLowerCase(); + col.innerHTML = cols[c]; + row.appendChild(col); + } + + this.contact_list.insert_row(row); + + this.enable_command('export', (this.contact_list.rowcount > 0)); + }; + /*********************************************************/ /********* user settings methods *********/ @@ -2993,7 +3032,7 @@ function rcube_webmail() this.load_identity(id, 'edit-identity'); }; - // load contact record + // load identity record this.load_identity = function(id, action) { if (action=='edit-identity' && (!id || id==this.env.iid)) @@ -3884,36 +3923,6 @@ function rcube_webmail() window.focus(); } - // add row to contacts list - this.add_contact_row = function(cid, cols, select) - { - if (!this.gui_objects.contactslist || !this.gui_objects.contactslist.tBodies[0]) - return false; - - var tbody = this.gui_objects.contactslist.tBodies[0]; - var rowcount = tbody.rows.length; - var even = rowcount%2; - - var row = document.createElement('tr'); - row.id = 'rcmrow'+cid; - row.className = 'contact '+(even ? 'even' : 'odd'); - - if (this.contact_list.in_selection(cid)) - row.className += ' selected'; - - // add each submitted col - for (var c in cols) { - col = document.createElement('td'); - col.className = String(c).toLowerCase(); - col.innerHTML = cols[c]; - row.appendChild(col); - } - - this.contact_list.insert_row(row); - - this.enable_command('export', (this.contact_list.rowcount > 0)); - }; - this.toggle_prefer_html = function(checkbox) { var addrbook_show_images; -- cgit v1.2.3