Add "Show Item in Library" button to retracted citation warning
This commit is contained in:
parent
368b057104
commit
cf8d383027
2 changed files with 39 additions and 8 deletions
|
@ -607,7 +607,8 @@ var Zotero_Citation_Dialog = new function () {
|
|||
if (Zotero.Retractions.isRetracted({id: parseInt(item.id)})) {
|
||||
var ps = Services.prompt;
|
||||
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
|
||||
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL
|
||||
+ ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING;
|
||||
var result = ps.confirmEx(null,
|
||||
Zotero.getString('general.warning'),
|
||||
Zotero.getString('retraction.citeWarning.text1') + '\n\n'
|
||||
|
@ -615,8 +616,12 @@ var Zotero_Citation_Dialog = new function () {
|
|||
buttonFlags,
|
||||
Zotero.getString('general.continue'),
|
||||
null,
|
||||
null, null, {});
|
||||
if (result != 0) {
|
||||
Zotero.getString('pane.items.showItemInLibrary'),
|
||||
null, {});
|
||||
if (result > 0) {
|
||||
if (result == 2) {
|
||||
_showItemInLibrary(parseInt(item.id));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -824,4 +829,25 @@ var Zotero_Citation_Dialog = new function () {
|
|||
function _clearCitationList() {
|
||||
while(_citationList.firstChild) _citationList.removeChild(_citationList.firstChild);
|
||||
}
|
||||
|
||||
async function _showItemInLibrary(id) {
|
||||
var pane = Zotero.getActiveZoteroPane();
|
||||
// Open main window if it's not open (Mac)
|
||||
if (!pane) {
|
||||
let win = Zotero.openMainWindow();
|
||||
await new Zotero.Promise((resolve) => {
|
||||
let onOpen = function () {
|
||||
win.removeEventListener('load', onOpen);
|
||||
resolve();
|
||||
};
|
||||
win.addEventListener('load', onOpen);
|
||||
});
|
||||
pane = win.ZoteroPane;
|
||||
}
|
||||
pane.show();
|
||||
pane.selectItem(id);
|
||||
|
||||
// Pull window to foreground
|
||||
Zotero.Utilities.Internal.activate(pane.document.defaultView);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -725,7 +725,8 @@ var Zotero_QuickFormat = new function () {
|
|||
referencePanel.hidden = true;
|
||||
var ps = Services.prompt;
|
||||
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
|
||||
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL
|
||||
+ ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING;
|
||||
var result = ps.confirmEx(null,
|
||||
Zotero.getString('general.warning'),
|
||||
Zotero.getString('retraction.citeWarning.text1') + '\n\n'
|
||||
|
@ -733,9 +734,13 @@ var Zotero_QuickFormat = new function () {
|
|||
buttonFlags,
|
||||
Zotero.getString('general.continue'),
|
||||
null,
|
||||
null, null, {});
|
||||
Zotero.getString('pane.items.showItemInLibrary'),
|
||||
null, {});
|
||||
referencePanel.hidden = false;
|
||||
if (result != 0) {
|
||||
if (result > 0) {
|
||||
if (result == 2) {
|
||||
Zotero_QuickFormat.showInLibrary(parseInt(citationItem.id));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1333,8 +1338,8 @@ var Zotero_QuickFormat = new function () {
|
|||
/**
|
||||
* Show an item in the library it came from
|
||||
*/
|
||||
this.showInLibrary = async function() {
|
||||
var id = panelRefersToBubble.citationItem.id;
|
||||
this.showInLibrary = async function (itemID) {
|
||||
var id = itemID || parseInt(panelRefersToBubble.citationItem.id);
|
||||
var pane = Zotero.getActiveZoteroPane();
|
||||
// Open main window if it's not open (Mac)
|
||||
if (!pane) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue