diff --git a/www/min/doi.min.js b/www/min/doi.min.js index f7ee0e8be75f645dbea38d2c8593b63300b68737..2cac955cae8963c2f140afb8fb891978f7849ef1 100644 --- a/www/min/doi.min.js +++ b/www/min/doi.min.js @@ -1 +1 @@ -function Author(){}function Citation(e){this.isBuildable=!!(e&&e.creator&&0!==e.creator.length&&e.date_registered&&e.title&&e.publisher&&e.doi)}function DOIController(e){var t=this;this.doiServer="https://data.datacite.org/",this.acceptedPrefix=["10.5072","10.15151"],this.view=e,this.experimentalReportController=new ExperimentalReportController,this.experimentalReportController.onSuccess.attach(function(e,r){t.view.renderExperimentalReportData(r)}),this.experimentalReportController.onError.attach(function(e,r){console.log("Error when retrieving fileList from SMIS."),t.view.renderErrorForExperimentalReport()})}function DoiData(e,t,r,n,i,a){this.title=e,this.doi=t,this.dataciteLink=r,this.publisher=n,this.creator=i,this.publiclyAccessibleYear=a}function DOIView(){this.mainPanelId="main",this.reportPanelId="expReport",this.badgePanelId="badges",this.metadataDivId="metadata",this.reportExperimentFileNames=null,this.failedRecievingExpReport=!1,this.isDOIAlreadyRendered=!1,this.onDOIRendered=new Event(this)}function Event(e){this._sender=e,this._listeners=[]}function ExperimentalReportController(){this.server="https://wwws.esrf.fr/misapps/SMISServer/rest/reports/fileNames",this.timeout=5e3,this.onSuccess=new Event(this),this.onError=new Event(this)}function JsonExtractor(e){}function proposalBeamlineTable(e,t,r,n){var i=n.mergedProposalBeamlines;if(e.write(''),e.write(""),e.write(""),e.write(''),e.write(''),e.write(""),e.write(""),e.write(""),i){for(var a=0;a"),e.write(""),"noLink"===l?e.write(""):e.write('"),e.write("")}else e.write(""),chunck.write(""),chunck.write(""),e.write("");return e.write(""),e.write("
ProposalsBeamlines
"+o+""+s+" '+s+"
unknown unknown
"),e.render(r.block,t)}}function abstract(e,t,r,n){var i=n.abstract;return e.write('
'),e.write(""),e.write('
'),i?e.write(i):e.write("There is no abstract for this session."),e.write("
"),e.write("
"),e.render(r.block,t)}Author.prototype.setFirstName=function(e){this.firstName=e},Author.prototype.setFamilyName=function(e){this.familyName=e},Author.prototype.setSingleName=function(e){this.singleName=e},Author.prototype.getRawFamilyName=function(){if(this.familyName)return this.familyName;if(this.singleName){var e=new RegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)return this.familyName=t[1],this.familyName;var r=new RegExp(/\s([^a-z]+$)/).exec(this.singleName);return r&&(this.familyName=r[1]),this.familyName}},Author.prototype.getRawFirstName=function(){if(this.firstName)return this.firstName;if(this.singleName){var e=new RegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)return this.firstName=t[0],this.firstName;var r=new RegExp(/^(.[^A-Z]+)+\b/).exec(this.singleName);return r&&(this.firstName=r[0]),r}},Author.prototype.getTitleCaseFamilyName=function(){if(this.familyName){allLowerCase=this.familyName.toLowerCase();var e=new RegExp(/^./);return allLowerCase.replace(e,function(e){return e.toUpperCase()})}return console.log("family name is undefined"),null},Author.prototype.getFirstNameInitials=function(){var e=new RegExp(/(\S+)/g);return this.firstName?this.firstName.replace(e,function(e){return e.charAt(0)+"."}):(console.log("first name is undefined"),null)};var BEAMLINEURL=[{name:"BM05",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/BM05"},{name:"BM29",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/BM29"},{name:"CM01",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/CM01.html"},{name:"ID01",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID01"},{name:"ID06",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MEx/id06-large-volume-press.html"},{name:"ID11",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/StructMaterials/ID11"},{name:"ID16A",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16A"},{name:"ID16B",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16B"},{name:"ID17",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/CBS/ID17"},{name:"ID19",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/home/UsersAndScience/Experiments/StructMaterials/ID19.html"},{name:"ID21",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID21"},{name:"ID22",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/id22"},{name:"ID23-1",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-1"},{name:"ID23-2",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-2"},{name:"ID29",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/Beamlines/content/content/id29.html"},{name:"ID30A1",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/MASSIF1"},{name:"ID30A3",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/id30a-3--massif-3.html"},{name:"ID30B",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/id30b"},{name:"ID32",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/ID32"}];Citation.prototype.getAuthorsForCitation=function(e){if(this.isBuildable){var t=_.transform(e,function(e,t,r,n){n instanceof Array||(t=n);var i=null;if(t.givenName?((i=new Author).setFamilyName(t.familyName),i.setFirstName(t.givenName),e.push(i.getTitleCaseFamilyName()+" "+i.getFirstNameInitials())):((i=new Author).setSingleName(t.name),i.getRawFamilyName()&&i.getRawFirstName()?e.push(i.getTitleCaseFamilyName()+" "+i.getFirstNameInitials()):e.push(t.name)),!(n instanceof Array))return!1},[]);return _.join(t,", ")}return console.log("the author list for the citation could not be generated."),""};var CONSTANTS={ES_RESOURCE_TYPE:"experimental session resource type",DC_RESOURCE_TYPE:"dataset collection resource type"};DOIController.prototype.isValidDOIData=function(e){return _.keysIn(e).length>3&&_.find(_.keysIn(e),function(e){return"title"===e}).length>0},DOIController.prototype.getData=function(e){var t=this;this.view.setDOIInTopBanner(e),this.hasAcceptedPrefix(e)?$.ajax({headers:{Accept:"application/vnd.datacite.datacite+json"},type:"GET",timeout:15e3,url:this.doiServer+e,beforeSend:function(){t.view.setLoading("Retrieving data from Server")},complete:function(){t.view.setLoading(!1)}}).done(function(r){if(r)if(t.isValidDOIData(r)){var n=new DoiData(r.title,r.doi.toUpperCase(),t.doiServer+e,r.publisher,r.creator,r.publication_year),i=new JsonExtractor;n.abstract=i.getAbstract(r),n.investigationId=i.extractInvestigationId(r),n.mintingYear=i.getMintingYear(r),n.proposalType=i.getFieldFromSubject(r.subject,"Proposal Type Description"),n.resourceType=i.getResourceType(r),n.resourceTypeGeneral=i.getResourceTypeGeneral(r),n.sessionDate=i.getSessionDate(r);var a=i.getFieldFromSubject(r.subject,"Proposal"),o=i.getFieldFromSubject(r.subject,"Instrument");t.experimentalReportController.requestFilenameList(a[0]),n.accessibility=n.getAccessibilityStatus(n.resourceType,n.sessionDate,n.publiclyAccessibleYear),n.accessMessage=t.view.setDataAccessMessage(n),n.citation=t.createCitation(r),n.resourceType===CONSTANTS.ES_RESOURCE_TYPE&&(n.beamlineUrls=t.getBeamlineUrl(o,r.date_collected,n.resourceType)),n.resourceType===CONSTANTS.DC_RESOURCE_TYPE&&(n.beamlineUrls=t.getBeamlineUrl(o,r.publication_year,n.resourceType)),n.mergedProposalBeamlines=i.getMergedProposalAndBeamline(a,o,n.beamlineUrls),t.view.renderDOIData(n)}else t.view.renderError("Not Found",t.origin)}).fail(function(e,r,n){t.view.renderError(e,n,t.origin),t.view.setLoading(!1)}):t.view.renderError("Bad Prefix",t.origin)},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_tpl",{},function(e,t){$("#main").html(t)}),"index"===this.origin&&this.getData(e)},DOIController.prototype.setOrigin=function(e){this.origin=e},DOIController.prototype.getBeamlineUrl=function(e,t,r){var n=[];return e.forEach(function(e){if(t){r===CONSTANTS.ES_RESOURCE_TYPE&&(t=moment(t)),r===CONSTANTS.DC_RESOURCE_TYPE&&(t=moment(t,"YYYY"));for(var i="",a=0;a=o&&t<=s){i=BEAMLINEURL[a].url;break}}""===i?n.push("noLink"):n.push(i)}else n.push("noLink")}),n},DOIController.prototype.createCitation=function(e){var t=new Citation(e);if(t.isBuildable){return t.getAuthorsForCitation(e.creator)+" ("+moment(e.date_registered).year()+"). "+e.title+". "+e.publisher+" (ESRF). doi:"+e.doi.toUpperCase()+""}return"The citation could not be generated."},DoiData.prototype.getAccessibilityStatus=function(e,t,r){if(e)if(e===CONSTANTS.ES_RESOURCE_TYPE){if(r&&t){var n=moment(r,"YYYY"),i=moment();if(i>n)return"Open access";if(i<=n)return"Restricted access"}}else if(e===CONSTANTS.DC_RESOURCE_TYPE)return"Open access";return console.log("Failed to determine whether the accessibility of the DOI."),"Accessibility status could not be determined"},DOIView.prototype.setLoading=function(e){0!=e?$("body").addClass("loading"):$("body").removeClass("loading")},DOIView.prototype.setDOIInTopBanner=function(e){$("#doiValue").text("DOI > "+e.toUpperCase())},DOIView.prototype.renderExperimentalReportData=function(e){if(e){var t=this;this.isDOIAlreadyRendered?dust.render("experimentalreport_tpl",{data:e},function(e,r){$("#"+t.reportPanelId).html(r)}):this.reportExperimentFileNames=e}},DOIView.prototype.renderDOIData=function(e){var t=this;dust.render("landingpage_tpl",{data:e},function(r,n){$("#"+t.mainPanelId).html(n),t.isDOIAlreadyRendered=!0,t.renderBadges(e),t.renderMetadata(e),t.failedRecievingExpReport?t.renderErrorForExperimentalReport():t.reportExperimentFileNames&&t.renderExperimentalReportData(t.reportExperimentFileNames)})},DOIView.prototype.renderError=function(e,t,r){var n="welcome-page"===r?"doinotfound2_tpl":"doinotfound_tpl",i="";i="Bad Prefix"===t?"welcome-page"===r?'

Not found !

The DOI was not found at ESRF because its prefix is not ESRF specific. Please use the DOI search engine at doi.org.

':'

Not found !

The DOI was not found at ESRF because its prefix is not ESRF specific.
Please use the DOI search engine at doi.org.

':"Not Found"===t?"welcome-page"===r?"

Not found !

Sorry, the requested DOI was not found.

":"

Not found !

Sorry, the requested DOI was not found.

":"timeout"===t?"welcome-page"===r?"

Not found !

Sorry, the server took too long to reply. Try again later.

":"

Not found !

Sorry, the server took too long to reply. Try again later.

":""===t&&"The resource you are looking for doesn't exist."===e.responseText?"welcome-page"===r?"

Not found !

It may take up to 24 hours for a newly generated DOI to become available. Please try again later.

":"

Not found !

It may take up to 24 hours for a newly generated DOI to become available. Please try again later.

":"welcome-page"===r?"

Not found !

Connexion problem to the datacite server. Please try again later.

":"

Not found !

Connexion problem to the datacite server. Please try again later.

",dust.render(n,{message:i},function(e,t){$("#error").html(t)})},DOIView.prototype.renderErrorForExperimentalReport=function(){this.failedRecievingExpReport=!0;$("#"+this.reportPanelId).html('

The filename list is not available.

