diff --git a/chrome/content/zotero/xpcom/data/cachedTypes.js b/chrome/content/zotero/xpcom/data/cachedTypes.js index 87f937f914..0a2fa1bdaa 100644 --- a/chrome/content/zotero/xpcom/data/cachedTypes.js +++ b/chrome/content/zotero/xpcom/data/cachedTypes.js @@ -97,12 +97,15 @@ Zotero.CachedTypes = function() { } - function getTypes(where) { - return Zotero.DB.query('SELECT ' + this._idCol + ' AS id, ' - + this._nameCol + ' AS name' - + (this._hasCustom ? ', custom' : '') - + ' FROM ' + this._table - + (where ? ' ' + where : '')); + function getTypes(where, params) { + return Zotero.DB.query( + 'SELECT ' + this._idCol + ' AS id, ' + + this._nameCol + ' AS name' + + (this._hasCustom ? ', custom' : '') + + ' FROM ' + this._table + + (where ? ' ' + where : ''), + params ? params : false + ); } @@ -231,11 +234,43 @@ Zotero.ItemTypes = new function() { var _customLabels = {}; function getPrimaryTypes() { - return this.getTypes('WHERE display=2'); + var limit = 5; + + // TODO: get rid of ' AND itemTypeID!=5' and just remove display=2 + // from magazineArticle in system.sql + var sql = 'WHERE (display=2 AND itemTypeID!=5) '; + + var mru = Zotero.Prefs.get('newItemTypeMRU'); + if (mru) { + var params = []; + mru = mru.split(',').slice(0, limit); + for (var i=0, len=mru.length; i - + - +