From 53d798c345abb24d7b89602679db5e3b52ea5b86 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 27 May 2009 04:18:37 +0000 Subject: [PATCH] - Remove unused code from Zotero.Groups - Adjust Zotero.Items.getAll(onlyTopLevel) to take a libraryID in the second parameter and only search local library otherwise -- this has the side effect of no longer exporting group items when using Export Library, which may or may not be what we want --- chrome/content/zotero/xpcom/data/group.js | 101 +--------------------- chrome/content/zotero/xpcom/data/items.js | 14 ++- 2 files changed, 13 insertions(+), 102 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/group.js b/chrome/content/zotero/xpcom/data/group.js index 724d5bcda6..c1e88ea991 100644 --- a/chrome/content/zotero/xpcom/data/group.js +++ b/chrome/content/zotero/xpcom/data/group.js @@ -279,7 +279,7 @@ Zotero.Group.prototype.save = function () { /** * Deletes group and all descendant objects **/ -Zotero.Group.prototype.erase = function(deleteItems) { +Zotero.Group.prototype.erase = function() { Zotero.DB.beginTransaction(); var sql, ids, obj; @@ -357,105 +357,6 @@ Zotero.Group.prototype.serialize = function() { } -/** - * Returns an array of descendent groups and items - * - * @param bool recursive Descend into subgroups - * @param bool nested Return multidimensional array with 'children' - * nodes instead of flat array - * @param string type 'item', 'group', or FALSE for both - * @return {Object[]} Array of objects with 'id', 'key', - * 'type' ('item' or 'group'), 'parent', - * and, if group, 'name' and the nesting 'level' - */ -Zotero.Group.prototype.getChildren = function(recursive, nested, type, level) { - if (!this.id) { - throw ('Zotero.Group.getChildren() cannot be called on an unsaved item'); - } - - var toReturn = []; - - if (!level) { - level = 1; - } - - // 0 == group - // 1 == item - var children = Zotero.DB.query('SELECT groupID AS id, ' - + "0 AS type, groupName AS groupName, key " - + 'FROM groups WHERE parentGroupID=?1' - + ' UNION SELECT itemID AS id, 1 AS type, NULL AS groupName, key ' - + 'FROM groupItems JOIN items USING (itemID) WHERE groupID=?1', this.id); - - if (type) { - switch (type) { - case 'item': - case 'group': - break; - default: - throw ("Invalid type '" + type + "' in Group.getChildren()"); - } - } - - for(var i=0, len=children.length; i