Commit 40af6057 authored by ephoto_dam's avatar ephoto_dam

Ephoto Dam Field in progress

parent 2896c944
......@@ -74,7 +74,7 @@
var self = this;
if (!ePhoto) {
console.log(Drupal.t('Error loading the Ephoto Dam API'));
console.log('Error : loading the Ephoto Dam API');
return;
}
......@@ -112,11 +112,11 @@
*/
selectVersions: function() {
if (!this._getFieldValues()) {
console.log('Field selection error');
console.log('Error : field selection error');
return;
}
this.ephoto.File.callOnFileReceived(this.getUrlsVersions.bind(this));
this.ephoto.File.callOnFileReceived(this.getVersionsUrls.bind(this));
this.ephoto.File.setButtons( this.ephoto.IMAGE_FILES, [ {
'mode': 'none'
......@@ -131,18 +131,33 @@
* @param {null} None value
* @param {object} DublinCore values
*/
getUrlsVersions: function(empty, dcore) {
//var version_support = this.settings.version_support === '1';
getVersionsUrls: function(empty, dcore) {
if (dcore === 'fileDoesNotExist') {
console.log('File does not exist');
console.log('Error : file does not exist');
return;
}
let versions = this._getFieldValues();
let id = parseInt(dcore['dc:identifier'], 10);
console.log(id);
console.log(versions);
const constid = dcore['dc:identifier:string'];
const id = parseInt(dcore['dc:identifier:number'], 10);
if (!id) {
console.log('Error : dc:identifier missing');
return;
}
this.ephoto.File.getVersions(id, function(versions) {
const fields = this._getFieldValues();
for (const inc in fields) {
if(typeof versions[fields[inc].name] === 'undefined') continue;
let size = fields[inc].size;
let name = fields[inc].name;
console.log('version:' + name + ';' + size + ';' + constid);
}
}.bind(this));
},
/**
......@@ -154,7 +169,7 @@
this.fieldSelected = this._getFieldValues()[delta];
if (!this.fieldSelected) {
console.log('Field selection error');
console.log('Error : field selection error');
return;
}
......@@ -162,7 +177,7 @@
if (size === '' || size === 0) return;
this.ephoto.File.callOnFileReceived(this.getUrl.bind(this));
this.ephoto.File.callOnFileReceived(this.getFileUrl.bind(this));
this.ephoto.File.setButtons( this.ephoto.IMAGE_FILES, [ {
'mode': 'link',
......@@ -182,16 +197,16 @@
* @param {string} URL value
* @param {object} DublinCore values
*/
getUrl: function(url, dcore) {
getFileUrl: function(url, dcore) {
if (url === 'fileDoesNotExist') {
console.log('File does not exist');
console.log('Error : file does not exist');
return;
}
var self = this;
if (!this.fieldSelected) {
console.log('Field selected missing');
console.log('Error : field selected missing');
return;
}
......
......@@ -67,9 +67,6 @@ msgstr "Veuillez saisir la taille des documents à l'affichage"
msgid "https://ephoto.mycompany.com/"
msgstr "https://ephoto.masociete.fr/"
msgid "Error loading the Ephoto Dam API"
msgstr "Erreur lors du chargement de l'API Ephoto Dam"
msgid "Please enter a correct URL"
msgstr "Veuillez saisir une URL correcte"
......
Markdown is supported
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