From 54561a253b5f7fd53237eb110482a93ebac45a88 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 28 Nov 2013 20:51:43 +0100 Subject: [PATCH] LSrelation : fixed refresh bug when multiple relations content the same object --- public_html/includes/class/class.LSrelation.php | 5 +++-- public_html/includes/js/LSrelation.js | 11 ++++++++--- public_html/templates/default/LSrelations.tpl | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public_html/includes/class/class.LSrelation.php b/public_html/includes/class/class.LSrelation.php index 6eaa9f40..8ea449b7 100644 --- a/public_html/includes/class/class.LSrelation.php +++ b/public_html/includes/class/class.LSrelation.php @@ -205,7 +205,7 @@ class LSrelation { else { $class=' LSrelation_editable'; } - $data['html'].= "
  • ".$o -> getDisplayName(NULL,true)."
  • \n"; + $data['html'].= "
  • getDn()."'>".$o -> getDisplayName(NULL,true)."
  • \n"; } } else { @@ -288,7 +288,8 @@ class LSrelation { } else { $data=array( - 'dn' => $_REQUEST['dn'] + 'dn' => $_REQUEST['dn'], + 'id' => $_REQUEST['id'] ); } } diff --git a/public_html/includes/js/LSrelation.js b/public_html/includes/js/LSrelation.js index 1e882752..110d349a 100644 --- a/public_html/includes/js/LSrelation.js +++ b/public_html/includes/js/LSrelation.js @@ -69,7 +69,7 @@ var LSrelation = new Class({ template: 'LSrelation', action: 'deleteByDn', id: id, - dn: a.id + dn: this.a2dn(a) }; data.imgload=varLSdefault.loadingImgDisplay(li,'inside'); new Request({url: 'index_ajax.php', data: data, onSuccess: this.deleteFromImgComplete.bind(this)}).send(); @@ -79,8 +79,8 @@ var LSrelation = new Class({ var data = JSON.decode(responseText); if ( varLSdefault.checkAjaxReturn(data) ) { try { - var li = $(data.dn).getParent(); - var ul=$(data.dn).getParent().getParent(); + var ul=$('LSrelation_ul_'+data.id); + var li = $('LSrelation_'+data.id+'_'+data.dn).getParent(); li.destroy(); if (!$type(ul.getFirst())) { var getId = /LSrelation_ul_([0-9]*)/ @@ -141,6 +141,11 @@ var LSrelation = new Class({ $('LSrelation_ul_'+this.refreshRelation).set('html',data.html); this.initializeBtn(); } + }, + + a2dn: function(a) { + var getId = /LSrelation_[0-9]*_(.*)$/ + return getId.exec(a.id)[1]; } }); diff --git a/public_html/templates/default/LSrelations.tpl b/public_html/templates/default/LSrelations.tpl index 8f8628bf..c16b3b60 100644 --- a/public_html/templates/default/LSrelations.tpl +++ b/public_html/templates/default/LSrelations.tpl @@ -8,7 +8,7 @@ {/if}