On Collection.changeParent(), change notify() action to 'move', and always send a three-value array in the order [collectionID, previousParent, newParent] -- 2nd or 3rd param will be null if moving from/to root

This commit is contained in:
Dan Stillman 2006-06-08 19:58:54 +00:00
parent 1336842d74
commit 01f50b9e4b

View File

@ -1155,17 +1155,15 @@ Scholar.Collection.prototype.changeParent = function(parent){
Scholar.DB.query(sql, [parentParam, {'int':this.getID()}]);
this._parent = parent;
var notifyIDs = [this.getID()];
if (previousParent){
notifyIDs.push(previousParent);
}
if (parent){
notifyIDs.push(parent);
}
var notifyIDs = [
this.getID(),
(previousParent ? previousParent : null),
(parent ? parent : null)
];
// TODO: only reload the necessary ones
Scholar.Collections.reloadAll();
Scholar.Notifier.trigger('modify', 'collection', notifyIDs);
Scholar.Notifier.trigger('move', 'collection', notifyIDs);
return true;
}