- {{ app.session.get('appname') }}
+ {{ app.session.get('appname') }}
{% if not app.session.get('subappname') is empty %}
{{ app.session.get('subappname') }}
{% endif %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php
index 355505f3..6dba0ef5 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php
@@ -424,7 +424,13 @@ class PageController extends Controller
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
- if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
+ if (!$entity) {
+ return $this->render('CadolesCoreBundle:Core:reconnect.html.twig', [
+ 'useheader' => false,
+ 'usemenu' => false,
+ 'usesidebar' => false,
+ ]);
+ }
// Permissions
if($access=="config") {
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php
index 8105e9a0..04f65663 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php
@@ -117,34 +117,6 @@ class PagetemplateController extends Controller
return new Response(json_encode($output), 200);
}
- public function ajaxseleclistAction(Request $request)
- {
- // S'assurer que c'est un appel ajax
- if (!$request->isXmlHttpRequest()) {
- return new JsonResponse(array('message' => 'Interdit'), 400);
- }
-
- $output=array();
- $em = $this->getDoctrine()->getManager();
- $page_limit=$request->query->get('page_limit');
- $q=$request->query->get('q');
-
- $qb = $em->createQueryBuilder();
- $qb->select('table')->from("CadolesPortalBundle:Page",'table')
- ->where('table.name LIKE :value')
- ->setParameter("value", "%".$q."%")
- ->orderBy('table.name');
-
- $datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
- foreach($datas as $data) {
- array_push($output,array("id"=>$data->getId(),"text"=>$data->getName()));
- }
-
- $response = new Response(json_encode($output));
- $response->headers->set('Content-Type', 'application/json');
- return $response;
- }
-
private function entityForm(Page $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
@@ -263,7 +235,36 @@ class PagetemplateController extends Controller
}
+ public function ajaxseleclistAction(Request $request)
+ {
+ // S'assurer que c'est un appel ajax
+ if (!$request->isXmlHttpRequest()) {
+ return new JsonResponse(array('message' => 'Interdit'), 400);
+ }
+ $output=array();
+ $em = $this->getDoctrine()->getManager();
+ $page_limit=$request->query->get('page_limit');
+ $q=$request->query->get('q');
+ $usage=$request->query->get('usage');
+
+ $qb = $em->createQueryBuilder();
+ $qb->select('table')->from("CadolesPortalBundle:Page",'table')
+ ->where('table.name LIKE :value')
+ ->andWhere('table.parentfor=:usage')
+ ->setParameter("value", "%".$q."%")
+ ->setParameter("usage", $usage)
+ ->orderBy('table.name');
+
+ $datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
+ foreach($datas as $data) {
+ array_push($output,array("id"=>$data->getId(),"text"=>$data->getName()));
+ }
+
+ $response = new Response(json_encode($output));
+ $response->headers->set('Content-Type', 'application/json');
+ return $response;
+ }
public function viewAction($id,$access=null) {
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php
index a6030b2a..17dd2fec 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php
@@ -7,13 +7,20 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
+use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
+use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
+
use Symfony\Component\OptionsResolver\OptionsResolver;
+use Doctrine\ORM\EntityRepository;
+
class PageSubmitType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
+ $access=$options["access"];
+
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
@@ -28,9 +35,50 @@ class PageSubmitType extends AbstractType
'label' => 'Catégorie de Page',
'class' => 'CadolesPortalBundle:Pagecategory',
'choice_label' => 'name',
- 'placeholder' => '-- Sélectionnez une catégorie --'
+ 'placeholder' => '-- Sélectionnez une catégorie --',
+ 'query_builder' => function(EntityRepository $er) use ($access) {
+ if($access=="config")
+ return $er->createQueryBuilder('pc')
+ ->select('pc');
+ else
+ return $er->createQueryBuilder('pc')
+ ->select('pc')
+ ->where('pc.id>0');
+
+ },
])
+ ->add('usage', ChoiceType::class, [
+ "label" => 'Usage',
+ "mapped" => false,
+ "choices" => ["Personnel" => 'user',"Groupe de Travail" => 'group'],
+ "disabled" => ($options["mode"]=="delete"?true:false),
+ ])
+
+
+ ->add('page',
+ Select2EntityType::class, array(
+ 'label' => "Modèle de Page",
+ 'disabled' => ($options["mode"]=="delete"?true:false),
+ "required" => false,
+ 'multiple' => false,
+ 'remote_route' => 'cadoles_portal_user_pagetemplate_ajax_selectlist',
+ 'class' => 'Cadoles\PortalBundle\Entity\PageTemplate',
+ 'req_params' => ['usage' => 'parent.children[usage]'],
+ 'primary_key' => 'id',
+ 'text_property' => 'name',
+ 'minimum_input_length' => 0,
+ 'page_limit' => 10,
+ 'allow_clear' => true,
+ 'delay' => 250,
+ 'cache' => false,
+ 'cache_timeout' => 60000, // if 'cache' is true
+ 'language' => 'fr',
+ 'placeholder' => 'Selectionner un modèle de page',
+ 'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
+ )
+ )
+
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml
index a379a652..06ce3c66 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml
@@ -247,6 +247,11 @@ cadoles_portal_config_pagetemplate_view:
path: /config/template/view/{id}
defaults: { _controller: CadolesPortalBundle:Pagetemplate:view, access: config }
+cadoles_portal_user_pagetemplate_ajax_selectlist:
+ path: /user/template/selectlist
+ defaults: { _controller: CadolesPortalBundle:Pagetemplate:ajaxseleclist, access: user }
+
+
#== PAGE =================================================================================================================================================
#-- Access config