Allow hiding of retraction warning for replaced works

This is unfortunate, but some journals are abusing (what should be)
unique identifiers.

https://forums.zotero.org/discussion/comment/335113/#Comment_335113
This commit is contained in:
Dan Stillman 2019-07-04 07:11:53 -04:00
parent 2186e939a9
commit eedc066d41
4 changed files with 65 additions and 2 deletions

View file

@ -2387,8 +2387,12 @@
return (async function () {
var htmlNS = 'http://www.w3.org/1999/xhtml';
var data = await Zotero.Retractions.getData(this.item);
if (!data) {
var show = Zotero.Retractions.isRetracted(this.item);
var data;
if (show) {
data = await Zotero.Retractions.getData(this.item);
}
if (!show || !data) {
this._id('retraction-box').hidden = true;
return;
}
@ -2410,6 +2414,7 @@
}
// Reasons
var allowHiding = false;
if (data.reasons.length) {
let elem = this._id('retraction-reasons');
elem.hidden = false;
@ -2423,6 +2428,10 @@
elem.appendChild(dt);
elem.appendChild(dd);
if (reason == 'Retract and Replace') {
allowHiding = true;
}
}
}
else {
@ -2494,6 +2503,13 @@
}
}
let hideElem = this._id('retraction-hide');
hideElem.firstChild.textContent = Zotero.getString('retraction.replacedItem.hide');
hideElem.hidden = !allowHiding;
hideElem.firstChild.onclick = (event) => {
ZoteroPane.promptToHideRetractionForReplacedItem(this.item);
};
Zotero.Utilities.Internal.updateHTMLInXUL(this._id('retraction-box'));
}.bind(this))();
]]></body>
@ -2626,6 +2642,7 @@
<div id="retraction-links"/>
<p id="retraction-credit"/>
<div id="retraction-hide"><button/></div>
</div>
</div>
<grid flex="1">

View file

@ -4823,6 +4823,30 @@ var ZoteroPane = new function()
};
this.promptToHideRetractionForReplacedItem = function (item) {
var ps = Services.prompt;
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL;
let index = ps.confirmEx(
null,
Zotero.getString('retraction.replacedItem.title'),
Zotero.getString('retraction.replacedItem.text1')
+ "\n\n"
+ Zotero.getString('retraction.replacedItem.text2'),
buttonFlags,
Zotero.getString('retraction.replacedItem.button'),
null,
null,
null,
{}
);
if (index == 0) {
Zotero.Retractions.hideRetraction(item);
this.hideRetractionBanner();
}
};
/**
* Sets the layout to either a three-vertical-pane layout and a layout where itemsPane is above itemPane
*/

View file

@ -1209,6 +1209,11 @@ retraction.date = Retracted on %S
retraction.notice = Retraction Notice
retraction.details = More details:
retraction.credit = Data from %S
retraction.replacedItem.hide = Hide warning for replaced work…
retraction.replacedItem.title = Retracted and Replaced Work
retraction.replacedItem.text1 = This work has been retracted and replaced by its publisher, and this item may not represent the final version.
retraction.replacedItem.text2 = Unfortunately, some publishers incorrectly reuse the original DOI and/or PMID when replacing a work. If youve checked that this is the latest version, you can permanently hide the retraction warning for this item.
retraction.replacedItem.button = Hide Retraction Warning
retraction.citeWarning.text1 = The item you are citing has been retracted. Do you still want to add it to your document?
retraction.citeWarning.text2 = You can view the item in your library for further details on the retraction.
retraction.citationWarning = A citation in your document has been retracted:

View file

@ -97,6 +97,23 @@
margin-bottom: .2em;
}
#retraction-hide {
text-align: right;
margin-top: .3em;
margin-right: -1.2em;
margin-bottom: .3em;
}
#retraction-hide button {
background: none;
margin: 0;
padding: 0;
cursor: pointer;
display: inline;
text-decoration: underline;
border-style: none;
}
/* Buttons in trash and feed views */
.zotero-item-pane-top-buttons {
-moz-appearance: toolbar;