commit 5e614e278727c3df606d9fd4a328e4f06fe1417a
parent 46997bd3e4c58711e164023f4101d812143585ef
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 11 Apr 2016 02:22:13 -0400
Fix a few protocol handler bugs
Diffstat:
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/chrome/content/zotero/reportInterface.js b/chrome/content/zotero/reportInterface.js
@@ -67,12 +67,7 @@ var Zotero_Report_Interface = new function() {
var items = ZoteroPane_Local.getSelectedItems();
if (!items || !items.length) {
- throw ('No items currently selected');
- }
-
- var keyHashes = [];
- for each(var item in items) {
- keyHashes.push(Zotero.Items.getLibraryKeyHash(item));
+ throw new Error('No items currently selected');
}
var url = 'zotero://report/' + Zotero.API.getLibraryPrefix(libraryID) + '/items/report.html'
diff --git a/chrome/content/zotero/xpcom/api.js b/chrome/content/zotero/xpcom/api.js
@@ -46,7 +46,7 @@ Zotero.API = {
switch (params.scopeObject) {
case 'collections':
if (params.scopeObjectKey) {
- var col = Zotero.Collections.getByLibraryAndKeyAsync(
+ var col = Zotero.Collections.getByLibraryAndKey(
params.libraryID, params.scopeObjectKey
);
}
@@ -61,12 +61,12 @@ Zotero.API = {
case 'searches':
if (params.scopeObjectKey) {
- var s = yield Zotero.Searches.getByLibraryAndKeyAsync(
+ var s = Zotero.Searches.getByLibraryAndKey(
params.libraryID, params.scopeObjectKey
);
}
else {
- var s = yield Zotero.Searches.getAsync(params.scopeObjectID);
+ var s = Zotero.Searches.get(params.scopeObjectID);
}
if (!s) {
throw new Error('Invalid search ID or key');
@@ -145,15 +145,19 @@ Zotero.API = {
getLibraryPrefix: function (libraryID) {
- switch (Zotero.Libraries.getType(libraryID)) {
+ var type = Zotero.Libraries.get(libraryID).libraryType;
+ switch (type) {
case 'user':
return 'library';
case 'publications':
return 'publications';
- case 'groups':
+ case 'group':
return 'groups/' + Zotero.Groups.getGroupIDFromLibraryID(libraryID);
+
+ default:
+ throw new Error(`Invalid type '${type}`);
}
}
};
diff --git a/chrome/content/zotero/xpcom/report.js b/chrome/content/zotero/xpcom/report.js
@@ -213,8 +213,8 @@ Zotero.Report.HTML = new function () {
case 'reportSearchMatch':
case 'reportChildren':
- case 'itemKey':
- case 'itemVersion':
+ case 'key':
+ case 'version':
case 'itemType':
case 'title':
case 'creators':