Index: umc/js/udm.js =================================================================== --- umc/js/udm.js (Revision 37470) +++ umc/js/udm.js (Arbeitskopie) @@ -365,17 +365,7 @@ isMultiAction: true, iconClass: 'umcIconDelete', callback: lang.hitch(this, function(ids) { - if (ids.length) { - var isContainer = false; - array.some(ids, lang.hitch(this, function(id) { - var item = this._grid.getItem(id); - if (item.objectType.substr(0, 9) == 'container') { - isContainer = true; - } - return isContainer; - })); - this.removeObjects(ids, isContainer); - } + this.removeObjects(ids); }) }, { name: 'move', @@ -383,17 +373,7 @@ description: _( 'Move objects to a different LDAP position.' ), isMultiAction: true, callback: lang.hitch(this, function(ids) { - if (ids.length) { - var isContainer = false; - array.some(ids, lang.hitch(this, function(id) { - var item = this._grid.getItem(id); - if (item.objectType.substr(0, 9) == 'container') { - isContainer = true; - } - return isContainer; - })); - this.moveObjects(ids, isContainer); - } + this.moveObjects(ids); }) }]; @@ -679,13 +659,13 @@ label: _( 'Delete' ), iconClass: 'umcIconDelete', onClick: lang.hitch(this, function() { - this.removeObjects(this._navContextItem.id, true); + this.removeObjects(this._navContextItem.id); }) })); menu.addChild(new MenuItem({ label: _('Move to...'), onClick: lang.hitch(this, function() { - this.moveObjects([this._navContextItem.id], true); + this.moveObjects([this._navContextItem.id]); }) })); menu.addChild(new MenuItem({ @@ -709,8 +689,7 @@ // in the case of changes, reload the navigation, as well (could have // changes referring to container objects) this.on('objectsaved', lang.hitch(this, function(dn, objectType) { - var isContainer = objectType.substr(0, 9) === 'container'; - this.resetPathAndReloadTreeAndFilter(isContainer); + this.resetPathAndReloadTreeAndFilter([dn]); })); titlePane.addChild(treePane); @@ -899,14 +878,11 @@ } }, - moveObjects: function(ids, /*Boolean?*/ isContainer) { + moveObjects: function(ids) { if (!ids.length) { return; } - // default values - isContainer = isContainer === undefined ? false : isContainer; - // add message to container widget var objectName = ids.length > 1 ? this.objectNamePlural : this.objectNameSingular; var container = new ContainerWidget({}); @@ -973,13 +949,6 @@ }); }, this); - // set reloading path to ldap base - if (isContainer) { - var ldapBase = this._tree.model.getIdentity(this._tree.model.root); - this._reloadingPath = ldapBase; - this._tree.set('path', [ this._tree.model.root ]); - } - // send UMCP command to move the objects this.standby(true); this.umcpCommand('udm/move', params).then(lang.hitch(this, function(data) { @@ -1001,7 +970,7 @@ // clear the selected objects this.moduleStore.onChange(); - this.resetPathAndReloadTreeAndFilter(isContainer); + this.resetPathAndReloadTreeAndFilter(ids); }), lang.hitch(this, function() { this.standby(false); })); @@ -1022,9 +991,23 @@ })); }, - resetPathAndReloadTreeAndFilter: function(reset) { - if (reset) { - this._tree.set('path', [ this._tree.model.root ]); + resetPathAndReloadTreeAndFilter: function(modifiedDNs) { + if (modifiedDNs.length) { + var notTouched = true; + var path = array.filter(this._tree.get('path'), function(part) { + if (modifiedDNs.indexOf(part.id) > -1) { + // if touched, set notTouched + // to false for this and every + // following part + notTouched = false; + } + return notTouched; + }); + if (path.length === 0) { + // user modified the root + path = [ this._tree.model.root ]; + } + this._tree.set('path', path); this.reloadTree(); } this.filter(); @@ -1154,13 +1137,6 @@ // enable standby animation this.standby(true); - // set reloading path to ldap base - if (isContainer) { - var ldapBase = this._tree.model.getIdentity(this._tree.model.root); - this._reloadingPath = ldapBase; - this._tree.set('path', [ this._tree.model.root ]); - } - // set the options var options = { cleanup: form.getWidget('deleteReferring').get('value'), @@ -1192,7 +1168,7 @@ if (!success) { dialog.alert(message); } - this.resetPathAndReloadTreeAndFilter(isContainer); + this.resetPathAndReloadTreeAndFilter(ids); }), lang.hitch(this, function() { this.standby(false); }));