Skip to content
Snippets Groups Projects
Commit c0b89c1d authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction de bug dans la page d'enregistrement des tables

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