From 99084084d4dced701b5034e540c6a2840a5bad91 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 30 Sep 2022 15:52:56 -0400 Subject: [PATCH] Remove default OpenURL gateway https://www.worldcat.org/registry/gateway is no longer supported -- see https://forums.zotero.org/discussion/comment/418373/#Comment_418373 for details If no resolver is selected, show an error on "Library Lookup" with a button to open the prefs. --- chrome/content/zotero/locateMenu.js | 18 +++++++++++-- .../preferences/preferences_advanced.js | 26 +++---------------- chrome/locale/en-US/zotero/zotero.properties | 2 ++ defaults/preferences/zotero.js | 2 +- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/chrome/content/zotero/locateMenu.js b/chrome/content/zotero/locateMenu.js index fc29a5de81..eeeb106622 100644 --- a/chrome/content/zotero/locateMenu.js +++ b/chrome/content/zotero/locateMenu.js @@ -589,9 +589,23 @@ var Zotero_LocateMenu = new function() { this.icon = "chrome://zotero/skin/locate-library-lookup.png"; this.canHandleItem = function (item) { return Zotero.Promise.resolve(item.isRegularItem()); }; this.handleItems = Zotero.Promise.method(function (items, event) { - // If no resolver configured, just switch to the default + // If no resolver configured, show error if (!Zotero.Prefs.get('openURL.resolver')) { - Zotero.Prefs.clear('openURL.resolver') + let ps = Services.prompt; + let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) + + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + let index = ps.confirmEx( + null, + Zotero.getString('locate.libraryLookup.noResolver.title'), + Zotero.getString('locate.libraryLookup.noResolver.text', Zotero.appName), + buttonFlags, + Zotero.getString('general.openPreferences'), + null, null, null, {} + ); + if (index == 0) { + Zotero.Utilities.Internal.openPreferences('zotero-prefpane-advanced'); + } + return; } var urls = []; for (let item of items) { diff --git a/chrome/content/zotero/preferences/preferences_advanced.js b/chrome/content/zotero/preferences/preferences_advanced.js index 4d4e949a16..8b3de671c0 100644 --- a/chrome/content/zotero/preferences/preferences_advanced.js +++ b/chrome/content/zotero/preferences/preferences_advanced.js @@ -27,8 +27,6 @@ Components.utils.import("resource://gre/modules/Services.jsm"); import FilePicker from 'zotero/modules/filePicker'; Zotero_Preferences.Advanced = { - DEFAULT_OPENURL_RESOLVER: 'https://www.worldcat.org/registry/gateway', - _openURLResolvers: null, init: function () { @@ -462,12 +460,6 @@ Zotero_Preferences.Advanced = { var menupopup = openURLMenu.firstChild; menupopup.innerHTML = ''; - var defaultMenuItem = document.createElement('menuitem'); - defaultMenuItem.setAttribute('label', Zotero.getString('general.default')); - defaultMenuItem.setAttribute('value', this.DEFAULT_OPENURL_RESOLVER); - defaultMenuItem.setAttribute('type', 'checkbox'); - menupopup.appendChild(defaultMenuItem); - var customMenuItem = document.createElement('menuitem'); customMenuItem.setAttribute('label', Zotero.getString('general.custom')); customMenuItem.setAttribute('value', 'custom'); @@ -521,13 +513,8 @@ Zotero_Preferences.Advanced = { } } - // Default - if (currentResolver == this.DEFAULT_OPENURL_RESOLVER) { - openURLMenu.setAttribute('label', Zotero.getString('general.default')); - defaultMenuItem.setAttribute('checked', true); - Zotero.Prefs.clear('openURL.name'); - } - else if (selectedName) { + // From directory + if (selectedName) { openURLMenu.setAttribute('label', selectedName); // If we found a match, update stored name Zotero.Prefs.set('openURL.name', selectedName); @@ -555,15 +542,8 @@ Zotero_Preferences.Advanced = { var openURLServerField = document.getElementById('openURLServerField'); var openURLVersionMenu = document.getElementById('openURLVersionMenu'); - // Default - if (event.target.value == this.DEFAULT_OPENURL_RESOLVER) { - Zotero.Prefs.clear('openURL.name'); - Zotero.Prefs.clear('openURL.resolver'); - Zotero.Prefs.clear('openURL.version'); - openURLServerField.value = this.DEFAULT_OPENURL_RESOLVER; - } // If "Custom" selected, clear URL field - else if (event.target.value == "custom") { + if (event.target.value == "custom") { Zotero.Prefs.clear('openURL.name'); Zotero.Prefs.set('openURL.resolver', ''); Zotero.Prefs.clear('openURL.version'); diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index fdfcedde37..d333535a05 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -1212,6 +1212,8 @@ locate.externalViewer.label = Open in External Viewer locate.internalViewer.label = Open in Internal Viewer locate.showFile.label = Show File locate.libraryLookup.label = Library Lookup +locate.libraryLookup.noResolver.title = No OpenURL Resolver +locate.libraryLookup.noResolver.text = You must choose an OpenURL resolver from the Advanced pane of the %S preferences. locate.manageLocateEngines = Manage Lookup Engines… locate.locateEngineDescription = Lookup engines help you find resources in your %S library on the web. Engines enabled in this list appear in the Locate drop-down in the toolbar. diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index bca1ef1cb6..38433c63dc 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -23,7 +23,7 @@ pref("extensions.zotero.automaticScraperUpdates",true); pref("extensions.zotero.triggerProxyAuthentication", true); // Proxy auth URLs should respond successfully to HEAD requests over HTTP and HTTPS (in case of forced HTTPS requests) pref("extensions.zotero.proxyAuthenticationURLs", "https://www.acm.org,https://www.ebscohost.com,https://www.sciencedirect.com,https://ieeexplore.ieee.org,https://www.jstor.org,http://www.ovid.com,https://link.springer.com,https://www.tandfonline.com"); -pref("extensions.zotero.openURL.resolver","https://www.worldcat.org/registry/gateway"); +pref("extensions.zotero.openURL.resolver",""); pref("extensions.zotero.openURL.version","1.0"); pref("extensions.zotero.automaticSnapshots",true); pref("extensions.zotero.downloadAssociatedFiles",true);