')},DOIView.prototype.renderBadges=function(e){if(e){var t=this;dust.render("badges_tpl",{data:e,constants:CONSTANTS},function(e,r){$("#"+t.badgePanelId).html(r)})}},DOIView.prototype.renderMetadata=function(e){if(e){var t=this;dust.render("metadata_tpl",{data:e,constants:CONSTANTS},function(e,r){$("#"+t.metadataDivId).html(r)})}},DOIView.prototype.setDataAccessMessage=function(e){return"Open access"===e.accessibility?"The data can be accessed by clicking on the link below":"Restricted access"===e.accessibility?"The data are under embargo until "+e.publiclyAccessibleYear+" but could be released earlier. Currently, they are only accessible to proposal team members.":void 0},Event.prototype={attach:function(e){this._listeners.push(e)},notify:function(e){for(var t=0;t'),e.write(""),e.write(""),e.write('Proposals'),e.write('Beamlines'),e.write(""),e.write(""),e.write(""),i){for(var a=0;a"),e.write(""+o+""),"noLink"===l?e.write(""+s+""):e.write(' '+s+" "),e.write("")}else e.write(""),chunck.write(" unknown "),chunck.write(" unknown "),e.write("");return e.write(""),e.write(""),e.render(r.block,t)}}function abstract(e,t,r,n){var i=n.abstract;return e.write('
'),e.write(""),e.write('
'),i?e.write(i):e.write("There is no abstract for this session."),e.write("
"),e.write("
"),e.render(r.block,t)}Author.prototype.setFirstName=function(e){this.firstName=e},Author.prototype.setFamilyName=function(e){this.familyName=e},Author.prototype.setSingleName=function(e){this.singleName=e},Author.prototype.getRawFamilyName=function(){if(this.familyName)return this.familyName;if(this.singleName){var e=new RegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)return this.familyName=t[1],this.familyName;var r=new RegExp(/\s([^a-z]+$)/).exec(this.singleName);return r&&(this.familyName=r[1]),this.familyName}},Author.prototype.getRawFirstName=function(){if(this.firstName)return this.firstName;if(this.singleName){var e=new RegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)return this.firstName=t[0],this.firstName;var r=new RegExp(/^(.[^A-Z]+)+\b/).exec(this.singleName);return r&&(this.firstName=r[0]),r}},Author.prototype.getTitleCaseFamilyName=function(){if(this.familyName){allLowerCase=this.familyName.toLowerCase();var e=new RegExp(/^./);return allLowerCase.replace(e,function(e){return e.toUpperCase()})}return console.log("family name is undefined"),null},Author.prototype.getFirstNameInitials=function(){var e=new RegExp(/(\S+)/g);return this.firstName?this.firstName.replace(e,function(e){return e.charAt(0)+"."}):(console.log("first name is undefined"),null)};var BEAMLINEURL=[{name:"BM05",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/BM05"},{name:"BM29",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/BM29"},{name:"CM01",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/CM01.html"},{name:"ID01",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID01"},{name:"ID06",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MEx/id06-large-volume-press.html"},{name:"ID11",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/StructMaterials/ID11"},{name:"ID16A",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16A"},{name:"ID16B",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16B"},{name:"ID17",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/CBS/ID17"},{name:"ID19",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/home/UsersAndScience/Experiments/StructMaterials/ID19.html"},{name:"ID21",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID21"},{name:"ID22",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/id22"},{name:"ID23-1",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-1"},{name:"ID23-2",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-2"},{name:"ID29",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/Beamlines/content/content/id29.html"},{name:"ID30A1",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/MASSIF1"},{name:"ID30A3",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/id30a-3--massif-3.html"},{name:"ID30B",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/id30b"},{name:"ID32",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/ID32"}];Citation.prototype.getAuthorsForCitation=function(e){if(this.isBuildable){var t=_.transform(e,function(e,t,r,n){n instanceof Array||(t=n);var i=null;if(t.givenName?((i=new Author).setFamilyName(t.familyName),i.setFirstName(t.givenName),e.push(i.getTitleCaseFamilyName()+" "+i.getFirstNameInitials())):((i=new Author).setSingleName(t.name),i.getRawFamilyName()&&i.getRawFirstName()?e.push(i.getTitleCaseFamilyName()+" "+i.getFirstNameInitials()):e.push(t.name)),!(n instanceof Array))return!1},[]);return _.join(t,", ")}return console.log("the author list for the citation could not be generated."),""};var CONSTANTS={ES_RESOURCE_TYPE:"experimental session resource type",DC_RESOURCE_TYPE:"dataset collection resource type"};DOIController.prototype.isValidDOIData=function(e){return _.keysIn(e).length>3&&_.find(_.keysIn(e),function(e){return"title"===e}).length>0},DOIController.prototype.getData=function(e){var t=this;this.view.setDOIInTopBanner(e),this.hasAcceptedPrefix(e)?$.ajax({headers:{Accept:"application/vnd.datacite.datacite+json"},type:"GET",timeout:15e3,url:this.doiServer+e,beforeSend:function(){t.view.setLoading("Retrieving data from Server")},complete:function(){t.view.setLoading(!1)}}).done(function(r){if(r)if(t.isValidDOIData(r)){var n=new DoiData(r.title,r.doi.toUpperCase(),t.doiServer+e,r.publisher,r.creator,r.publication_year),i=new JsonExtractor;n.abstract=i.getAbstract(r),n.investigationId=i.getInvestigationId(r),n.mintingYear=i.getMintingYear(r),n.proposalType=i.getFieldFromSubject(r.subject,"Proposal Type Description"),n.resourceType=i.getResourceType(r),n.resourceTypeGeneral=i.getResourceTypeGeneral(r),n.sessionDate=i.getSessionDate(r);var a=i.getFieldFromSubject(r.subject,"Proposal"),o=i.getFieldFromSubject(r.subject,"Instrument");t.experimentalReportController.requestFilenameList(a[0]),n.accessibility=n.getAccessibilityStatus(n.resourceType,n.sessionDate,n.publiclyAccessibleYear),n.accessMessage=t.view.setDataAccessMessage(n),n.citation=t.createCitation(r),n.resourceType===CONSTANTS.ES_RESOURCE_TYPE&&(n.beamlineUrls=t.getBeamlineUrl(o,r.date_collected,n.resourceType)),n.resourceType===CONSTANTS.DC_RESOURCE_TYPE&&(n.beamlineUrls=t.getBeamlineUrl(o,r.publication_year,n.resourceType)),n.mergedProposalBeamlines=i.getMergedProposalAndBeamline(a,o,n.beamlineUrls),t.view.renderDOIData(n)}else t.view.renderError("Not Found",t.origin)}).fail(function(e,r,n){t.view.renderError(e,n,t.origin),t.view.setLoading(!1)}):t.view.renderError("Bad Prefix",t.origin)},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_tpl",{},function(e,t){$("#main").html(t)}),"index"===this.origin&&this.getData(e)},DOIController.prototype.setOrigin=function(e){this.origin=e},DOIController.prototype.getBeamlineUrl=function(e,t,r){var n=[];return e.forEach(function(e){if(t){r===CONSTANTS.ES_RESOURCE_TYPE&&(t=moment(t)),r===CONSTANTS.DC_RESOURCE_TYPE&&(t=moment(t,"YYYY"));for(var i="",a=0;a=o&&t<=s){i=BEAMLINEURL[a].url;break}}""===i?n.push("noLink"):n.push(i)}else n.push("noLink")}),n},DOIController.prototype.createCitation=function(e){var t=new Citation(e);if(t.isBuildable){return t.getAuthorsForCitation(e.creator)+" ("+moment(e.date_registered).year()+"). "+e.title+". "+e.publisher+" (ESRF). doi:"+e.doi.toUpperCase()+""}return"The citation could not be generated."},DoiData.prototype.getAccessibilityStatus=function(e,t,r){if(e)if(e===CONSTANTS.ES_RESOURCE_TYPE){if(r&&t){var n=moment(r,"YYYY"),i=moment();if(i>n)return"Open access";if(i<=n)return"Restricted access"}}else if(e===CONSTANTS.DC_RESOURCE_TYPE)return"Open access";return console.log("Failed to determine whether the accessibility of the DOI."),"Accessibility status could not be determined"},DOIView.prototype.setLoading=function(e){0!=e?$("body").addClass("loading"):$("body").removeClass("loading")},DOIView.prototype.setDOIInTopBanner=function(e){$("#doiValue").text("DOI > "+e.toUpperCase())},DOIView.prototype.renderExperimentalReportData=function(e){if(e){var t=this;this.isDOIAlreadyRendered?dust.render("experimentalreport_tpl",{data:e},function(e,r){$("#"+t.reportPanelId).html(r)}):this.reportExperimentFileNames=e}},DOIView.prototype.renderDOIData=function(e){var t=this;dust.render("landingpage_tpl",{data:e,constants:CONSTANTS},function(r,n){$("#"+t.mainPanelId).html(n),t.isDOIAlreadyRendered=!0,t.renderBadges(e),t.renderMetadata(e),t.failedRecievingExpReport?t.renderErrorForExperimentalReport():t.reportExperimentFileNames&&t.renderExperimentalReportData(t.reportExperimentFileNames)})},DOIView.prototype.renderError=function(e,t,r){var n="welcome-page"===r?"doinotfound2_tpl":"doinotfound_tpl",i="";i="Bad Prefix"===t?"welcome-page"===r?'

