[VIVO-1670] ORCID - Disable Step 2 and Internationalization (#130)
* Internationalize ORCiD add an iD * ORCID Internationalization, allow Step 2 to be disabled if only a public API key Resolves: https://jira.duraspace.org/browse/VIVO-1670
This commit is contained in:
parent
06d266ea94
commit
d3b377b3a7
6 changed files with 108 additions and 56 deletions
|
@ -13,6 +13,7 @@ import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
import javax.servlet.ServletContextListener;
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vivo.orcid.controller.OrcidAbstractHandler;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -54,6 +55,10 @@ public class OrcidContextSetup implements ServletContextListener {
|
||||||
private void initializeOrcidClientContext(ConfigurationProperties props,
|
private void initializeOrcidClientContext(ConfigurationProperties props,
|
||||||
StartupStatus ss) {
|
StartupStatus ss) {
|
||||||
try {
|
try {
|
||||||
|
if (!"member".equalsIgnoreCase(props.getProperty("orcid.apiLevel", "member"))) {
|
||||||
|
OrcidAbstractHandler.setAPiLevelPublic();
|
||||||
|
}
|
||||||
|
|
||||||
Map<Setting, String> settings = new EnumMap<>(Setting.class);
|
Map<Setting, String> settings = new EnumMap<>(Setting.class);
|
||||||
settings.put(CLIENT_ID, props.getProperty("orcid.clientId"));
|
settings.put(CLIENT_ID, props.getProperty("orcid.clientId"));
|
||||||
settings.put(CLIENT_SECRET,
|
settings.put(CLIENT_SECRET,
|
||||||
|
|
|
@ -45,6 +45,8 @@ public abstract class OrcidAbstractHandler {
|
||||||
protected final OrcidConfirmationState state;
|
protected final OrcidConfirmationState state;
|
||||||
protected final UserAccount currentUser;
|
protected final UserAccount currentUser;
|
||||||
|
|
||||||
|
private static String apiLevel = "member";
|
||||||
|
|
||||||
protected OrcidAbstractHandler(VitroRequest vreq) {
|
protected OrcidAbstractHandler(VitroRequest vreq) {
|
||||||
this.vreq = vreq;
|
this.vreq = vreq;
|
||||||
this.occ = OrcidClientContext.getInstance();
|
this.occ = OrcidClientContext.getInstance();
|
||||||
|
@ -121,7 +123,12 @@ public abstract class OrcidAbstractHandler {
|
||||||
protected ResponseValues showConfirmationPage() {
|
protected ResponseValues showConfirmationPage() {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("orcidInfo", state.toMap());
|
map.put("orcidInfo", state.toMap());
|
||||||
|
map.put("orcidApiLevel", apiLevel);
|
||||||
return new TemplateResponseValues(TEMPLATE_CONFIRM, map);
|
return new TemplateResponseValues(TEMPLATE_CONFIRM, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setAPiLevelPublic() {
|
||||||
|
apiLevel = "public";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,6 +230,13 @@ VitroConnection.DataSource.validationQuery = SELECT 1
|
||||||
# release, sandbox
|
# release, sandbox
|
||||||
# orcid.api = sandbox
|
# orcid.api = sandbox
|
||||||
|
|
||||||
|
# Specify the type of API access that you have - public or member
|
||||||
|
# public - only allows you to confirm ORCID IDs
|
||||||
|
# member - allows VIVO to write a link to the VIVO profile in the ORCID record
|
||||||
|
# If you only have a public API key, ensure that you have entered public here
|
||||||
|
#orcid.apiLevel = public
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# OTHER OPTIONS
|
# OTHER OPTIONS
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -810,6 +810,50 @@ role_in_presentation_capitalized=Role in Presentation
|
||||||
advisee_capitalized_first_name=First Name
|
advisee_capitalized_first_name=First Name
|
||||||
advisee_capitalized_lastname=Last Name
|
advisee_capitalized_lastname=Last Name
|
||||||
|
|
||||||
|
add_orcid_id=Add an iD
|
||||||
|
|
||||||
|
orcid_title_add = Do you want to add an ORCID iD?
|
||||||
|
orcid_step1_add = Step 1: Adding your ORCID iD
|
||||||
|
orcid_title_confirm = Do you want to add an ORCID iD?
|
||||||
|
orcid_step1_confirm = Step 1: Adding your ORCID iD
|
||||||
|
|
||||||
|
orcid_step1_description = <ul><li>VIVO redirects you to ORCID's web site.</li> \
|
||||||
|
<li>You log in to your ORCID account. <ul class="inner"><li>If you don't have an account, you can create one.</li></ul></li> \
|
||||||
|
<li>You tell ORCID that VIVO may read your ORCID record. (one-time permission)</li> \
|
||||||
|
<li>VIVO reads your ORCID record.</li> \
|
||||||
|
<li>VIVO notes that your ORCID iD is confirmed.</li></ul>
|
||||||
|
|
||||||
|
orcid_step1_denied = <p>You denied VIVO's request to read your ORCID record.</p> \
|
||||||
|
<p>Confirmation can't continue.</p>
|
||||||
|
|
||||||
|
orcid_step1_failed = <p>VIVO failed to read your ORCID record.</p> \
|
||||||
|
<p>Confirmation can't continue.</p>
|
||||||
|
|
||||||
|
orcid_step1_confirmed = <p>Your ORCID iD is confirmed as {0}</p>
|
||||||
|
|
||||||
|
orcid_step2_heading = Step 2 (recommended): Linking your ORCID record to VIVO
|
||||||
|
|
||||||
|
orcid_step2_description = <ul><li>VIVO redirects you to ORCID's web site</li> \
|
||||||
|
<li>You tell ORCID that VIVO may add an "external ID" to your ORCID record. (one-time permission)</li> \
|
||||||
|
<li>VIVO adds the external ID.</li></ul>
|
||||||
|
|
||||||
|
orcid_step2_already_present = <p>Your ORCID record already includes a link to VIVO.</p>
|
||||||
|
|
||||||
|
orcid_step2_denied = <p>You denied VIVO's request to add an External ID to your ORCID record.</p> \
|
||||||
|
<p>Linking can't continue.</p>
|
||||||
|
|
||||||
|
orcid_step2_failed = <p>VIVO failed to add an External ID to your ORCID record.</p> \
|
||||||
|
<p>Linking can't continue.</p>
|
||||||
|
|
||||||
|
orcid_step2_added = <p>Your ORCID record is linked to VIVO</p>
|
||||||
|
|
||||||
|
orcid_button_step1 = Continue Step 1
|
||||||
|
orcid_button_step2 = Continue Step 2
|
||||||
|
|
||||||
|
orcid_step_completed = (step completed)
|
||||||
|
orcid_view_orcid_record = View your ORCID record.
|
||||||
|
orcid_return_to_vivo = Return to your VIVO profile page
|
||||||
|
|
||||||
# Messages for creating and linking resources (publications)
|
# Messages for creating and linking resources (publications)
|
||||||
create_and_link_enter=Enter {0}:
|
create_and_link_enter=Enter {0}:
|
||||||
create_and_link_claim_for=Claiming works for<br />{0}
|
create_and_link_claim_for=Claiming works for<br />{0}
|
||||||
|
|
|
@ -65,81 +65,70 @@ span.completed {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<#assign orcidTextOne = "add an" />
|
<#assign orcidTitle = i18n().orcid_title_add />
|
||||||
<#assign orcidTextTwo = "Adding" />
|
<#assign orcidStepHeading = i18n().orcid_step1_add />
|
||||||
<#if (orcidInfo.existingOrcids?size > 0) >
|
<#if (orcidInfo.existingOrcids?size > 0) >
|
||||||
<#assign orcidTextOne = "confirm your" />
|
<#assign orcidTitle = i18n().orcid_title_confirm />
|
||||||
<#assign orcidTextTwo = "Confirming" />
|
<#assign orcidStepHeading = i18n().orcid_step1_confirm />
|
||||||
</#if>
|
</#if>
|
||||||
<#assign step2dimmed = (["START", "FAILED_AUTHENTICATE", "DENIED_AUTHENTICATE"]?seq_contains(orcidInfo.progress))?string("dimmed", "") />
|
<#assign step2dimmed = (["START", "FAILED_AUTHENTICATE", "DENIED_AUTHENTICATE"]?seq_contains(orcidInfo.progress))?string("dimmed", "") />
|
||||||
<#assign continueAppears = (["START", "GOT_PROFILE"]?seq_contains(orcidInfo.progress))/>
|
<#assign continueAppears = (["START"]?seq_contains(orcidInfo.progress))/>
|
||||||
|
<#if orcidApiLevel == "member">
|
||||||
|
<#assign continueAppears = (["START", "GOT_PROFILE"]?seq_contains(orcidInfo.progress))/>
|
||||||
|
</#if>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<section id="orcid-offer" role="region">
|
<section id="orcid-offer" role="region">
|
||||||
<h2>Do you want to ${orcidTextOne} ORCID iD?</h2>
|
<h2>${orcidTitle}</h2>
|
||||||
|
|
||||||
<div class="step">
|
<div class="step">
|
||||||
<#if "START" == orcidInfo.progress>
|
<#if "START" == orcidInfo.progress>
|
||||||
<h2>Step 1: ${orcidTextTwo} your ORCID iD</h2>
|
<h2>${orcidStepHeading}</h2>
|
||||||
<ul>
|
${i18n().orcid_step1_description}
|
||||||
<li>VIVO redirects you to ORCID's web site.</li>
|
|
||||||
<li>You log in to your ORCID account.
|
|
||||||
<ul class="inner"><li>If you don't have an account, you can create one.</li></ul>
|
|
||||||
</li>
|
|
||||||
<li>You tell ORCID that VIVO may read your ORCID record. (one-time permission)</li>
|
|
||||||
<li>VIVO reads your ORCID record.</li>
|
|
||||||
<li>VIVO notes that your ORCID iD is confirmed.</li>
|
|
||||||
</ul>
|
|
||||||
<#elseif "DENIED_AUTHENTICATE" == orcidInfo.progress>
|
<#elseif "DENIED_AUTHENTICATE" == orcidInfo.progress>
|
||||||
<h2>Step 1: ${orcidTextTwo} your ORCID iD</h2>
|
<h2>${orcidStepHeading}</h2>
|
||||||
<p>You denied VIVO's request to read your ORCID record.</p>
|
${i18n().orcid_step1_denied}
|
||||||
<p>Confirmation can't continue.</p>
|
|
||||||
<#elseif "FAILED_AUTHENTICATE" == orcidInfo.progress>
|
<#elseif "FAILED_AUTHENTICATE" == orcidInfo.progress>
|
||||||
<h2>Step 1: ${orcidTextTwo} your ORCID iD</h2>
|
<h2>${orcidStepHeading}</h2>
|
||||||
<p>VIVO failed to read your ORCID record.</p>
|
${i18n().orcid_step1_failed}
|
||||||
<p>Confirmation can't continue.</p>
|
|
||||||
<#else>
|
<#else>
|
||||||
<h2>Step 1: ${orcidTextTwo} your ORCID iD <span class="completed">(step completed)</span></h2>
|
<h2>${orcidStepHeading} <span class="completed">${i18n().orcid_step_completed}</span></h2>
|
||||||
<p>Your ORCID iD is confirmed as ${orcidInfo.orcid}</p>
|
${i18n().orcid_step1_confirmed(orcidInfo.orcid)}
|
||||||
<p><a href="${orcidInfo.orcidUri}" target="_blank">View your ORCID record.</a></p>
|
<p><a href="${orcidInfo.orcidUri}" target="_blank">${i18n().orcid_view_orcid_record}</a></p>
|
||||||
</#if>
|
</#if>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<#if orcidApiLevel == "member">
|
||||||
<div class="step ${step2dimmed}">
|
<div class="step ${step2dimmed}">
|
||||||
<#if "ID_ALREADY_PRESENT" == orcidInfo.progress>
|
<#if "ID_ALREADY_PRESENT" == orcidInfo.progress>
|
||||||
<h2>Step 2 (recommended): Linking your ORCID record to VIVO <span class="completed">(step completed)</span></h2>
|
<h2>${i18n().orcid_step2_heading} <span class="completed">${i18n().orcid_step_completed}</span></h2>
|
||||||
<p>Your ORCID record already includes a link to VIVO.</p>
|
${i18n().orcid_step2_already_present}
|
||||||
<#elseif "DENIED_ID" == orcidInfo.progress>
|
<#elseif "DENIED_ID" == orcidInfo.progress>
|
||||||
<h2>Step 2 (recommended): Linking your ORCID record to VIVO</h2>
|
<h2>${i18n().orcid_step2_heading}</h2>
|
||||||
<p>You denied VIVO's request to add an External ID to your ORCID record.</p>
|
${i18n().orcid_step2_denied}
|
||||||
<p>Linking can't continue.</p>
|
|
||||||
<#elseif "FAILED_ID" == orcidInfo.progress>
|
<#elseif "FAILED_ID" == orcidInfo.progress>
|
||||||
<h2>Step 2 (recommended): Linking your ORCID record to VIVO</h2>
|
<h2>${i18n().orcid_step2_heading}</h2>
|
||||||
<p>VIVO failed to add an External ID to your ORCID record.</p>
|
${i18n().orcid_step2_failed}
|
||||||
<p>Linking can't continue.</p>
|
|
||||||
<#elseif "ADDED_ID" == orcidInfo.progress>
|
<#elseif "ADDED_ID" == orcidInfo.progress>
|
||||||
<h2>Step 2 (recommended): Linking your ORCID record to VIVO <span class="completed">(step completed)</span></h2>
|
<h2>${i18n().orcid_step2_heading} <span class="completed">${i18n().orcid_step_completed}</span></h2>
|
||||||
<p>Your ORCID record is linked to VIVO</p>
|
${i18n().orcid_step2_added}
|
||||||
<p><a href="${orcidInfo.orcidUri}" target="_blank">View your ORCID record.</a></p>
|
<p><a href="${orcidInfo.orcidUri}" target="_blank">${i18n().orcid_view_orcid_record}</a></p>
|
||||||
<#else>
|
<#else>
|
||||||
<h2>Step 2 (recommended): Linking your ORCID record to VIVO</h2>
|
<h2>${i18n().orcid_step2_heading}</h2>
|
||||||
<ul>
|
${i18n().orcid_step2_description}
|
||||||
<li>VIVO redirects you to ORCID's web site</li>
|
|
||||||
<li>You tell ORCID that VIVO may add an "external ID" to your ORCID record. (one-time permission)</li>
|
|
||||||
<li>VIVO adds the external ID.</li>
|
|
||||||
</ul>
|
|
||||||
</#if>
|
</#if>
|
||||||
</div>
|
</div>
|
||||||
|
</#if>
|
||||||
|
|
||||||
<div class=links>
|
<div class=links>
|
||||||
<form method="GET" action="${orcidInfo.progressUrl}">
|
<form method="GET" action="${orcidInfo.progressUrl}">
|
||||||
<p>
|
<p>
|
||||||
<#if continueAppears>
|
<#if continueAppears>
|
||||||
<input type="submit" name="submit" value="Continue <#if "START" == orcidInfo.progress>Step 1<#else>Step 2</#if>" class="submit"/>
|
<input type="submit" name="submit" value="<#if "START" == orcidInfo.progress>${i18n().orcid_button_step1}<#else>${i18n().orcid_button_step1}</#if>" class="submit"/>
|
||||||
or
|
or
|
||||||
</#if>
|
</#if>
|
||||||
<a class="cancel" href="${orcidInfo.profilePage}">Return to your VIVO profile page</a>
|
<a class="cancel" href="${orcidInfo.profilePage}">${i18n().orcid_return_to_vivo}</a>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
|
|
||||||
<#list orcidInfo.orcids?keys as key>
|
<#list orcidInfo.orcids?keys as key>
|
||||||
<#if "no" == orcidInfo.orcids[key]?string("yes","no") >
|
<#if "no" == orcidInfo.orcids[key]?string("yes","no") >
|
||||||
<#assign confirmThis = "Confirm the ID" />
|
<#assign confirmThis = i18n().confirm_orcid_id />
|
||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
|
|
||||||
<#if orcidInfo.authorizedToConfirm>
|
<#if orcidInfo.authorizedToConfirm>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#orcidId a.add-orcidId').replaceWith("<a class='add-orcidId' style='padding-left:20px' href='${orcidInfo.orcidUrl}'><#if orcidInfo.orcids?size == 0>Add an iD<#else>${confirmThis}</#if></a> ");
|
$('#orcidId a.add-orcidId').replaceWith("<a class='add-orcidId' style='padding-left:20px' href='${orcidInfo.orcidUrl}'><#if orcidInfo.orcids?size == 0>${i18n().add_orcid_id}<#else>${confirmThis}</#if></a> ");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
Loading…
Add table
Reference in a new issue