Mendeley citation relinking tweaks
- Show "More information" link next to relink option - Automatically check relink option when coming from integration prompt - Change done message to "[x] items were relinked" instead of "0 items were imported"
This commit is contained in:
parent
e10fc538d0
commit
a6a69605c6
8 changed files with 39 additions and 6 deletions
|
@ -61,7 +61,7 @@ const Zotero_Import_Wizard = { // eslint-disable-line no-unused-vars
|
||||||
},
|
},
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
const { mendeleyCode, libraryID, pageID } = window.arguments[0].wrappedJSObject ?? {};
|
const { mendeleyCode, libraryID, pageID, relinkOnly } = window.arguments[0].wrappedJSObject ?? {};
|
||||||
|
|
||||||
this.libraryID = libraryID;
|
this.libraryID = libraryID;
|
||||||
|
|
||||||
|
@ -97,10 +97,10 @@ const Zotero_Import_Wizard = { // eslint-disable-line no-unused-vars
|
||||||
document.getElementById('import-other').checked = ev.currentTarget.value.length > 0;
|
document.getElementById('import-other').checked = ev.currentTarget.value.length > 0;
|
||||||
});
|
});
|
||||||
document
|
document
|
||||||
.querySelector('#page-done-error-mendeley > a')
|
.querySelector('a')
|
||||||
.addEventListener('click', this.onURLInteract.bind(this));
|
.addEventListener('click', this.onURLInteract.bind(this));
|
||||||
document
|
document
|
||||||
.querySelector('#page-done-error-mendeley > a')
|
.querySelector('a')
|
||||||
.addEventListener('keydown', this.onURLInteract.bind(this));
|
.addEventListener('keydown', this.onURLInteract.bind(this));
|
||||||
document
|
document
|
||||||
.querySelector('#page-done-error > button')
|
.querySelector('#page-done-error > button')
|
||||||
|
@ -125,6 +125,11 @@ const Zotero_Import_Wizard = { // eslint-disable-line no-unused-vars
|
||||||
this.wizard.shadowRoot
|
this.wizard.shadowRoot
|
||||||
.querySelector('.wizard-header-label').style.fontSize = '16px';
|
.querySelector('.wizard-header-label').style.fontSize = '16px';
|
||||||
|
|
||||||
|
if (relinkOnly) {
|
||||||
|
document.getElementById('relink-only-checkbox').checked = true;
|
||||||
|
this.onRelinkOnlyChange();
|
||||||
|
}
|
||||||
|
|
||||||
if (pageID) {
|
if (pageID) {
|
||||||
this.wizard.goTo(pageID);
|
this.wizard.goTo(pageID);
|
||||||
}
|
}
|
||||||
|
@ -437,9 +442,12 @@ const Zotero_Import_Wizard = { // eslint-disable-line no-unused-vars
|
||||||
}
|
}
|
||||||
|
|
||||||
const numItems = this.translation.newItems.length;
|
const numItems = this.translation.newItems.length;
|
||||||
|
const numRelinked = this.translation.numRelinked;
|
||||||
this.skipToDonePage(
|
this.skipToDonePage(
|
||||||
'file-interface-import-complete',
|
'file-interface-import-complete',
|
||||||
['file-interface-items-were-imported', { numItems }]
|
document.getElementById('relink-only-checkbox').checked
|
||||||
|
? ['file-interface-items-were-relinked', { numRelinked }]
|
||||||
|
: ['file-interface-items-were-imported', { numItems }]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
>
|
>
|
||||||
<div class="options-group" id="page-options-relink-only">
|
<div class="options-group" id="page-options-relink-only">
|
||||||
<checkbox id="relink-only-checkbox" data-l10n-id="import-online-relink-only" />
|
<checkbox id="relink-only-checkbox" data-l10n-id="import-online-relink-only" />
|
||||||
|
<html:a data-l10n-id="import-online-relink-kb" href="https://www.zotero.org/support/kb/mendeley_import#using_mendeley_citations" />
|
||||||
</div>
|
</div>
|
||||||
<div class="options-group" id="page-options-common">
|
<div class="options-group" id="page-options-common">
|
||||||
<checkbox native="true" id="create-collection" data-l10n-id="import-create-collection" />
|
<checkbox native="true" id="create-collection" data-l10n-id="import-create-collection" />
|
||||||
|
|
|
@ -33,6 +33,7 @@ var Zotero_Import_Mendeley = function () {
|
||||||
this.mendeleyAuth = null;
|
this.mendeleyAuth = null;
|
||||||
this.newItemsOnly = false;
|
this.newItemsOnly = false;
|
||||||
this.relinkOnly = false;
|
this.relinkOnly = false;
|
||||||
|
this.numRelinked = 0;
|
||||||
|
|
||||||
this._tokens = null;
|
this._tokens = null;
|
||||||
this._db = null;
|
this._db = null;
|
||||||
|
@ -1319,6 +1320,7 @@ Zotero_Import_Mendeley.prototype._saveItems = async function (libraryID, json) {
|
||||||
// Update any child items to point to the existing item's key instead of the
|
// Update any child items to point to the existing item's key instead of the
|
||||||
// new generated one
|
// new generated one
|
||||||
this._updateParentKeys('item', json, i + 1, itemJSON.key, item.key);
|
this._updateParentKeys('item', json, i + 1, itemJSON.key, item.key);
|
||||||
|
this.numRelinked++;
|
||||||
|
|
||||||
// Leave item in any collections it's in
|
// Leave item in any collections it's in
|
||||||
itemJSON.collections = item.getCollections()
|
itemJSON.collections = item.getCollections()
|
||||||
|
@ -1337,7 +1339,7 @@ Zotero_Import_Mendeley.prototype._saveItems = async function (libraryID, json) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.relinkOnly && !isMappedToExisting) {
|
if (this.relinkOnly && !isMappedToExisting) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2680,7 +2680,14 @@ Zotero.Integration.URIMap.prototype.getZoteroItemForURIs = async function (uris)
|
||||||
checkbox
|
checkbox
|
||||||
});
|
});
|
||||||
if (result === 0) {
|
if (result === 0) {
|
||||||
setTimeout(() => Zotero.getMainWindow().Zotero_File_Interface.showImportWizard({ pageID: 'page-mendeley-online-intro' }));
|
setTimeout(
|
||||||
|
() => Zotero.getMainWindow().Zotero_File_Interface.showImportWizard(
|
||||||
|
{
|
||||||
|
pageID: 'page-mendeley-online-intro',
|
||||||
|
relinkOnly: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
throw new Zotero.Exception.UserCancelled("Importing mendeley citations");
|
throw new Zotero.Exception.UserCancelled("Importing mendeley citations");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<!ENTITY zotero.general.advancedOptions.label "Advanced Options">
|
<!ENTITY zotero.general.advancedOptions.label "Advanced Options">
|
||||||
<!ENTITY zotero.general.tools "Tools">
|
<!ENTITY zotero.general.tools "Tools">
|
||||||
<!ENTITY zotero.general.more "More">
|
<!ENTITY zotero.general.more "More">
|
||||||
|
<!ENTITY zotero.general.moreInformation "More Information">
|
||||||
<!ENTITY zotero.general.loading "Loading…">
|
<!ENTITY zotero.general.loading "Loading…">
|
||||||
<!ENTITY zotero.general.close "Close">
|
<!ENTITY zotero.general.close "Close">
|
||||||
<!ENTITY zotero.general.minimize "Minimize">
|
<!ENTITY zotero.general.minimize "Minimize">
|
||||||
|
|
|
@ -50,6 +50,10 @@ file-interface-items-were-imported = { $numItems ->
|
||||||
[one] item was imported
|
[one] item was imported
|
||||||
*[other] { $numItems } items were imported
|
*[other] { $numItems } items were imported
|
||||||
}
|
}
|
||||||
|
file-interface-items-were-relinked = { $numRelinked ->
|
||||||
|
[one] item was relinked
|
||||||
|
*[other] { $numRelinked } items were relinked
|
||||||
|
}
|
||||||
|
|
||||||
import-mendeley-encrypted = The selected Mendeley database cannot be read, likely because it is encrypted.
|
import-mendeley-encrypted = The selected Mendeley database cannot be read, likely because it is encrypted.
|
||||||
See <a data-l10n-name="mendeley-import-kb">How do I import a Mendeley library into Zotero?</a> for more information.
|
See <a data-l10n-name="mendeley-import-kb">How do I import a Mendeley library into Zotero?</a> for more information.
|
||||||
|
@ -63,6 +67,7 @@ import-online-wrong-credentials = Login to { $targetApp } failed. Please re-ente
|
||||||
import-online-blocked-by-plugin = The import cannot continue with { $plugin } installed. Please disable this plugin and try again.
|
import-online-blocked-by-plugin = The import cannot continue with { $plugin } installed. Please disable this plugin and try again.
|
||||||
import-online-relink-only =
|
import-online-relink-only =
|
||||||
.label = Relink Mendeley Desktop citations
|
.label = Relink Mendeley Desktop citations
|
||||||
|
import-online-relink-kb = More Information
|
||||||
|
|
||||||
report-error =
|
report-error =
|
||||||
.label = Report Error…
|
.label = Report Error…
|
||||||
|
|
|
@ -799,6 +799,7 @@ dragAndDrop.filesNotFound = The following files were not found and could not be
|
||||||
fileInterface.importing = Importing…
|
fileInterface.importing = Importing…
|
||||||
fileInterface.importComplete = Import Complete
|
fileInterface.importComplete = Import Complete
|
||||||
fileInterface.itemsWereImported = %1$S item was imported;%1$S items were imported
|
fileInterface.itemsWereImported = %1$S item was imported;%1$S items were imported
|
||||||
|
fileInterface.itemsWereRelinked = %1$S item was relinked;%1$S items were relinked
|
||||||
fileInterface.itemsExported = Exporting items…
|
fileInterface.itemsExported = Exporting items…
|
||||||
fileInterface.import = Import
|
fileInterface.import = Import
|
||||||
fileInterface.chooseAppDatabaseToImport = Choose the %S database to import
|
fileInterface.chooseAppDatabaseToImport = Choose the %S database to import
|
||||||
|
|
|
@ -92,6 +92,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#page-options-relink-only {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
a {
|
||||||
|
margin: 4px 1em 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.page-options-file-handling-description {
|
.page-options-file-handling-description {
|
||||||
margin-top: .6em;
|
margin-top: .6em;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
|
Loading…
Reference in a new issue