mirror of
https://github.com/zotero/zotero.git
synced 2026-10-09 03:18:01 +00:00
Fix erroneous "You cannot add files to the currently selected library." message when trying to store a file in a group library
This commit is contained in:
parent
5be1b75b2b
commit
97b2aff10a
2 changed files with 18 additions and 17 deletions
|
|
@ -2482,12 +2482,8 @@ var ZoteroPane = new function()
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME: temporarily disable file attachment options for groups
|
||||
var itemGroup = this.collectionsView._getItemAtRow(this.collectionsView.selection.currentIndex);
|
||||
if (itemGroup.isWithinGroup()) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", "Files cannot currently be added to group libraries.");
|
||||
if (!this.canEditFiles()) {
|
||||
this.displayCannotEditLibraryFilesMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2597,10 +2593,8 @@ var ZoteroPane = new function()
|
|||
//
|
||||
//
|
||||
|
||||
if (libraryID) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", "Files cannot currently be added to group libraries.");
|
||||
if (!this.canEditFiles(row)) {
|
||||
this.displayCannotEditLibraryFilesMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2611,7 +2605,7 @@ var ZoteroPane = new function()
|
|||
var collectionID = false;
|
||||
}
|
||||
|
||||
Zotero.Attachments.importFromDocument(doc, false, false, collectionID);
|
||||
Zotero.Attachments.importFromDocument(doc, false, false, collectionID, null, libraryID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2935,10 +2929,14 @@ var ZoteroPane = new function()
|
|||
this.displayCannotEditLibraryMessage = function () {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert(
|
||||
Zotero.getString('general.accessDenied'),
|
||||
"You cannot make changes to the currently selected library."
|
||||
);
|
||||
pr.alert("", "You cannot make changes to the currently selected library.");
|
||||
}
|
||||
|
||||
|
||||
this.displayCannotEditLibraryFilesMessage = function () {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", "You cannot add files to the currently selected library.");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ Zotero.Attachments = new function(){
|
|||
/*
|
||||
* Save a snapshot -- uses synchronous WebPageDump or asynchronous saveURI()
|
||||
*/
|
||||
function importFromDocument(document, sourceItemID, forceTitle, parentCollectionIDs, callback) {
|
||||
function importFromDocument(document, sourceItemID, forceTitle, parentCollectionIDs, callback, libraryID) {
|
||||
Zotero.debug('Importing attachment from document');
|
||||
|
||||
if (sourceItemID && parentCollectionIDs) {
|
||||
|
|
@ -507,7 +507,10 @@ Zotero.Attachments = new function(){
|
|||
try {
|
||||
// Create a new attachment
|
||||
var attachmentItem = new Zotero.Item('attachment');
|
||||
if (sourceItemID) {
|
||||
if (libraryID) {
|
||||
attachmentItem.libraryID = libraryID;
|
||||
}
|
||||
else if (sourceItemID) {
|
||||
var parentItem = Zotero.Items.get(sourceItemID);
|
||||
attachmentItem.libraryID = parentItem.libraryID;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue