Commit be1e0bfb authored by Olivier Lezoray's avatar Olivier Lezoray 🇫🇷
Browse files

Modification Hal.js

parent d572cf9a
//search a structure : https://api.archives-ouvertes.fr/ref/structure/?q=GREYC
//search an author : https://api.archives-ouvertes.fr/ref/author/?q=lézoray
/**
@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
//fields for search : https://api.archives-ouvertes.fr/docs/search/schema/fields/#fields
//https://www.ccsd.cnrs.fr/2015/04/produire-la-liste-des-publications-pour-un-laboratoire-une-collection-un-portail/
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();
......@@ -18,6 +37,13 @@
$("#"+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");
......@@ -33,6 +59,18 @@
$("#"+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.
* @param {String} selectedDocType the type of required documents.
* @param {int} selectedYear the year of the required documents.
**/
function getDocuments(displayid,idHal,firstName,lastName,lab,selectedDocType,selectedYear){
var criteria="authFullName_t:"+firstName+"+"+lastName+" and labStructId_i:"+lab+" and docType_s:"+selectedDocType;
//var criteria="authIdHal_s:"+idHal+" and labStructId_i:"+lab+" and docType_s:"+selectedDocType;
......@@ -108,6 +146,10 @@
"json"
);
}
/**
* Description.
* Makes an update of the document on a change of year.
**/
function yearChange(){
var selectedYear=$("#yearSelect").val();
var selectedDocType=$("#documentTypeSelect").val();
......@@ -118,6 +160,10 @@
getDocuments("publications",idHal,firstName,lastName,lab,selectedDocType,selectedYear);
}
}
/**
* Description.
* Makes an update of the document on a change of document type.
**/
function typeChange(){
lastName=$("#lastName").val();
firstName=$("#firstName").val();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment