|
365 |
isMultiAction: true, |
365 |
isMultiAction: true, |
366 |
iconClass: 'umcIconDelete', |
366 |
iconClass: 'umcIconDelete', |
367 |
callback: lang.hitch(this, function(ids) { |
367 |
callback: lang.hitch(this, function(ids) { |
368 |
if (ids.length) { |
368 |
this.removeObjects(ids); |
369 |
var isContainer = false; |
|
|
370 |
array.some(ids, lang.hitch(this, function(id) { |
371 |
var item = this._grid.getItem(id); |
372 |
if (item.objectType.substr(0, 9) == 'container') { |
373 |
isContainer = true; |
374 |
} |
375 |
return isContainer; |
376 |
})); |
377 |
this.removeObjects(ids, isContainer); |
378 |
} |
379 |
}) |
369 |
}) |
380 |
}, { |
370 |
}, { |
381 |
name: 'move', |
371 |
name: 'move', |
|
383 |
description: _( 'Move objects to a different LDAP position.' ), |
373 |
description: _( 'Move objects to a different LDAP position.' ), |
384 |
isMultiAction: true, |
374 |
isMultiAction: true, |
385 |
callback: lang.hitch(this, function(ids) { |
375 |
callback: lang.hitch(this, function(ids) { |
386 |
if (ids.length) { |
376 |
this.moveObjects(ids); |
387 |
var isContainer = false; |
|
|
388 |
array.some(ids, lang.hitch(this, function(id) { |
389 |
var item = this._grid.getItem(id); |
390 |
if (item.objectType.substr(0, 9) == 'container') { |
391 |
isContainer = true; |
392 |
} |
393 |
return isContainer; |
394 |
})); |
395 |
this.moveObjects(ids, isContainer); |
396 |
} |
397 |
}) |
377 |
}) |
398 |
}]; |
378 |
}]; |
399 |
|
379 |
|
|
679 |
label: _( 'Delete' ), |
659 |
label: _( 'Delete' ), |
680 |
iconClass: 'umcIconDelete', |
660 |
iconClass: 'umcIconDelete', |
681 |
onClick: lang.hitch(this, function() { |
661 |
onClick: lang.hitch(this, function() { |
682 |
this.removeObjects(this._navContextItem.id, true); |
662 |
this.removeObjects(this._navContextItem.id); |
683 |
}) |
663 |
}) |
684 |
})); |
664 |
})); |
685 |
menu.addChild(new MenuItem({ |
665 |
menu.addChild(new MenuItem({ |
686 |
label: _('Move to...'), |
666 |
label: _('Move to...'), |
687 |
onClick: lang.hitch(this, function() { |
667 |
onClick: lang.hitch(this, function() { |
688 |
this.moveObjects([this._navContextItem.id], true); |
668 |
this.moveObjects([this._navContextItem.id]); |
689 |
}) |
669 |
}) |
690 |
})); |
670 |
})); |
691 |
menu.addChild(new MenuItem({ |
671 |
menu.addChild(new MenuItem({ |
|
709 |
// in the case of changes, reload the navigation, as well (could have |
689 |
// in the case of changes, reload the navigation, as well (could have |
710 |
// changes referring to container objects) |
690 |
// changes referring to container objects) |
711 |
this.on('objectsaved', lang.hitch(this, function(dn, objectType) { |
691 |
this.on('objectsaved', lang.hitch(this, function(dn, objectType) { |
712 |
var isContainer = objectType.substr(0, 9) === 'container'; |
692 |
this.resetPathAndReloadTreeAndFilter([dn]); |
713 |
this.resetPathAndReloadTreeAndFilter(isContainer); |
|
|
714 |
})); |
693 |
})); |
715 |
|
694 |
|
716 |
titlePane.addChild(treePane); |
695 |
titlePane.addChild(treePane); |
|
899 |
} |
878 |
} |
900 |
}, |
879 |
}, |
901 |
|
880 |
|
902 |
moveObjects: function(ids, /*Boolean?*/ isContainer) { |
881 |
moveObjects: function(ids) { |
903 |
if (!ids.length) { |
882 |
if (!ids.length) { |
904 |
return; |
883 |
return; |
905 |
} |
884 |
} |
906 |
|
885 |
|
907 |
// default values |
|
|
908 |
isContainer = isContainer === undefined ? false : isContainer; |
909 |
|
910 |
// add message to container widget |
886 |
// add message to container widget |
911 |
var objectName = ids.length > 1 ? this.objectNamePlural : this.objectNameSingular; |
887 |
var objectName = ids.length > 1 ? this.objectNamePlural : this.objectNameSingular; |
912 |
var container = new ContainerWidget({}); |
888 |
var container = new ContainerWidget({}); |
|
973 |
}); |
949 |
}); |
974 |
}, this); |
950 |
}, this); |
975 |
|
951 |
|
976 |
// set reloading path to ldap base |
|
|
977 |
if (isContainer) { |
978 |
var ldapBase = this._tree.model.getIdentity(this._tree.model.root); |
979 |
this._reloadingPath = ldapBase; |
980 |
this._tree.set('path', [ this._tree.model.root ]); |
981 |
} |
982 |
|
983 |
// send UMCP command to move the objects |
952 |
// send UMCP command to move the objects |
984 |
this.standby(true); |
953 |
this.standby(true); |
985 |
this.umcpCommand('udm/move', params).then(lang.hitch(this, function(data) { |
954 |
this.umcpCommand('udm/move', params).then(lang.hitch(this, function(data) { |
|
1001 |
|
970 |
|
1002 |
// clear the selected objects |
971 |
// clear the selected objects |
1003 |
this.moduleStore.onChange(); |
972 |
this.moduleStore.onChange(); |
1004 |
this.resetPathAndReloadTreeAndFilter(isContainer); |
973 |
this.resetPathAndReloadTreeAndFilter(ids); |
1005 |
}), lang.hitch(this, function() { |
974 |
}), lang.hitch(this, function() { |
1006 |
this.standby(false); |
975 |
this.standby(false); |
1007 |
})); |
976 |
})); |
|
1022 |
})); |
991 |
})); |
1023 |
}, |
992 |
}, |
1024 |
|
993 |
|
1025 |
resetPathAndReloadTreeAndFilter: function(reset) { |
994 |
resetPathAndReloadTreeAndFilter: function(modifiedDNs) { |
1026 |
if (reset) { |
995 |
if (modifiedDNs.length) { |
1027 |
this._tree.set('path', [ this._tree.model.root ]); |
996 |
var notTouched = true; |
|
|
997 |
var path = array.filter(this._tree.get('path'), function(part) { |
998 |
if (modifiedDNs.indexOf(part.id) > -1) { |
999 |
// if touched, set notTouched |
1000 |
// to false for this and every |
1001 |
// following part |
1002 |
notTouched = false; |
1003 |
} |
1004 |
return notTouched; |
1005 |
}); |
1006 |
if (path.length === 0) { |
1007 |
// user modified the root |
1008 |
path = [ this._tree.model.root ]; |
1009 |
} |
1010 |
this._tree.set('path', path); |
1028 |
this.reloadTree(); |
1011 |
this.reloadTree(); |
1029 |
} |
1012 |
} |
1030 |
this.filter(); |
1013 |
this.filter(); |
|
1154 |
// enable standby animation |
1137 |
// enable standby animation |
1155 |
this.standby(true); |
1138 |
this.standby(true); |
1156 |
|
1139 |
|
1157 |
// set reloading path to ldap base |
|
|
1158 |
if (isContainer) { |
1159 |
var ldapBase = this._tree.model.getIdentity(this._tree.model.root); |
1160 |
this._reloadingPath = ldapBase; |
1161 |
this._tree.set('path', [ this._tree.model.root ]); |
1162 |
} |
1163 |
|
1164 |
// set the options |
1140 |
// set the options |
1165 |
var options = { |
1141 |
var options = { |
1166 |
cleanup: form.getWidget('deleteReferring').get('value'), |
1142 |
cleanup: form.getWidget('deleteReferring').get('value'), |
|
1192 |
if (!success) { |
1168 |
if (!success) { |
1193 |
dialog.alert(message); |
1169 |
dialog.alert(message); |
1194 |
} |
1170 |
} |
1195 |
this.resetPathAndReloadTreeAndFilter(isContainer); |
1171 |
this.resetPathAndReloadTreeAndFilter(ids); |
1196 |
}), lang.hitch(this, function() { |
1172 |
}), lang.hitch(this, function() { |
1197 |
this.standby(false); |
1173 |
this.standby(false); |
1198 |
})); |
1174 |
})); |