New options in context menu of regular items in the item list:

Attach Snapshot of Current Page
Attach Link to Current Page

I also removed "New Item" from the context menu, as it was the only option in the menu that wasn't specific to the selected item, it made the whole menu a lot more confusing, and it doesn't take all that much longer to click the (+) button and choose Book (assuming that's even the item you want).
This commit is contained in:
Dan Stillman 2006-10-05 05:56:56 +00:00
parent 83da98f208
commit 3919594834
4 changed files with 63 additions and 21 deletions

View file

@ -628,36 +628,74 @@ var ZoteroPane = new function()
{
var menu = document.getElementById('zotero-itemmenu');
var enable = [], disable = [], show = [], hide = [], multiple = '';
if(itemsView && itemsView.selection.count > 0)
{
menu.childNodes[2].removeAttribute('disabled');
menu.childNodes[3].removeAttribute('disabled');
menu.childNodes[5].removeAttribute('disabled');
menu.childNodes[6].removeAttribute('disabled');
enable.push(3,4,5,7);
// Multiple items selected
if (itemsView.selection.count > 1)
{
var multiple = '.multiple';
}
// Single item selected
else
{
var item = itemsView._getItemAtRow(itemsView.selection.currentIndex);
if (item.ref.isRegularItem())
{
var itemID = item.ref.getID();
menu.setAttribute('itemID', itemID);
show.push(0,1,2);
}
else
{
hide.push(0,1,2);
}
}
}
else
{
menu.childNodes[2].setAttribute('disabled', true);
menu.childNodes[3].setAttribute('disabled', true);
menu.childNodes[5].setAttribute('disabled', true);
menu.childNodes[6].setAttribute('disabled', true);
disable.push(3,4,6,7);
}
var multiple = (itemsView && itemsView.selection.count > 1) ? '.multiple' : '';
// Remove from collection
if (itemsView._itemGroup.isCollection())
{
menu.childNodes[2].setAttribute('label', Zotero.getString('pane.items.menu.remove' + multiple));
menu.childNodes[2].setAttribute('hidden', false);
menu.childNodes[3].setAttribute('label', Zotero.getString('pane.items.menu.remove' + multiple));
show.push(3);
}
else
{
menu.childNodes[2].setAttribute('hidden', true);
hide.push(3);
}
menu.childNodes[3].setAttribute('label', Zotero.getString('pane.items.menu.erase' + multiple));
menu.childNodes[5].setAttribute('label', Zotero.getString('pane.items.menu.export' + multiple));
menu.childNodes[6].setAttribute('label', Zotero.getString('pane.items.menu.createBib' + multiple));
// Plural if necessary
menu.childNodes[4].setAttribute('label', Zotero.getString('pane.items.menu.erase' + multiple));
menu.childNodes[6].setAttribute('label', Zotero.getString('pane.items.menu.export' + multiple));
menu.childNodes[7].setAttribute('label', Zotero.getString('pane.items.menu.createBib' + multiple));
for (var i in disable)
{
menu.childNodes[disable[i]].setAttribute('disabled', true);
}
for (var i in enable)
{
menu.childNodes[enable[i]].setAttribute('disabled', false);
}
for (var i in hide)
{
menu.childNodes[hide[i]].setAttribute('hidden', true);
}
for (var i in show)
{
menu.childNodes[show[i]].setAttribute('hidden', false);
}
}
// Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9

View file

@ -65,7 +65,8 @@
<menuitem label="&toolbar.export.label;" oncommand="Zotero_File_Interface.exportFile()"/>
</popup>
<popup id="zotero-itemmenu" onpopupshowing="ZoteroPane.buildItemContextMenu();">
<menuitem label="&toolbar.newItem.label;" command="cmd_zotero_newItem"/>
<menuitem label="&items.menu.attach.snapshot;" oncommand="ZoteroPane.addAttachmentFromPage(false, this.parentNode.getAttribute('itemID'));"/>
<menuitem label="&items.menu.attach.link;" oncommand="ZoteroPane.addAttachmentFromPage(true, this.parentNode.getAttribute('itemID'));"/>
<menuseparator/>
<menuitem oncommand="ZoteroPane.deleteSelectedItem();"/>
<menuitem oncommand="ZoteroPane.deleteSelectedItem(true);"/>

View file

@ -16,6 +16,9 @@
<!ENTITY items.dateAdded_column "Date Added">
<!ENTITY items.dateModified_column "Date Modified">
<!ENTITY items.menu.attach.snapshot "Attach Snapshot of Current Page">
<!ENTITY items.menu.attach.link "Attach Link to Current Page">
<!ENTITY collections.name_column "Collections">
<!ENTITY toolbar.newItem.label "New Item">

View file

@ -11,12 +11,12 @@ pane.items.delete.title = Delete
pane.items.delete.attached = Erase attached notes and files
pane.items.menu.remove = Remove Selected Item
pane.items.menu.remove.multiple = Remove Selected Items
pane.items.menu.erase = Delete Selected Item From Library...
pane.items.menu.erase.multiple = Delete Selected Items From Library...
pane.items.menu.erase = Delete Selected Item from Library...
pane.items.menu.erase.multiple = Delete Selected Items from Library...
pane.items.menu.export = Export Selected Item...
pane.items.menu.export.multiple = Export Selected Items...
pane.items.menu.createBib = Create Bibliography From Selected Item...
pane.items.menu.createBib.multiple = Create Bibliography From Selected Items...
pane.items.menu.createBib = Create Bibliography from Selected Item...
pane.items.menu.createBib.multiple = Create Bibliography from Selected Items...
pane.item.selected.zero = No items selected
pane.item.selected.multiple = %1 items selected