Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Hal.js 7.51 KiB
/**
@file Hal.js
@date October 21, 2018
@author Olivier Lézoray
@version 1.0
@description
This Javascript file contains functions useful to make queries to the HAL webservice.
The HAL API is https://api.archives-ouvertes.fr
For instance to search a structure :
https://api.archives-ouvertes.fr/ref/structure/?q=GREYC
To search an author :
https://api.archives-ouvertes.fr/ref/author/?q=lézoray
The fields for searching are :
https://api.archives-ouvertes.fr/docs/search/schema/fields/#fields
**/
/**
* Description.
* Generates a set of <option> year tags to be included in a <select>.
* Each <option> corresponds to a year that can be chosen in the list.
* @param {int} deb the starting year.
* @param {int} fin the ending year.
* @param {int} theid the id of the select to add the generated <option> tags.
**/
function generateYears(deb,fin,theid){
var i;
var actualYear=new Date();
actualYear=actualYear.getYear()+1900;
var option = $('<option/>');
option.attr({ "value": "None" }).text("Aucune année");
$("#"+theid).append(option);
for(i=fin;i>=deb;i--) {
var option = $('<option/>');
option.attr({ 'value': i }).text(i);
$("#"+theid).append(option);
}
}
/**
* Description.
* Generates a set of <option> HAL doc types tags to be included in a <select>.
* Each <option> corresponds to a type of document that can be chosen in the list.
* @param int theid the id of the select to add the generated <option> tags.
**/
function generateDocTypes(theid){
var res="";
var typesCODES=new Array("None","ART","COMM","COUV","OTHER","OUV","DOUV","PATENT","POSTER","UNDEFINED","REPORT","THESE","HDR","LECTURE");
var typesDESCR=new Array("Selectionnez un type de document","Article dans des revues","Communication dans un congrès",
"Chapitre d'ouvrage","Autre publication","Ouvrage (y compris édition critique et traduction)",
"Direction d'ouvrage, Proceedings","Brevet","Poster",
"Pré-publication, Document de travail","Rapport",
"Thèse","HDR","Cours");
var i;
for(i=0;i<typesCODES.length;i++) {
var option = $('<option/>');
option.attr({ 'value': typesCODES[i] }).text(typesDESCR[i]);
$("#"+theid).append(option);
}
}
/**
* Description.
* Generates in a given element, a text containing the list of documents for an author.
* This makes a query to the HAL API webservice.
* @param {int} displayid the id of the element ot contain the generated text.
* @param {String} idHal the id of the author.
* @param {String} firstName the first name of the author.
* @param {String} lastName the last name of the author.
* @param {int} lab the id of the lab of the author.