From 61e9ace79e390eadfbf1eb55551ca0efad048f09 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 8 Feb 2010 18:00:09 +0000 Subject: [PATCH] Display a clearer error message attempting to import an unsupported file format, with a button pointing to http://zotero.org/support/kb/importing --- chrome/content/zotero/fileInterface.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 5b61c316ec..fc9b90b704 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -275,9 +275,25 @@ var Zotero_File_Interface = new function() { Zotero.DB.beginTransaction(); translation.translate(); } else { - var prompt = Components.classes["@mozilla.org/network/default-prompt;1"] - .getService(Components.interfaces.nsIPrompt); - prompt.alert("", Zotero.getString("fileInterface.fileFormatUnsupported")); + // TODO: localize and remove fileInterface.fileFormatUnsupported string + var unsupportedFormat = "The selected file is not in a supported format."; + var viewSupportedFormats = "View Supported Formats..."; + + var pr = Components.classes["@mozilla.org/network/default-prompt;1"] + .getService(Components.interfaces.nsIPrompt); + var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_OK) + + (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_IS_STRING); + var index = pr.confirmEx( + "", + unsupportedFormat, + buttonFlags, + null, + viewSupportedFormats, + null, null, {} + ); + if (index == 1) { + window.loadURI("http://zotero.org/support/kb/importing"); + } } }