Not found !

The DOI was not found at ESRF because its prefix is not ESRF specific. Please use the DOI search engine at doi.org.

':'

Not found !

The DOI was not found at ESRF because its prefix is not ESRF specific.
Please use the DOI search engine at doi.org.

':"Not Found"===t?"welcome-page"===r?"

Not found !

Sorry, the requested DOI was not found.

":"

Not found !

Sorry, the requested DOI was not found.

":"timeout"===t?"welcome-page"===r?"

Not found !

Sorry, the server took too long to reply. Try again later.

":"

Not found !

Sorry, the server took too long to reply. Try again later.

":""===t&&"The resource you are looking for doesn't exist."===e.responseText?"welcome-page"===r?"

Not found !

It may take up to 24 hours for a newly generated DOI to become available. Please try again later.

":"

Not found !

It may take up to 24 hours for a newly generated DOI to become available. Please try again later.

":"welcome-page"===r?"

Not found !

Connexion problem to the datacite server. Please try again later.

":"

Not found !

Connexion problem to the datacite server. Please try again later.

",dust.render(n,{message:i},function(e,t){$("#error").html(t)})},DOIView.prototype.renderErrorForExperimentalReport=function(){this.failedRecievingExpReport=!0;$("#"+this.reportPanelId).html('

The filename list is not available.

')},DOIView.prototype.renderBadges=function(e){if(e){var t=this;dust.render("badges_tpl",{data:e,constants:CONSTANTS},function(e,r){$("#"+t.badgePanelId).html(r)})}},DOIView.prototype.renderMetadata=function(e){if(e){var t=this;dust.render("metadata_tpl",{data:e,constants:CONSTANTS},function(e,r){$("#"+t.metadataDivId).html(r)})}},DOIView.prototype.setDataAccessMessage=function(e){return"Open access"===e.accessibility?"The data can be accessed by clicking on the link below":"Restricted access"===e.accessibility?"The data are under embargo until "+e.publiclyAccessibleYear+" but could be released earlier. Currently, they are only accessible to proposal team members.":void 0},Event.prototype={attach:function(e){this._listeners.push(e)},notify:function(e){for(var t=0;t

").f(ctx.get(["message"], false),ctx,"h",["s"]).w("

");}body_0.__dustBody=!0;return body_0}(dust)); (function(dust){dust.register("doinotfound2_tpl",body_0);function body_0(chk,ctx){return chk.f(ctx.get(["message"], false),ctx,"h",["s"]);}body_0.__dustBody=!0;return body_0}(dust)); (function(dust){dust.register("experimentalreport_tpl",body_0);function body_0(chk,ctx){return chk.w("
").x(ctx.get(["data"], false),ctx,{"else":body_1,"block":body_2},{});}body_0.__dustBody=!0;function body_1(chk,ctx){return chk.w("

There is currently no experimental report.

