Add file sync info/link to File Not Found dialog

This commit is contained in:
Dan Stillman 2016-05-15 04:24:00 -04:00
parent 427234917d
commit 56dcd6da26
2 changed files with 39 additions and 12 deletions

View File

@ -57,7 +57,6 @@ var ZoteroPane = new function()
this.contextPopupShowing = contextPopupShowing; this.contextPopupShowing = contextPopupShowing;
this.openNoteWindow = openNoteWindow; this.openNoteWindow = openNoteWindow;
this.viewSelectedAttachment = viewSelectedAttachment; this.viewSelectedAttachment = viewSelectedAttachment;
this.showAttachmentNotFoundDialog = showAttachmentNotFoundDialog;
this.reportErrors = reportErrors; this.reportErrors = reportErrors;
this.displayErrorMessage = displayErrorMessage; this.displayErrorMessage = displayErrorMessage;
@ -3959,7 +3958,9 @@ var ZoteroPane = new function()
} }
if (!(yield downloadedItem.getFilePathAsync())) { if (!(yield downloadedItem.getFilePathAsync())) {
ZoteroPane_Local.showAttachmentNotFoundDialog(downloadedItem.id, noLocateOnMissing); ZoteroPane_Local.showAttachmentNotFoundDialog(
downloadedItem.id, noLocateOnMissing, true
);
return; 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"]. var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
createInstance(Components.interfaces.nsIPromptService); 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 // Don't show Locate button
if (noLocate) { if (noLocate) {
var index = ps.alert(null, let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_OK)
Zotero.getString('pane.item.attachments.fileNotFound.title'), + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING);
Zotero.getString('pane.item.attachments.fileNotFound.text') 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; return;
} }
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) 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, var index = ps.confirmEx(null,
Zotero.getString('pane.item.attachments.fileNotFound.title'), title,
Zotero.getString('pane.item.attachments.fileNotFound.text'), text,
buttonFlags, Zotero.getString('general.locate'), null, buttonFlags,
null, null, {}); Zotero.getString('general.locate'),
null,
Zotero.getString('general.moreInformation'), null, {}
);
if (index == 0) { if (index == 0) {
this.relinkAttachment(itemID); this.relinkAttachment(itemID);
} }
else if (index == 2) {
this.loadURI(supportURL, { metaKey: true, shiftKey: true });
}
} }

View File

@ -293,7 +293,10 @@ pane.item.attachments.rename.title = New title:
pane.item.attachments.rename.renameAssociatedFile = Rename associated file pane.item.attachments.rename.renameAssociatedFile = Rename associated file
pane.item.attachments.rename.error = An error occurred while renaming the 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.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.delete.confirm = Are you sure you want to delete this attachment?
pane.item.attachments.count.zero = %S attachments: pane.item.attachments.count.zero = %S attachments:
pane.item.attachments.count.singular = %S attachment: pane.item.attachments.count.singular = %S attachment: