From e4cc28ac6041dd4bdd56fb5f26de6015ce4d05f4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 16 Jan 2018 12:36:27 -0500 Subject: [PATCH] Tweak wording of delayed-citations mode "Delay citation updates until manual refresh" would be fine in the doc prefs, but "until manual refresh" is a bit too awkward for the prompt. Instead, go with @rmzelle's suggestion from #1242 of referring to "automatic citation updates", and invert the checkbox. --- chrome/content/zotero/bibliography.js | 52 ++++++++----------- .../integration/integrationDocPrefs.xul | 6 +-- chrome/content/zotero/xpcom/integration.js | 11 +++- chrome/locale/en-US/zotero/zotero.dtd | 6 +-- chrome/locale/en-US/zotero/zotero.properties | 6 ++- 5 files changed, 42 insertions(+), 39 deletions(-) diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js index 7702208d8a..f4990e32cf 100644 --- a/chrome/content/zotero/bibliography.js +++ b/chrome/content/zotero/bibliography.js @@ -146,8 +146,7 @@ var Zotero_File_Interface_Bibliography = new function() { if(_io.useEndnotes && _io.useEndnotes == 1) document.getElementById("displayAs").selectedIndex = 1; let dialog = document.getElementById("zotero-doc-prefs-dialog"); dialog.setAttribute('title', `${Zotero.clientName} - ${dialog.getAttribute('title')}`); - } - if(document.getElementById("formatUsing")) { + if(_io.fieldType == "Bookmark") document.getElementById("formatUsing").selectedIndex = 1; var formatOption = (_io.primaryFieldType == "ReferenceMark" ? "referenceMarks" : "fields"); document.getElementById("fields").label = @@ -158,19 +157,16 @@ var Zotero_File_Interface_Bibliography = new function() { Zotero.getString("integration."+formatOption+".fileFormatNotice"); document.getElementById("bookmarks-file-format-notice").textContent = Zotero.getString("integration.fields.fileFormatNotice"); - } - if(document.getElementById("automaticJournalAbbreviations-checkbox")) { + + if(_io.automaticJournalAbbreviations === undefined) { _io.automaticJournalAbbreviations = Zotero.Prefs.get("cite.automaticJournalAbbreviations"); } if(_io.automaticJournalAbbreviations) { document.getElementById("automaticJournalAbbreviations-checkbox").checked = true; } - } - if (document.getElementById("delayCitationUpdates-checkbox")) { - if (_io.delayCitationUpdates) { - document.getElementById("delayCitationUpdates-checkbox").checked = true; - } + + document.getElementById("automaticCitationUpdates-checkbox").checked = !_io.delayCitationUpdates; } // set style to false, in case this is cancelled @@ -205,31 +201,29 @@ var Zotero_File_Interface_Bibliography = new function() { // // For integrationDocPrefs.xul // - - // update status of displayAs box based on style class - if(document.getElementById("displayAs-groupbox")) { + if (isDocPrefs) { + // update status of displayAs box based on style class var isNote = selectedStyleObj.class == "note"; document.getElementById("displayAs-groupbox").hidden = !isNote; // update status of formatUsing box based on style class - if(document.getElementById("formatUsing")) { - if(isNote) document.getElementById("formatUsing").selectedIndex = 0; - document.getElementById("bookmarks").disabled = isNote; - document.getElementById("bookmarks-caption").disabled = isNote; - } - } - - // update status of displayAs box based on style class - if(document.getElementById("automaticJournalAbbreviations-vbox")) { + if(isNote) document.getElementById("formatUsing").selectedIndex = 0; + document.getElementById("bookmarks").disabled = isNote; + document.getElementById("bookmarks-caption").disabled = isNote; + + // update status of displayAs box based on style class document.getElementById("automaticJournalAbbreviations-vbox").hidden = !selectedStyleObj.usesAbbreviation; - } - // Hide the delayCitationUpdates checkbox before the prompt is shown - document.getElementById("delayCitationUpdates-vbox").hidden = _io.dontAskDelayCitationUpdates == undefined; - // Highlight delay citations checkbox after displaying the alert - // NOTE: Currently unused - if (_io.highlightDelayCitations) { - document.getElementById("delayCitationUpdates-vbox").style.border = "1px dashed #e52e2e" + + // Hide the automaticCitationUpdates checkbox before the prompt is shown + document.getElementById("automaticCitationUpdates-vbox").hidden + = _io.dontAskDelayCitationUpdates == undefined; + + // Highlight delay citations checkbox after displaying the alert + // NOTE: Currently unused + if (_io.highlightDelayCitations) { + document.getElementById("automaticCitationUpdates-vbox").style.border = "1px dashed #e52e2e" + } } // @@ -286,7 +280,7 @@ var Zotero_File_Interface_Bibliography = new function() { } _io.useEndnotes = document.getElementById("displayAs").selectedIndex; _io.fieldType = (document.getElementById("formatUsing").selectedIndex == 0 ? _io.primaryFieldType : _io.secondaryFieldType); - _io.delayCitationUpdates = document.getElementById("delayCitationUpdates-checkbox").checked; + _io.delayCitationUpdates = !document.getElementById("automaticCitationUpdates-checkbox").checked; } // remember style and locale if user selected these explicitly diff --git a/chrome/content/zotero/integration/integrationDocPrefs.xul b/chrome/content/zotero/integration/integrationDocPrefs.xul index 0d6a561f3c..033af3584a 100644 --- a/chrome/content/zotero/integration/integrationDocPrefs.xul +++ b/chrome/content/zotero/integration/integrationDocPrefs.xul @@ -86,9 +86,9 @@ &zotero.integration.prefs.automaticJournalAbbeviations.caption; - - - &zotero.integration.prefs.delayCitationUpdates.description; + + + &zotero.integration.prefs.automaticCitationUpdates.description; \ No newline at end of file diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 541a47516e..1b11322ff9 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -939,8 +939,15 @@ Zotero.Integration.Fields.prototype.updateDocument = Zotero.Promise.coroutine(fu // If the update takes longer than 5s suggest delaying citation updates if (diff > DELAY_CITATIONS_PROMPT_TIMEOUT && !this._session.data.prefs.dontAskDelayCitationUpdates && !this._session.data.prefs.delayCitationUpdates) { this._doc.activate(); - var result = this._session.displayAlert(Zotero.getString('integration.delayCitationUpdates.alert'), - DIALOG_ICON_WARNING, DIALOG_BUTTONS_YES_NO_CANCEL); + var result = this._session.displayAlert( + Zotero.getString('integration.delayCitationUpdates.alert.text1') + + "\n\n" + + Zotero.getString('integration.delayCitationUpdates.alert.text2') + + "\n\n" + + Zotero.getString('integration.delayCitationUpdates.alert.text3'), + DIALOG_ICON_WARNING, + DIALOG_BUTTONS_YES_NO_CANCEL + ); if (result == 2) { this._session.data.prefs.delayCitationUpdates = true; } diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd index b75631bb52..1ee719e329 100644 --- a/chrome/locale/en-US/zotero/zotero.dtd +++ b/chrome/locale/en-US/zotero/zotero.dtd @@ -231,9 +231,9 @@ - - - + + + diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index e9e3ac3ad7..d30a2cb4a8 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -870,8 +870,10 @@ integration.corruptBibliography.description = All items cited in the text will a integration.citationChanged = You have modified this citation since Zotero generated it. Do you want to keep your modifications and prevent future updates? integration.citationChanged.description = Clicking "Yes" will prevent Zotero from updating this citation if you add additional citations, switch styles, or modify the item to which it refers. Clicking "No" will erase your changes. integration.citationChanged.edit = You have modified this citation since Zotero generated it. Editing will clear your modifications. Do you want to continue? -integration.delayCitationUpdates.alert = Updating citations in this document is taking a long time. Would you like to delay citation updates until manual refresh?\n\nYou can change this setting later in the document preferences. -integration.delayCitationUpdates.bibliography = Delayed citing mode is enabled. To see the bibliography click Refresh in Zotero plugin. +integration.delayCitationUpdates.alert.text1 = Updating citations in this document is taking a long time. Would you like to disable automatic citation updates? +integration.delayCitationUpdates.alert.text2 = You will need to click Refresh in the Zotero plugin when you are done inserting citations. +integration.delayCitationUpdates.alert.text3 = You can change this setting later in the document preferences. +integration.delayCitationUpdates.bibliography = Automatic citation updates are disabled. To see the bibliography, click Refresh in the Zotero plugin. styles.install.title = Install Style styles.install.unexpectedError = An unexpected error occurred while installing "%1$S"