functionAuthor(){}functionCitation(e){this.isBuildable=!!(e&&e.creator&&0!==e.creator.length&&e.date_registered&&e.title&&e.publisher&&e.doi)}functionDOIController(e){vart=this;this.doiServer="https://data.datacite.org/",this.acceptedPrefix=["10.5072","10.15151"],this.view=e,this.experimentalReportController=newExperimentalReportController,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()})}functionDoiData(){}functionDOIView(){this.mainPanelId="main",this.reportPanelId="expReport",this.badgePanelId="badges",this.reportExperimentFileNames=null,this.failedRecievingExpReport=!1,this.isDOIAlreadyRendered=!1,this.onDOIRendered=newEvent(this)}functionEvent(e){this._sender=e,this._listeners=[]}functionExperimentalReportController(){this.server="https://wwws.esrf.fr/misapps/SMISServer/rest/reports/fileNames",this.timeout=5e3,this.onSuccess=newEvent(this),this.onError=newEvent(this)}functionJsonExtractor(e){}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)returnthis.familyName;if(this.singleName){vare=newRegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)returnthis.familyName=t[1],this.familyName;varr=newRegExp(/\s([^a-z]+$)/).exec(this.singleName);returnr&&(this.familyName=r[1]),this.familyName}},Author.prototype.getRawFirstName=function(){if(this.firstName)returnthis.firstName;if(this.singleName){vare=newRegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)returnthis.firstName=t[0],this.firstName;varr=newRegExp(/^(.[^A-Z]+)+\b/).exec(this.singleName);returnr&&(this.firstName=r[0]),r}},Author.prototype.getTitleCaseFamilyName=function(){if(this.familyName){allLowerCase=this.familyName.toLowerCase();vare=newRegExp(/^./);returnallLowerCase.replace(e,function(e){returne.toUpperCase()})}returnconsole.log("family name is undefined"),null},Author.prototype.getFirstNameInitials=function(){vare=newRegExp(/(\S+)/g);returnthis.firstName?this.firstName.replace(e,function(e){returne.charAt(0)+"."}):(console.log("first name is undefined"),null)};varBEAMLINEURL=[{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){vart=_.transform(e,function(e,t,r,n){ninstanceofArray||(t=n);vari=null;if(t.givenName?((i=newAuthor).setFamilyName(t.familyName),i.setFirstName(t.givenName),e.push(i.getTitleCaseFamilyName()+""+i.getFirstNameInitials())):((i=newAuthor).setSingleName(t.name),i.getRawFamilyName()&&i.getRawFirstName()?e.push(i.getTitleCaseFamilyName()+""+i.getFirstNameInitials()):e.push(t.name)),!(ninstanceofArray))return!1},[]);return_.join(t,", ")}returnconsole.log("the author list for the citation could not be generated."),""},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){vart=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)){varn=newDoiData;n.title=r.title,n.doi=r.doi.toUpperCase(),n.dataciteLink=t.doiServer+e,n.publisher=r.publisher,n.creator=r.creator;vari=newJsonExtractor;if(n.mintingYear=i.getMintingYear(r),n.sessionDate=i.getSessionDate(r),n.publiclyAccessibleYear=r.publication_year,n.proposalType=i.getFieldFromSubject(r.subject,"Proposal Type Description"),n.proposalNumber=i.getFieldFromSubject(r.subject,"Proposal"),t.experimentalReportController.requestFilenameList(n.proposalNumber),n.beamline=i.getFieldFromSubject(r.subject,"instrument"),n.investigationId=i.extractInvestigationId(r),n.accessibility=n.getAccessibilityStatus(n.sessionDate,n.publiclyAccessibleYear),n.accessMessage=t.view.setDataAccessMessage(n),n.citation=t.createCitation(r),n.resourceTypeGeneral=i.getResourceTypeGeneral(r),n.resourceType=i.getResourceType(r),r.date_collected){varo=moment(r.date_collected);n.beamlineUrl=t.getBeamlineUrl(n.beamline,o)}elsen.beamlineUrl="noLink";t.view.renderDOIData(n)}elset.view.renderError("Not Found",t.origin)}).fail(function(e,r,n){t.view.renderError(n,t.origin),t.view.setLoading(!1)}):t.view.renderError("Bad Prefix",t.origin)},DOIController.prototype.hasAcceptedPrefix=function(e){vart=e.split("/")[0];return-1!=_.findIndex(this.acceptedPrefix,function(e){returnt==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){for(varr=0;r<BEAMLINEURL.length;r++){varn=moment(BEAMLINEURL[r].startDate),i=moment(BEAMLINEURL[r].endDate);if(BEAMLINEURL[r].name.toLowerCase()===e.toLowerCase()&&t>=n&&t<=i)returnBEAMLINEURL[r].url}returnnull},DOIController.prototype.createCitation=function(e){vart=newCitation(e);if(t.isBuildable){returnt.getAuthorsForCitation(e.creator)+" ("+moment(e.date_registered).year()+"). "+e.title+". "+e.publisher+" (ESRF). <a href='https://doi.esrf.fr/"+e.doi+"'> doi:"+e.doi.toUpperCase()+"</a>"}return"The citation could not be generated."},DoiData.prototype.getAccessibilityStatus=function(e,t){if(t&&e){varr=moment(t,"YYYY"),n=moment();if(n>r)return"Open access";if(n<=r)return"Restricted access"}returnconsole.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){vart=this;this.isDOIAlreadyRendered?dust.render("experimentalreport_tpl",{data:e},function(e,r){$("#"+t.reportPanelId).html(r)}):this.reportExperimentFileNames=e}},DOIView.prototype.renderDOIData=function(e){vart=this;dust.render("landingpage_tpl",{data:e},function(r,n){$("#"+t.mainPanelId).html(n),t.isDOIAlreadyRendered=!0,t.renderBadges(e),t.failedRecievingExpReport?t.renderErrorForExperimentalReport():t.reportExperimentFileNames&&t.renderExperimentalReportData(t.reportExperimentFileNames)})},DOIView.prototype.renderError=function(e,t){varr="welcome-page"===t?"doinotfound2_tpl":"doinotfound_tpl",n="";n="Bad Prefix"===e?"welcome-page"===t?'<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>':'<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>':"Not Found"===e?"welcome-page"===t?"<h3> Not found ! </h3> <p> Sorry, the requested DOI was not found. </p>":"<h2> Not found ! </h2> <p> Sorry, the requested DOI was not found. </p>":"timeout"===e?"welcome-page"===t?"<h3> Not found ! </h3> <p> Sorry, the server took too long to reply. Try again later. </p>":"<h2> Not found ! </h2> <p> Sorry, the server took too long to reply. Try again later. </p>":"welcome-page"===t?"<h3> Not found ! </h3> <p> Connexion problem to the server. </p>":"<h2> Not found ! </h2> <p> Connexion problem to the server. </p>",dust.render(r,{message:n},function(e,t){$("#error").html(t)})},DOIView.prototype.renderErrorForExperimentalReport=function(){this.failedRecievingExpReport=!0;$("#"+this.reportPanelId).html('<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>')},DOIView.prototype.renderBadges=function(e){if(e){vart=this;dust.render("badges_tpl",{data:e},function(e,r){$("#"+t.badgePanelId).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 <b>"+e.publiclyAccessibleYear+"</b> but could be released earlier. Currently, they are only accessible to proposal team members.":void0},Event.prototype={attach:function(e){this._listeners.push(e)},notify:function(e){for(vart=0;t<this._listeners.length;t++)this._listeners[t](this._sender,e)}},ExperimentalReportController.prototype.requestFilenameList=function(e){vart=this;if(e){aroundHyphenRegExp=newRegExp(/^(.*)-(.*)/);varr=aroundHyphenRegExp.exec(e)[1],n=aroundHyphenRegExp.exec(e)[2];r&&n&&$.ajax({type:"GET",timeout:this.timeout,url:this.server,data:{categoryCode:r,categoryCounter:n},dataType:"json",success:function(e){t.onSuccess.notify(e)},error:function(e){t.onError.notify(e)}})}elset.onError.notify("Proposal is null")},ExperimentalReportController.prototype.openFileInNewTab=function(e){if(e)try{window.open("ftp://www.esrf.eu/pub/UserReports/"+e,"_blank")}catch(t){alert("The requested file "+e+" could not be downloaded.")}},JsonExtractor.prototype.extractInvestigationId=function(e){returnRegExp(/\/\w*-*[Ee][Ss][Rr][Ff]-[Ee][Ss]-(\d+)$/).exec(e.doi)[1]},JsonExtractor.prototype.getFieldFromSubject=function(e,t){if(e&&e[0])for(varr=0;r<e[0].length;r++)if(e[0][r].subject_scheme===t)returne[0][r].text;returnnull},JsonExtractor.prototype.getMintingYear=function(e){returne&&e.date_registered&&null!=e.date_registered?moment(e.date_registered).year():null},JsonExtractor.prototype.getSessionDate=function(e){returne&&e.date_collected&&null!=e.date_collected?moment(e.date_collected).format("YYYY-M-D"):null},JsonExtractor.prototype.getResourceTypeGeneral=function(e){returne&&e.resource_type_general?e.resource_type_general:null},JsonExtractor.prototype.getResourceType=function(e){returne&&e.resource_type?e.resource_type:null};
\ No newline at end of file
functionAuthor(){}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)returnthis.familyName;if(this.singleName){vare=newRegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)returnthis.familyName=t[1],this.familyName;varr=newRegExp(/\s([^a-z]+$)/).exec(this.singleName);returnr&&(this.familyName=r[1]),this.familyName}},Author.prototype.getRawFirstName=function(){if(this.firstName)returnthis.firstName;if(this.singleName){vare=newRegExp(/(\S+)/g),t=this.singleName.match(e);if(2===t.length)returnthis.firstName=t[0],this.firstName;varr=newRegExp(/^(.[^A-Z]+)+\b/).exec(this.singleName);returnr&&(this.firstName=r[0]),r}},Author.prototype.getTitleCaseFamilyName=function(){if(this.familyName){allLowerCase=this.familyName.toLowerCase();vare=newRegExp(/^./);returnallLowerCase.replace(e,function(e){returne.toUpperCase()})}returnconsole.log("family name is undefined"),null},Author.prototype.getFirstNameInitials=function(){vare=newRegExp(/(\S+)/g);returnthis.firstName?this.firstName.replace(e,function(e){returne.charAt(0)+"."}):(console.log("first name is undefined"),null)};varBEAMLINEURL=[{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"}];functionCitation(e){this.isBuildable=!!(e&&e.creator&&0!==e.creator.length&&e.date_registered&&e.title&&e.publisher&&e.doi)}functionDOIController(e){varr=this;this.doiServer="https://data.datacite.org/",this.acceptedPrefix=["10.5072","10.15151"],this.view=e,this.experimentalReportController=newExperimentalReportController,this.experimentalReportController.onSuccess.attach(function(e,t){r.view.renderExperimentalReportData(t)}),this.experimentalReportController.onError.attach(function(e,t){console.log("Error when retrieving fileList from SMIS."),r.view.renderErrorForExperimentalReport()})}functionDoiData(){}functionDOIView(){this.mainPanelId="main",this.reportPanelId="expReport",this.badgePanelId="badges",this.reportExperimentFileNames=null,this.failedRecievingExpReport=!1,this.isDOIAlreadyRendered=!1,this.onDOIRendered=newEvent(this)}functionEvent(e){this._sender=e,this._listeners=[]}functionExperimentalReportController(){this.server="https://wwws.esrf.fr/misapps/SMISServer/rest/reports/fileNames",this.timeout=5e3,this.onSuccess=newEvent(this),this.onError=newEvent(this)}functionJsonExtractor(e){}Citation.prototype.getAuthorsForCitation=function(e){if(this.isBuildable){vart=_.transform(e,function(e,t,r,n){ninstanceofArray||(t=n);vari=null;if(t.givenName?((i=newAuthor).setFamilyName(t.familyName),i.setFirstName(t.givenName),e.push(i.getTitleCaseFamilyName()+""+i.getFirstNameInitials())):((i=newAuthor).setSingleName(t.name),i.getRawFamilyName()&&i.getRawFirstName()?e.push(i.getTitleCaseFamilyName()+""+i.getFirstNameInitials()):e.push(t.name)),!(ninstanceofArray))return!1},[]);return_.join(t,", ")}returnconsole.log("the author list for the citation could not be generated."),""},DOIController.prototype.isValidDOIData=function(e){return3<_.keysIn(e).length&&0<_.find(_.keysIn(e),function(e){return"title"===e}).length},DOIController.prototype.getData=function(i){varo=this;this.view.setDOIInTopBanner(i),this.hasAcceptedPrefix(i)?$.ajax({headers:{Accept:"application/vnd.datacite.datacite+json"},type:"GET",timeout:15e3,url:this.doiServer+i,beforeSend:function(){o.view.setLoading("Retrieving data from Server")},complete:function(){o.view.setLoading(!1)}}).done(function(e){if(e)if(o.isValidDOIData(e)){vart=newDoiData;t.title=e.title,t.doi=e.doi.toUpperCase(),t.dataciteLink=o.doiServer+i,t.publisher=e.publisher,t.creator=e.creator;varr=newJsonExtractor;if(t.mintingYear=r.getMintingYear(e),t.sessionDate=r.getSessionDate(e),t.publiclyAccessibleYear=e.publication_year,t.proposalType=r.getFieldFromSubject(e.subject,"Proposal Type Description"),t.proposalNumber=r.getFieldFromSubject(e.subject,"Proposal"),o.experimentalReportController.requestFilenameList(t.proposalNumber),t.beamline=r.getFieldFromSubject(e.subject,"instrument"),t.investigationId=r.extractInvestigationId(e),t.accessibility=t.getAccessibilityStatus(t.sessionDate,t.publiclyAccessibleYear),t.accessMessage=o.view.setDataAccessMessage(t),t.citation=o.createCitation(e),t.resourceTypeGeneral=r.getResourceTypeGeneral(e),t.resourceType=r.getResourceType(e),e.date_collected){varn=moment(e.date_collected);t.beamlineUrl=o.getBeamlineUrl(t.beamline,n)}elset.beamlineUrl="noLink";o.view.renderDOIData(t)}elseo.view.renderError("Not Found",o.origin)}).fail(function(e,t,r){o.view.renderError(r,o.origin),o.view.setLoading(!1)}):o.view.renderError("Bad Prefix",o.origin)},DOIController.prototype.hasAcceptedPrefix=function(e){vart=e.split("/")[0];return-1!=_.findIndex(this.acceptedPrefix,function(e){returnt==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){for(varr=0;r<BEAMLINEURL.length;r++){varn=moment(BEAMLINEURL[r].startDate),i=moment(BEAMLINEURL[r].endDate);if(BEAMLINEURL[r].name.toLowerCase()===e.toLowerCase()&&n<=t&&t<=i)returnBEAMLINEURL[r].url}returnnull},DOIController.prototype.createCitation=function(e){vart=newCitation(e);returnt.isBuildable?t.getAuthorsForCitation(e.creator)+" ("+moment(e.date_registered).year()+"). "+e.title+". "+e.publisher+" (ESRF). <a href='https://doi.esrf.fr/"+e.doi+"'> doi:"+e.doi.toUpperCase()+"</a>":"The citation could not be generated."},DoiData.prototype.getAccessibilityStatus=function(e,t){if(t&&e){varr=moment(t,"YYYY"),n=moment();if(r<n)return"Open access";if(n<=r)return"Restricted access"}returnconsole.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){varr=this;this.isDOIAlreadyRendered?dust.render("experimentalreport_tpl",{data:e},function(e,t){$("#"+r.reportPanelId).html(t)}):this.reportExperimentFileNames=e}},DOIView.prototype.renderDOIData=function(r){varn=this;dust.render("landingpage_tpl",{data:r},function(e,t){$("#"+n.mainPanelId).html(t),n.isDOIAlreadyRendered=!0,n.renderBadges(r),n.failedRecievingExpReport?n.renderErrorForExperimentalReport():n.reportExperimentFileNames&&n.renderExperimentalReportData(n.reportExperimentFileNames)})},DOIView.prototype.renderError=function(e,t){varr="welcome-page"===t?"doinotfound2_tpl":"doinotfound_tpl",n="";n="Bad Prefix"===e?"welcome-page"===t?'<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>':'<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>':"Not Found"===e?"welcome-page"===t?"<h3> Not found ! </h3> <p> Sorry, the requested DOI was not found. </p>":"<h2> Not found ! </h2> <p> Sorry, the requested DOI was not found. </p>":"timeout"===e?"welcome-page"===t?"<h3> Not found ! </h3> <p> Sorry, the server took too long to reply. Try again later. </p>":"<h2> Not found ! </h2> <p> Sorry, the server took too long to reply. Try again later. </p>":"welcome-page"===t?"<h3> Not found ! </h3> <p> Connexion problem to the server. </p>":"<h2> Not found ! </h2> <p> Connexion problem to the server. </p>",dust.render(r,{message:n},function(e,t){$("#error").html(t)})},DOIView.prototype.renderErrorForExperimentalReport=function(){this.failedRecievingExpReport=!0;$("#"+this.reportPanelId).html('<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>')},DOIView.prototype.renderBadges=function(e){if(e){varr=this;dust.render("badges_tpl",{data:e},function(e,t){$("#"+r.badgePanelId).html(t)})}},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 <b>"+e.publiclyAccessibleYear+"</b> but could be released earlier. Currently, they are only accessible to proposal team members.":void0},Event.prototype={attach:function(e){this._listeners.push(e)},notify:function(e){for(vart=0;t<this._listeners.length;t++)this._listeners[t](this._sender,e)}},ExperimentalReportController.prototype.requestFilenameList=function(e){vart=this;if(e){aroundHyphenRegExp=newRegExp(/^(.*)-(.*)/);varr=aroundHyphenRegExp.exec(e)[1],n=aroundHyphenRegExp.exec(e)[2];r&&n&&$.ajax({type:"GET",timeout:this.timeout,url:this.server,data:{categoryCode:r,categoryCounter:n},dataType:"json",success:function(e){t.onSuccess.notify(e)},error:function(e){t.onError.notify(e)}})}elset.onError.notify("Proposal is null")},ExperimentalReportController.prototype.openFileInNewTab=function(t){if(t)try{window.open("ftp://www.esrf.eu/pub/UserReports/"+t,"_blank")}catch(e){alert("The requested file "+t+" could not be downloaded.")}},JsonExtractor.prototype.extractInvestigationId=function(e){returnRegExp(/\/\w*-*[Ee][Ss][Rr][Ff]-[Ee][Ss]-(\d+)$/).exec(e.doi)[1]},JsonExtractor.prototype.getFieldFromSubject=function(e,t){if(e&&e[0])for(varr=0;r<e[0].length;r++)if(e[0][r].subject_scheme===t)returne[0][r].text;returnnull},JsonExtractor.prototype.getMintingYear=function(e){returne&&e.date_registered&&null!=e.date_registered?moment(e.date_registered).year():null},JsonExtractor.prototype.getSessionDate=function(e){returne&&e.date_collected&&null!=e.date_collected?moment(e.date_collected).format("YYYY-M-D"):null},JsonExtractor.prototype.getResourceTypeGeneral=function(e){returne&&e.resource_type_general?e.resource_type_general:null},JsonExtractor.prototype.getResourceType=function(e){returne&&e.resource_type?e.resource_type:null};
Thispagecentralizesthe<ahref="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.