Commit 5166ff7a authored by Maxime Chaillet's avatar Maxime Chaillet

fix merge request issue

parents 37547539 478f945e
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
# redirect a call to doi.esrf.fr to display the page welcome.html
RewriteRule "^$" "welcome.html" [NC,L]
# redirect a call to doi.esrf.fr/DOIprefix/DOIsuffix to doi.esrf.fr/index.html?DOI=DOIprefix/DOIsuffix
RewriteCond %{REQUEST_URI} !(\.js)
......
......@@ -25,8 +25,9 @@ module.exports = function(grunt) {
'bower_components/jquery/dist/jquery.js',
'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' ],
'min/doi.min.js': [
'bower_components/dustjs-helpers/dist/dust-helpers.min.js',
'bower_components/lodash/dist/lodash.min.js' ],
'min/doi.min.js': [
'src/*js']
}
}
......@@ -77,6 +78,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-include-source');
grunt.registerTask('default', ['jshint', 'dustjs', 'uglify', 'cssmin', 'wiredep:prod']);
grunt.registerTask('default', ['jshint', 'dustjs', 'uglify', 'cssmin']);
grunt.registerTask('dev', ['jshint', 'includeSource:dev', 'dustjs', 'cssmin', 'wiredep:dev']);
};
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -28,6 +28,7 @@
"jquery": "^3.2.1",
"dustjs-linkedin": "^2.7.5",
"bootstrap": "^3.3.7",
"dustjs-helpers": "^1.7.3"
"dustjs-helpers": "^1.7.3",
"lodash": "^4.17.5"
}
}
......@@ -70,6 +70,11 @@ body {
padding:10px;
}
.padding-0{
padding-right:0;
padding-left:0;
}
.whiteBackground{
background-color: #ffffff;
}
......
......@@ -10,6 +10,7 @@
<!-- Using grunt-include-source, the proper js files created by us (not minified) are included below -->
<script src="src/beamlineUrl.js"></script>
<script src="src/doicontroller.js"></script>
<script src="src/doiview.js"></script>
......@@ -21,6 +22,7 @@
<script src="bower_components/dustjs-linkedin/dist/dust-full.min.js"></script>
<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>
<!-- endbower -->
<!-- Using grunt-include-source, the proper all dustjs templates files (not minified are included below -->
......
......@@ -3,32 +3,35 @@
<head>
<meta charset="UTF-8">
<title>ESRF</title>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="/min/output.min.css" >
<link rel="stylesheet" href="/min/output.min.css" >
</head>
<!--
<script src="/min/doi-landing-page.min.js"></script>
-->
<script src="/min/components.min.js"></script>
<script src="/min/precompiled.templates.min.js"></script>
<script src="/src/doiview.js"></script>
<script src="/src/doicontroller.js"></script>
<script src="/min/doi.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var params = new URLSearchParams(document.location.search.substring(1));
var doi;
if (params.get("DOI")){
doi = params.get("DOI");
}
else{
doi = document.location.pathname.substring(1,document.location.pathname.length )
}
new DOIController(new DOIView()).getData(doi);
});
$(document).ready(function() {
var doi = document.location.pathname.substring(1,document.location.pathname.length);
var controller = new DOIController(new DOIView());
if (doi !="") {
controller.setOrigin("index");
}
else {
controller.setOrigin("welcome-page");
}
controller.displayMainContent(doi);
});
// search the doi entered in the search box
function searchDOI(){
var doi = $('#doiSearchBox').val();
var controller = new DOIController(new DOIView());
controller.setOrigin("welcome-page");
controller.getData(doi);
};
</script>
</head>
<body>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
function DOIController(e){this.server="https://data.datacite.org/",this.sessionId=null,this.acceptedPrefix=["10.5072","10.15151"],this.view=e}function findRegExpInText(e,t){return t.search(e)}function extractFieldsFromCategories(e){var t,n=e.categories;for(t in n)0!=findRegExpInText(/id/,n[t])&&0!=findRegExpInText(/bm/,n[t])||(e.beamline=n[t]);for(t in n)0==findRegExpInText(/\D+-/,n[t])&&(e.proposalNumber=n[t]);for(t in n)-1!=findRegExpInText(/\s/,n[t])&&(e.proposalType=n[t])}function extractFieldsFromDoi(e){var t=RegExp(/^10\.(5072|15151)\/esrf-es-(\d+)/);e.investigationId=t.exec(e.DOI)[2]}function DOIView(){}DOIController.prototype.getData=function(e){var t=this;this.view.setDOI(e),this.hasAcceptedPrefix(e)?$.ajax({headers:{Accept:"application/vnd.citationstyles.csl+json"},type:"GET",url:this.server+e,beforeSend:function(){t.view.setLoading("Retrieving data from Server")},complete:function(){t.view.setLoading(!1)},success:function(e){e?(extractFieldsFromCategories(e),extractFieldsFromDoi(e),dust.render("esrf-landing-page",{data:e},function(e,t){$("#main").html(t)})):dust.render("doi-not-found-page",{message:"Sorry, the requested DOI was not found."},function(e,t){$("#main").html(t)})},error:function(e,n,i){$("#result").text("error: "+n),dust.render("doi-not-found-page",{message:"Sorry, there was a connexion problem with the datacite server."},function(e,t){$("#main").html(t)}),t.view.setLoading(!1)}}):dust.render("doi-not-found-page",{message:'The DOI was not found at ESRF. (bad prefix). </br> Please use the DOI search engine at <a href="https://www.doi.org"> doi.org</a>.'},function(e,t){$("#main").html(t)})},DOIController.prototype.hasAcceptedPrefix=function(e){var t=e.split("/")[0];return this.acceptedPrefix.includes(t)},DOIView.prototype.setLoading=function(e){0!=e?$("body").addClass("loading"):$("body").removeClass("loading")},DOIView.prototype.setDOI=function(e){$("#doiPanel").html(e)};
\ No newline at end of file
function DOIController(e){this.doiServer="https://data.datacite.org/",this.acceptedPrefix=["10.5072","10.15151"],this.view=e}function findRegExpInText(e,t){return t.search(e)}function extractFieldsFromCategories(e){var t,n=e.categories;for(t in n)0!=findRegExpInText(/id/,n[t])&&0!=findRegExpInText(/bm/,n[t])||(e.beamline=n[t]);for(t in n)0==findRegExpInText(/\D+-/,n[t])&&(e.proposalNumber=n[t]);for(t in n)-1!=findRegExpInText(/\s/,n[t])&&(e.proposalType=n[t])}function extractFieldsFromDoi(e){var t=RegExp(/^10\.(5072|15151)\/esrf-es-(\d+)/);e.investigationId=t.exec(e.DOI)[2]}function DOIView(){}var BEAMLINEURL=[{name:"BM05",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/BM05"},{name:"BM29",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/BM29"},{name:"CM01",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/CM01.html"},{name:"ID01",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID01"},{name:"ID06",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MEx/id06-large-volume-press.html"},{name:"ID11",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.fr/UsersAndScience/Experiments/StructMaterials/ID11"},{name:"ID16A",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16A"},{name:"ID16B",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16B"},{name:"ID17",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.fr/UsersAndScience/Experiments/CBS/ID17"},{name:"ID19",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.fr/home/UsersAndScience/Experiments/StructMaterials/ID19.html"},{name:"ID21",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID21"},{name:"ID22",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/id22"},{name:"ID23-1",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-1"},{name:"ID23-2",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-2"},{name:"ID29",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/Beamlines/content/content/id29.html"},{name:"ID30A1",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/MASSIF1"},{name:"ID30A3",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/id30a-3--massif-3.html"},{name:"ID30B",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/id30b"},{name:"ID32",startDate:"01 01 2000 00:00 +0000",endDate:"01 12 2100 00:00 +0000",url:"http://www.esrf.eu/ID32"}];DOIController.prototype.getData=function(e){var t=this;this.view.setDOI(e),this.hasAcceptedPrefix(e)?$.ajax({headers:{Accept:"application/vnd.citationstyles.csl+json"},type:"GET",url:this.doiServer+e,beforeSend:function(){t.view.setLoading("Retrieving data from Server")},complete:function(){t.view.setLoading(!1)},success:function(e){if(e){extractFieldsFromCategories(e),extractFieldsFromDoi(e);var n=e.issued["date-parts"]-3,r=new Date(n+" 01 01 00:00 +0000");e.beamlineUrl=t.findsUrl(e.beamline,r),dust.render("esrf-landing-page",{data:e},function(e,t){$("#main").html(t)})}else"welcome-page"==this.origin?t.view.displayMessage("doi-not-found-page","Sorry, the requested DOI was not found.","error"):t.view.displayMessage("doi-not-found-page","Sorry, the requested DOI was not found.","main")},error:function(e,n,r){"welcome-page"==this.origin?t.view.displayMessage("doi-not-found-page","Sorry, there was a connexion problem with the datacite server.","error"):t.view.displayMessage("doi-not-found-page","Sorry, there was a connexion problem with the datacite server.","main"),t.view.setLoading(!1)}}):"welcome-page"==this.origin?t.view.displayMessage("doi-not-found-page2","<h3> Not found ! </h3> <p> The DOI <b>"+e+'</b> 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>',"error"):t.view.displayMessage("doi-not-found-page","<h2> Not found ! </h2> <p> The DOI <b>"+e+'</b> 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>',"main")},DOIController.prototype.hasAcceptedPrefix=function(e){var t=e.split("/")[0];return-1!=_.findIndex(this.acceptedPrefix,function(e){return t==e})},DOIController.prototype.displayMainContent=function(e){"welcome-page"===this.origin&&dust.render("welcome-page",{},function(e,t){$("#main").html(t)}),"index"===this.origin&&this.getData(e)},DOIController.prototype.setOrigin=function(e){this.origin=e},DOIController.prototype.findsUrl=function(e,t){for(var n="noLink",r=0;BEAMLINEURL[r]&&"noLink"===n;){var a=new Date(BEAMLINEURL[r].startDate),s=new Date(BEAMLINEURL[r].endDate);BEAMLINEURL[r].name.toLowerCase()===e.toLowerCase()&&t>a&&t<s&&(n=BEAMLINEURL[r].url),r++}return n},DOIView.prototype.setLoading=function(e){0!=e?$("body").addClass("loading"):$("body").removeClass("loading")},DOIView.prototype.setDOI=function(e){$("#doiPanel").html(e)},DOIView.prototype.displayMessage=function(e,t,n){dust.render(e,{message:t},function(e,t){$("#"+n).html(t)})};
\ No newline at end of file
html{position:relative;min-height:100%}body{margin-bottom:60px}.footer{position:absolute;bottom:0;width:100%;height:60px;line-height:60px;background-color:#f4f4f4}.container{width:auto;max-width:680px;padding:0 15px}.flex{display:flex}.doiTitle{font-size:30px}.blueBackground{background-color:#132577!important}.lightRedBackground{background-color:#ffcaca!important}.grayBackground{background-color:#dcdee2}.whiteVCenteredFont{color:#fff;margin-top:auto;margin-bottom:auto}.padding-top-15{padding-top:15px}.padding-bottom-15{padding-bottom:15px}.padding10{padding:10px}.whiteBackground{background-color:#fff}.welcomeBanner{heigth:100px}.whiteFont{color:#fff}.flexCentered{display:flex;justify-content:center;align-items:center}.height100p{height:100%}.btn{white-space:normal}.btn-primary:hover{}.btn-primary{border-color:#132577;background-color:#132577}.btn-primary.disabled{background-color:#132577;border-color:#132577}.btn.disabled{opacity :.50}label{font-weight:700}#logo{height:50px}.card-header{background-color:#CFD1D2}.modal{display:none;position:absolute;z-index:1000;top:82px;bottom:60px;background:rgba(0,0,0,.05) url(../src/images/ajax-loader.gif) 50% 50% no-repeat}body.loading{overflow:hidden}body.loading .modal{display:block}
\ No newline at end of file
html{position:relative;min-height:100%}body{margin-bottom:60px}.footer{position:absolute;bottom:0;width:100%;height:60px;line-height:60px;background-color:#f4f4f4}.container{width:auto;max-width:680px;padding:0 15px}.flex{display:flex}.doiTitle{font-size:30px}.blueBackground{background-color:#132577!important}.lightRedBackground{background-color:#ffcaca!important}.grayBackground{background-color:#dcdee2}.whiteVCenteredFont{color:#fff;margin-top:auto;margin-bottom:auto}.padding-top-15{padding-top:15px}.padding-bottom-15{padding-bottom:15px}.padding10{padding:10px}.padding-0{padding-right:0;padding-left:0}.whiteBackground{background-color:#fff}.welcomeBanner{heigth:100px}.whiteFont{color:#fff}.flexCentered{display:flex;justify-content:center;align-items:center}.height100p{height:100%}.btn{white-space:normal}.btn-primary:hover{}.btn-primary{border-color:#132577;background-color:#132577}.btn-primary.disabled{background-color:#132577;border-color:#132577}.btn.disabled{opacity :.50}label{font-weight:700}#logo{height:50px}.card-header{background-color:#CFD1D2}.modal{display:none;position:absolute;z-index:1000;top:82px;bottom:60px;background:rgba(0,0,0,.05) url(../src/images/ajax-loader.gif) 50% 50% no-repeat}body.loading{overflow:hidden}body.loading .modal{display:block}
\ No newline at end of file
This diff is collapsed.
var BEAMLINEURL = [
{
"name" : "BM05",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.fr/UsersAndScience/Experiments/XNP/BM05"
},
{
"name" : "BM29",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/BM29"
},
{
"name" : "CM01",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/CM01.html"
},
{
"name" : "ID01",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID01"
},
{
"name" : "ID06",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/home/UsersAndScience/Experiments/MEx/id06-large-volume-press.html"
},
{
"name" : "ID11",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.fr/UsersAndScience/Experiments/StructMaterials/ID11"
},
{
"name" : "ID16A",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16A"
},
{
"name" : "ID16B",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16B"
},
{
"name" : "ID17",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.fr/UsersAndScience/Experiments/CBS/ID17"
},
{
"name" : "ID19",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.fr/home/UsersAndScience/Experiments/StructMaterials/ID19.html"
},
{
"name" : "ID21",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID21"
},
{
"name" : "ID22",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/id22"
},
{
"name" : "ID23-1",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-1"
},
{
"name" : "ID23-2",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-2"
},
{
"name" : "ID29",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/home/UsersAndScience/Experiments/Beamlines/content/content/id29.html"
},
{
"name" : "ID30A1",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/MASSIF1"
},
{
"name" : "ID30A3",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/id30a-3--massif-3.html"
},
{
"name" : "ID30B",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/id30b"
},
{
"name" : "ID32",
"startDate" : "01 01 2000 00:00 +0000",
"endDate" : "01 12 2100 00:00 +0000",
"url" : "http://www.esrf.eu/ID32"
}
];
\ No newline at end of file
function DOIController(view) {
this.server = "https://data.datacite.org/";
this.sessionId = null;
this.acceptedPrefix = [ "10.5072", "10.15151" ];
// doiServer = the server which provides doi details from a given doi name.
this.doiServer = "https://data.datacite.org/";
// 10.5072 is the test esrf doi prefix;
// 10.15151 is the production esrf doi prefix;
this.acceptedPrefix = [ "10.5072", "10.15151" ];
this.view = view;
}
......@@ -19,56 +18,56 @@ DOIController.prototype.getData = function(doi) {
Accept : "application/vnd.citationstyles.csl+json"
},
type : "GET",
url : this.server + doi,
url : this.doiServer + doi,
beforeSend : function() {
_this.view.setLoading("Retrieving data from Server");
},
complete : function() {
_this.view.setLoading(false);
},
success : function(data) {
if (data) {
// extract fields from data.categories
extractFieldsFromCategories(data);
//extractInvestigationId from data.doi
extractFieldsFromDoi(data);
success : function(doiData) {
if (doiData) {
// extract fields from doiData.categories
extractFieldsFromCategories(doiData);
//extractInvestigationId from doiData.doi
extractFieldsFromDoi(doiData);
// Retrieve the URL corresponding to the beamline name. Currently, the date of the
// experiment is calculated from the publicationYear.
var experimentalYear = doiData.issued["date-parts"] - 3 ;
var experimentalDate = new Date(experimentalYear + " 01 01 00:00 +0000");
doiData.beamlineUrl = _this.findsUrl(doiData.beamline, experimentalDate);
// send to dust render
dust.render('esrf-landing-page', {
data : data
}, function(err, out) {
$("#main").html(out);
});
data : doiData
}, function(err, out) {
$("#main").html(out);
}
);
} else {
dust.render('doi-not-found-page', {
message : "Sorry, the requested DOI was not found."
}, function(err, out) {
$("#main").html(out);
});
if (this.origin == "welcome-page") {
_this.view.displayMessage('doi-not-found-page', "Sorry, the requested DOI was not found.", "error" );
} else {
_this.view.displayMessage('doi-not-found-page', "Sorry, the requested DOI was not found.", "main" );
}
}
},
error : function(jqXHR, textStatus, errorThrown) {
$("#result").text("error: " + textStatus);
dust.render(
'doi-not-found-page',
{
message : "Sorry, there was a connexion problem with the datacite server."
},
function(err, out) {
$("#main").html(out);
});
error : function(jqXHR, textStatus, errorThrown) {
if (this.origin == "welcome-page") {
_this.view.displayMessage('doi-not-found-page', "Sorry, there was a connexion problem with the datacite server.", "error" );
} else {
_this.view.displayMessage('doi-not-found-page', "Sorry, there was a connexion problem with the datacite server.", "main" );
}
_this.view.setLoading(false);
}
});
} else {
dust.render(
'doi-not-found-page',
{
message : 'The DOI was not found at ESRF. (bad prefix). </br> Please use the DOI search engine at <a href="https://www.doi.org"> doi.org</a>.'
},
function(err, out) {
$("#main").html(out);
});
if (this.origin == "welcome-page") {
_this.view.displayMessage('doi-not-found-page2', '<h3> Not found ! </h3> <p> The DOI <b>' + doi + '</b> 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>', 'error');
} else {
_this.view.displayMessage('doi-not-found-page', '<h2> Not found ! </h2> <p> The DOI <b>' + doi + '</b> 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>', 'main');
}
}
};
......@@ -77,9 +76,49 @@ DOIController.prototype.getData = function(doi) {
// return false otherwise
DOIController.prototype.hasAcceptedPrefix = function(doi) {
var prefix = doi.split('/')[0];
return this.acceptedPrefix.includes(prefix);
return (_.findIndex(this.acceptedPrefix, function(o){ return prefix==o; }) != -1);
};
// Selects what will be displayed in the main id div
DOIController.prototype.displayMainContent = function(doi){
var isDOIProvided = false;
if (this.origin === "welcome-page" ) {
dust.render('welcome-page', {}, function(err, out) {
$("#main").html(out);
});
}
if (this.origin === "index" ) {
this.getData(doi);
}
};
// Set the origin from where the DOI controller is created. This affects the content of error messages for example
// depending on whether they are displayed in the "welcome-page" content or the "doi landing page" content.
DOIController.prototype.setOrigin = function(origin){
this.origin = origin;
};
// Search the corresponding url for a given beamline name
// @param: beamline, the beamline name
// @param: date, the date the experiment was performed. (Date Object)
// @return the url of the beamLine, "noLink" if it is not found
DOIController.prototype.findsUrl = function(beamline, date){
var result = "noLink";
var i = 0;
while(BEAMLINEURL[i] && result === "noLink") {
var startDate = new Date(BEAMLINEURL[i].startDate);
var endDate = new Date(BEAMLINEURL[i].endDate);
if (BEAMLINEURL[i].name.toLowerCase() === beamline.toLowerCase() &&
date > startDate &&
date < endDate
) {
result = BEAMLINEURL[i].url;
}
i++;
}
return result;
};
//HELPER FUNCTIONS
......
......@@ -13,3 +13,16 @@ DOIView.prototype.setLoading = function(message) {
DOIView.prototype.setDOI = function(doi) {
$("#doiPanel").html(doi);
};
DOIView.prototype.displayMessage = function(template, message, id){
dust.render(
template,
{
message : message
},
function(err, out) {
$("#" + id).html(out);
}
);
};
\ No newline at end of file
<div class="container-fluid">
<div class="container-fluid " style="color:black;">
<div class="row">
<div class="col-12 text-center" > <h2> Not found </h2> </div>
</div>
<div class="row">
<div class="col-3" > </div>
<div class="col-6 lightRedBackground text-center" >
<div class="col lightRedBackground text-center rounded" style="border: 10px" >
<p> {message|s} </p>
</div>
<div class="col-3" > </div>
</div>
</div>
{message|s}
\ No newline at end of file
......@@ -52,7 +52,11 @@
<div class="card-header text-center">
<label>Beamline </label>
</div>
<div class="card-body text-center">{data.beamline}</div>
{@eq key=data.beamlineUrl value="noLink"}
<div class="card-body text-center"> {data.beamline} </div>
{:else}
<div class="card-body text-center"><a href="{data.beamlineUrl}"> {data.beamline} </a> </div>
{/eq}
</div>
</div>
</div>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ESRF landing page</title>
<head>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"
integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ"
crossorigin="anonymous">
<link
rel="stylesheet"
href="/min/output.min.css">
<script type="text/javascript">
function redirectDoiLandingPage(){
var doiName = window.document.getElementById("doiSearchBox").value;
window.open("https://doi.esrf.fr/" + doiName, "_self");
}
</script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-12 col-sm-4 blueBackground">
<img
id="logo"
style="height: 80px;"
src="/src/images/esrfLogo.png"
alt="the ESRF logo"> </img>
</div>
<div class="col-12 col-sm-8 blueBackground flex"></div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div
class="col-12 flexCentered whiteFont"
style="color:#132577; font-size: 4rem; height: 200px; margin-top: 10px; margin-bottom: 10px;">ESRF Data Portal</div>
<div class="col-12 flexCentered whiteFont" style="color:#132577; font-size: 4rem; height: 200px; margin-top: 10px; margin-bottom: 10px;">ESRF Data Portal</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-4">
......@@ -66,30 +27,30 @@ function redirectDoiLandingPage(){
<h2>DOI resolver</h2>
</div>
<div class="card-body padding10">
The search engine below only finds DOI which have been minted at ESRF. </br> Use <a href="https://doi.org">
doi.org </a> search engine for any other DOI.
</p>
<p>
<input
id="doiSearchBox"
type="text"
value="10.5072/..." /> <input
type="submit"
value="Search"
onclick="redirectDoiLandingPage()" />
The search engine below only finds DOI which have been minted at ESRF. </br> Use <a href="https://doi.org">
doi.org </a> search engine for any other DOI.
</p>
</div>
<div class="row">
<div class="col-xl-9 padding-0">
<input id="doiSearchBox" class="form-control" placeholder="10.5072/..." type="text" required/>
<div class="text-danger" id="error"> </div>
</div>
<div class="col padding-0">
<input class="btn btn-primary" type="submit" value="Search" onclick="searchDOI()" />
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-4">
<div class="padding10">
<div class="card-header text-center">
<h2>About DOI</h2>
</div>
<div class="card-body padding10">
The Digital Object Identifier (DOI) is a code composed of digits and characters. It identifies data in a
The Digital Object Identifier (<a href="https://www.doi.org/">DOI</a>) is a code composed of digits and characters. It identifies data in a
unique and perennial way thus referencing this data worldwide. The DOI has two parts namely the DOI prefix
and the DOI suffix separated by a slash ("/") as depicted below :
</p>
......@@ -99,26 +60,4 @@ function redirectDoiLandingPage(){
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-6">
<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>
</div>
</footer>
</body>
</html>
\ No newline at end of file
</div>
\ No newline at end of file
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">