From b7a261d3da1732c7c8c55d3f5917515df573efc1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 12 Oct 2006 06:44:07 +0000 Subject: [PATCH] Allow item types to be passed by name in Item constructor -- don't know why I never did this before, since they're cached Feel free to remove redundant calls to ItemTypes.getID() (I actually see a whole bunch of calls to the constructor using type names in scrapers, but presumably those are converted to itemTypeIDs in translate.js, since they seem to have been working just fine...) --- chrome/content/zotero/xpcom/data_access.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index 74b03e580..deacaf435 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -30,7 +30,7 @@ Zotero.Item = function(){ // Accept itemTypeID in constructor if (arguments.length){ - this.setType(arguments[0]); + this.setType(Zotero.ItemTypes.getID(arguments[0])); } } @@ -268,6 +268,11 @@ Zotero.Item.prototype.getCreators = function(){ /* * Set or update the creator at the specified position + * + * _orderIndex_: the position of this creator in the item (from 0) + * _fieldMode_: 0 for double-field, 1 for single-field mode + * + * If single-field mode, _firstName_ is ignored */ Zotero.Item.prototype.setCreator = function(orderIndex, firstName, lastName, creatorTypeID, fieldMode){ if (this.getID() && !this._creatorsLoaded){