Commit 5392f03f authored by Maxime Chaillet's avatar Maxime Chaillet

fix merge conflicts with latest version of master.

parents cc0f9f0c 1e7443c6
......@@ -6,8 +6,11 @@ ENV http_proxy http://proxy.esrf.fr:3128
ENV https_proxy https://proxy.esrf.fr:3128
ENV DEBIAN_FRONTEND noninteractive
ADD www /usr/local/apache2/htdocs/
COPY myHttpd.conf /usr/local/apache2/conf/httpd.conf
RUN apt-get update
RUN apt-get install apache2 -y
ADD www /var/www/html/
ADD 000-default.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
EXPOSE 80
CMD /usr/sbin/apache2ctl -D FOREGROUND
\ No newline at end of file
docker run -p 8092:80 -dit --name doiLandingPage dockcs.esrf.fr/dau/doi:1.0.0-SNAPSHOT
docker run -p 8092:80 -i -t dockcs.esrf.fr/dau/doi:1.0.0-SNAPSHOT
......@@ -26,7 +26,8 @@ module.exports = function(grunt) {
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/dustjs-linkedin/dist/dust-full.min.js',
'bower_components/dustjs-helpers/dist/dust-helpers.min.js',
'bower_components/lodash/dist/lodash.min.js' ],
'bower_components/lodash/dist/lodash.min.js',
'bower_components/moment/moment.js' ],
'min/doi.min.js': [
'src/*js']
}
......
......@@ -29,7 +29,8 @@
"dustjs-linkedin": "^2.7.5",
"bootstrap": "^4.0.0",
"dustjs-helpers": "^1.7.3",
"lodash": "^4.17.5"
"lodash": "^4.17.5",
"moment": "momentjs#^2.21.0"
},
"overrides": {
"bootstrap": {
......
......@@ -7,6 +7,7 @@ html {
body {
margin-bottom: 60px; /* Margin bottom by footer height */
font-size: 14px;
}
.footer {
......@@ -96,10 +97,12 @@ label{
padding:10px;
}
.padding-0{
padding-right:0;
.padding-left-0{
padding-left:0;
}
.padding-right-0{
padding-right:0;
}
.whiteBackground{
background-color: #ffffff;
......
......@@ -8,9 +8,12 @@
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Using grunt-include-source, the proper js files created by us (not minified) are included below -->
<script src="src/author.js"></script>
<script src="src/beamlineUrl.js"></script>
<script src="src/citation.js"></script>
<script src="src/doicontroller.js"></script>
<script src="src/doiview.js"></script>
<script src="src/jsonExtractor.js"></script>
<!-- Using grunt-wiredep, the proper js files from bower components are included below -->
<!-- bower:js -->
......@@ -19,6 +22,7 @@
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/dustjs-helpers/dist/dust-helpers.min.js"></script>
<script src="bower_components/lodash/lodash.js"></script>
<script src="bower_components/moment/moment.js"></script>
<!-- endbower -->
<!-- bower:css -->
......@@ -51,17 +55,22 @@
</div>
<div id="main"></div>
<div id='error' ></div>
<div class="modal">
<!-- nothing to write here -->
</div>
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-6" >
<div class="col-12 col-md-5" >
<p><a style='font-weight:bold;' href="http://www.esrf.eu">European Synchrotron Radiation Facility</a></p>
</div>
<div class="col-12 col-md-6">
<p class="float-right" style="font-size:12px;display:block;" >Access to data is governed by the <a href="http://www.esrf.eu/datapolicy">ESRF data policy</a>.</p>
</div>
<div class="col-12 col-md-2" >
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a>
</div>
<div class="col-12 col-md-5">
<p class="float-right" style="font-size:12px;display:block;" > Access to data is governed by the <a href="http://www.esrf.eu/files/live/sites/www/files/about/organisation/ESRF%20data%20policy-web.pdf" target="_blank">ESRF data policy</a>.</p>
</div>
</div>
</div>
......
......@@ -43,17 +43,22 @@
</div>
<div id="main"></div>
<div id='error' ></div>
<div class="modal">
<!-- nothing to write here -->
</div>
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-6" >
<div class="col-12 col-md-5" >
<p><a style='font-weight:bold;' href="http://www.esrf.eu">European Synchrotron Radiation Facility</a></p>
</div>
<div class="col-12 col-md-6">
<p class="float-right" style="font-size:12px;display:block;" >Access to data is governed by the <a href="http://www.esrf.eu/datapolicy">ESRF data policy</a>.</p>
</div>
<div class="col-12 col-md-2" >
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a>
</div>
<div class="col-12 col-md-5">
<p class="float-right" style="font-size:12px;display:block;" > Access to data is governed by the <a href="http://www.esrf.eu/files/live/sites/www/files/about/organisation/ESRF%20data%20policy-web.pdf" target="_blank">ESRF data policy</a>.</p>
</div>
</div>
</div>
......
......@@ -47,17 +47,21 @@
</div>
</div>
<div id='main' ></div>
<div id='error' ></div>
<div class="modal">
<!-- nothing to write here -->
</div>
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-6" >
<div class="col-12 col-md-5" >
<p><a style='font-weight:bold;' href="http://www.esrf.eu">European Synchrotron Radiation Facility</a></p>
</div>
<div class="col-12 col-md-6">
<p class="float-right" style="font-size:12px;display:block;" >Access to data is governed by the <a href="http://www.esrf.eu/datapolicy">ESRF data policy</a>.</p>
</div>
<div class="col-12 col-md-2" >
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a>
</div>
<div class="col-12 col-md-5">
<p class="float-right" style="font-size:12px;display:block;" > Access to data is governed by the <a href="http://www.esrf.eu/files/live/sites/www/files/about/organisation/ESRF%20data%20policy-web.pdf" target="_blank">ESRF data policy</a>.</p>
</div>
</div>
</div>
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
function Author() {
}
/**
* Set the first name as received from Json
*/
Author.prototype.setFirstName = function(firstName) {
this.firstName = firstName;
};
/**
* Set the family name as received from Json
*/
Author.prototype.setFamilyName = function(familyName) {
this.familyName = familyName;
};
/**
* Set the single name which contains the first name and the family name
*/
Author.prototype.setSingleName = function(singleName) {
this.singleName = singleName;
};
/**
* Return the raw family name.
* @return {string} the family name if it was found. Null if not.
*/
Author.prototype.getRawFamilyName = function(){
if (this.familyName){
return this.familyName;
} else {
if (this.singleName){
// Check whether the family name can be extracted from the singleChain.
// 1 - play first Card : there are only 2 words in the chain. => second word is the familyName
var findWordsRegExp = new RegExp(/(\S+)/g);
var wordTable = this.singleName.match(findWordsRegExp);
if (wordTable.length === 2){
// there are 2 words
this.familyName = wordTable[1];
return this.familyName;
}
// 2 - play second card : Assumes all family names are FULLY UPPSERCASE in the single string
var familyRegExp = new RegExp(/\s([^a-z]+$)/);
var result = familyRegExp.exec(this.singleName); // null if not found
if (result){
this.familyName = result[1];
}
return this.familyName; //returns null if it not found
}
}
};
/**
* Return the raw first name.
* @return {string} the first name if it was found. Null if not.
*/
Author.prototype.getRawFirstName = function(){
if (this.firstName){
return this.firstName;
} else {
if (this.singleName){
// Check whether the family name can be extracted from the singleChain.
// 1 - play first Card : there are only 2 words in the chain. => first word is the firstName
var findWordsRegExp = new RegExp(/(\S+)/g);
var wordTable = this.singleName.match(findWordsRegExp);
if (wordTable.length === 2){
// there are 2 words
this.firstName = wordTable[0];
return this.firstName;
}
// 2 - play second card : Assumes all first name are lowercase except first letter which can optionally be uppercase
var firstNameRegExp = new RegExp(/^(.[^A-Z]+)+\b/);
var result = firstNameRegExp.exec(this.singleName); // null if not found
if (result){
this.firstName = result[0];
}
return result; //returns null if it not found
}
}
};
/**
* Returns the family name as title name. Only the first letter of each words is
* uppercase.
*/
Author.prototype.getTitleCaseFamilyName = function() {
if (this.familyName) {
allLowerCase = this.familyName.toLowerCase();
var findFirstLetter = new RegExp(/^./);
return allLowerCase.replace(findFirstLetter, function(foundCharacter){return foundCharacter.toUpperCase();});
} else {
console.log ("family name is undefined");
return null;
}
};
/**
* Returns the initials of the first name.
*/
Author.prototype.getFirstNameInitials = function(){
var firstNameInitialsRegExp = new RegExp(/(\S+)/g);
if (this.firstName) {
return this.firstName.replace(firstNameInitialsRegExp, function(foundString){return foundString.charAt(0) + ".";});
}
else {
console.log ("first name is undefined");
return null;
}
};
function Citation(data) {
this.isBuildable = (data && data.creator && data.creator.length !== 0 &&
data.date_registered && data.title && data.publisher && data.doi) ? true
: false;
}
/**
* Construct the author list for the citation. Authors name are composed of the
* familyName in titleCase followed by the first letter of the first name
*
* @param {arrayOrObj}
* The creator(s). When there is a single author, it is an
* object. When there are several authors, it is an array.
* @return {string} The formated list of authors to be used for the citation. An
* empty string when the list could not be generated.
*/
Citation.prototype.getAuthorsForCitation = function(creator) {
if (this.isBuildable) {
var authorList = _.transform(creator, function(result, val, key, obj) {
if (!(obj instanceof Array)) {
val = obj;
}
var author = null;
if (val.givenName) {
author = new Author();
author.setFamilyName(val.familyName);
author.setFirstName(val.givenName);
result.push(author.getTitleCaseFamilyName() + ' ' +
author.getFirstNameInitials());
} else {
// Here first name and last name are in a single string field
// creator.name
author = new Author();
author.setSingleName(val.name);
if (!author.getRawFamilyName() || !author.getRawFirstName()) {
result.push(val.name);
} else {
// FirstName and family name are not in a single string
result.push(author.getTitleCaseFamilyName() + " " +
author.getFirstNameInitials());
}
}
if (!(obj instanceof Array)) {
return false;
}
}, []);
return _.join(authorList, ', ');
} else {
console.log("the author list for the citation could not be generated.");
return "";
}
};
\ No newline at end of file
This diff is collapsed.
......@@ -11,18 +11,71 @@ DOIView.prototype.setLoading = function(message) {
};
DOIView.prototype.setDOI = function(doi) {
$("#doiPanel").html(doi);
$("#doiPanel").html(doi.toUpperCase());
};
/**
* Render the error message
*
* @param {string}
* error The error which was thrown
* @param {string}
* origin The page which caused this rendering. This directly
* influence the element id
*/
DOIView.prototype.renderError = function(error, origin) {
var template = ((origin === "welcome-page") ? "doi-not-found-page2" : "doi-not-found-page");
DOIView.prototype.displayMessage = function(template, message, id){
dust.render(
template,
{
message : message
},
function(err, out) {
$("#" + id).html(out);
var message = "";
if (error === "Bad Prefix") {
if (origin === "welcome-page") {
message = '<h3> Not found ! </h3> <p> The DOI was not found at ESRF because its prefix is not ESRF specific. Please use the DOI search engine at <a href="https://www.doi.org"> doi.org</a>. </p>';
} else {
message = '<h2> Not found ! </h2> <p> The DOI was not found at ESRF because its prefix is not ESRF specific. </br> Please use the DOI search engine at <a href="https://www.doi.org"> doi.org</a>. </p>';
}
} else if (error === "Not Found") {
if (origin === "welcome-page") {
message = "<h3> Not found ! </h3> <p> Sorry, the requested DOI was not found. </p>";
} else {
message = "<h2> Not found ! </h2> <p> Sorry, the requested DOI was not found. </p>";
}
} else if (error === "timeout") {
if (origin === "welcome-page") {
message = "<h3> Not found ! </h3> <p> Sorry, the server took too long to reply. Try again later. </p>";
} else {
message = "<h2> Not found ! </h2> <p> Sorry, the server took too long to reply. Try again later. </p>";
}
} else {
if (origin === "welcome-page") {
message = "<h3> Not found ! </h3> <p> Connexion problem to the server. </p>";
} else {
message = "<h2> Not found ! </h2> <p> Connexion problem to the server. </p>";
}
);
};
\ No newline at end of file
}
dust.render(template, {
message : message
}, function(err, out) {
$("#error").html(out);
});
};
/**
* Set the message which is displayed just above the "Access data button"
*
* @param {object}
* data The json object reference.
*/
DOIView.prototype.setDataAccessMessage = function(data) {
var publicationDate = moment(data.publication_year, "YYYY");
var now = moment();
if (now > publicationDate) {
data.accessMessage = "The data can be downloaded by clicking on the link below";
} else {
data.accessMessage = "The data is under embargo until <b>" +
data.publication_year +
"</b> but could be released earlier. It is currently only available to download if you are a member of the proposal team.";
}
};
function JsonExtractor(json) {
}
/**
* Extract investigationId from the data.doi field as received from the json
* response. Add the corresponding fields in the data object
*
* @param {string}
* data The data object reference which is sent to the dustjs
* template
*/
JsonExtractor.prototype.extractInvestigationId = function(data) {
var regExp = RegExp(/\/\w*-*[Ee][Ss][Rr][Ff]-[Ee][Ss]-(\d+)$/);
data.investigationId = regExp.exec(data.doi)[1];
};
/**
* Extract field value (beamline, proposal number and proposal type) from the
* data json object. Returns nullif the field is not found.
*
* @param {array}
* subject The array containing objects of interest template
* @param {string}
* field The text field which is searched
*/
JsonExtractor.prototype.getFieldFromSubject = function(subject, field) {
if (subject) {
if (subject[0]) {
for (var i = 0; i < subject[0].length; i++) {
if (subject[0][i].subject_scheme === field) {
return subject[0][i].text;
}
}
}
}
return null;
};
/**
* Extract useful dates from the data object. Handles the possibility that these
* dates do not exist.
*
* @param {object}
* data The data object reference which is sent to the dustjs
* template
*/
JsonExtractor.prototype.extractDates = function(data) {
// Displayed publication Year in doi landing page is the minting year
if (data.date_registered && data.date_registered != null) {
data.mintingYear = moment(data.date_registered).year();
} else {
data.mintingYear = "Not available";
}
// Session date is the date the experiment for the session was performed
if (data.date_collected && data.date_registered != null) {
data.sessionDate = moment(data.date_collected).format('YYYY-M-D');
} else {
data.sessionDate = "Not available";
}
};
......@@ -9,26 +9,26 @@
<hr>
<div class="row">
<div class="col-3">
<div class="col-4">
<div class="myBorder-left">
<label> Proposal </label>
<div class="padding-left-15">{data.proposalNumber}</div>
</div>
</div>
<div class="col-3">
<div class="col-4">
<div class="myBorder-left">
<label> Release year </label>
<div class="padding-left-15">{data.issued.date-parts}</div>
<label> Publication year </label>
<div class="padding-left-15">{data.mintingYear}</div>
</div>
</div>
<div class="col-6">
<div class="col-4">
<div class="myBorder-left">
<label> Beamline </label>
{@eq key=data.beamlineUrl value="noLink"}
<div class="padding-left-15">{data.beamline}</div>
{:else}
<div class="padding-left-15">
<a href="{data.beamlineUrl}"> {data.beamline} </a>
<a href="{data.beamlineUrl}" target="_blank"> {data.beamline} </a>
</div>
{/eq}
</div>
......@@ -36,13 +36,19 @@
</div>
<div class="padding-top-15"></div>
<div class="row">
<div class="col-6">
<div class="col-4">
<div class="myBorder-left">
<label> Session date </label>
<div class="padding-left-15">{data.sessionDate}</div>
</div>
</div>
<div class="col-4">
<div class="myBorder-left">
<label>Category </label>
<div class="padding-left-15">{data.proposalType}</div>
</div>
</div>
<div class="col-6">
<div class="col-4">
<div class="myBorder-left">
<label>Publisher </label>
<div class="padding-left-15"><a href="http://www.esrf.fr"> {data.publisher} </a> </div>
......@@ -57,7 +63,7 @@
<div class="myBorder-left">
<label> Abstract </label>
<div class="padding-left-15">
There is no abstract for this DOI
There is no abstract for this session.
</div>
</div>
</div>
......@@ -84,11 +90,11 @@
<label>Experimental data </label>
</div>
<div class="card-body padding10">
<p class="card-text" >The data is currently only available to download if you are a member of the proposal team.</p>
<p class="card-text" >{data.accessMessage|s}</p>
</div>
<div class="card-footer">
<form action="https://icat.esrf.fr/#/browse/facility/ESRF/proposal/{data.proposalNumber}/investigation/{data.investigationId}/dataset" target="_blank">
<button type="submit" class="btn btn-primary btn-lg btn-block"> <span class="fa fa-download whiteFont"></span> Download </button>
<button type="submit" class="btn btn-primary btn-lg btn-block"> Access data </button>
</form>
</div>
</div>
......@@ -121,7 +127,7 @@
<label>Authors </label>
</div>
<div class="card-body text-center">
{#data.author} {?.given} {.given} {.family} </br> {:else} {.literal} </br> {/.given} {/data.author}
{#data.creator} {?.givenName} {.givenName} {.familyName} </br> {:else} {.name} </br> {/.givenName} {/data.creator}
</div>
</div>
</div>
......
......@@ -15,7 +15,7 @@
This page centralizes the services offered by the ESRF to access data stored at the facility as part of its data policy.
<ul>
<li>DOI search engine</li>
<li>Data catalogue <a href="https://icat.esrf.fr"> icat.esrf.fr</a></li>
<li>Data catalogue <a href="https://icat.esrf.fr" target="_blank"> icat.esrf.fr</a></li>
</ul>
</div>
</div>
......@@ -32,14 +32,19 @@
doi.org </a> search engine for any other DOI.
</p>
<div class="row">
<div class="col-xl-9 padding-0">
<input id="doiSearchBox" class="form-control" placeholder="10.5072/..." type="text" required/>
<div class="col-xl-9 padding-right-0">
<p> <input id="doiSearchBox" class="form-control" placeholder="10.15151/..." type="text" required/> </p>
<div class="text-danger" id="error"> </div>
</div>
<div class="col padding-0">
<div class="col padding-left-0">
<input class="btn btn-primary" type="submit" value="Search" onclick="searchDOI()" />
</div>
</div>
</div>
<div class="row">
<div class="col">
<p> <a href="https://search.datacite.org/works?query=10.15151"> Advanced search </a> </p>
</div>
</div>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment