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()}]); Scholar.DB.query(sql, [parentParam, {'int':this.getID()}]);
this._parent = parent; this._parent = parent;
var notifyIDs = [this.getID()]; var notifyIDs = [
if (previousParent){ this.getID(),
notifyIDs.push(previousParent); (previousParent ? previousParent : null),
} (parent ? parent : null)
if (parent){ ];
notifyIDs.push(parent);
}
// TODO: only reload the necessary ones // TODO: only reload the necessary ones
Scholar.Collections.reloadAll(); Scholar.Collections.reloadAll();
Scholar.Notifier.trigger('modify', 'collection', notifyIDs); Scholar.Notifier.trigger('move', 'collection', notifyIDs);
return true; return true;
} }