Addresses #87, Add fromArray() and toArray() methods to Item objects

Item.getTags() (which toArray() uses) now returns actual tags rather than ids -- separate method getTagIDs to return ids
This commit is contained in:
Dan Stillman 2006-07-06 13:06:32 +00:00
parent b7124bd8c1
commit 40b3ecc996

View File

@ -971,6 +971,12 @@ Scholar.Item.prototype.addTag = function(tag){
}
Scholar.Item.prototype.getTags = function(){
var sql = "SELECT tag FROM tags WHERE tagID IN "
+ "(SELECT tagID FROM itemTags WHERE itemID=" + this.getID() + ")";
return Scholar.DB.columnQuery(sql);
}
Scholar.Item.prototype.getTagIDs = function(){
var sql = "SELECT tagID FROM itemTags WHERE itemID=" + this.getID();
return Scholar.DB.columnQuery(sql);
}