commit f88c2b8859e4a898c42e2a026a08bd680e1bc04c
parent 207af37ee7ce4bafe40c63128b1ec53441a7a0e4
Author: Simon Kornblith <simon@simonster.com>
Date: Fri, 26 Aug 2011 21:49:47 +0000
- Show warning if items cannot be saved to current library, and default to my library
- Disable PDF saving with message if PDF tools are not installed
Diffstat:
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/downloadOverlay.js b/chrome/content/zotero/downloadOverlay.js
@@ -61,8 +61,13 @@ var Zotero_DownloadOverlay = new function() {
var win = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser");
- var libraryID = (win ? win.ZoteroPane.getSelectedLibraryID() : false);
- var collection = (win ? win.ZoteroPane.getSelectedCollection() : false);
+ var libraryID, collection;
+ try {
+ if(win.ZoteroPane.getItemGroup().filesEditable) {
+ libraryID = win.ZoteroPane.getSelectedLibraryID();
+ collection = win.ZoteroPane.getSelectedCollection();
+ }
+ } catch(e) {};
var recognizePDF = document.getElementById('zotero-recognizePDF').checked
&& !document.getElementById('zotero-recognizePDF').hidden;
@@ -123,10 +128,33 @@ var Zotero_DownloadOverlay = new function() {
document.getElementById('rememberChoice').disabled = zoteroSelected;
// disable recognizePDF checkbox as necessary
- document.getElementById('zotero-recognizePDF').disabled = !zoteroSelected;
+ if(!Zotero.Fulltext.pdfConverterIsRegistered()) {
+ document.getElementById('zotero-noPDFTools-description').hidden = !zoteroSelected;
+ document.getElementById('zotero-recognizePDF').disabled = true;
+ window.sizeToContent();
+ } else {
+ document.getElementById('zotero-recognizePDF').disabled = !zoteroSelected;
+ }
+
+ Zotero_DownloadOverlay.updateLibraryNote();
};
/**
+ * Determines whether the note stating that the item will be saved to "My Library" is shown
+ */
+ this.updateLibraryNote = function() {
+ var zoteroSelected = document.getElementById('zotero-radio').selected;
+ var zp = Zotero.getActiveZoteroPane(), canSave = true;
+ try {
+ canSave = zp.getItemGroup().filesEditable;
+ } catch(e) {
+ Zotero.logError(e);
+ };
+ document.getElementById('zotero-saveToLibrary-description').hidden = !zoteroSelected || canSave;
+ window.sizeToContent();
+ }
+
+ /**
* Called when the save dialog is opened
*/
this.init = function() {
@@ -169,4 +197,5 @@ var Zotero_DownloadOverlay = new function() {
};
}
-window.addEventListener("load", Zotero_DownloadOverlay.init, false);
-\ No newline at end of file
+window.addEventListener("load", Zotero_DownloadOverlay.init, false);
+window.addEventListener("activate", Zotero_DownloadOverlay.updateLibraryNote, false);
+\ No newline at end of file
diff --git a/chrome/content/zotero/downloadOverlay.xul b/chrome/content/zotero/downloadOverlay.xul
@@ -41,7 +41,9 @@
<vbox insertbefore="save" id="zotero-container" flex="1" hidden="true">
<radio id="zotero-radio" label="&zotero.downloadManager.label;" disabled="true"/>
<vbox style="margin-left: 10px">
+ <description id="zotero-saveToLibrary-description" style="font: -moz-info" hidden="true">&zotero.downloadManager.saveToLibrary.description;</description>
<checkbox id="zotero-recognizePDF" hidden="true" persist="checked" disabled="true"/>
+ <description style="margin-left: 20px; font: -moz-info" id="zotero-noPDFTools-description" hidden="true">&zotero.downloadManager.noPDFTools.description;</description>
</vbox>
</vbox>
</radiogroup>