commit 4966a55a1b1fa3cee58c506475ba9932989ea8f4
parent d63d24c636f87c0de0dfa0069898c6c77e9374a8
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 11 Jan 2012 18:23:36 -0500
Disable "New Saved Search" menu option in read-only libraries
Diffstat:
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -1063,10 +1063,17 @@ var ZoteroPane = new function()
itemgroup.setSearch('');
itemgroup.setTags(getTagSelection());
- // Enable or disable toolbar icons as necessary
- const disableIfNoEdit = ["cmd_zotero_newCollection", "zotero-tb-add",
- "cmd_zotero_newItemFromCurrentPage", "zotero-tb-lookup", "cmd_zotero_newStandaloneNote",
- "zotero-tb-note-add", "zotero-tb-attachment-add"];
+ // Enable or disable toolbar icons and menu options as necessary
+ const disableIfNoEdit = [
+ "cmd_zotero_newCollection",
+ "cmd_zotero_newSavedSearch",
+ "zotero-tb-add",
+ "cmd_zotero_newItemFromCurrentPage",
+ "zotero-tb-lookup",
+ "cmd_zotero_newStandaloneNote",
+ "zotero-tb-note-add",
+ "zotero-tb-attachment-add"
+ ];
for(var i=0; i<disableIfNoEdit.length; i++) {
var el = document.getElementById(disableIfNoEdit[i]);
if(itemgroup.editable) {
@@ -2123,7 +2130,9 @@ var ZoteroPane = new function()
}
// Disable some actions if user doesn't have write access
- var s = [m.editSelectedCollection, m.removeCollection, m.newCollection, m.newSavedSearch, m.newSubcollection];
+ //
+ // Some actions are disabled via their commands in onCollectionSelected()
+ var s = [m.newSubcollection, m.editSelectedCollection, m.removeCollection, m.emptyTrash];
if (itemGroup.isWithinGroup() && !itemGroup.editable && !itemGroup.isDuplicates() && !itemGroup.isUnfiled()) {
disable = disable.concat(s);
}
diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul
@@ -236,6 +236,7 @@
<popupset>
<menupopup id="zotero-collectionmenu" onpopupshowing="ZoteroPane_Local.buildCollectionContextMenu();">
+ <!-- Keep order in sync with buildCollectionContextMenu -->
<menuitem label="&zotero.toolbar.newCollection.label;" command="cmd_zotero_newCollection"/>
<menuitem label="&zotero.toolbar.newSavedSearch.label;" command="cmd_zotero_newSavedSearch"/>
<menuitem label="&zotero.toolbar.newSubcollection.label;" oncommand="ZoteroPane_Local.newCollection(ZoteroPane_Local.getSelectedCollection().id)"/>
@@ -254,6 +255,7 @@
<menuitem label="Refresh" oncommand="ZoteroPane_Local.refreshCommonsBucket();"/><!--TODO localize -->
</menupopup>
<menupopup id="zotero-itemmenu" onpopupshowing="ZoteroPane_Local.buildItemContextMenu();">
+ <!-- Keep order in sync with buildItemContextMenu -->
<menuitem label="&zotero.items.menu.showInLibrary;" oncommand="ZoteroPane_Local.selectItem(this.parentNode.getAttribute('itemID'), true)"/>
<menuseparator/>
<!-- with icon: <menuitem class="menuitem-iconic" id="zotero-menuitem-note" label="&zotero.items.menu.attach.note;" oncommand="ZoteroPane_Local.newNote(false, this.parentNode.getAttribute('itemID'))"/>-->