Fix a few protocol handler bugs
This commit is contained in:
parent
46997bd3e4
commit
5e614e2787
|
@ -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'
|
||||
|
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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':
|
||||
|
|
Loading…
Reference in New Issue
Block a user