From 56dcd6da268a5e8bcd6472e022d4ba700c9733ad Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 15 May 2016 04:24:00 -0400 Subject: [PATCH] Add file sync info/link to File Not Found dialog --- chrome/content/zotero/zoteroPane.js | 46 +++++++++++++++----- chrome/locale/en-US/zotero/zotero.properties | 5 ++- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index af90c583e..8e4227b93 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -57,7 +57,6 @@ var ZoteroPane = new function() this.contextPopupShowing = contextPopupShowing; this.openNoteWindow = openNoteWindow; this.viewSelectedAttachment = viewSelectedAttachment; - this.showAttachmentNotFoundDialog = showAttachmentNotFoundDialog; this.reportErrors = reportErrors; this.displayErrorMessage = displayErrorMessage; @@ -3959,7 +3958,9 @@ var ZoteroPane = new function() } if (!(yield downloadedItem.getFilePathAsync())) { - ZoteroPane_Local.showAttachmentNotFoundDialog(downloadedItem.id, noLocateOnMissing); + ZoteroPane_Local.showAttachmentNotFoundDialog( + downloadedItem.id, noLocateOnMissing, true + ); return; } @@ -4186,31 +4187,54 @@ var ZoteroPane = new function() } - function showAttachmentNotFoundDialog(itemID, noLocate) { + this.showAttachmentNotFoundDialog = function (itemID, noLocate, notOnServer) { var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]. createInstance(Components.interfaces.nsIPromptService); + var title = Zotero.getString('pane.item.attachments.fileNotFound.title'); + var text = Zotero.getString('pane.item.attachments.fileNotFound.text1') + "\n\n" + + Zotero.getString( + 'pane.item.attachments.fileNotFound.text2' + (notOnServer ? '.notOnServer' : ''), + [ZOTERO_CONFIG.CLIENT_NAME, ZOTERO_CONFIG.DOMAIN_NAME] + ); + var supportURL = Zotero.getString('pane.item.attachments.fileNotFound.supportURL'); // Don't show Locate button if (noLocate) { - var index = ps.alert(null, - Zotero.getString('pane.item.attachments.fileNotFound.title'), - Zotero.getString('pane.item.attachments.fileNotFound.text') + let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_OK) + + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING); + let index = ps.confirmEx(null, + title, + text, + buttonFlags, + null, + Zotero.getString('general.moreInformation'), + null, null, {} ); + if (index == 1) { + this.loadURI(supportURL, { metaKey: true, shiftKey: true }); + } return; } var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) - + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL) + + (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING); var index = ps.confirmEx(null, - Zotero.getString('pane.item.attachments.fileNotFound.title'), - Zotero.getString('pane.item.attachments.fileNotFound.text'), - buttonFlags, Zotero.getString('general.locate'), null, - null, null, {}); + title, + text, + buttonFlags, + Zotero.getString('general.locate'), + null, + Zotero.getString('general.moreInformation'), null, {} + ); if (index == 0) { this.relinkAttachment(itemID); } + else if (index == 2) { + this.loadURI(supportURL, { metaKey: true, shiftKey: true }); + } } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 3a6bada5e..0a6221b69 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -293,7 +293,10 @@ pane.item.attachments.rename.title = New title: pane.item.attachments.rename.renameAssociatedFile = Rename associated file pane.item.attachments.rename.error = An error occurred while renaming the file. pane.item.attachments.fileNotFound.title = File Not Found -pane.item.attachments.fileNotFound.text = The attached file could not be found.\n\nIt may have been moved or deleted outside of Zotero. +pane.item.attachments.fileNotFound.text1 = The attached file could not be found. +pane.item.attachments.fileNotFound.text2 = It may have been moved or deleted outside of %1$S, or, if the file was added on another computer, it may not yet have been synced to or from %2$S. +pane.item.attachments.fileNotFound.text2.notOnServer = It may have been moved or deleted outside of %1$S, or, if the file was added on another computer, it may not yet have been synced to %2$S. +pane.item.attachments.fileNotFound.supportURL = https://www.zotero.org/support/kb/files_not_syncing pane.item.attachments.delete.confirm = Are you sure you want to delete this attachment? pane.item.attachments.count.zero = %S attachments: pane.item.attachments.count.singular = %S attachment: