Addresses #1805, Add "Create Item from Current Page" contextual menu item and/or browser button

Adds "Create New Item from Current Page" context menu option. We can add a toolbar button too if we can come up with an icon for it.
This commit is contained in:
Simon Kornblith 2011-07-12 01:38:17 +00:00
parent ffd671ce7b
commit ec6f894e1a
2 changed files with 5 additions and 7 deletions

View file

@ -2677,7 +2677,6 @@ var ZoteroPane = new function()
}
var menuitem = document.getElementById("zotero-context-add-to-current-note");
var showing = false;
if (menuitem){
var items = ZoteroPane_Local.getSelectedItems();
if (ZoteroPane_Local.itemsView.selection && ZoteroPane_Local.itemsView.selection.count==1
@ -2685,7 +2684,6 @@ var ZoteroPane = new function()
&& window.gContextMenu.isTextSelected)
{
menuitem.hidden = false;
showing = true;
}
else
{
@ -2698,7 +2696,6 @@ var ZoteroPane = new function()
if (window.gContextMenu.isTextSelected)
{
menuitem.hidden = false;
showing = true;
}
else
{
@ -2710,7 +2707,6 @@ var ZoteroPane = new function()
if (menuitem) {
if (window.gContextMenu.onLink) {
menuitem.hidden = false;
showing = true;
}
else {
menuitem.hidden = true;
@ -2723,7 +2719,6 @@ var ZoteroPane = new function()
// they can use the Firefox option to view and then import from there
if (window.gContextMenu.onImage) {
menuitem.hidden = false;
showing = true;
}
else {
menuitem.hidden = true;
@ -2732,7 +2727,6 @@ var ZoteroPane = new function()
// If Zotero is locked or library is read-only, disable menu items
var menu = document.getElementById('zotero-content-area-context-menu');
menu.hidden = !showing;
var disabled = Zotero.locked;
if (!disabled && self.collectionsView.selection && self.collectionsView.selection.count) {
var itemGroup = self.collectionsView._getItemAtRow(self.collectionsView.selection.currentIndex);

View file

@ -58,11 +58,15 @@
<command id="cmd_zotero_newCollection" oncommand="ZoteroPane_Local.newCollection()"/>
<command id="cmd_zotero_newSavedSearch" oncommand="ZoteroPane_Local.newSearch()"/>
<command id="cmd_zotero_newStandaloneNote" oncommand="ZoteroPane_Local.newNote(event.shiftKey);"/>
<command id="cmd_zotero_newItemFromCurrentPage" oncommand="ZoteroPane_Local.addItemFromPage('temporaryPDFHack', event.shiftKey ? !Zotero.Prefs.get('automaticSnapshots') : null)"/>
</commandset>
<popup id="contentAreaContextMenu">
<menu id="zotero-content-area-context-menu" label="Zotero">
<menupopup>
<menuitem id="zotero-context-item-from-page" class="menu-iconic"
label="&zotero.toolbar.newItemFromPage.label;"
command="cmd_zotero_newItemFromCurrentPage"/>
<menuitem id="zotero-context-add-to-current-note" class="menu-iconic"
label="&zotero.contextMenu.addTextToCurrentNote;" hidden="true"
oncommand="var str = event.currentTarget.ownerDocument.popupNode.ownerDocument.defaultView.getSelection().toString(); var uri = event.currentTarget.ownerDocument.popupNode.ownerDocument.location.href; ZoteroPane_Local.addTextToNote(str, uri)"/>
@ -135,7 +139,7 @@
</menu>
</menupopup>
</toolbarbutton>
<toolbarbutton id="zotero-tb-item-from-page" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newItemFromPage.label;" oncommand="ZoteroPane_Local.addItemFromPage('temporaryPDFHack', event.shiftKey ? !Zotero.Prefs.get('automaticSnapshots') : null)"/>
<toolbarbutton id="zotero-tb-item-from-page" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newItemFromPage.label;" command="cmd_zotero_newItemFromCurrentPage"/>
<toolbarbutton id="zotero-tb-lookup" class="zotero-tb-button" tooltiptext="&zotero.toolbar.lookup.label;" oncommand="ZoteroPane_Local.openLookupWindow()"/>
<!--<toolbarbutton id="zotero-tb-note-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.note.standalone;" oncommand="ZoteroPane_Local.newNote(event.shiftKey);"/>-->
<toolbarbutton id="zotero-tb-note-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newNote;" type="menu">