Commit c0b89c1d authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Correction de bug dans la page d'enregistrement des tables

parent 71a04d50
......@@ -20,6 +20,7 @@ class TableForm extends Form implements InputFilterProviderInterface
{
$hydrator = new TableFormHydrator;
$this->setHydrator($hydrator);
$this->setAttribute('class', 'tables-edit');
$this->add([
'name' => 'syncEnabled',
......@@ -40,7 +41,7 @@ class TableForm extends Form implements InputFilterProviderInterface
$this->add([
'name' => 'syncFiltre',
'options' => [
'label' => 'Filtre de synchronisation',
'label' => 'Filtre de synchronisation (SQL partiel)',
],
'attributes' => [
'id' => 'sync_filtre',
......@@ -52,7 +53,7 @@ class TableForm extends Form implements InputFilterProviderInterface
$this->add([
'name' => 'syncHookBefore',
'options' => [
'label' => 'À exécuter avant la synchro',
'label' => 'À exécuter avant la synchro (code PL/SQL)',
],
'attributes' => [
'id' => 'sync_hook_before',
......@@ -64,7 +65,7 @@ class TableForm extends Form implements InputFilterProviderInterface
$this->add([
'name' => 'syncHookAfter',
'options' => [
'label' => 'À exécuter après la synchro',
'label' => 'À exécuter après la synchro (code PL/SQL)',
],
'attributes' => [
'id' => 'sync_hook_after',
......@@ -73,14 +74,14 @@ class TableForm extends Form implements InputFilterProviderInterface
'type' => 'TextArea',
]);
// $this->add([
// 'name' => 'submit',
// 'type' => 'Submit',
// 'attributes' => [
// 'value' => 'Enregistrer',
// 'class' => 'btn btn-primary',
// ],
// ]);
$this->add([
'name' => 'submit',
'type' => 'Submit',
'attributes' => [
'value' => 'Enregistrer',
'class' => 'btn btn-primary btn-save',
],
]);
}
......
......@@ -68,6 +68,7 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );
title="Vous pouvez trier les tables en déplaçant les lignes du tableau"></span>&nbsp;
<a class="ajax-modal"
data-event="table-modifier"
href="<?= $this->url('import/tables/modifier',['table' => $table->getName()]) ?>"
title="Modifier le paramétrage de la table"
><span class="glyphicon glyphicon-edit"></span></a>
......@@ -162,6 +163,11 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );
});
WidgetInitializer.add('tables-config', 'tablesConfig');
$("body").on("table-modifier", function(event, data) {
window.location.reload();
});
});
......
......@@ -3,7 +3,7 @@
use UnicaenImport\Form\TableForm;
/**
* @var $form TableForm
* @var $form TableForm
* @var $title string
*/
......@@ -14,37 +14,62 @@ echo $this->form($form);
?>
<script>
var options = {
minLines: 10, maxLines: 10,
};
$(function ()
{
$.widget("unicaenImport.tablesEdit", {
filtreEditor: null,
hookBeforeEditor: null,
hookAfterEditor: null,
var filtreEditor = ace.edit("sync_filtre");
filtreEditor.setTheme("ace/theme/github");
filtreEditor.getSession().setMode("ace/mode/sql");
filtreEditor.setOptions(options);
save: function ()
{
var filtre = $("<input>")
.attr("type", "hidden")
.attr("name","syncFiltre")
.val(this.filtreEditor.getSession().getValue());
this.element.append($(filtre));
var hookBeforeEditor = ace.edit("sync_hook_before");
hookBeforeEditor.setTheme("ace/theme/github");
hookBeforeEditor.getSession().setMode("ace/mode/sql");
hookBeforeEditor.setOptions(options);
var hookBefore = $("<input>")
.attr("type", "hidden")
.attr("name","syncHookBefore")
.val(this.hookBeforeEditor.getSession().getValue());
this.element.append($(hookBefore));
var hookAfterEditor = ace.edit("sync_hook_after");
hookAfterEditor.setTheme("ace/theme/github");
hookAfterEditor.getSession().setMode("ace/mode/sql");
hookAfterEditor.setOptions(options);
var hookAfter = $("<input>")
.attr("type", "hidden")
.attr("name","syncHookAfter")
.val(this.hookAfterEditor.getSession().getValue());
this.element.append($(hookAfter));
},
function posterForm()
{
//var url = '<?php echo $this->url(null, [], [], true); ?>';
//var regles = editor.getSession().getValue();
_create: function ()
{
var that = this;
that.element.find('.btn-save').click(function () { that.save();});
var options = {
minLines: 10, maxLines: 10,
};
that.filtreEditor = ace.edit("sync_filtre");
that.filtreEditor.setTheme("ace/theme/github");
that.filtreEditor.getSession().setMode("ace/mode/sql");
that.filtreEditor.setOptions(options);
that.hookBeforeEditor = ace.edit("sync_hook_before");
that.hookBeforeEditor.setTheme("ace/theme/github");
that.hookBeforeEditor.getSession().setMode("ace/mode/sql");
that.hookBeforeEditor.setOptions(options);
//$.post(url, {regles: regles});
}
that.hookAfterEditor = ace.edit("sync_hook_after");
that.hookAfterEditor.setTheme("ace/theme/github");
that.hookAfterEditor.getSession().setMode("ace/mode/sql");
that.hookAfterEditor.setOptions(options);
}
});
function test(){
console.log($('#sync_hook_after').val());
console.log(hookAfterEditor.getSession().getValue() );
}
WidgetInitializer.add('tables-edit', 'tablesEdit');
});
</script>
<button class="btn btn-primary" type="button" onclick="test()">Enregistrer</button>
\ No newline at end of file
</script>
\ No newline at end of file
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