- 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
This commit is contained in:
parent
207af37ee7
commit
f88c2b8859
2 changed files with 35 additions and 4 deletions
|
@ -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,9 +128,32 @@ var Zotero_DownloadOverlay = new function() {
|
|||
document.getElementById('rememberChoice').disabled = zoteroSelected;
|
||||
|
||||
// disable recognizePDF checkbox as necessary
|
||||
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
|
||||
*/
|
||||
|
@ -170,3 +198,4 @@ var Zotero_DownloadOverlay = new function() {
|
|||
}
|
||||
|
||||
window.addEventListener("load", Zotero_DownloadOverlay.init, false);
|
||||
window.addEventListener("activate", Zotero_DownloadOverlay.updateLibraryNote, false);
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue