- remove attachment go buttons
- tweaks to locate menu behavior for attachments
This commit is contained in:
parent
7d0e31bc95
commit
701845fa0a
|
@ -42,7 +42,6 @@
|
||||||
Public properties
|
Public properties
|
||||||
-->
|
-->
|
||||||
<field name="editable">false</field>
|
<field name="editable">false</field>
|
||||||
<field name="displayGoButtons">false</field>
|
|
||||||
<field name="clickableLink">false</field>
|
<field name="clickableLink">false</field>
|
||||||
<field name="displayButton">false</field>
|
<field name="displayButton">false</field>
|
||||||
<field name="displayNote">false</field>
|
<field name="displayNote">false</field>
|
||||||
|
@ -58,7 +57,6 @@
|
||||||
Zotero.debug("Setting mode to '" + val + "'");
|
Zotero.debug("Setting mode to '" + val + "'");
|
||||||
|
|
||||||
this.editable = false;
|
this.editable = false;
|
||||||
this.displayGoButtons = false;
|
|
||||||
this.displayURL = false;
|
this.displayURL = false;
|
||||||
this.displayFileName = false;
|
this.displayFileName = false;
|
||||||
this.clickableLink = false;
|
this.clickableLink = false;
|
||||||
|
@ -71,7 +69,6 @@
|
||||||
|
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 'view':
|
case 'view':
|
||||||
this.displayGoButtons = true;
|
|
||||||
this.displayURL = true;
|
this.displayURL = true;
|
||||||
this.displayFileName = true;
|
this.displayFileName = true;
|
||||||
this.clickableLink = true;
|
this.clickableLink = true;
|
||||||
|
@ -84,7 +81,6 @@
|
||||||
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
this.editable = true;
|
this.editable = true;
|
||||||
this.displayGoButtons = true;
|
|
||||||
this.displayURL = true;
|
this.displayURL = true;
|
||||||
this.displayFileName = true;
|
this.displayFileName = true;
|
||||||
this.clickableLink = true;
|
this.clickableLink = true;
|
||||||
|
@ -148,9 +144,6 @@
|
||||||
|
|
||||||
var attachmentBox = document.getAnonymousNodes(this)[0];
|
var attachmentBox = document.getAnonymousNodes(this)[0];
|
||||||
var title = this._id('title');
|
var title = this._id('title');
|
||||||
var goButtons = this._id('go-buttons');
|
|
||||||
var viewButton = this._id('view');
|
|
||||||
var showButton = this._id('show');
|
|
||||||
var fileNameRow = this._id('fileNameRow');
|
var fileNameRow = this._id('fileNameRow');
|
||||||
var urlField = this._id('url');
|
var urlField = this._id('url');
|
||||||
var accessed = this._id('accessedRow');
|
var accessed = this._id('accessedRow');
|
||||||
|
@ -188,14 +181,6 @@
|
||||||
title.addEventListener('click', this.editTitle, false);
|
title.addEventListener('click', this.editTitle, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// View and Show buttons
|
|
||||||
if (this.displayGoButtons) {
|
|
||||||
goButtons.hidden = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
goButtons.hidden = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var isImportedURL = this.item.attachmentLinkMode ==
|
var isImportedURL = this.item.attachmentLinkMode ==
|
||||||
Zotero.Attachments.LINK_MODE_IMPORTED_URL;
|
Zotero.Attachments.LINK_MODE_IMPORTED_URL;
|
||||||
|
|
||||||
|
@ -210,8 +195,6 @@
|
||||||
var str = Zotero.getString('pane.item.attachments.view.link');
|
var str = Zotero.getString('pane.item.attachments.view.link');
|
||||||
}
|
}
|
||||||
|
|
||||||
showButton.hidden = !isImportedURL;
|
|
||||||
|
|
||||||
// URL
|
// URL
|
||||||
if (this.displayURL) {
|
if (this.displayURL) {
|
||||||
var urlSpec = this.item.getField('url');
|
var urlSpec = this.item.getField('url');
|
||||||
|
@ -247,7 +230,6 @@
|
||||||
// Metadata for files
|
// Metadata for files
|
||||||
else {
|
else {
|
||||||
var str = Zotero.getString('pane.item.attachments.view.file');
|
var str = Zotero.getString('pane.item.attachments.view.file');
|
||||||
showButton.hidden = false;
|
|
||||||
urlField.hidden = true;
|
urlField.hidden = true;
|
||||||
accessed.hidden = true;
|
accessed.hidden = true;
|
||||||
}
|
}
|
||||||
|
@ -271,9 +253,6 @@
|
||||||
else {
|
else {
|
||||||
fileNameRow.hidden = true;
|
fileNameRow.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
viewButton.setAttribute('label', str);
|
|
||||||
|
|
||||||
// Page count
|
// Page count
|
||||||
if (this.displayPages) {
|
if (this.displayPages) {
|
||||||
|
@ -531,10 +510,6 @@
|
||||||
<vbox id="attachment-box" flex="1" orient="vertical"
|
<vbox id="attachment-box" flex="1" orient="vertical"
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
<label id="title"/>
|
<label id="title"/>
|
||||||
<hbox id="go-buttons">
|
|
||||||
<button id="view" flex="1" oncommand="document.getBindingParent(this).onViewClick(event)"/>
|
|
||||||
<button id="show" label="&zotero.item.attachment.file.show;" flex="1" oncommand="document.getBindingParent(this).onShowClick(event)"/>
|
|
||||||
</hbox>
|
|
||||||
<label id="url" crop="end"
|
<label id="url" crop="end"
|
||||||
ondragstart="var dt = event.dataTransfer; dt.setData('text/x-moz-url', this.value); dt.setData('text/uri-list', this.value); dt.setData('text/plain', this.value);"/>
|
ondragstart="var dt = event.dataTransfer; dt.setData('text/x-moz-url', this.value); dt.setData('text/uri-list', this.value); dt.setData('text/plain', this.value);"/>
|
||||||
<grid>
|
<grid>
|
||||||
|
|
|
@ -164,11 +164,14 @@ var Zotero_LocateMenu = new function() {
|
||||||
menuitem.addEventListener("command", this.openItemURL, false);
|
menuitem.addEventListener("command", this.openItemURL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add library lookup to any item
|
// add library lookup to regular items
|
||||||
var menuitem = _createMenuItem(Zotero.getString("locate.libraryLookup.label"),
|
var regularItems = [item for each(item in selectedItems) if(item.isRegularItem())];
|
||||||
"zotero-locate-service-openurl", Zotero.getString("locate.libraryLookup.tooltip"));
|
if(regularItems.length) {
|
||||||
locateMenu.appendChild(menuitem);
|
var menuitem = _createMenuItem(Zotero.getString("locate.libraryLookup.label"),
|
||||||
menuitem.addEventListener("command", this.lookupItem, false);
|
"zotero-locate-service-openurl", Zotero.getString("locate.libraryLookup.tooltip"));
|
||||||
|
locateMenu.appendChild(menuitem);
|
||||||
|
menuitem.addEventListener("command", this.lookupItem, false);
|
||||||
|
}
|
||||||
|
|
||||||
// add wayback if there are real URLs
|
// add wayback if there are real URLs
|
||||||
if(realURLs.length) {
|
if(realURLs.length) {
|
||||||
|
@ -259,6 +262,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
this.lookupItem = function(event) {
|
this.lookupItem = function(event) {
|
||||||
var urls = [];
|
var urls = [];
|
||||||
for each(var item in ZoteroPane.getSelectedItems()) {
|
for each(var item in ZoteroPane.getSelectedItems()) {
|
||||||
|
if(!item.isRegularItem()) continue;
|
||||||
var url = Zotero.OpenURL.resolve(item);
|
var url = Zotero.OpenURL.resolve(item);
|
||||||
if(url) urls.push(url);
|
if(url) urls.push(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,8 @@ Zotero.LocateManager = new function() {
|
||||||
return [encodeURIComponent(val) for each(val in itemOpenURL[OPENURL_CONTEXT_MAPPINGS[param]])];
|
return [encodeURIComponent(val) for each(val in itemOpenURL[OPENURL_CONTEXT_MAPPINGS[param]])];
|
||||||
} else if(ns === "http://www.zotero.org/namespaces/openSearch#") {
|
} else if(ns === "http://www.zotero.org/namespaces/openSearch#") {
|
||||||
if(param === "openURL") {
|
if(param === "openURL") {
|
||||||
return [Zotero.OpenURL.createContextObject(item, "1.0")];
|
var ctx = Zotero.OpenURL.createContextObject(item, "1.0");
|
||||||
|
return (ctx ? [ctx] : false);
|
||||||
} else if(param === "year") {
|
} else if(param === "year") {
|
||||||
return (itemOpenURL["rft.date"] ? [itemOpenURL["rft.date"][0].substr(0, 4)] : false);
|
return (itemOpenURL["rft.date"] ? [itemOpenURL["rft.date"][0].substr(0, 4)] : false);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user