diff --git a/chrome/content/zotero/collectionTree.jsx b/chrome/content/zotero/collectionTree.jsx index 98fe092740..a97e546ce4 100644 --- a/chrome/content/zotero/collectionTree.jsx +++ b/chrome/content/zotero/collectionTree.jsx @@ -515,6 +515,7 @@ var CollectionTree = class CollectionTree extends LibraryTree { Zotero.Prefs.getVirtualCollectionState('unfiled'); this._virtualCollectionLibraries.retracted = Zotero.Prefs.getVirtualCollectionState('retracted'); + this._virtualCollectionLibraries.publications = Zotero.Prefs.getVirtualCollectionState('publications'); var newRows = []; var added = 0; @@ -1263,7 +1264,8 @@ var CollectionTree = class CollectionTree extends LibraryTree { const types = { duplicates: 'D', unfiled: 'U', - retracted: 'R' + retracted: 'R', + publications: 'P' }; if (!(type in types)) { throw new Error("Invalid virtual collection type '" + type + "'"); @@ -2981,6 +2983,7 @@ var CollectionTree = class CollectionTree extends LibraryTree { && this._virtualCollectionLibraries.retracted?.[libraryID] !== false && Zotero.Retractions.libraryHasRetractedItems(libraryID); var showPublications = this.props.hideSources.indexOf('publications') == -1 + && this._virtualCollectionLibraries.publications?.[libraryID] !== false && libraryID == Zotero.Libraries.userLibraryID; var showTrash = this.props.hideSources.indexOf('trash') == -1; } diff --git a/chrome/content/zotero/xpcom/prefs.js b/chrome/content/zotero/xpcom/prefs.js index 1cf0162f2c..b1e64c0b45 100644 --- a/chrome/content/zotero/xpcom/prefs.js +++ b/chrome/content/zotero/xpcom/prefs.js @@ -460,7 +460,8 @@ Zotero.Prefs = new function() { const prefKeys = { duplicates: 'duplicateLibraries', unfiled: 'unfiledLibraries', - retracted: 'retractedLibraries' + retracted: 'retractedLibraries', + publications: 'publications', }; let prefKey = prefKeys[type]; if (!prefKey) { @@ -493,7 +494,8 @@ Zotero.Prefs = new function() { const prefKeys = { duplicates: 'duplicateLibraries', unfiled: 'unfiledLibraries', - retracted: 'retractedLibraries' + retracted: 'retractedLibraries', + publications: 'publications' }; let prefKey = prefKeys[type]; if (!prefKey) { diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index bbe9ae7148..e4e34ed4a5 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -2326,8 +2326,7 @@ var ZoteroPane = new function() var collectionTreeRow = this.getCollectionTreeRow(); // Don't allow deleting libraries or My Publications - if (collectionTreeRow.isLibrary(true) && !collectionTreeRow.isFeed() - || collectionTreeRow.isPublications()) { + if (collectionTreeRow.isLibrary(true) && !collectionTreeRow.isFeed()) { return; } @@ -2346,6 +2345,11 @@ var ZoteroPane = new function() this.setVirtual(collectionTreeRow.ref.libraryID, 'retracted', false); return; } + // Hide "My Publications" + else if (collectionTreeRow.isPublications()) { + this.setVirtual(collectionTreeRow.ref.libraryID, 'publications', false); + return; + } if (!this.canEdit() && !collectionTreeRow.isFeedsOrFeed()) { this.displayCannotEditLibraryMessage(); @@ -3249,6 +3253,12 @@ var ZoteroPane = new function() this.setVirtual(this.getSelectedLibraryID(), 'retracted', true, true); } }, + { + id: "showPublications", + oncommand: () => { + this.setVirtual(this.getSelectedLibraryID(), 'publications', true, true); + } + }, { id: "editSelectedCollection", oncommand: () => this.editSelectedCollection() @@ -3477,9 +3487,9 @@ var ZoteroPane = new function() else if (collectionTreeRow.isHeader()) { } else if (collectionTreeRow.isPublications()) { - show = [ - 'exportFile' - ]; + show = ['exportFile', 'deleteCollection']; + m.deleteCollection.setAttribute('label', Zotero.getString('general.hide')); + useHideOrDelete = "hide"; } // Library else { @@ -3503,7 +3513,10 @@ var ZoteroPane = new function() let retracted = Zotero.Prefs.getVirtualCollectionStateForLibrary( libraryID, 'retracted' ); - if (!duplicates || !unfiled || !retracted) { + let publications = Zotero.Prefs.getVirtualCollectionStateForLibrary( + libraryID, 'publications' + ); + if (!duplicates || !unfiled || !retracted || !publications) { if (!library.archived) { show.push('sep2'); } @@ -3516,6 +3529,9 @@ var ZoteroPane = new function() if (!retracted) { show.push('showRetracted'); } + if (!publications) { + show.push('showPublications'); + } } if (!library.archived) { show.push('sep3'); diff --git a/chrome/content/zotero/zoteroPane.xhtml b/chrome/content/zotero/zoteroPane.xhtml index 4b9ff3e521..5803509197 100644 --- a/chrome/content/zotero/zoteroPane.xhtml +++ b/chrome/content/zotero/zoteroPane.xhtml @@ -915,6 +915,7 @@ +