");}body_1.__dustBody=!0;function body_2(chk,ctx){return chk.h("eq",ctx,{"block":body_3},{"key":ctx.getPath(false, ["data","length"]),"value":1},"h").h("gt",ctx,{"block":body_4},{"key":ctx.getPath(false, ["data","length"]),"value":1},"h").w(" ");}body_2.__dustBody=!0;function body_3(chk,ctx){return chk.w("

One report has been found for this proposal.

");}body_3.__dustBody=!0;function body_4(chk,ctx){return chk.w("

In total, ").f(ctx.getPath(false, ["data","length"]),ctx,"h").w(" reports have been found for this proposal:

").s(ctx.get(["data"], false),ctx,{"block":body_5},{}).w("
");}body_4.__dustBody=!0;function body_5(chk,ctx){return chk.w(" ").h("sep",ctx,{"block":body_6},{},"h").h("last",ctx,{"block":body_7},{},"h");}body_5.__dustBody=!0;function body_6(chk,ctx){return chk.w("
");}body_6.__dustBody=!0;function body_7(chk,ctx){return chk.w("
");}body_7.__dustBody=!0;return body_0}(dust)); -(function(dust){dust.register("landingpage_tpl",body_0);function body_0(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","title"]),ctx,"h").w("
").s(ctx.getPath(false, ["data","creator"]),ctx,{"block":body_1},{}).w("



").f(ctx.getPath(false, ["data","accessMessage"]),ctx,"h",["s"]).w("


Below is the recommended format for citing this work in a research publication.

").f(ctx.getPath(false, ["data","citation"]),ctx,"h",["s"]).w("
");}body_0.__dustBody=!0;function body_1(chk,ctx){return chk.h("sep",ctx,{"block":body_2},{},"h").h("last",ctx,{"block":body_5},{},"h");}body_1.__dustBody=!0;function body_2(chk,ctx){return chk.x(ctx.getPath(true, ["givenName"]),ctx,{"else":body_3,"block":body_4},{});}body_2.__dustBody=!0;function body_3(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["name"]),ctx,"h").w(" ; ");}body_3.__dustBody=!0;function body_4(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["givenName"]),ctx,"h").w(" ").f(ctx.getPath(true, ["familyName"]),ctx,"h").w(" ; ");}body_4.__dustBody=!0;function body_5(chk,ctx){return chk.x(ctx.getPath(true, ["givenName"]),ctx,{"else":body_6,"block":body_7},{});}body_5.__dustBody=!0;function body_6(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["name"]),ctx,"h").w(". ");}body_6.__dustBody=!0;function body_7(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["givenName"]),ctx,"h").w(" ").f(ctx.getPath(true, ["familyName"]),ctx,"h").w(". ");}body_7.__dustBody=!0;return body_0}(dust)); +(function(dust){dust.register("landingpage_tpl",body_0);function body_0(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","title"]),ctx,"h").w("
").s(ctx.getPath(false, ["data","creator"]),ctx,{"block":body_1},{}).w("



").f(ctx.getPath(false, ["data","accessMessage"]),ctx,"h",["s"]).w("

").f(ctx.getPath(false, ["data","resourceType"]),ctx,"h").f(ctx.getPath(false, ["constants","ES_RESOURCE_TYPE"]),ctx,"h").h("eq",ctx,{"else":body_8,"block":body_9},{"key":ctx.getPath(false, ["data","resourceType"]),"value":ctx.getPath(false, ["constants","ES_RESOURCE_TYPE"])},"h").w("

Below is the recommended format for citing this work in a research publication.

").f(ctx.getPath(false, ["data","citation"]),ctx,"h",["s"]).w("
");}body_0.__dustBody=!0;function body_1(chk,ctx){return chk.h("sep",ctx,{"block":body_2},{},"h").h("last",ctx,{"block":body_5},{},"h");}body_1.__dustBody=!0;function body_2(chk,ctx){return chk.x(ctx.getPath(true, ["givenName"]),ctx,{"else":body_3,"block":body_4},{});}body_2.__dustBody=!0;function body_3(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["name"]),ctx,"h").w(" ; ");}body_3.__dustBody=!0;function body_4(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["givenName"]),ctx,"h").w(" ").f(ctx.getPath(true, ["familyName"]),ctx,"h").w(" ; ");}body_4.__dustBody=!0;function body_5(chk,ctx){return chk.x(ctx.getPath(true, ["givenName"]),ctx,{"else":body_6,"block":body_7},{});}body_5.__dustBody=!0;function body_6(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["name"]),ctx,"h").w(". ");}body_6.__dustBody=!0;function body_7(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["givenName"]),ctx,"h").w(" ").f(ctx.getPath(true, ["familyName"]),ctx,"h").w(". ");}body_7.__dustBody=!0;function body_8(chk,ctx){return chk.w("
");}body_8.__dustBody=!0;function body_9(chk,ctx){return chk.w("");}body_9.__dustBody=!0;return body_0}(dust)); (function(dust){dust.register("metadata_tpl",body_0);function body_0(chk,ctx){return chk.h("eq",ctx,{"block":body_1},{"key":ctx.getPath(false, ["data","resourceType"]),"value":ctx.getPath(false, ["constants","ES_RESOURCE_TYPE"])},"h").h("eq",ctx,{"block":body_17},{"key":ctx.getPath(false, ["data","resourceType"]),"value":ctx.getPath(false, ["constants","DC_RESOURCE_TYPE"])},"h").w(" ");}body_0.__dustBody=!0;function body_1(chk,ctx){return chk.w("
").x(ctx.getPath(false, ["data","mergedProposalBeamlines"]),ctx,{"block":body_2},{}).w("

").h("abstract",ctx,{"block":body_16},{"abstract":ctx.getPath(false, ["data","abstract"])},"h").w("
");}body_1.__dustBody=!0;function body_2(chk,ctx){return chk.x(ctx.getPath(false, ["data","mergedProposalBeamlines","0"]),ctx,{"block":body_3},{});}body_2.__dustBody=!0;function body_3(chk,ctx){return chk.w("
").x(ctx.getPath(false, ["data","mergedProposalBeamlines","0","proposal"]),ctx,{"else":body_4,"block":body_5},{}).w("
").x(ctx.getPath(false, ["data","mintingYear"]),ctx,{"else":body_6,"block":body_7},{}).w("
").x(ctx.getPath(false, ["data","mergedProposalBeamlines","0","beamline"]),ctx,{"else":body_8,"block":body_9},{}).w("
").x(ctx.getPath(false, ["data","sessionDate"]),ctx,{"else":body_12,"block":body_13},{}).w("
").x(ctx.getPath(false, ["data","proposalType"]),ctx,{"else":body_14,"block":body_15},{}).w("
");}body_3.__dustBody=!0;function body_4(chk,ctx){return chk.w("
Not available
");}body_4.__dustBody=!0;function body_5(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","mergedProposalBeamlines","0","proposal"]),ctx,"h").w("
");}body_5.__dustBody=!0;function body_6(chk,ctx){return chk.w("
Not available
");}body_6.__dustBody=!0;function body_7(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","mintingYear"]),ctx,"h").w("
");}body_7.__dustBody=!0;function body_8(chk,ctx){return chk.w("
Not available
");}body_8.__dustBody=!0;function body_9(chk,ctx){return chk.h("eq",ctx,{"else":body_10,"block":body_11},{"key":ctx.getPath(false, ["data","mergedProposalBeamlines","0","beamlineUrl"]),"value":"noLink"},"h");}body_9.__dustBody=!0;function body_10(chk,ctx){return chk.w("");}body_10.__dustBody=!0;function body_11(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","mergedProposalBeamlines","0","beamline"]),ctx,"h").w("
");}body_11.__dustBody=!0;function body_12(chk,ctx){return chk.w("
Not available
");}body_12.__dustBody=!0;function body_13(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","sessionDate"]),ctx,"h").w("
");}body_13.__dustBody=!0;function body_14(chk,ctx){return chk.w("
Not available
");}body_14.__dustBody=!0;function body_15(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","proposalType"]),ctx,"h").w("
");}body_15.__dustBody=!0;function body_16(chk,ctx){return chk.w(" ");}body_16.__dustBody=!0;function body_17(chk,ctx){return chk.w("
").h("abstract",ctx,{"block":body_18},{"abstract":ctx.getPath(false, ["data","abstract"])},"h").w("
").h("proposalBeamlineTable",ctx,{"block":body_19},{"mergedProposalBeamlines":ctx.getPath(false, ["data","mergedProposalBeamlines"])},"h").w("
").x(ctx.getPath(false, ["data","mintingYear"]),ctx,{"else":body_20,"block":body_21},{}).w("
");}body_17.__dustBody=!0;function body_18(chk,ctx){return chk.w(" ");}body_18.__dustBody=!0;function body_19(chk,ctx){return chk.w(" ");}body_19.__dustBody=!0;function body_20(chk,ctx){return chk.w("
Not available
");}body_20.__dustBody=!0;function body_21(chk,ctx){return chk.w("
").f(ctx.getPath(false, ["data","mintingYear"]),ctx,"h").w("
");}body_21.__dustBody=!0;return body_0}(dust)); (function(dust){dust.register("welcome_tpl",body_0);function body_0(chk,ctx){return chk.w("
ESRF DOI Portal

About the portal

This page centralizes the DOI 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 icat.esrf.fr.

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

DOI resolver

The search engine below only searches DOIs which have been minted at the ESRF.
Use doi.org search engine for other DOIs.

About DOI

The Digital Object Identifier (DOI) 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:

ESRF-ES - for a session at the ESRF 
Refer to the DOI concepts page to find out what a session is.
");}body_0.__dustBody=!0;return body_0}(dust)); \ No newline at end of file diff --git a/www/src/doicontroller.js b/www/src/doicontroller.js index e80a4dcd0d49580c54885bb463f375d075f623a9..c1d97e79337564aced26f57e1f43d71830ae3e42 100644 --- a/www/src/doicontroller.js +++ b/www/src/doicontroller.js @@ -3,7 +3,6 @@ function DOIController(view) { // 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"]; @@ -68,7 +67,7 @@ DOIController.prototype.getData = function (doi) { var jsonExtractor = new JsonExtractor(); doiData.abstract = jsonExtractor.getAbstract(data); - doiData.investigationId = jsonExtractor.extractInvestigationId(data); + doiData.investigationId = jsonExtractor.getInvestigationId(data); doiData.mintingYear = jsonExtractor.getMintingYear(data); doiData.proposalType = jsonExtractor.getFieldFromSubject(data.subject, "Proposal Type Description"); doiData.resourceType = jsonExtractor.getResourceType(data); diff --git a/www/src/doiview.js b/www/src/doiview.js index a7a8aec7353a08c2b12a086d04e2c8a665446d74..50b001a0cebfc7c15a31650c055d0f3550cd3fed 100644 --- a/www/src/doiview.js +++ b/www/src/doiview.js @@ -54,7 +54,8 @@ DOIView.prototype.renderExperimentalReportData = function (data) { DOIView.prototype.renderDOIData = function (doiData) { var _this = this; dust.render('landingpage_tpl', { - data: doiData + data: doiData, + constants : CONSTANTS }, function (err, out) { $('#' + _this.mainPanelId).html(out); _this.isDOIAlreadyRendered = true; diff --git a/www/src/jsonextractor.js b/www/src/jsonextractor.js index 4eb78855923b2c14f2300ab0d052dadc3ce4ab8d..bf22330823cab10075f1237e9f0f11c6d214048e 100644 --- a/www/src/jsonextractor.js +++ b/www/src/jsonextractor.js @@ -7,9 +7,12 @@ function JsonExtractor(json) { * @param {string} data The data object provided by datacite * @return {string} investigationId The investigationID requested for accessing data in ICAT. */ -JsonExtractor.prototype.extractInvestigationId = function (data) { +JsonExtractor.prototype.getInvestigationId = function (data) { var regExp = RegExp(/\/\w*-*[Ee][Ss][Rr][Ff]-[Ee][Ss]-(\d+)$/); - return regExp.exec( data.doi )[1]; + if (regExp.exec( data.doi )){ + return regExp.exec( data.doi )[1]; + } + return null; }; /** diff --git a/www/templates/landingpage_tpl.js b/www/templates/landingpage_tpl.js index a6549c32e3c3e05c264910b75b3053cb4fff8b20..62a4df67a2fe2df79211e6e6b31774ec2e50bd0a 100644 --- a/www/templates/landingpage_tpl.js +++ b/www/templates/landingpage_tpl.js @@ -83,7 +83,13 @@
+ {data.resourceType} + {constants.ES_RESOURCE_TYPE} + {@eq key=data.resourceType value=constants.ES_RESOURCE_TYPE} + {:else} + + {/eq}
diff --git a/www/tests/jsonExtractor.test.js b/www/tests/jsonExtractor.test.js index f9cbc39850164679bc6bb33f2a88788de8aab290..bf396d1dccd3c8c83247c17664feed5b28037527 100644 --- a/www/tests/jsonExtractor.test.js +++ b/www/tests/jsonExtractor.test.js @@ -135,4 +135,22 @@ describe("jsonExtractor", () => { expect(myJsonExtractor.getMergedProposalAndBeamline(actualProposals, actualBeamlines, actualBeamlineUrls)).toEqual(expectedMerge); }) }) + + describe("GetInvestigationId", () => { + + it("returns investigationId for a experimental session doi", () => { + let actualDOIdata = { doi: "10.15151/ESRF-ES-130874985" }; + let expectedInvestigationId = "130874985"; + let myJsonExtractor = new JsonExtractor(); + expect(myJsonExtractor.getInvestigationId(actualDOIdata)).toEqual(expectedInvestigationId); + }) + + it("returns null for a data collection doi", () => { + let actualDOIdata = { doi: "10.15151/ESRF-DC-130874985" }; + let expectedInvestigationId = null; + let myJsonExtractor = new JsonExtractor(); + expect(myJsonExtractor.getInvestigationId(actualDOIdata)).toEqual(expectedInvestigationId); + }) + + }) }) diff --git a/www/tests/readme.txt b/www/tests/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..996691fc573f2e930d9680036fa8555dc228544e --- /dev/null +++ b/www/tests/readme.txt @@ -0,0 +1,4 @@ +Below are doi created for the tests: + +- 10.5072/TEST-ESRF-MAX3 : data collection DOI +- DOI=10.5072/ESRF-ES-130884741 : experiment session DOI \ No newline at end of file