diff --git a/config/install/tsa.settings.yml b/config/install/tsa.settings.yml new file mode 100644 index 0000000000000000000000000000000000000000..3c2f6bb5286a1055242507f2e56255a5bab1def5 --- /dev/null +++ b/config/install/tsa.settings.yml @@ -0,0 +1,37 @@ + +tsa_api: 'https://tsaapi.bfa.ar/api/tsa/' +ext_rdt: '.rd.temp' +ext_rdd: '.rd' +mainBody: 'El servicio de Sello de Tiempo de BFA permite demostrar digitalmente que el contenido de cualquier documento existió en un momento y que desde entonces, no ha cambiado.' +tab01: '1. Sellar' +tab01Title: '1. Sellar' +tab01Body: 'Seleccioná un archivo para generar un Sello de Tiempo. El servicio generará un <i>hash</i> (un código criptográfico asociado a dicho documento) y lo enviará a la blockchain. A continuación, se descargará automáticamente un recibo digital <b>temporario</b> (.rd.temp) que luego podrás usar para obtener el recibo digital <b>definitivo</b> (.rd) en la pestaña <i>Obtener recibo</i>.<br>Importante: El documento seleccionado nunca se sube a la red, garantizando su privacidad.' +tab01drag: 'Arrastrá un archivo aquÃ<br>ó' +tab01select: 'Seleccioná un archivo <span class="sr-only">para Sellar</span>' +tab02: '2. Obtener recibo' +tab02Title: 'Paso 2: Obtener recibo digital definitivo' +tab02Body: 'Para obtener el recibo definitivo (.rd) de un Sello de Tiempo se debe tener el documento original y el recibo digital temporario (.rd.temp). Al seleccionar ambos archivos, el recibo se descargará automáticamente y podrás visualizar en este sitio el dÃa y la hora en que el hash del documento original fue sellado en la Blockchain Federal Argentina.' +tab02Box01: 'Seleccioná el archivo original' +tab02Box01drag: 'Arrastrá el archivo <b>original</b> aquÃ<br>ó' +tab02Box01select: 'Seleccioná un archivo <span class="sr-only">original</span>' +tab02Box02: 'Seleccioná el recibo digital temporario' +tab02Box02drag: 'Arrastrá el archivo <b>.rdt</b> aquÃ<br>ó' +tab02Box02select: 'Seleccioná un archivo <span class="sr-only">.rdt</span>' +tab03: 'Verificar' +tab03Title: 'Verificar un sello de tiempo' +tab03Body: 'Para verificar un Sello de Tiempo se debe tener el documento original y el recibo digital definitivo (.rd). Podrá verificar el dÃa y la hora en que el hash del documento original fue sellado en la Blockchain Federal Argentina.' +tab03Box01: 'Seleccioná el archivo original' +tab03Box01drag: 'Arrastrá el archivo <b>original</b> aquÃ<br>ó' +tab03Box01select: 'Seleccioná un archivo <span class="sr-only">original</span>' +tab03Box02: 'Seleccioná el recibo digital temporario' +tab03Box02drag: 'Arrastrá el archivo <b>.rdd</b> aquÃ<br>ó' +tab03Box02select: 'Seleccioná un archivo <span class="sr-only">.rdd</span>' +jsTxt01: 'Nombre del archivo:' +jsTxt02: 'Hash del archivo:' +jsTxt03: 'Seleccioná otro archivo <span class="sr-only">para sellar</span>' +jsTxt04: 'Seleccioná otro archivo <span class="sr-only">original</span>' +jsTxt05: 'Seleccioná otro archivo <span class="sr-only">.rd.temp</span>' +jsTxt06: 'Seleccioná otro archivo <span class="sr-only">.rd</span>' +jsTxt07: 'El recibo digital no corresponde al documento seleccionado.' +jsTxt08: 'No se pudo conectar a Blockchain Federal Argentina' +jsTxt09: 'Debe ingresar el archivo original' \ No newline at end of file diff --git a/config/schema/tsa.schema.yml b/config/schema/tsa.schema.yml new file mode 100644 index 0000000000000000000000000000000000000000..7975628a7a0206df20be368569e804fb32442fe2 --- /dev/null +++ b/config/schema/tsa.schema.yml @@ -0,0 +1,113 @@ +tsa.settings: + type: mapping + label: 'Configuración TSA' + mapping: + tsa_api: + type: text + label: 'URLs de APIs' + ext_rdt: + type: text + label: 'Extensión Recibo Temporario' + ext_rdd: + type: text + label: 'Extensión Recibo Definitivo' + mainBody: + type: text + label: 'Texto Principal' + tab01: + type: text + label: 'Tab 1: Label' + tab01Title: + type: text + label: 'Tab 1: TÃtulo' + tab01Body: + type: text + label: 'Tab 1: Texto' + tab01drag: + type: text + label: 'Tab 1: Texto drag' + tab01select: + type: text + label: 'Tab 1: Texto select' + tab02: + type: text + label: 'Tab 2: Label' + tab02Title: + type: text + label: 'Tab 2: TÃtulo' + tab02Body: + type: text + label: 'Tab 2: Texto' + tab02Box01: + type: text + label: 'Tab 2: SubtÃtulo Drop 1' + tab02Box01drag: + type: text + label: 'Tab 2: Texto drag 01' + tab02Box01select: + type: text + label: 'Tab 2: Texto select 01' + tab02Box02: + type: text + label: 'Tab 2: SubtÃtulo Drop 2' + tab02Box02drag: + type: text + label: 'Tab 2: Texto drag 02' + tab02Box02select: + type: text + label: 'Tab 2: Texto select 02' + tab03: + type: text + label: 'Tab 3: Label' + tab03Title: + type: text + label: 'Tab 3: TÃtulo' + tab03Body: + type: text + label: 'Tab 3: Texto' + tab03Box01: + type: text + label: 'Tab 3: SubtÃtulo Drop 1' + tab03Box01drag: + type: text + label: 'Tab 3: Texto drag 01' + tab03Box01select: + type: text + label: 'Tab 3: Texto select 01' + tab03Box02: + type: text + label: 'Seleccioná el recibo digital temporario' + tab03Box02drag: + type: text + label: 'Tab 3: Texto drag 02' + tab03Box02select: + type: text + label: 'Tab 3: Texto select 02' + jsTxt01: + type: text + label: 'Texto JS: Nombre del archivo' + jsTxt02: + type: text + label: 'Texto JS: Hash del archivo' + jsTxt03: + type: text + label: 'Texto JS: Seleccionar para sellar' + jsTxt04: + type: text + label: 'Texto JS: Seleccionar original' + jsTxt05: + type: text + label: 'Texto JS: Seleccionar Recibo Temporal' + jsTxt06: + type: text + label: 'Texto JS: Seleccionar Recibo Definitivo' + jsTxt07: + type: text + label: 'Texto JS: Error archivo no corresponde al recibo' + jsTxt08: + type: text + label: 'Texto JS: Error no se pudo conectar' + jsTxt09: + type: text + label: 'Texto JS: Error ingresar archivo original' + diff --git a/js/tsa.js b/js/tsa.js index 21d57db8b6de1bac3a2bc1d5820951b37d71dcb1..a3e2669503d20c13247d1be05382fcd1dd595b15 100644 --- a/js/tsa.js +++ b/js/tsa.js @@ -1,5 +1,14 @@ var $ = jQuery; var tsa_api = 'https://tsaapi.bfa.ar/api/tsa/'; +var jsTxt01 = 'Nombre del archivo:'; +var jsTxt02 = 'Hash del archivo:'; +var jsTxt03 = 'Seleccioná otro archivo <span class="sr-only">para sellar</span>'; +var jsTxt04 = 'Seleccioná otro archivo <span class="sr-only">original</span>'; +var jsTxt05 = 'Seleccioná otro archivo <span class="sr-only">.rd.temp</span>'; +var jsTxt06 = 'Seleccioná otro archivo <span class="sr-only">.rd</span>'; +var jsTxt07 = 'El recibo digital no corresponde al documento seleccionado.'; +var jsTxt08 = 'No se pudo conectar a Blockchain Federal Argentina'; +var jsTxt09 = 'Debe ingresar el archivo original'; var loader_gif = 'lib/images/loader.svg'; var ots_api = ''; var deadline_date = new Date('2018-09-03 00:00:00'); @@ -12,6 +21,16 @@ var currentTab = whash.substring(5, 6); var ntsa_api = drupalSettings.tsa.tsa_api; if(ntsa_api) tsa_api = ntsa_api; + if(drupalSettings.tsa.jsTxt01) jsTxt01 = drupalSettings.tsa.jsTxt01; + if(drupalSettings.tsa.jsTxt02) jsTxt02 = drupalSettings.tsa.jsTxt02; + if(drupalSettings.tsa.jsTxt03) jsTxt03 = drupalSettings.tsa.jsTxt03; + if(drupalSettings.tsa.jsTxt04) jsTxt04 = drupalSettings.tsa.jsTxt04; + if(drupalSettings.tsa.jsTxt05) jsTxt05 = drupalSettings.tsa.jsTxt05; + if(drupalSettings.tsa.jsTxt06) jsTxt06 = drupalSettings.tsa.jsTxt06; + if(drupalSettings.tsa.jsTxt07) jsTxt07 = drupalSettings.tsa.jsTxt07; + if(drupalSettings.tsa.jsTxt08) jsTxt08 = drupalSettings.tsa.jsTxt08; + if(drupalSettings.tsa.jsTxt09) jsTxt09 = drupalSettings.tsa.jsTxt09; + whash && $('ul.nav a[href="' + whash + '"]').tab('show'); $('.nav-tabs a').click(function (e) { $(this).tab('show'); @@ -24,10 +43,10 @@ var currentTab = whash.substring(5, 6); for (let i = 1; i < 4; i++) { - $('#selectOriginal_' + i+', #selectOriginalArea_' + i).on('click', function () { - $('#fileUploadOriginal_' + i).click(); - return false; - }); + // $('#selectOriginal_' + i+', #selectOriginalArea_' + i).on('click', function () { + // $('#fileUploadOriginal_' + i).click(); + // return false; + // }); if (i == 1) { $('#fileUploadOriginal_' + i).change( function () { @@ -42,10 +61,10 @@ var currentTab = whash.substring(5, 6); original_file_check(file); } ); - $('#selectRecibo_' + i+', #selectReciboArea_' + i).on('click', function () { - $('#fileUploadRecibo_' + i).click(); - return false; - }); + // $('#selectRecibo_' + i+', #selectReciboArea_' + i).on('click', function () { + // $('#fileUploadRecibo_' + i).click(); + // return false; + // }); $('#fileUploadRecibo_' + i).change( function () { var file = $(this).prop('files')[0]; @@ -66,8 +85,8 @@ function stamp(file) { hash.update(file_contents); var file_hash = hash.hex(); - $('#originalInfo_1').html('<p>Nombre del archivo: <b>' + file.name + '</b></p><p>Hash del archivo: <b><span class="hash">' + file_hash + '</span></b></p>'); - $('#selectOriginal_1').html('Seleccioná otro archivo <span class="sr-only">para marcar</span>'); + $('#originalInfo_1').html('<p>'+jsTxt01+' <b>' + file.name + '</b></p><p>'+jsTxt02+' <b><span class="hash">' + file_hash + '</span></b></p>'); + $('#selectOriginal_1').html(jsTxt03); $.ajax({ @@ -171,9 +190,9 @@ function verify_bfa(ots) { fileName = $('#hidden_original_file_name_' + currentTab).val() + ".rd"; if (currentTab == '2') { - ms = 'Seleccioná otro archivo <span class="sr-only">.rd.temp</span>'; + ms = jsTxt05; } else if (currentTab == '3') { - ms = 'Seleccioná otro archivo <span class="sr-only">.rd</span>'; + ms = jsTxt06; } $('#selectRecibo_' + currentTab).html(ms); @@ -189,10 +208,10 @@ function verify_bfa(ots) { }, error: function (jqXHR, textStatus, errorThrown) { - responseText = 'El recibo digital no corresponde al documento seleccionado.'; + responseText = jsTxt07; if (errorThrown == 'timeout') { - responseText = 'No se pudo conectar a Blockchain Federal Argentina'; + responseText = jsTxt08; } if (whash == '#certificado-tab') { rp_id = "#response_cert"; @@ -227,8 +246,8 @@ function original_file_check(file) { $('#hidden_original_file_hash_' + currentTab).val(file_hash); $('#hidden_original_file_name_' + currentTab).val(file.name); - $('#originalInfo_' + currentTab).html('<p>Nombre del archivo: <b>' + file.name + '</b></p><p>Hash del archivo: <b><span class="hash">' + file_hash + '</span></b></p>'); - $('#selectOriginal_' + currentTab).html('Seleccioná otro archivo <span class="sr-only">original</span>'); + $('#originalInfo_' + currentTab).html('<p>'+jsTxt01+' <b>' + file.name + '</b></p><p>'+jsTxt02+' <b><span class="hash">' + file_hash + '</span></b></p>'); + $('#selectOriginal_' + currentTab).html(jsTxt04); }; } @@ -239,7 +258,7 @@ function ots_check(file) { var file_contents = ''; var file_hash = $('#hidden_original_file_hash_' + currentTab).val(); if (file_hash == '') { - $('#response_' + currentTab).html('<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Debe ingresar el archivo original'); + $('#response_' + currentTab).html('<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> '+jsTxt09); $('#response_' + currentTab).addClass('alert alert-danger'); return; } diff --git a/src/Controller/tsaController.php b/src/Controller/tsaController.php index 89614334c383370cc7f20b6abd29c69e9a964f59..90bd688cff985a8d113000a08c80e5245e6f5768 100644 --- a/src/Controller/tsaController.php +++ b/src/Controller/tsaController.php @@ -28,16 +28,35 @@ class tsaController extends ControllerBase { $element['#tab01'] = $config->get('tab01'); $element['#tab01Title'] = $config->get('tab01Title'); $element['#tab01Body'] = $config->get('tab01Body'); + $element['#tab01drag'] = $config->get('tab01drag'); + $element['#tab01select'] = $config->get('tab01select'); $element['#tab02'] = $config->get('tab02'); $element['#tab02Title'] = $config->get('tab02Title'); $element['#tab02Body'] = $config->get('tab02Body'); $element['#tab02Box01'] = $config->get('tab02Box01'); + $element['#tab02Box01drag'] = $config->get('tab02Box01drag'); + $element['#tab02Box01select'] = $config->get('tab02Box01select'); $element['#tab02Box02'] = $config->get('tab02Box02'); + $element['#tab02Box02drag'] = $config->get('tab02Box02drag'); + $element['#tab02Box02select'] = $config->get('tab02Box02select'); $element['#tab03'] = $config->get('tab03'); $element['#tab03Title'] = $config->get('tab03Title'); $element['#tab03Body'] = $config->get('tab03Body'); $element['#tab03Box01'] = $config->get('tab03Box01'); + $element['#tab03Box01drag'] = $config->get('tab03Box01drag'); + $element['#tab03Box01select'] = $config->get('tab03Box01select'); $element['#tab03Box02'] = $config->get('tab03Box02'); + $element['#tab03Box02drag'] = $config->get('tab03Box02drag'); + $element['#tab03Box02select'] = $config->get('tab03Box02select'); + $element['#jsTxt01'] = $config->get('jsTxt01'); + $element['#jsTxt02'] = $config->get('jsTxt02'); + $element['#jsTxt03'] = $config->get('jsTxt03'); + $element['#jsTxt04'] = $config->get('jsTxt04'); + $element['#jsTxt05'] = $config->get('jsTxt05'); + $element['#jsTxt06'] = $config->get('jsTxt06'); + $element['#jsTxt07'] = $config->get('jsTxt07'); + $element['#jsTxt08'] = $config->get('jsTxt08'); + $element['#jsTxt09'] = $config->get('jsTxt09'); $element['#theme'] = 'tsa_theme'; return $element; } diff --git a/src/Form/tsaForm.php b/src/Form/tsaForm.php index b492de7f39218bc1c47f6d406a3f253012576e03..dec94ea7974bc6ef093c6052241a249d91ea9e0b 100644 --- a/src/Form/tsaForm.php +++ b/src/Form/tsaForm.php @@ -29,104 +29,209 @@ class tsaForm extends ConfigFormBase { '#title' => $this->t('URLs de APIs'), '#description' => $this->t('Separados por coma'), '#default_value' => $config->get('tsa_api'), - ); + ); - $form['ext_rdt'] = array( - '#type' => 'textfield', - '#title' => $this->t('Extensión Recibo Temporario'), - '#default_value' => ($config->get('ext_rdt')) ? $config->get('ext_rdt') : '.rd.temp' - ); + $form['ext_rdt'] = array( + '#type' => 'textfield', + '#title' => $this->t('Extensión Recibo Temporario'), + '#default_value' => $config->get('ext_rdt'), + ); - $form['ext_rdd'] = array( - '#type' => 'textfield', - '#title' => $this->t('Extensión Recibo Definitivo'), - '#default_value' => ($config->get('ext_rdd')) ? $config->get('ext_rdd') : '.rd' - ); + $form['ext_rdd'] = array( + '#type' => 'textfield', + '#title' => $this->t('Extensión Recibo Definitivo'), + '#default_value' => $config->get('ext_rdd'), + ); - $form['mainBody'] = array( - '#type' => 'textarea', - '#title' => $this->t('Texto Principal'), - '#default_value' => ($config->get('mainBody')) ? $config->get('mainBody') : 'El servicio de Sello de Tiempo de BFA permite demostrar digitalmente que el contenido de cualquier documento existió en un momento y que desde entonces, no ha cambiado.' - ); + $form['mainBody'] = array( + '#type' => 'textarea', + '#title' => $this->t('Texto Principal'), + '#default_value' => $config->get('mainBody'), + ); - $form['tab01'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 1: Label'), - '#default_value' => ($config->get('tab01')) ? $config->get('tab01') : '1. Sellar' - ); + $form['tab01'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 1: Label'), + '#default_value' => $config->get('tab01'), + ); - $form['tab01Title'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 1: TÃtulo'), - '#default_value' => ($config->get('tab01Title')) ? $config->get('tab01Title') : 'Paso 1: Iniciar sellado' - ); + $form['tab01Title'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 1: TÃtulo'), + '#default_value' => $config->get('tab01Title'), + ); - $form['tab01Body'] = array( - '#type' => 'textarea', - '#title' => $this->t('Tab 1: Texto'), - '#default_value' => ($config->get('tab01Body')) ? $config->get('tab01Body') : 'Seleccioná un archivo para generar un Sello de Tiempo. El servicio generará un <i>hash</i> (un código criptográfico asociado a dicho documento) y lo enviará a la blockchain. A continuación, se descargará automáticamente un recibo digital <b>temporario</b> (.rd.temp) que luego podrás usar para obtener el recibo digital <b>definitivo</b> (.rd) en la pestaña <i>Obtener recibo</i>.<br>Importante: El documento seleccionado nunca se sube a la red, garantizando su privacidad.' - ); + $form['tab01Body'] = array( + '#type' => 'textarea', + '#title' => $this->t('Tab 1: Texto'), + '#default_value' => $config->get('tab01Body'), + ); - $form['tab02'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 2: Label'), - '#default_value' => ($config->get('tab02')) ? $config->get('tab02') : '2. Obtener recibo' - ); + $form['tab01drag'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 1: Texto drag'), + '#default_value' => $config->get('tab01drag'), + ); - $form['tab02Title'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 2: TÃtulo'), - '#default_value' => ($config->get('tab02Title')) ? $config->get('tab02Title') : 'Paso 2: Obtener recibo digital definitivo' - ); + $form['tab01select'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 1: Texto select'), + '#default_value' => $config->get('tab01select'), + ); - $form['tab02Body'] = array( - '#type' => 'textarea', - '#title' => $this->t('Tab 2: Texto'), - '#default_value' => ($config->get('tab02Body')) ? $config->get('tab02Body') : 'Para obtener el recibo definitivo (.rd) de un Sello de Tiempo se debe tener el documento original y el recibo digital temporario (.rd.temp). Al seleccionar ambos archivos, el recibo se descargará automáticamente y podrás visualizar en este sitio el dÃa y la hora en que el hash del documento original fue sellado en la Blockchain Federal Argentina.' - ); + $form['tab02'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: Label'), + '#default_value' => $config->get('tab02'), + ); - $form['tab02Box01'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 2: SubtÃtulo Drop 1'), - '#default_value' => ($config->get('tab02Box01')) ? $config->get('tab02Box01') : 'Seleccioná el archivo original' - ); + $form['tab02Title'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: TÃtulo'), + '#default_value' => $config->get('tab02Title'), + ); - $form['tab02Box02'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 2: SubtÃtulo Drop 2'), - '#default_value' => ($config->get('tab02Box02')) ? $config->get('tab02Box02') : 'Seleccioná el recibo digital temporario' - ); + $form['tab02Body'] = array( + '#type' => 'textarea', + '#title' => $this->t('Tab 2: Texto'), + '#default_value' => $config->get('tab02Body'), + ); - $form['tab03'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 3: Label'), - '#default_value' => ($config->get('tab03')) ? $config->get('tab03') : 'Verificar' - ); + $form['tab02Box01'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: SubtÃtulo Drop 1'), + '#default_value' => $config->get('tab02Box01'), + ); - $form['tab03Title'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 3: TÃtulo'), - '#default_value' => ($config->get('tab03Title')) ? $config->get('tab03Title') : 'Verificar un sello de tiempo' - ); + $form['tab02Box01drag'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: Texto drag 01'), + '#default_value' => $config->get('tab02Box01drag'), + ); - $form['tab03Body'] = array( - '#type' => 'textarea', - '#title' => $this->t('Tab 3: Texto'), - '#default_value' => ($config->get('tab03Body')) ? $config->get('tab03Body') : 'Para verificar un Sello de Tiempo se debe tener el documento original y el recibo digital definitivo (.rd). Podrá verificar el dÃa y la hora en que el hash del documento original fue sellado en la Blockchain Federal Argentina.' - ); + $form['tab02Box01select'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: Texto select 01'), + '#default_value' => $config->get('tab02Box01select'), + ); - $form['tab03Box01'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 3: SubtÃtulo Drop 1'), - '#default_value' => ($config->get('tab03Box01')) ? $config->get('tab03Box01') : 'Seleccioná el archivo original' - ); + $form['tab02Box02'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: SubtÃtulo Drop 2'), + '#default_value' => $config->get('tab02Box02'), + ); - $form['tab03Box02'] = array( - '#type' => 'textfield', - '#title' => $this->t('Tab 3: SubtÃtulo Drop 2'), - '#default_value' => ($config->get('tab03Box02')) ? $config->get('tab03Box02') : 'Seleccioná el recibo digital definitivo' - ); - + $form['tab02Box02drag'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: Texto drag 02'), + '#default_value' => $config->get('tab02Box02drag'), + ); + + $form['tab02Box02select'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 2: Texto select 02'), + '#default_value' => $config->get('tab02Box02select'), + ); + + $form['tab03'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: Label'), + '#default_value' => $config->get('tab03'), + ); + + $form['tab03Title'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: TÃtulo'), + '#default_value' => $config->get('tab03Title'), + ); + + $form['tab03Body'] = array( + '#type' => 'textarea', + '#title' => $this->t('Tab 3: Texto'), + '#default_value' => $config->get('tab03Body'), + ); + + $form['tab03Box01'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: SubtÃtulo Drop 1'), + '#default_value' => $config->get('tab03Box01'), + ); + + $form['tab03Box01drag'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: Texto drag 01'), + '#default_value' => $config->get('tab03Box01drag'), + ); + + $form['tab03Box01select'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: Texto select 01'), + '#default_value' => $config->get('tab03Box01select'), + ); + + $form['tab03Box02'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: SubtÃtulo Drop 2'), + '#default_value' => $config->get('tab03Box02'), + ); + + $form['tab03Box02drag'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: Texto drag 02'), + '#default_value' => $config->get('tab03Box02drag'), + ); + + $form['tab03Box02select'] = array( + '#type' => 'textfield', + '#title' => $this->t('Tab 3: Texto select 02'), + '#default_value' => $config->get('tab03Box02select'), + ); + + $form['jsTxt01'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Nombre del archivo'), + '#default_value' => $config->get('jsTxt01'), + ); + $form['jsTxt02'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Hash del archivo'), + '#default_value' => $config->get('jsTxt02'), + ); + $form['jsTxt03'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Seleccionar para sellar'), + '#default_value' => $config->get('jsTxt03'), + ); + $form['jsTxt04'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Seleccionar original' ), + '#default_value' => $config->get('jsTxt04'), + ); + $form['jsTxt05'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Seleccionar Recibo Temporal'), + '#default_value' => $config->get('jsTxt05'), + ); + $form['jsTxt06'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Seleccionar Recibo Definitivo'), + '#default_value' => $config->get('jsTxt06'), + ); + $form['jsTxt07'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Error archivo no corresponde al recibo'), + '#default_value' => $config->get('jsTxt07'), + ); + $form['jsTxt08'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Error no se pudo conectar'), + '#default_value' => $config->get('jsTxt08'), + ); + $form['jsTxt09'] = array( + '#type' => 'textfield', + '#title' => $this->t('Texto JS: Error ingresar archivo original'), + '#default_value' => $config->get('jsTxt09'), + ); return $form; } @@ -149,16 +254,35 @@ class tsaForm extends ConfigFormBase { $config->set('tab01', $form_state->getValue('tab01')); $config->set('tab01Title', $form_state->getValue('tab01Title')); $config->set('tab01Body', $form_state->getValue('tab01Body')); + $config->set('tab01drag', $form_state->getValue('tab01drag')); + $config->set('tab01select', $form_state->getValue('tab01select')); $config->set('tab02', $form_state->getValue('tab02')); $config->set('tab02Title', $form_state->getValue('tab02Title')); $config->set('tab02Body', $form_state->getValue('tab02Body')); $config->set('tab02Box01', $form_state->getValue('tab02Box01')); + $config->set('tab02Box01drag', $form_state->getValue('tab02Box01drag')); + $config->set('tab02Box01select', $form_state->getValue('tab02Box01select')); $config->set('tab02Box02', $form_state->getValue('tab02Box02')); + $config->set('tab02Box02drag', $form_state->getValue('tab02Box02drag')); + $config->set('tab02Box02select', $form_state->getValue('tab02Box02select')); $config->set('tab03', $form_state->getValue('tab03')); $config->set('tab03Title', $form_state->getValue('tab03Title')); $config->set('tab03Body', $form_state->getValue('tab03Body')); $config->set('tab03Box01', $form_state->getValue('tab03Box01')); + $config->set('tab03Box01drag', $form_state->getValue('tab03Box01drag')); + $config->set('tab03Box01select', $form_state->getValue('tab03Box01select')); $config->set('tab03Box02', $form_state->getValue('tab03Box02')); + $config->set('tab03Box02drag', $form_state->getValue('tab03Box02drag')); + $config->set('tab03Box02select', $form_state->getValue('tab03Box02select')); + $config->set('jsTxt01', $form_state->getValue('jsTxt01')); + $config->set('jsTxt02', $form_state->getValue('jsTxt02')); + $config->set('jsTxt03', $form_state->getValue('jsTxt03')); + $config->set('jsTxt04', $form_state->getValue('jsTxt04')); + $config->set('jsTxt05', $form_state->getValue('jsTxt05')); + $config->set('jsTxt06', $form_state->getValue('jsTxt06')); + $config->set('jsTxt07', $form_state->getValue('jsTxt07')); + $config->set('jsTxt08', $form_state->getValue('jsTxt08')); + $config->set('jsTxt09', $form_state->getValue('jsTxt09')); $config->save(); return parent::submitForm($form, $form_state); } diff --git a/templates/tsa-template.html.twig b/templates/tsa-template.html.twig index d0f20f314e2aee71b564b6f8bdd922196d2ff7eb..17c9f864cea3bf9eb07d8a04a12fd8a8c624fabb 100644 --- a/templates/tsa-template.html.twig +++ b/templates/tsa-template.html.twig @@ -14,9 +14,9 @@ <div id="selectOriginalArea_1" class="dropArea" ondrop="dropStamp(event)" ondragover="allowDrop(event)"> <div id="originalInfo_1" class="replacedTxt"> <div><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></div> - <div class="droptxt">Arrastrá un archivo aquÃ<br>ó</div> + <div class="droptxt">{{ tab01drag }}</div> </div> - <div><button type="button" id="selectOriginal_1" class="btn btn-primary btn-pill">Seleccioná un archivo <span class="sr-only">para Sellar</span></button></div> + <div><button type="button" id="selectOriginal_1" class="btn btn-primary btn-pill">{{ tab01select }}</button></div> </div> <input type="file" id="fileUploadOriginal_1" hidden/> <!-- <div id="ots_div" class="loading"></div> --> @@ -35,9 +35,9 @@ ondragover="allowDrop(event)"> <div id="originalInfo_2" class="replacedTxt"> <div><span class=" glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></div> - <div class="droptxt">Arrastrá el archivo <b>original</b> aquÃ<br>ó</div> + <div class="droptxt">{{ tab02Box01drag }}</div> </div> - <div><button type="button" id="selectOriginal_2" class="btn btn-primary btn-pill">Seleccioná un archivo <span class="sr-only">original</span></button></div> + <div><button type="button" id="selectOriginal_2" class="btn btn-primary btn-pill">{{ tab02Box01select }}</button></div> </div> <input type="file" id="fileUploadOriginal_2" hidden/> </div> @@ -48,10 +48,10 @@ <div id="reciboInfo_2"></div> <div id="reciboInstructions_2"> <div><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></div> - <div class="droptxt">Arrastrá el archivo <b>{{ ext_rdt }}</b> aquÃ<br>ó</div> + <div class="droptxt">{{ tab02Box02drag }}</div> </div> </div> - <div><button type="button" id="selectRecibo_2" class="btn btn-primary btn-pill">Seleccioná un archivo <span class="sr-only">{{ ext_rdt }}</span></button></div> + <div><button type="button" id="selectRecibo_2" class="btn btn-primary btn-pill">{{ tab02Box02select }}</button></div> </div> <input type="file" id="fileUploadRecibo_2" hidden/> </div> @@ -70,9 +70,9 @@ ondragover="allowDrop(event)"> <div id="originalInfo_3" class="replacedTxt"> <div><span class=" glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></div> - <div class="droptxt">Arrastrá el archivo <b>original</b> aquÃ<br>ó</div> + <div class="droptxt">{{ tab03Box01drag }}</div> </div> - <div><button type="button" id="selectOriginal_3" class="btn btn-success btn-pill">Seleccioná un archivo <span class="sr-only">original</span></button></div> + <div><button type="button" id="selectOriginal_3" class="btn btn-success btn-pill">{{ tab03Box01select }}</button></div> </div> <input type="file" id="fileUploadOriginal_3" hidden/> </div> @@ -83,10 +83,10 @@ <div id="reciboInfo_3"></div> <div id="reciboInstructions_3"> <div><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></div> - <div class="droptxt">Arrastrá el archivo <b>{{ ext_rdd }}</b> aquÃ<br>ó</div> + <div class="droptxt">{{ tab03Box02drag }}</div> </div> </div> - <div><button type="button" id="selectRecibo_3" class="btn btn-success btn-pill">Seleccioná un archivo <span class="sr-only">{{ ext_rdd }}</span></button></div> + <div><button type="button" id="selectRecibo_3" class="btn btn-success btn-pill">{{ tab03Box02select }}</button></div> </div> <input type="file" id="fileUploadRecibo_3" hidden/> </div> diff --git a/tsa.config_translation.yml b/tsa.config_translation.yml new file mode 100644 index 0000000000000000000000000000000000000000..7c262945f891ec02b9de0a4d4aa468dc06616d59 --- /dev/null +++ b/tsa.config_translation.yml @@ -0,0 +1,5 @@ +tsa: + title: 'Configuración TSA' + base_route_name: tsa.form + names: + - 'tsa.settings' diff --git a/tsa.info.yml b/tsa.info.yml index 0cec24000324aff953de3a32955a725a39f6994f..1dba6259096ed951b20017c3ab5c9dbb1a7edae9 100644 --- a/tsa.info.yml +++ b/tsa.info.yml @@ -2,4 +2,6 @@ name: tsa description: Modulo Custom de TSA package: BFA type: module -core: 8.x \ No newline at end of file +version: 1.0 +core: 8.x +configure: tsa.form diff --git a/tsa.links.task.yml b/tsa.links.task.yml new file mode 100644 index 0000000000000000000000000000000000000000..95d71d95badc6a2647b44381cf78028138f171f8 --- /dev/null +++ b/tsa.links.task.yml @@ -0,0 +1,4 @@ +tsa.tsa_form_tab: + route_name: tsa.form + title: Configuración + base_route: tsa.form diff --git a/tsa.module b/tsa.module index 5b08ecd683234636c7211547dfa5a37716053d1a..27cbec2027a25041e0737bc7db1ac64da91e9549 100644 --- a/tsa.module +++ b/tsa.module @@ -21,16 +21,35 @@ function tsa_theme($existing, $type, $theme, $path) { 'tab01' => NULL, 'tab01Title' => NULL, 'tab01Body' => NULL, + 'tab01drag' => NULL, + 'tab01select' => NULL, 'tab02' => NULL, 'tab02Title' => NULL, 'tab02Body' => NULL, 'tab02Box01' => NULL, + 'tab02Box01drag' => NULL, + 'tab02Box01select' => NULL, 'tab02Box02' => NULL, + 'tab02Box02drag' => NULL, + 'tab02Box02select' => NULL, 'tab03' => NULL, 'tab03Title' => NULL, 'tab03Body' => NULL, 'tab03Box01' => NULL, + 'tab03Box01drag' => NULL, + 'tab03Box01select' => NULL, 'tab03Box02' => NULL, + 'tab03Box02drag' => NULL, + 'tab03Box02select' => NULL, + 'jsTxt01' => NULL, + 'jsTxt02' => NULL, + 'jsTxt03' => NULL, + 'jsTxt04' => NULL, + 'jsTxt05' => NULL, + 'jsTxt06' => NULL, + 'jsTxt07' => NULL, + 'jsTxt08' => NULL, + 'jsTxt09' => NULL, ), 'template' => 'tsa-template', ), @@ -40,10 +59,29 @@ function tsa_theme($existing, $type, $theme, $path) { } + function tsa_preprocess_html(&$variables) { $variables['#attached']['library'][] = 'tsa/tsa'; $config = \Drupal::config('tsa.settings'); $tsa_api = $config->get('tsa_api'); $variables['#attached']['drupalSettings']['tsa']['tsa_api'] = $tsa_api; + $jsTxt01 = $config->get('jsTxt01'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt01'] = $jsTxt01; + $jsTxt02 = $config->get('jsTxt02'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt02'] = $jsTxt02; + $jsTxt03 = $config->get('jsTxt03'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt03'] = $jsTxt03; + $jsTxt04 = $config->get('jsTxt04'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt04'] = $jsTxt04; + $jsTxt05 = $config->get('jsTxt05'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt05'] = $jsTxt05; + $jsTxt06 = $config->get('jsTxt06'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt06'] = $jsTxt06; + $jsTxt07 = $config->get('jsTxt07'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt07'] = $jsTxt07; + $jsTxt08 = $config->get('jsTxt08'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt08'] = $jsTxt08; + $jsTxt09 = $config->get('jsTxt09'); + $variables['#attached']['drupalSettings']['tsa']['jsTxt09'] = $jsTxt09; } \ No newline at end of file diff --git a/tsa.routing.yml b/tsa.routing.yml index 989f945a013dc51baf13aee04576a537102a8017..7f4f3975b0d9b966da66fc853a91405780e17f1f 100644 --- a/tsa.routing.yml +++ b/tsa.routing.yml @@ -9,7 +9,7 @@ tsa.content: tsa.form: path: '/admin/config/development/tsa' defaults: - _form: 'Drupal\tsa\Form\tsaForm' _title: 'Configuración TSA' + _form: 'Drupal\tsa\Form\tsaForm' requirements: _permission: 'administer site configuration' \ No newline at end of file