Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Olivier Lezoray
Hal
Commits
be1e0bfb
Commit
be1e0bfb
authored
Oct 21, 2018
by
Olivier Lezoray
🇫🇷
Browse files
Modification Hal.js
parent
d572cf9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
js/Hal.js
View file @
be1e0bfb
//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
The fields for searching are :
//https://www.ccsd.cnrs.fr/2015/04/produire-la-liste-des-publications-pour-un-laboratoire-une-collection-un-portail/
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
){
function
generateYears
(
deb
,
fin
,
theid
){
var
i
;
var
i
;
var
actualYear
=
new
Date
();
var
actualYear
=
new
Date
();
...
@@ -18,21 +37,40 @@
...
@@ -18,21 +37,40 @@
$
(
"
#
"
+
theid
).
append
(
option
);
$
(
"
#
"
+
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
){
function
generateDocTypes
(
theid
){
var
res
=
""
;
var
res
=
""
;
var
typesCODES
=
new
Array
(
"
None
"
,
"
ART
"
,
"
COMM
"
,
"
COUV
"
,
"
OTHER
"
,
"
OUV
"
,
"
DOUV
"
,
"
PATENT
"
,
"
POSTER
"
,
"
UNDEFINED
"
,
"
REPORT
"
,
"
THESE
"
,
"
HDR
"
,
"
LECTURE
"
);
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
"
,
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)
"
,
"
Chapitre d'ouvrage
"
,
"
Autre publication
"
,
"
Ouvrage (y compris édition critique et traduction)
"
,
"
Direction d'ouvrage, Proceedings
"
,
"
Brevet
"
,
"
Poster
"
,
"
Direction d'ouvrage, Proceedings
"
,
"
Brevet
"
,
"
Poster
"
,
"
Pré-publication, Document de travail
"
,
"
Rapport
"
,
"
Pré-publication, Document de travail
"
,
"
Rapport
"
,
"
Thèse
"
,
"
HDR
"
,
"
Cours
"
);
"
Thèse
"
,
"
HDR
"
,
"
Cours
"
);
var
i
;
var
i
;
for
(
i
=
0
;
i
<
typesCODES
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
typesCODES
.
length
;
i
++
)
{
var
option
=
$
(
'
<option/>
'
);
var
option
=
$
(
'
<option/>
'
);
option
.
attr
({
'
value
'
:
typesCODES
[
i
]
}).
text
(
typesDESCR
[
i
]);
option
.
attr
({
'
value
'
:
typesCODES
[
i
]
}).
text
(
typesDESCR
[
i
]);
$
(
"
#
"
+
theid
).
append
(
option
);
$
(
"
#
"
+
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
){
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
=
"
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;
//var criteria="authIdHal_s:"+idHal+" and labStructId_i:"+lab+" and docType_s:"+selectedDocType;
...
@@ -108,6 +146,10 @@
...
@@ -108,6 +146,10 @@
"
json
"
"
json
"
);
);
}
}
/**
* Description.
* Makes an update of the document on a change of year.
**/
function
yearChange
(){
function
yearChange
(){
var
selectedYear
=
$
(
"
#yearSelect
"
).
val
();
var
selectedYear
=
$
(
"
#yearSelect
"
).
val
();
var
selectedDocType
=
$
(
"
#documentTypeSelect
"
).
val
();
var
selectedDocType
=
$
(
"
#documentTypeSelect
"
).
val
();
...
@@ -118,6 +160,10 @@
...
@@ -118,6 +160,10 @@
getDocuments
(
"
publications
"
,
idHal
,
firstName
,
lastName
,
lab
,
selectedDocType
,
selectedYear
);
getDocuments
(
"
publications
"
,
idHal
,
firstName
,
lastName
,
lab
,
selectedDocType
,
selectedYear
);
}
}
}
}
/**
* Description.
* Makes an update of the document on a change of document type.
**/
function
typeChange
(){
function
typeChange
(){
lastName
=
$
(
"
#lastName
"
).
val
();
lastName
=
$
(
"
#lastName
"
).
val
();
firstName
=
$
(
"
#firstName
"
).
val
();
firstName
=
$
(
"
#firstName
"
).
val
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment