Commit 08d84431 authored by Andrew Goetz's avatar Andrew Goetz

Merge branch 'issue53FitsWithIssueOnGithub' into 'master'

Issue53 fits with issue on github

See merge request !61
parents b2136c0f 0ff61e0b
Pipeline #4014 passed with stages
in 1 minute and 17 seconds
This diff is collapsed.
This diff is collapsed.
......@@ -103,7 +103,7 @@ DOIController.prototype.getData = function(doi) {
}
}
}).fail(function(jqXHR, textStatus, errorThrown) {
_this.view.renderError(errorThrown, _this.origin);
_this.view.renderError(jqXHR, errorThrown, _this.origin);
_this.view.setLoading(false);
});
......
......@@ -7,23 +7,23 @@ function DOIView() {
this.reportExperimentFileNames = null;
this.failedRecievingExpReport = false;
this.isDOIAlreadyRendered = false;
this.onDOIRendered = new Event( this );
this.onDOIRendered = new Event(this);
}
DOIView.prototype.setLoading = function( message ) {
if ( message == false ) {
$( "body" ).removeClass( "loading" );
DOIView.prototype.setLoading = function (message) {
if (message == false) {
$("body").removeClass("loading");
return;
}
$( "body" ).addClass( "loading" );
$("body").addClass("loading");
};
/**
* Set the doi prefix/suffix text in the top banner of the doi landing page. This is done before the template is rendered.
*
*/
DOIView.prototype.setDOIInTopBanner = function( doiCode ) {
$( "#doiValue" ).text( "DOI > " + doiCode.toUpperCase() );
DOIView.prototype.setDOIInTopBanner = function (doiCode) {
$("#doiValue").text("DOI > " + doiCode.toUpperCase());
};
/**
......@@ -32,16 +32,16 @@ DOIView.prototype.setDOIInTopBanner = function( doiCode ) {
* @param {array}
* data The filename list to be displayed
*/
DOIView.prototype.renderExperimentalReportData = function( data ) {
if ( data ) {
DOIView.prototype.renderExperimentalReportData = function (data) {
if (data) {
var _this = this;
/** Only render the list of files if DOI has already been rendered * */
if ( this.isDOIAlreadyRendered ) {
dust.render( 'experimentalreport_tpl', {
if (this.isDOIAlreadyRendered) {
dust.render('experimentalreport_tpl', {
data: data
}, function( err, out ) {
$( '#' + _this.reportPanelId ).html( out );
} );
}, function (err, out) {
$('#' + _this.reportPanelId).html(out);
});
} else {
this.reportExperimentFileNames = data;
}
......@@ -50,24 +50,24 @@ DOIView.prototype.renderExperimentalReportData = function( data ) {
}
};
DOIView.prototype.renderDOIData = function( doiData ) {
DOIView.prototype.renderDOIData = function (doiData) {
var _this = this;
dust.render( 'landingpage_tpl', {
dust.render('landingpage_tpl', {
data: doiData
}, function( err, out ) {
$( '#' + _this.mainPanelId ).html( out );
}, function (err, out) {
$('#' + _this.mainPanelId).html(out);
_this.isDOIAlreadyRendered = true;
_this.renderBadges( doiData );
_this.renderBadges(doiData);
/**
* If there are experimental reports already retrieved then render them after
* the rendering of the DOI
*/
if ( _this.failedRecievingExpReport ) {
if (_this.failedRecievingExpReport) {
_this.renderErrorForExperimentalReport();
} else if ( _this.reportExperimentFileNames ) {
_this.renderExperimentalReportData( _this.reportExperimentFileNames );
} else if (_this.reportExperimentFileNames) {
_this.renderExperimentalReportData(_this.reportExperimentFileNames);
}
} );
});
};
/**
......@@ -79,47 +79,52 @@ DOIView.prototype.renderDOIData = function( doiData ) {
* origin The page which caused this rendering. This directly
* influence the element id
*/
DOIView.prototype.renderError = function( error, origin ) {
var template = ( ( origin === "welcome-page" ) ? "doinotfound2_tpl" : "doinotfound_tpl" );
DOIView.prototype.renderError = function (jqXHR, errorThrown, origin) {
var template = ((origin === "welcome-page") ? "doinotfound2_tpl" : "doinotfound_tpl");
var message = "";
if ( error === "Bad Prefix" ) {
if ( origin === "welcome-page" ) {
if (errorThrown === "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" ) {
} else if (errorThrown === "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" ) {
} else if (errorThrown === "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 (errorThrown === "" && jqXHR.responseText === "The resource you are looking for doesn't exist.") {
if (origin === "welcome-page") {
message = "<h3> Not found ! </h3> <p>It may take up to 24 hours for a newly generated DOI to become available. Please try again later.</p>";
} else {
message = "<h2> Not found ! </h2> <p>It may take up to 24 hours for a newly generated DOI to become available. Please try again later.</p>";
}
} else {
if ( origin === "welcome-page" ) {
message = "<h3> Not found ! </h3> <p> Connexion problem to the server. </p>";
if (origin === "welcome-page") {
message = "<h3> Not found ! </h3> <p> Connexion problem to the datacite server. Please try again later.</p>";
} else {
message = "<h2> Not found ! </h2> <p> Connexion problem to the server. </p>";
message = "<h2> Not found ! </h2> <p> Connexion problem to the datacite server. Please try again later.</p>";
}
}
dust.render( template, {
dust.render(template, {
message: message
}, function( err, out ) {
$( "#error" ).html( out );
} );
}, function (err, out) {
$("#error").html(out);
});
};
DOIView.prototype.renderErrorForExperimentalReport = function() {
DOIView.prototype.renderErrorForExperimentalReport = function () {
this.failedRecievingExpReport = true;
var out = '<div class="card-header text-center"> <label>Experimental report </label> </div> <div class="card-body padding10"> <p> The filename list is not available. </p> </div>';
$( '#' + this.reportPanelId ).html( out );
$('#' + this.reportPanelId).html(out);
};
......@@ -129,15 +134,15 @@ DOIView.prototype.renderErrorForExperimentalReport = function() {
*
* */
DOIView.prototype.renderBadges = function( data ) {
if ( data ) {
DOIView.prototype.renderBadges = function (data) {
if (data) {
var _this = this;
dust.render( 'badges_tpl', {
dust.render('badges_tpl', {
data: data
}, function( err, out ) {
$( '#' + _this.badgePanelId ).html( out );
} );
}, function (err, out) {
$('#' + _this.badgePanelId).html(out);
});
}
};
......@@ -150,10 +155,10 @@ DOIView.prototype.renderBadges = function( data ) {
* @return {string}
* the message to display
*/
DOIView.prototype.setDataAccessMessage = function( doiData ) {
if ( doiData.accessibility === "Open access" ) {
DOIView.prototype.setDataAccessMessage = function (doiData) {
if (doiData.accessibility === "Open access") {
return "The data can be accessed by clicking on the link below";
} else if ( doiData.accessibility === "Restricted access" ) {
} else if (doiData.accessibility === "Restricted access") {
return "The data are under embargo until <b>" + doiData.publiclyAccessibleYear + "</b> but could be released earlier." +
" Currently, they are only accessible to proposal team members.";
}
......
......@@ -12,7 +12,7 @@
<h1 class="font-3p2rem">About the portal</h1>
</div>
<div class="card-body padding10">
This page centralizes the <a href="http://www.esrf.eu/home/UsersAndScience/UserGuide/esrf-data-policy/doi.html" target="_blank"> DOI</a> services offered by the ESRF to access data stored at the facility as part of its data policy.
This page centralizes the <a href="http://www.esrf.eu/home/UsersAndScience/UserGuide/esrf-data-policy/doi.html" target="_blank"> DOI</a> services offered by the ESRF to access data stored at the facility as part of its data policy.
Data referred to by ESRF DOIs are accessed via the ESRF data catalogue <a href="https://icat.esrf.fr" target="_blank"> icat.esrf.fr</a>.
<p> In case you require a DOI for a subset of data please send an email with the following high level metadata - "proposal", "title", "authors", "abstract", "datasets" to datapolicy@esrf.fr </p>
</div>
......@@ -53,6 +53,7 @@
<h1 class="font-3p2rem">About DOI </h1>
</div>
<div class="card-body padding10">
The Digital Object Identifier (<a href="http://www.esrf.eu/home/UsersAndScience/UserGuide/esrf-data-policy/doi.html">DOI</a>) is a code composed of digits and characters. It identifies data in a
unique and permanent way thereby allowing data to be referenced worldwide. The DOI has two parts, namely the DOI prefix and the DOI suffix separated by a slash ("/"). The ESRF prefix is 10.15151 followed by a slash and the ESRF suffix.
Currently the following suffix(es) are defined:
......
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