VIVO-769 Merge branch 'feature/orcid' into develop

This commit is contained in:
j2blake 2014-05-07 17:32:38 -04:00
parent 73fbe66534
commit 939950dcd4
25 changed files with 1551 additions and 1 deletions

View file

@ -85,5 +85,7 @@ org.apache.commons.fileupload.servlet.FileCleanerCleanup
# and the PermissionRegistry must already be set up.
edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache$Setup
edu.cornell.mannlib.vivo.orcid.OrcidContextSetup
# This should be near the end, because it will issue a warning if the connection to Solr times out.
edu.cornell.mannlib.vitro.webapp.servlet.setup.SolrSmokeTest

View file

@ -1400,7 +1400,15 @@
<url-pattern>/searchService/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>OrcidIntegrationController</servlet-name>
<servlet-class>edu.cornell.mannlib.vivo.orcid.controller.OrcidIntegrationController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>OrcidIntegrationController</servlet-name>
<url-pattern>/orcid/*</url-pattern>
</servlet-mapping>
<!-- ==================== tag libraries ============================== -->
<jsp-config>
<taglib>

View file

@ -0,0 +1,148 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
The body map contains the orcidInfo structure, which is set up like this:
orcidInfo
progress - a string set to one of these values: START, DENIED_AUTHENTICATE,
FAILED_AUTHENTICATE, GOT_PROFILE, ID_ALREADY_PRESENT, DENIED_ID,
FAILED_ID, ADDED_ID
individualUri - the URI of the person
profilePage - the URL of the individual's profile page
orcid - the confirmed ORCID (just xxxx-xxxx-xxxx-xxxx),
or the empty string.
orcidUri - the confirmed ORCID (full URI), or the empty string.
externalIds - empty if we haven't read their profile. Otherwise, a sequence
of maps, one for each external ID in their profile. These
might include SCOPUS ID, etc. Each map looks like this:
commonName - e.g., "VIVO Cornell"
reference - e.g., their VIVO localname
uri - e.g., their VIVO URI
hasVivoId - true, if we have read the profile and they already have
their VIVO URI as an external ID. False otherwise.
existingOrcids - A sequence of the ORCIDs (full URI) that we already associate
with this individual.
progressUrl - The URL to go to, that will continue this process. If the
process is complete or has failed, this is empty.
-->
<style TYPE="text/css">
#orcid-offer .step {
background-color: #F7F7F4;
border: 1px solid #cdcdcd;
border-radius: 10px;
padding: 0 1em 1em;
margin: 12px
}
#orcid-offer .links {
text-align: left;
margin-left: 12px;
}
#orcid-offer ul {
list-style: disc inside;
line-height: 28px;
}
#orcid-offer ul.inner {
list-style: none;
padding-left: 8px;
}
#orcid-offer li {
padding-left: 10px;
}
#orcid-offer .dimmed {
opacity:0.35;
filter:alpha(opacity=35);
}
span.completed {
color: #9a9a9a;
font-size: .8em;
}
</style>
<#assign orcidTextOne = "add an" />
<#assign orcidTextTwo = "Adding" />
<#if (orcidInfo.existingOrcids?size > 0) >
<#assign orcidTextOne = "confirm your" />
<#assign orcidTextTwo = "Confirming" />
</#if>
<#assign step2dimmed = (["START", "FAILED_AUTHENTICATE", "DENIED_AUTHENTICATE"]?seq_contains(orcidInfo.progress))?string("dimmed", "") />
<#assign continueAppears = (["START", "GOT_PROFILE"]?seq_contains(orcidInfo.progress))/>
<div>
<section id="orcid-offer" role="region">
<h2>Do you want to ${orcidTextOne} ORCID Identification?</h2>
<div class="step">
<#if "START" == orcidInfo.progress>
<h2>Step 1: ${orcidTextTwo} your ORCID ID</h2>
<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>
<#elseif "DENIED_AUTHENTICATE" == orcidInfo.progress>
<h2>Step 1: ${orcidTextTwo} your ORCID ID</h2>
<p>You denied VIVO's request to read your ORCID profile.</p>
<p>Confirmation can't continue.</p>
<#elseif "FAILED_AUTHENTICATE" == orcidInfo.progress>
<h2>Step 1: ${orcidTextTwo} your ORCID ID</h2>
<p>VIVO failed to read your ORCID profile.</p>
<p>Confirmation can't continue.</p>
<#else>
<h2>Step 1: ${orcidTextTwo} your ORCID ID <span class="completed">(step completed)</span></h2>
<p>Your ORCID ID is confirmed as ${orcidInfo.orcid}</p>
<p><a href="${orcidInfo.orcidUri}" target="_blank">View your ORCID profile page.</a></p>
</#if>
</div>
<div class="step ${step2dimmed}">
<#if "ID_ALREADY_PRESENT" == orcidInfo.progress>
<h2>Step 2 (recommended): Linking your ORCID Record to VIVO <span class="completed">(step completed)</span></h2>
<p>Your ORCID profile already includes a link to VIVO.</p>
<#elseif "DENIED_ID" == orcidInfo.progress>
<h2>Step 2 (recommended): Linking your ORCID Record to VIVO</h2>
<p>You denied VIVO's request to add an External ID to your ORCID profile.</p>
<p>Linking can't continue.</p>
<#elseif "FAILED_ID" == orcidInfo.progress>
<h2>Step 2 (recommended): Linking your ORCID Record to VIVO</h2>
<p>VIVO failed to add an External ID to your ORCID profile.</p>
<p>Linking can't continue.</p>
<#elseif "ADDED_ID" == orcidInfo.progress>
<h2>Step 2 (recommended): Linking your ORCID Record to VIVO <span class="completed">(step completed)</span></h2>
<p>Your ORCID profile is linked to VIVO</p>
<p><a href="${orcidInfo.orcidUri}" target="_blank">View your ORCID profile page.</a></p>
<#else>
<h2>Step 2 (recommended): Linking your ORCID Record to VIVO</h2>
<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>
</#if>
</div>
<div class=links>
<form method="GET" action="${orcidInfo.progressUrl}">
<p>
<#if continueAppears>
<input type="submit" name="submit" value="Continue <#if "START" == orcidInfo.progress>Step 1<#else>Step 2</#if>" class="submit"/>
or
</#if>
<a class="cancel" href="${orcidInfo.profilePage}">Return to your VIVO profile page</a>
</p>
</form>
</div>
</section>
</div>

View file

@ -0,0 +1,34 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
If authorized to confirm ORCID IDs, add the function that will replace the add link.
The OrcidIdDataGetter is attached to this template; it sets the orcidInfo structure,
which looks like this:
orcidInfo = map {
authorizedToConfirm: boolean
orcidUrl: link to the orcid controller
orcids: map of String to boolean [
orcid: String (full URI)
confirmed: boolean
]
}
-->
<#assign confirmThis = "" />
<#if orcidInfo??>
<#list orcidInfo.orcids?keys as key>
<#if "no" == orcidInfo.orcids[key]?string("yes","no") >
<#assign confirmThis = "Confirm the ID" />
</#if>
</#list>
<#if orcidInfo.authorizedToConfirm>
<script>
$(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> ");
});
</script>
</#if>
</#if>

View file

@ -9,6 +9,13 @@
<#macro showStatement statement>
<a href="${statement.value!}" title="ORCID iD" target="_blank">${statement.value!"ORCID iD not found"}</a>
<#if orcidInfo??>
<#if (orcidInfo.orcids[statement.value])!false>
<span style="color:#FF7700">(confirmed)</span>
<#else>
<span style="color:#FF7700">(pending confirmation)</span>
</#if>
</#if>
</#macro>