Disable "New Saved Search" menu option in read-only libraries

This commit is contained in:
Dan Stillman 2012-01-11 18:23:36 -05:00
parent d63d24c636
commit 4966a55a1b
2 changed files with 16 additions and 5 deletions

View file

@ -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);
}

View file

@ -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'))"/>-->