From d63d24c636f87c0de0dfa0069898c6c77e9374a8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 11 Jan 2012 18:12:21 -0500 Subject: [PATCH] Show access error for translator save attempt to read-only library Not sure how this works for connector saves --- chrome/content/zotero/browser.js | 9 +++++++++ chrome/content/zotero/zoteroPane.js | 4 ++-- chrome/locale/en-US/zotero/zotero.properties | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index 8eb28f089..b81672f22 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -152,6 +152,15 @@ var Zotero_Browser = new function() { var libraryID = null, collectionID = null; if(ZoteroPane && !Zotero.isConnector) { try { + if (!ZoteroPane.collectionsView.editable) { + Zotero_Browser.progress.changeHeadline(Zotero.getString("ingester.scrapeError")); + var desc = Zotero.getString('save.error.cannotMakeChangesToLibrary'); + Zotero_Browser.progress.addDescription(desc); + Zotero_Browser.progress.show(); + Zotero_Browser.progress.startCloseTimer(8000); + return; + } + libraryID = ZoteroPane.getSelectedLibraryID(); collectionID = ZoteroPane.getSelectedCollection(true); } catch(e) {} diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index b05b34c16..797f1baf1 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3498,14 +3498,14 @@ var ZoteroPane = new function() this.displayCannotEditLibraryMessage = function () { var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); - ps.alert(null, "", "You cannot make changes to the currently selected library."); + ps.alert(null, "", Zotero.getString('save.error.cannotMakeChangesToLibrary')); } this.displayCannotEditLibraryFilesMessage = function () { var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); - ps.alert(null, "", "You cannot add files to the currently selected library."); + ps.alert(null, "", Zotero.getString('save.error.cannotAddFilesToLibrary')); } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index c578c384b..abe84e4c1 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -396,6 +396,8 @@ fileTypes.document = Document save.attachment = Saving Snapshot… save.link = Saving Link… save.link.error = An error occurred while saving this link. +save.error.cannotMakeChangesToLibrary = You cannot make changes to the currently selected library. +save.error.cannotAddFilesToLibrary = You cannot add files to the currently selected library. ingester.saveToZotero = Save to Zotero ingester.saveToZoteroUsing = Save to Zotero using "%S"