Commit 14591fe6 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajustement du formulaire de template + retrait des morceaux fantomes d'historisation

parent 12bc7326
Pipeline #11032 passed with stage
in 20 seconds
...@@ -4,7 +4,6 @@ INSERT INTO unicaen_privilege_categorie (id ,code, libelle, ordre, namespace) VA ...@@ -4,7 +4,6 @@ INSERT INTO unicaen_privilege_categorie (id ,code, libelle, ordre, namespace) VA
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_index', 'Afficher l''index des macros', 1); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_index', 'Afficher l''index des macros', 1);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_ajouter', 'Ajouter une macro', 10); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_ajouter', 'Ajouter une macro', 10);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_modifier', 'Modifier une macro', 20); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_modifier', 'Modifier une macro', 20);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_historiser', 'Historiser/Restaure une macro', 30);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_supprimer', 'Supprimer une macro', 40); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documentmacro_supprimer', 'Supprimer une macro', 40);
-- TEMPLATE -- TEMPLATE
...@@ -12,7 +11,6 @@ INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) ...@@ -12,7 +11,6 @@ INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre)
INSERT INTO unicaen_privilege_categorie (id, code, libelle, ordre, namespace) VALUES (next_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate', 'UnicaenRenderer - Gestion des templates', 11020, 'UnicaenRenderer\Provider\Privilege'); INSERT INTO unicaen_privilege_categorie (id, code, libelle, ordre, namespace) VALUES (next_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate', 'UnicaenRenderer - Gestion des templates', 11020, 'UnicaenRenderer\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_index', 'Afficher l''index des contenus', 1); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_index', 'Afficher l''index des contenus', 1);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_modifier', 'Modifier un contenu', 20); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_modifier', 'Modifier un contenu', 20);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_historiser', 'Historiser/Restaurer un contenu', 30);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_supprimer', 'Supprimer un contenu', 40); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_supprimer', 'Supprimer un contenu', 40);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_ajouter', 'Ajouter un contenu', 15); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_ajouter', 'Ajouter un contenu', 15);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_afficher', 'Afficher un template', 10); INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val('unicaen_privilege_privilege_id_seq'), current_val('unicaen_privilege_categorie_id_seq'), 'documenttemplate_afficher', 'Afficher un template', 10);
......
...@@ -45,16 +45,6 @@ return [ ...@@ -45,16 +45,6 @@ return [
DocumentmacroPrivileges::DOCUMENTMACRO_MODIFIER, DocumentmacroPrivileges::DOCUMENTMACRO_MODIFIER,
], ],
], ],
[
'controller' => MacroController::class,
'action' => [
'historiser',
'restaurer',
],
'privileges' => [
DocumentmacroPrivileges::DOCUMENTMACRO_HISTORISER,
],
],
[ [
'controller' => MacroController::class, 'controller' => MacroController::class,
'action' => [ 'action' => [
...@@ -136,26 +126,6 @@ return [ ...@@ -136,26 +126,6 @@ return [
], ],
], ],
], ],
'historiser' => [
'type' => Segment::class,
'options' => [
'route' => '/historiser/:macro',
'defaults' => [
'controller' => MacroController::class,
'action' => 'historiser',
],
],
],
'restaurer' => [
'type' => Segment::class,
'options' => [
'route' => '/restaurer/:macro',
'defaults' => [
'controller' => MacroController::class,
'action' => 'restaurer',
],
],
],
'supprimer' => [ 'supprimer' => [
'type' => Segment::class, 'type' => Segment::class,
'options' => [ 'options' => [
......
...@@ -53,16 +53,6 @@ return [ ...@@ -53,16 +53,6 @@ return [
DocumenttemplatePrivileges::DOCUMENTTEMPLATE_MODIFIER, DocumenttemplatePrivileges::DOCUMENTTEMPLATE_MODIFIER,
], ],
], ],
[
'controller' => TemplateController::class,
'action' => [
'historiser',
'restaurer',
],
'privileges' => [
DocumenttemplatePrivileges::DOCUMENTTEMPLATE_HISTORISER,
],
],
[ [
'controller' => TemplateController::class, 'controller' => TemplateController::class,
'action' => [ 'action' => [
...@@ -144,26 +134,6 @@ return [ ...@@ -144,26 +134,6 @@ return [
], ],
], ],
], ],
'restaurer' => [
'type' => Segment::class,
'options' => [
'route' => '/restaurer/:template',
'defaults' => [
'controller' => TemplateController::class,
'action' => 'restaurer',
],
],
],
'historiser' => [
'type' => Segment::class,
'options' => [
'route' => '/historiser/:template',
'defaults' => [
'controller' => TemplateController::class,
'action' => 'historiser',
],
],
],
'detruire' => [ 'detruire' => [
'type' => Segment::class, 'type' => Segment::class,
'options' => [ 'options' => [
......
...@@ -116,7 +116,6 @@ Privilèges associés au module ...@@ -116,7 +116,6 @@ Privilèges associés au module
const DOCUMENTMACRO_INDEX = 'documentmacro-documentmacro_index'; const DOCUMENTMACRO_INDEX = 'documentmacro-documentmacro_index';
const DOCUMENTMACRO_AJOUTER = 'documentmacro-documentmacro_ajouter'; const DOCUMENTMACRO_AJOUTER = 'documentmacro-documentmacro_ajouter';
const DOCUMENTMACRO_MODIFIER = 'documentmacro-documentmacro_modifier'; const DOCUMENTMACRO_MODIFIER = 'documentmacro-documentmacro_modifier';
const DOCUMENTMACRO_HISTORISER = 'documentmacro-documentmacro_historiser';
const DOCUMENTMACRO_SUPPRIMER = 'documentmacro-documentmacro_supprimer'; const DOCUMENTMACRO_SUPPRIMER = 'documentmacro-documentmacro_supprimer';
``` ```
...@@ -127,7 +126,6 @@ const DOCUMENTTEMPLATE_INDEX = 'documenttemplate-documenttemplate_index'; ...@@ -127,7 +126,6 @@ const DOCUMENTTEMPLATE_INDEX = 'documenttemplate-documenttemplate_index';
const DOCUMENTTEMPLATE_AFFICHER = 'documenttemplate-documenttemplate_afficher'; const DOCUMENTTEMPLATE_AFFICHER = 'documenttemplate-documenttemplate_afficher';
const DOCUMENTTEMPLATE_AJOUTER = 'documenttemplate-documenttemplate_ajouter'; const DOCUMENTTEMPLATE_AJOUTER = 'documenttemplate-documenttemplate_ajouter';
const DOCUMENTTEMPLATE_MODIFIER = 'documenttemplate-documenttemplate_modifier'; const DOCUMENTTEMPLATE_MODIFIER = 'documenttemplate-documenttemplate_modifier';
const DOCUMENTTEMPLATE_HISTORISER = 'documenttemplate-documenttemplate_historiser';
const DOCUMENTTEMPLATE_SUPPRIMER = 'documenttemplate-documenttemplate_supprimer'; const DOCUMENTTEMPLATE_SUPPRIMER = 'documenttemplate-documenttemplate_supprimer';
``` ```
......
...@@ -85,20 +85,6 @@ class MacroController extends AbstractActionController { ...@@ -85,20 +85,6 @@ class MacroController extends AbstractActionController {
return $vm; return $vm;
} }
public function historiserAction()
{
$macro = $this->getMacroService()->getRequestedMacro($this);
$this->getMacroService()->historise($macro);
return $this->redirect()->toRoute('contenu/macro', [], [], true);
}
public function restaurerAction()
{
$macro = $this->getMacroService()->getRequestedMacro($this);
$this->getMacroService()->restore($macro);
return $this->redirect()->toRoute('contenu/macro', [], [], true);
}
public function supprimerAction() public function supprimerAction()
{ {
$macro = $this->getMacroService()->getRequestedMacro($this); $macro = $this->getMacroService()->getRequestedMacro($this);
......
...@@ -83,22 +83,6 @@ class TemplateController extends AbstractActionController { ...@@ -83,22 +83,6 @@ class TemplateController extends AbstractActionController {
]); ]);
} }
public function historiserAction()
{
$template = $this->getTemplateService()->getRequestedTemplate($this);
$this->getTemplateService()->historise($template);
return $this->redirect()->toRoute('contenu/template', [], [], true);
}
public function restaurerAction()
{
$template = $this->getTemplateService()->getRequestedTemplate($this);
$this->getTemplateService()->restore($template);
return $this->redirect()->toRoute('contenu/template', [], [], true);
}
public function detruireAction() public function detruireAction()
{ {
$template = $this->getTemplateService()->getRequestedTemplate($this); $template = $this->getTemplateService()->getRequestedTemplate($this);
......
...@@ -74,7 +74,7 @@ class TemplateForm extends Form { ...@@ -74,7 +74,7 @@ class TemplateForm extends Form {
]); ]);
//complement //complement
$this->add([ $this->add([
'name' => 'complement', 'name' => 'sujet',
'type' => 'textarea', 'type' => 'textarea',
'options' => [ 'options' => [
'label' => 'Sujet (sujet du courrier électronique, nom du fichier, étiquette, ... ) * : ', 'label' => 'Sujet (sujet du courrier électronique, nom du fichier, étiquette, ... ) * : ',
...@@ -83,13 +83,13 @@ class TemplateForm extends Form { ...@@ -83,13 +83,13 @@ class TemplateForm extends Form {
], ],
], ],
'attributes' => [ 'attributes' => [
'id' => 'complement', 'id' => 'sujet',
'class' => 'form-control complement', 'class' => 'form-control sujet',
] ]
]); ]);
//template //template
$this->add([ $this->add([
'name' => 'template', 'name' => 'corps',
'type' => 'textarea', 'type' => 'textarea',
'options' => [ 'options' => [
'label' => 'Corps * : ', 'label' => 'Corps * : ',
...@@ -98,8 +98,8 @@ class TemplateForm extends Form { ...@@ -98,8 +98,8 @@ class TemplateForm extends Form {
], ],
], ],
'attributes' => [ 'attributes' => [
'id' => 'template', 'id' => 'corps',
'class' => 'form-control contenu', 'class' => 'form-control corps',
] ]
]); ]);
//css //css
...@@ -153,8 +153,8 @@ class TemplateForm extends Form { ...@@ -153,8 +153,8 @@ class TemplateForm extends Form {
'old-code' => ['required' => false, ], 'old-code' => ['required' => false, ],
'type' => ['required' => true, ], 'type' => ['required' => true, ],
'description' => ['required' => false, ], 'description' => ['required' => false, ],
'complement' => ['required' => true, ], 'sujet' => ['required' => true, ],
'contenu' => ['required' => true, ], 'corps' => ['required' => true, ],
'css' => ['required' => false, ], 'css' => ['required' => false, ],
])); ]));
......
...@@ -17,8 +17,8 @@ class TemplateHydrator implements HydratorInterface { ...@@ -17,8 +17,8 @@ class TemplateHydrator implements HydratorInterface {
'code' => ($object)?$object->getCode():null, 'code' => ($object)?$object->getCode():null,
'type' => ($object)?$object->getType():null, 'type' => ($object)?$object->getType():null,
'description' => ($object)?$object->getDescription():null, 'description' => ($object)?$object->getDescription():null,
'complement' => ($object)?$object->getComplement():null, 'sujet' => ($object)?$object->getSujet():null,
'template' => ($object)?$object->getTemplate():null, 'corps' => ($object)?$object->getCorps():null,
'css' => ($object)?$object->getCss():null, 'css' => ($object)?$object->getCss():null,
]; ];
...@@ -35,15 +35,15 @@ class TemplateHydrator implements HydratorInterface { ...@@ -35,15 +35,15 @@ class TemplateHydrator implements HydratorInterface {
$code = (isset($data['code']) AND trim($data['code']) !== "")?trim($data['code']):null; $code = (isset($data['code']) AND trim($data['code']) !== "")?trim($data['code']):null;
$type = (isset($data['type']) AND trim($data['type']) !== "")?trim($data['type']):null; $type = (isset($data['type']) AND trim($data['type']) !== "")?trim($data['type']):null;
$description = (isset($data['description']) AND trim($data['description']) !== "")?trim($data['description']):null; $description = (isset($data['description']) AND trim($data['description']) !== "")?trim($data['description']):null;
$complement = (isset($data['complement']) AND trim($data['complement']) !== "")?strip_tags(trim($data['complement'])):null; $sujet = (isset($data['sujet']) AND trim($data['sujet']) !== "")?strip_tags(trim($data['sujet'])):null;
$template = (isset($data['template']) AND trim($data['template']) !== "")?trim($data['template']):null; $corps = (isset($data['corps']) AND trim($data['corps']) !== "")?trim($data['corps']):null;
$css = (isset($data['css']) AND trim($data['css']) !== "")?strip_tags(trim($data['css'])):null; $css = (isset($data['css']) AND trim($data['css']) !== "")?strip_tags(trim($data['css'])):null;
$object->setCode($code); $object->setCode($code);
$object->setType($type); $object->setType($type);
$object->setDescription($description); $object->setDescription($description);
$object->setComplement($complement); $object->setSujet($sujet);
$object->setTemplate($contenu); $object->setCorps($corps);
$object->setCss($css); $object->setCss($css);
return $object; return $object;
......
...@@ -10,6 +10,5 @@ class DocumenttemplatePrivileges extends Privileges ...@@ -10,6 +10,5 @@ class DocumenttemplatePrivileges extends Privileges
const DOCUMENTTEMPLATE_AJOUTER = 'documenttemplate-documenttemplate_ajouter'; const DOCUMENTTEMPLATE_AJOUTER = 'documenttemplate-documenttemplate_ajouter';
const DOCUMENTTEMPLATE_AFFICHER = 'documenttemplate-documenttemplate_afficher'; const DOCUMENTTEMPLATE_AFFICHER = 'documenttemplate-documenttemplate_afficher';
const DOCUMENTTEMPLATE_MODIFIER = 'documenttemplate-documenttemplate_modifier'; const DOCUMENTTEMPLATE_MODIFIER = 'documenttemplate-documenttemplate_modifier';
const DOCUMENTTEMPLATE_HISTORISER = 'documenttemplate-documenttemplate_historiser';
const DOCUMENTTEMPLATE_SUPPRIMER = 'documenttemplate-documenttemplate_supprimer'; const DOCUMENTTEMPLATE_SUPPRIMER = 'documenttemplate-documenttemplate_supprimer';
} }
\ No newline at end of file
...@@ -202,9 +202,7 @@ class MacroService { ...@@ -202,9 +202,7 @@ class MacroService {
$result = "let macros = [\n"; $result = "let macros = [\n";
foreach ($macros as $macro) { foreach ($macros as $macro) {
if ($macro->estNonHistorise()) { $result .= " { title:'" . $macro->getCode() . "', description:'" . strip_tags(str_replace("'","\'",$macro->getDescription())) . "', content:'VAR[" . $macro->getCode() . "]' },\n";
$result .= " { title:'" . $macro->getCode() . "', description:'" . strip_tags(str_replace("'","\'",$macro->getDescription())) . "', content:'VAR[" . $macro->getCode() . "]' },\n";
}
} }
$result .= "];\n"; $result .= "];\n";
......
...@@ -48,34 +48,6 @@ class TemplateService { ...@@ -48,34 +48,6 @@ class TemplateService {
return $template; return $template;
} }
/**
* @param Template $template
* @return Template
*/
public function historise(Template $template) : Template
{
try {
$this->getEntityManager()->flush($template);
} catch (ORMException $e) {
throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD du Template.", $e);
}
return $template;
}
/**
* @param Template $template
* @return Template
*/
public function restore(Template $template) : Template
{
try {
$this->getEntityManager()->flush($template);
} catch (ORMException $e) {
throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD du Template.", $e);
}
return $template;
}
/** /**
* @param Template $template * @param Template $template
* @return Template * @return Template
......
...@@ -48,7 +48,7 @@ $this->headTitle("Index des macros"); ...@@ -48,7 +48,7 @@ $this->headTitle("Index des macros");
</thead> </thead>
<tbody> <tbody>
<?php foreach($macros as $macro) : ?> <?php foreach($macros as $macro) : ?>
<tr <?php if ($macro->estHistorise()) echo 'class="historise"'; ?> > <tr>
<td> <td>
<?php echo $macro->getCode(); ?> <?php echo $macro->getCode(); ?>
<?php if ($macro->getDescription() !== null) : ?> <?php if ($macro->getDescription() !== null) : ?>
...@@ -69,21 +69,6 @@ $this->headTitle("Index des macros"); ...@@ -69,21 +69,6 @@ $this->headTitle("Index des macros");
> >
<span class="icon editer"></span></a> <span class="icon editer"></span></a>
<?php endif; ?> <?php endif; ?>
<?php if ($canHistoriser) : ?>
<?php if ($macro->estHistorise()): ?>
<a href="<?php echo $this->url('contenu/macro/restaurer', ['macro' => $macro->getId()], [], true); ?>"
data-toggle="tooltip" data-html="true"
title="Restauration de la macro <span class='highlight macro'><?php echo $macro->getCode(); ?></span>"
>
<span class="icon restaurer"></span></a>
<?php else :?>
<a href="<?php echo $this->url('contenu/macro/historiser', ['macro' => $macro->getId()], [], true); ?>"
data-toggle="tooltip" data-html="true"
title="Historiser de la macro <span class='highlight macro'><?php echo $macro->getCode(); ?></span>"
>
<span class="icon historiser"></span>
<?php endif; ?>
<?php endif; ?>
<?php if ($canSupprimer) : ?> <?php if ($canSupprimer) : ?>
<a href="<?php echo $this->url('contenu/macro/supprimer', ['macro' => $macro->getId()], [], true); ?>" <a href="<?php echo $this->url('contenu/macro/supprimer', ['macro' => $macro->getId()], [], true); ?>"
class="ajax-modal" data-event="modification" data-toggle="tooltip" data-html="true" class="ajax-modal" data-event="modification" data-toggle="tooltip" data-html="true"
......
<?php <?php
use UnicaenRenderer\Entity\Db\Content; use UnicaenRenderer\Entity\Db\Template;
/** /**
* @see \UnicaenRenderer\Controller\ContenuController::afficherAction() * @see \UnicaenRenderer\Controller\ContenuController::afficherAction()
* @var Content $contenu * @var Template $contenu
*/ */
?> ?>
......
...@@ -11,7 +11,6 @@ use UnicaenRenderer\Provider\Privilege\DocumenttemplatePrivileges; ...@@ -11,7 +11,6 @@ use UnicaenRenderer\Provider\Privilege\DocumenttemplatePrivileges;
$canAjouter = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_AJOUTER)); $canAjouter = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_AJOUTER));
$canAfficher = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_AFFICHER)); $canAfficher = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_AFFICHER));
$canModifier = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_MODIFIER)); $canModifier = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_MODIFIER));
$canHistoriser = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_HISTORISER));
$canDetruire = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_SUPPRIMER)); $canDetruire = $this->isAllowed(DocumenttemplatePrivileges::getResourceId(DocumenttemplatePrivileges::DOCUMENTTEMPLATE_SUPPRIMER));
$this->headTitle("Index des templates"); $this->headTitle("Index des templates");
...@@ -40,7 +39,7 @@ $this->headTitle("Index des templates"); ...@@ -40,7 +39,7 @@ $this->headTitle("Index des templates");
</thead> </thead>
<tbody> <tbody>
<?php foreach ($templates as $template) : ?> <?php foreach ($templates as $template) : ?>
<tr class="<?php if ($template->estHistorise()) echo 'historise '; ?>"> <tr>
<td> <td>
<?php echo $template->getCode(); ?> <?php echo $template->getCode(); ?>
<?php if ($template->getDescription() !== null) : ?> <?php if ($template->getDescription() !== null) : ?>
...@@ -65,19 +64,6 @@ $this->headTitle("Index des templates"); ...@@ -65,19 +64,6 @@ $this->headTitle("Index des templates");
> >
<span class="icon editer"></span></a> <span class="icon editer"></span></a>
<?php endif; ?> <?php endif; ?>
<?php if ($canHistoriser) : ?>
<?php if ($template->estNonHistorise()) : ?>
<?php /** @see \UnicaenRenderer\Controller\TemplateController::historiserAction() */?>
<a href="<?php echo $this->url('contenu/template/historiser', ['template' => $template->getId()], [], true); ?>"
>
<span class="icon historiser"></span></a>
<?php else : ?>
<?php /** @see \UnicaenRenderer\Controller\TemplateController::restaurerAction() */?>
<a href="<?php echo $this->url('contenu/template/restaurer', ['template' => $template->getId()], [], true); ?>"
>
<span class="icon restaurer"></span></a>
<?php endif; ?>
<?php endif; ?>
<?php if ($canDetruire) : ?> <?php if ($canDetruire) : ?>
<?php /** @see \UnicaenRenderer\Controller\TemplateController::detruireAction() */?> <?php /** @see \UnicaenRenderer\Controller\TemplateController::detruireAction() */?>
<a href="<?php echo $this->url('contenu/template/detruire', ['template' => $template->getId()], [], true); ?>" <a href="<?php echo $this->url('contenu/template/detruire', ['template' => $template->getId()], [], true); ?>"
......
<?php <?php
use UnicaenRenderer\Form\Contenu\ContenuForm; use UnicaenRenderer\Form\Template\TemplateForm;
/** /**
* @see \UnicaenRenderer\Controller\ContenuController::ajouterAction() * @see \UnicaenRenderer\Controller\ContenuController::ajouterAction()
* @see \UnicaenRenderer\Controller\ContenuController::modifierAction() * @see \UnicaenRenderer\Controller\ContenuController::modifierAction()
* @var ContenuForm $form * @var TemplateForm $form
* @var string $macros * @var string $macros
*/ */
...@@ -46,7 +46,7 @@ use UnicaenRenderer\Form\Contenu\ContenuForm; ...@@ -46,7 +46,7 @@ use UnicaenRenderer\Form\Contenu\ContenuForm;
} }
}); });
tinymce.init({ tinymce.init({
selector: '.complement', selector: '.sujet',
toolbar: 'newdocument undo redo | template', toolbar: 'newdocument undo redo | template',
resize: true, resize: true,
language: 'fr_FR', language: 'fr_FR',
...@@ -56,15 +56,15 @@ use UnicaenRenderer\Form\Contenu\ContenuForm; ...@@ -56,15 +56,15 @@ use UnicaenRenderer\Form\Contenu\ContenuForm;
browser_spellcheck: true, browser_spellcheck: true,
branding: false, branding: false,
menu: {}, menu: {},
body_id: 'complement', body_id: 'sujet',
setup: function (editor) { setup: function (editor) {
editor.on("focusout", function () { editor.on("focusout", function () {
$('textarea#complement').val(tinymce.get('complement').getContent()); $('textarea#sujet').val(tinymce.get('sujet').getContent());
}); });
} }
}); });
tinymce.init({ tinymce.init({
selector: '.contenu', selector: '.corps',
menubar: 'table', menubar: 'table',
toolbar: 'newdocument undo redo | bold italic | bullist table | alignjustify alignleft alignright aligncenter | formatselect template', toolbar: 'newdocument undo redo | bold italic | bullist table | alignjustify alignleft alignright aligncenter | formatselect template',
block_formats: 'Normal=p;Titre 1=h1;Titre 2=h2;Titre 3=h3', block_formats: 'Normal=p;Titre 1=h1;Titre 2=h2;Titre 3=h3',
...@@ -76,10 +76,10 @@ use UnicaenRenderer\Form\Contenu\ContenuForm; ...@@ -76,10 +76,10 @@ use UnicaenRenderer\Form\Contenu\ContenuForm;
browser_spellcheck: true, browser_spellcheck: true,