commit 3919594834fde880d7bb95a01b2bb8a78610e6ae
parent 83da98f2088171c5dcacf5ba257c5859cf672097
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 5 Oct 2006 05:56:56 +0000
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).
Diffstat:
4 files changed, 63 insertions(+), 21 deletions(-)
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
@@ -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);
+ }
+
+ // 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);
}
- 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));
+ 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
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
@@ -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);"/>
diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd
@@ -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">
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
@@ -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