From 0c0ee8eb2eff408a0be214e40147e7f4918a07f2 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 22 Jun 2020 15:55:43 +0200 Subject: [PATCH 1/7] correction ortho --- .../PortalBundle/Resources/views/Project/edit.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Project/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Project/edit.html.twig index d028bbce..28d20d7c 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Project/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Project/edit.html.twig @@ -4,9 +4,9 @@ {{ form_start(form) }}

{% if mode=="update" %} - Modification Project + Modification Projet {% elseif mode=="submit" %} - Création Project + Création Projet {% endif %}

From 47599404012a641b08fcca14843ff7de07cf73d3 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 22 Jun 2020 16:03:37 +0200 Subject: [PATCH 2/7] suppresion autocomplete sur zone login / password du user (ref #169) --- .../src/Cadoles/CoreBundle/Form/RegistrationType.php | 4 ++-- src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php index 2cdbf8db..b29f2699 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php @@ -52,7 +52,7 @@ class RegistrationType extends AbstractType TextType::class, array( "label" =>"Login", "disabled" => ($options["mode"]=="submit"?false:true), - "attr" => array("class" => "form-control", "style" => "margin-bottom:15px") + "attr" => array("class" => "form-control", "style" => "margin-bottom:15px", "autocomplete" => "new-password") ) ); @@ -97,7 +97,7 @@ class RegistrationType extends AbstractType RepeatedType::class, array( "type" => PasswordType::class, "required" => ($options["mode"]=="submit"?true:false), - "first_options" => array("label" => "Mot de Passe","attr" => array("class" => "form-control", "style" => "margin-bottom:15px")), + "first_options" => array("label" => "Mot de Passe","attr" => array("class" => "form-control", "style" => "margin-bottom:15px", "autocomplete" => "new-password")), "second_options" => array('label' => 'Confirmer Mot de Passe',"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")) ) ); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php index 7ccbefd2..e78e5052 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php @@ -44,7 +44,7 @@ class UserType extends AbstractType TextType::class, array( "label" =>"Login", "disabled" => ($options["mode"]=="submit"?false:true), - "attr" => array("class" => "form-control", "style" => "margin-bottom:15px") + "attr" => array("class" => "form-control", "style" => "margin-bottom:15px", "autocomplete" => "new-password") ) ); @@ -120,7 +120,7 @@ class UserType extends AbstractType "type" => PasswordType::class, "required" => ($options["mode"]=="submit"?true:false), "options" => array("always_empty" => true), - "first_options" => array("label" => "Mot de Passe","attr" => array("class" => "form-control", "style" => "margin-bottom:15px")), + "first_options" => array("label" => "Mot de Passe","attr" => array("class" => "form-control", "style" => "margin-bottom:15px", "autocomplete" => "new-password")), "second_options" => array('label' => 'Confirmer Mot de Passe',"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")) ) ); From 7444af740ea31e08f52c11e737b1fe1c663221ea Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 22 Jun 2020 16:15:56 +0200 Subject: [PATCH 3/7] griser menu navigation projet / blog / calendrier (ref #152) --- .../CoreBundle/Resources/public/themes/transnum/style.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css index 47bfc2fb..9532ad46 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css @@ -14,7 +14,10 @@ body.simple { border-color: #2e3339 !important; } - +.nav-pills { + background-color: #999999 !important; + border-color: #999999 !important; +} .grid .grid-small, .grid .grid-small .item-link { height: 130px; From 92a0d91a1d569b13a93b53e2a4754dd985583f17 Mon Sep 17 00:00:00 2001 From: afornerot Date: Tue, 23 Jun 2020 10:44:22 +0200 Subject: [PATCH 4/7] personnalisation par niveau01 (ref #162) --- .../CoreBundle/Command/PurgeFileCommand.php | 5 +- .../Controller/Niveau01Controller.php | 62 ++++++- .../Controller/Niveau02Controller.php | 64 +++++-- .../Cadoles/CoreBundle/Entity/Niveau01.php | 174 ++++++++++++++++++ .../EventListener/sessionListener.php | 19 ++ .../Cadoles/CoreBundle/Form/Niveau01Type.php | 61 ++++++ .../Cadoles/CoreBundle/Form/Niveau02Type.php | 45 +++-- .../CoreBundle/Resources/config/routing.yml | 3 + .../public/themes/transnum/function.html.twig | 8 +- .../Resources/views/Niveau01/edit.html.twig | 59 +++++- .../Resources/views/Niveau01/header.html.twig | 36 ++++ .../Resources/views/Niveau01/list.html.twig | 2 + tmpl/ninegate-init-01.sql | 3 +- 13 files changed, 494 insertions(+), 47 deletions(-) create mode 100755 src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/header.html.twig diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php index 02bd32f1..782cfd74 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php @@ -194,8 +194,9 @@ class PurgeFileCommand extends Command foreach (iterator_to_array($finder) as $file) { $name = $file->getRelativePathname(); if($name!="logo.png") { - $entity=$this->em->getRepository("CadolesCoreBundle:Niveau01")->findBy(["logo"=>"uploads/niveau01/".$name]); - if(!$entity) { + $logo=$this->em->getRepository("CadolesCoreBundle:Niveau01")->findBy(["logo"=>"uploads/niveau01/".$name]); + $header=$this->em->getRepository("CadolesCoreBundle:Niveau01")->findBy(["header"=>"uploads/niveau01/".$name]); + if(!$logo&&!$header) { $this->writeln($name); $url=$directory."/".$name; if($fs->exists($url)) { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau01Controller.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau01Controller.php index d33cf22c..e881dfa4 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau01Controller.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau01Controller.php @@ -43,20 +43,35 @@ class Niveau01Controller extends Controller $draw= $request->query->get('draw'); $order= $request->query->get('order'); + // Modo ? + $ismodo=false; + if($this->getUser()->getRole()=="ROLE_MODO") { + $ismodo=true; + } + // Nombre total d'enregistrement - $total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult(); + if($ismodo) + $total = $em->createQueryBuilder()->select('COUNT(table)')->from("CadolesCoreBundle:UserModo",'table')->where("table.user = :user")->setParameter("user", $this->getUser())->getQuery()->getSingleScalarResult(); + else + $total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult(); // Nombre d'enregistrement filtré if($search["value"]=="") $totalf = $total; else { - $totalf= $em->createQueryBuilder() + $qb = $em->createQueryBuilder() ->select('COUNT(table)') ->from($this->labelentity,'table') ->where('table.label LIKE :value') - ->setParameter("value", "%".$search["value"]."%") - ->getQuery() - ->getSingleScalarResult(); + ->setParameter("value", "%".$search["value"]."%"); + if($ismodo) + $qb ->from("CadolesCoreBundle:UserModo","usermodo") + ->andwhere("usermodo.user = :user") + ->andWhere("usermodo.niveau01=table") + ->setParameter("user", $this->getUser()); + + + $totalf = $qb->getQuery()->getSingleScalarResult(); } // Construction du tableau de retour @@ -70,8 +85,15 @@ class Niveau01Controller extends Controller // Parcours des Enregistrement $qb = $em->createQueryBuilder(); $qb->select('table')->from($this->labelentity,'table'); + if($ismodo) { + $qb->from("CadolesCoreBundle:UserModo","usermodo") + ->where("usermodo.user = :user") + ->andWhere("usermodo.niveau01=table") + ->setParameter("user", $this->getUser()); + } + if($search["value"]!="") { - $qb ->where('table.label LIKE :value') + $qb ->andwhere('table.label LIKE :value') ->setParameter("value", "%".$search["value"]."%"); } switch($order[0]["column"]) { @@ -84,7 +106,7 @@ class Niveau01Controller extends Controller foreach($datas as $data) { $action ="$data->getId()))."'>"; - if($data->getId()>0) $action.="$data->getId()))."'>"; + if($data->getId()>0&&!$ismodo) $action.="$data->getId()))."'>"; array_push($output["data"],array($action,$data->getLabel())); } @@ -97,6 +119,10 @@ class Niveau01Controller extends Controller // Initialisation de l'enregistrement $data = new Niveau01(); + // Interdit pour les modos + if($this->getUser()->getRole()=="ROLE_MODO") + throw $this->createNotFoundException('Permission denied'); + // Création du formulaire $form = $this->createForm(Niveau01Type::class,$data,array( "mode" => "submit", @@ -136,10 +162,16 @@ class Niveau01Controller extends Controller public function updateAction($id,Request $request) { + $em = $this->getDoctrine()->getManager(); + // Récupération de l'enregistrement courant $data=$this->getData($id); - // Vérifier que cet enregistrement est modifiable + // Modification modo que si niveau modéré + if($this->getUser()->getRole()=="ROLE_MODO") { + $usermodo=$em->getRepository("CadolesCoreBundle:UserModo")->findOneBy(["user"=>$this->getUser(),"niveau01"=>$data]); + if(!$usermodo) throw $this->createNotFoundException('Permission denied'); + } // Création du formulaire $form = $this->createForm(Niveau01Type::class,$data,array( @@ -156,7 +188,6 @@ class Niveau01Controller extends Controller // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); $data = $form->getData(); // Sauvegarde @@ -184,7 +215,9 @@ class Niveau01Controller extends Controller // Récupération de l'enregistrement courant $data=$this->getData($id); - // Vérifier que cet enregistrement est supprimable + // Interdit pour les modos + if($this->getUser()->getRole()=="ROLE_MODO") + throw $this->createNotFoundException('Permission denied'); // Création du formulaire $form = $this->createForm(Niveau01Type::class,$data,array( @@ -228,6 +261,15 @@ class Niveau01Controller extends Controller ]); } + public function headerAction() + { + return $this->render('CadolesCoreBundle:Niveau01:header.html.twig',[ + 'useheader' => false, + 'usemenu' => false, + 'usesidebar' => false, + ]); + } + protected function getDatas() { $em = $this->getDoctrine()->getManager(); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php index a64c1b4a..5daf5e9a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php @@ -43,22 +43,45 @@ class Niveau02Controller extends Controller $draw= $request->query->get('draw'); $order= $request->query->get('order'); + // Modo ? + $ismodo=false; + if($this->getUser()->getRole()=="ROLE_MODO") { + $ismodo=true; + } + + // Nombre total d'enregistrement - $total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult(); + if($ismodo) { + $total = $em->createQueryBuilder()->select('COUNT(table)') + ->from($this->labelentity,'table') + ->from("CadolesCoreBundle:UserModo","usermodo") + ->Where("table.niveau01=usermodo.niveau01") + ->andWhere("usermodo.user=:user") + ->setParameter("user",$this->getUser()) + ->getQuery()->getSingleScalarResult(); + } + else + $total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult(); // Nombre d'enregistrement filtré if($search["value"]=="") $totalf = $total; else { - $totalf= $em->createQueryBuilder() + $qb = $em ->createQueryBuilder() ->select('COUNT(table)') ->from($this->labelentity,'table') ->from("CadolesCoreBundle:Niveau01",'nv1') ->where('table.niveau01=nv1.id') ->andwhere('table.label LIKE :value or nv1.label LIKE :value') - ->setParameter("value", "%".$search["value"]."%") - ->getQuery() - ->getSingleScalarResult(); + ->setParameter("value", "%".$search["value"]."%"); + if($ismodo) { + $qb ->from("CadolesCoreBundle:UserModo","usermodo") + ->andwhere("table.niveau01=usermodo.niveau01") + ->andWhere("usermodo.user=:user") + ->setParameter("user",$this->getUser()); + } + + $totalf = $qb->getQuery()->getSingleScalarResult(); } // Construction du tableau de retour @@ -79,6 +102,13 @@ class Niveau02Controller extends Controller $qb ->andwhere('table.label LIKE :value or nv1.label LIKE :value') ->setParameter("value", "%".$search["value"]."%"); } + if($ismodo) { + $qb->from("CadolesCoreBundle:UserModo","usermodo") + ->andWhere("table.niveau01=usermodo.niveau01") + ->andWhere("usermodo.user=:user") + ->setParameter("user",$this->getUser()); + } + switch($order[0]["column"]) { case 1 : $qb->orderBy('nv1.label',$order[0]["dir"]); @@ -107,7 +137,7 @@ class Niveau02Controller extends Controller $data = new Niveau02(); // Création du formulaire - $form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"submit")); + $form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"submit","user"=>$this->getUser())); // Récupération des data du formulaire $form->handleRequest($request); @@ -141,13 +171,19 @@ class Niveau02Controller extends Controller public function updateAction($id,Request $request) { + $em = $this->getDoctrine()->getManager(); + // Récupération de l'enregistrement courant $data=$this->getData($id); - // Vérifier que cet enregistrement est modifiable + // Suppression modo que si niveau modéré + if($this->getUser()->getRole()=="ROLE_MODO") { + $usermodo=$em->getRepository("CadolesCoreBundle:UserModo")->findOneBy(["user"=>$this->getUser(),"niveau01"=>$data->getNiveau01()]); + if(!$usermodo) throw $this->createNotFoundException('Permission denied'); + } // Création du formulaire - $form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"update")); + $form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"update","user"=>$this->getUser())); // Récupération des data du formulaire $form->handleRequest($request); @@ -157,7 +193,6 @@ class Niveau02Controller extends Controller // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); $data = $form->getData(); // Sauvegarde @@ -182,13 +217,19 @@ class Niveau02Controller extends Controller public function deleteAction($id,Request $request) { + $em = $this->getDoctrine()->getManager(); + // Récupération de l'enregistrement courant $data=$this->getData($id); - // Vérifier que cet enregistrement est supprimable + // Suppression modo que si niveau modéré + if($this->getUser()->getRole()=="ROLE_MODO") { + $usermodo=$em->getRepository("CadolesCoreBundle:UserModo")->findOneBy(["user"=>$this->getUser(),"niveau01"=>$data->getNiveau01()]); + if(!$usermodo) throw $this->createNotFoundException('Permission denied'); + } // Création du formulaire - $form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"delete")); + $form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"delete","user"=>$this->getUser())); // Récupération des data du formulaire $form->handleRequest($request); @@ -198,7 +239,6 @@ class Niveau02Controller extends Controller // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); $em->remove($data); $em->flush(); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Niveau01.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Niveau01.php index d822d2c7..da3c7c63 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Niveau01.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Niveau01.php @@ -44,6 +44,36 @@ class Niveau01 */ private $logo; + /** + * @ORM\Column(type="text", nullable=true) + */ + private $header; + + /** + * @ORM\Column(type="text", nullable=true) + */ + private $colormain; + + /** + * @ORM\Column(type="text", nullable=true) + */ + private $fontcolorhover; + + /** + * @ORM\Column(type="text", nullable=true) + */ + private $colorbody; + + /** + * @ORM\Column(type="text", nullable=true) + */ + private $fontfacetitle; + + /** + * @ORM\Column(type="text", nullable=true) + */ + private $fontfacebody; + /** * @ORM\Column(type="text", nullable=true) */ @@ -465,4 +495,148 @@ class Niveau01 { return $this->alerts; } + + /** + * Set header + * + * @param string $header + * + * @return Niveau01 + */ + public function setHeader($header) + { + $this->header = $header; + + return $this; + } + + /** + * Get header + * + * @return string + */ + public function getHeader() + { + return $this->header; + } + + /** + * Set colormain + * + * @param string $colormain + * + * @return Niveau01 + */ + public function setColormain($colormain) + { + $this->colormain = $colormain; + + return $this; + } + + /** + * Get colormain + * + * @return string + */ + public function getColormain() + { + return $this->colormain; + } + + /** + * Set fontcolorhover + * + * @param string $fontcolorhover + * + * @return Niveau01 + */ + public function setFontcolorhover($fontcolorhover) + { + $this->fontcolorhover = $fontcolorhover; + + return $this; + } + + /** + * Get fontcolorhover + * + * @return string + */ + public function getFontcolorhover() + { + return $this->fontcolorhover; + } + + /** + * Set colorbody + * + * @param string $colorbody + * + * @return Niveau01 + */ + public function setColorbody($colorbody) + { + $this->colorbody = $colorbody; + + return $this; + } + + /** + * Get colorbody + * + * @return string + */ + public function getColorbody() + { + return $this->colorbody; + } + + /** + * Set fontfacetitle + * + * @param string $fontfacetitle + * + * @return Niveau01 + */ + public function setFontfacetitle($fontfacetitle) + { + $this->fontfacetitle = $fontfacetitle; + + return $this; + } + + /** + * Get fontfacetitle + * + * @return string + */ + public function getFontfacetitle() + { + return $this->fontfacetitle; + } + + /** + * Set fontfacebody + * + * @param string $fontfacebody + * + * @return Niveau01 + */ + public function setFontfacebody($fontfacebody) + { + $this->fontfacebody = $fontfacebody; + + return $this; + } + + /** + * Get fontfacebody + * + * @return string + */ + public function getFontfacebody() + { + return $this->fontfacebody; + } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php index bc702779..eafe98ca 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php @@ -283,6 +283,25 @@ if(!is_null($niveau01->getLogo())) $session->set("sublogo", $niveau01->getLogo()); + if(!is_null($niveau01->getHeader())) + $session->set("header", $niveau01->getHeader()); + + if(!is_null($niveau01->getColormain())) + $session->set("colormain", $niveau01->getColormain()); + + if(!is_null($niveau01->getFontcolorhover())) + $session->set("fontcolorhover", $niveau01->getFontcolorhover()); + + if(!is_null($niveau01->getColorbody())) + $session->set("colorbody", $niveau01->getColorbody()); + + if(!is_null($niveau01->getFontfacebody())) + $session->set("fontfacebody", $niveau01->getFontfacebody()); + + if(!is_null($niveau01->getFontfacetitle())) + $session->set("fontfacetitle", $niveau01->getFontfacetitle()); + + } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau01Type.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau01Type.php index ccdf3290..b5c8715a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau01Type.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau01Type.php @@ -57,7 +57,68 @@ class Niveau01Type extends AbstractType ) ); + $choices=array( + "Helvetica" => "Helvetica", + "Peacesans" => "Peacesans", + "Acme-Regular" => "Acme-Regular", + "Redressed" => "Redressed", + "Roboto-Regular" => "Roboto-Regular", + "Justanotherhand-Regular" => "Justanotherhand-Regular", + "Lato-Regular" => "Lato-Regular", + + "ABeeZee-Regular" => "ABeeZee-Regular", + "AlfaSlabOne-Regular" => "AlfaSlabOne-Regular", + "Anton-Regular" => "Anton-Regular", + "FredokaOne-Regular" => "FredokaOne-Regular", + "Overpass-Black" => "Overpass-Black", + "Righteous-Regular" => "Righteous-Regular", + "Signika-Regular" => "Signika-Regular", + "Teko-Bold" => "Teko-Bold", + "LuckiestGuy-Regular" => "LuckiestGuy-Regular", + + "Baloo-Regular" => "Baloo-Regular", + "CarterOne-Regular" => "CarterOne-Regular", + "Chewy-Regular" => "Chewy-Regular", + "Courgette-Regular" => "Courgette-Regular", + "LexendDeca-Regular" => "LexendDeca-Regular", + "RubikMonoOne-Regular" => "RubikMonoOne-Regular", + "SigmarOne-Regular" => "SigmarOne-Regular", + "Viga-Regular" => "Viga-Regular", + ); + + $builder->add('colormain', + TextType::class, + array("label" => "Couleur principale", + "attr" => array("class" => "pick-a-color form-control"), + 'required' => false)); + + $builder->add('fontcolorhover', + TextType::class, + array("label" => "Couleur de texte sur couleur Principale", + "attr" => array("class" => "pick-a-color form-control"), + 'required' => false)); + + $builder->add('colorbody', + TextType::class, + array("label" => "Couleur de fond des pages", + "attr" => array("class" => "pick-a-color form-control"), + 'required' => false)); + + $builder->add("fontfacebody", ChoiceType::class, + array("label" =>"Police principale", + "attr" => array("class" => "form-control"), + 'required' => false, + "choices" => $choices)); + + $builder->add("fontfacetitle", ChoiceType::class, + array("label" =>"Police pour les titres", + "attr" => array("class" => "form-control"), + 'required' => false, + "choices" => $choices)); + + $builder->add('logo',HiddenType::class); + $builder->add('header',HiddenType::class); // Si masteridentity = LDAP alors on demande obligatoirement le filtre des utilisateurs qui appartiennent à ce niveau01 if($options["masteridentity"]=="LDAP") diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau02Type.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau02Type.php index a879ab5a..48d3b3df 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau02Type.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau02Type.php @@ -18,6 +18,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\Query\Expr\Join; class Niveau02Type extends AbstractType { @@ -31,16 +32,37 @@ class Niveau02Type extends AbstractType ) ); - $builder->add('niveau01', - EntityType::class, - array( - "class" => "CadolesCoreBundle:Niveau01", - "label" => $session->get('labelniveau01'), - "choice_label" => "label", - "disabled" => ($options["mode"]!="submit"?true:false), - "attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]!="submit"?true:false)) - ) - ); + if($options["user"]->getRole()=="ROLE_MODO") { + $userid=$options["user"]->getId(); + $builder->add('niveau01', + EntityType::class, + array( + "class" => "CadolesCoreBundle:Niveau01", + "label" => $session->get('labelniveau01'), + "choice_label" => "label", + "disabled" => ($options["mode"]!="submit"?true:false), + "attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]!="submit"?true:false)), + "query_builder"=> function (EntityRepository $er) use($userid) { + $result=$er->createQueryBuilder("table")->innerJoin("CadolesCoreBundle:UserModo", "usermodo", Join::WITH, "table.id = usermodo.niveau01"); + $result->andWhere("usermodo.user = :userid"); + $result->setParameter('userid', $userid); + return $result; + }, + ) + ); + } + else { + $builder->add('niveau01', + EntityType::class, + array( + "class" => "CadolesCoreBundle:Niveau01", + "label" => $session->get('labelniveau01'), + "choice_label" => "label", + "disabled" => ($options["mode"]!="submit"?true:false), + "attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]!="submit"?true:false)) + ) + ); + } $builder->add('label', TextType::class, array( @@ -73,7 +95,8 @@ class Niveau02Type extends AbstractType { $resolver->setDefaults(array( 'data_class' => 'Cadoles\CoreBundle\Entity\Niveau02', - 'mode' => "string" + 'mode' => "string", + 'user' => 'Cadoles\CoreBundle\Entity\User', )); } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml index cb6a5d13..bbfe07fd 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml @@ -327,6 +327,9 @@ cadoles_core_config_niveau01_logo: path: /config/niveau01/logo defaults: { _controller: CadolesCoreBundle:Niveau01:logo } +cadoles_core_config_niveau01_header: + path: /config/niveau01/header + defaults: { _controller: CadolesCoreBundle:Niveau01:header } #== Niveau02 ============================================================================================================= cadoles_core_config_niveau02: diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig index a5dc1715..668fe9b9 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig @@ -1,14 +1,14 @@ {% set logo = "transnum-logo.png" %} {% set fgheader = "" %} -{% set header = "transnum-header.png" %} +{% set header = "" %} {% set heightheader = "" %} -{% set colormain = "2176ad" %} +{% set colormain = "" %} {% set fontcolorhover = "" %} -{% set colorbody = "eeeeee" %} +{% set colorbody = "" %} -{% set fontfacetitle = "LexendDeca-Regular" %} +{% set fontfacetitle = "" %} {% set fontfacebody = "" %} {{ diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/edit.html.twig index b7799e5b..b5418f21 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/edit.html.twig @@ -53,15 +53,56 @@ {% if masteridentity=="SSO" %} {{ form_row(form.attributes) }} {% endif %} + + -
- - {{ form_widget(form.logo) }} - Modifier - Détacher le Logo +
+
+
+
+ Logo +
-
- +
+
+ + {{ form_widget(form.logo) }} + Modifier + Détacher le Logo +
+
+
+
+ +
+
+
+ Style +
+ +
+ {{ form_row(form.colormain) }} + {{ form_row(form.fontcolorhover) }} + {{ form_row(form.colorbody) }} + {{ form_row(form.fontfacebody) }} + {{ form_row(form.fontfacetitle) }} +
+
+
+
+ +
+
+ Bannière +
+ +
+
+ + {{ form_widget(form.header) }} + Modifier + Détacher la Bannière +
{{ form_end(form) }} @@ -72,4 +113,8 @@ $("#niveau01_logo_img").attr("src",""); $("#niveau01_logo").val(null); } + function delHeader() { + $("#niveau01_header_img").attr("src",""); + $("#niveau01_header").val(null); + } {% endblock %} \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/header.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/header.html.twig new file mode 100755 index 00000000..2c1c3927 --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/header.html.twig @@ -0,0 +1,36 @@ +{% extends '@CadolesCore/base.html.twig' %} + +{% block pagewrapper %} + + Annuler + +
+
+{% endblock %} + + + +{% block localjavascript %} + Dropzone.options.MyDropZone = { + acceptedMimeTypes: 'image/*', + maxFiles: 1, + resizeWidth:500, + + success: function( file, response ){ + parent.$("#niveau01_header").val("uploads/niveau01/"+response["file"]); + parent.$("#niveau01_header_img").attr("src","/{{ alias }}/uploads/niveau01/"+response["file"]); + closeModal(); + } + } + + function closeModal() { + window.parent.$("#mymodal").modal('hide'); + } + + $(window).load(function () { + // On vérifie que l'execution se fait bien dans le cadre d'une modal + if(!window.parent.$("#mymodal #framemodal").length) { + $(location).attr('href',"{{ path('cadoles_core_home') }}"); + } + }); +{% endblock %} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/list.html.twig index bca0f0e6..5bd27e5b 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/list.html.twig @@ -3,7 +3,9 @@ {% block pagewrapper %}

Gestion des {{ labelsniveau01 }}

+ {% if is_granted('ROLE_ADMIN') %}

Ajouter

+ {% endif %}
diff --git a/tmpl/ninegate-init-01.sql b/tmpl/ninegate-init-01.sql index 1aae968e..5907fa28 100644 --- a/tmpl/ninegate-init-01.sql +++ b/tmpl/ninegate-init-01.sql @@ -129,7 +129,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES ('cadoles_core_config_datauser',0), ('cadoles_core_config_datausers',0), ('cadoles_core_config_whitelist',0), -('cadoles_core_config_niveau01',0), +('cadoles_core_config_niveau01',1), ('cadoles_core_config_niveau02',1), ('cadoles_core_config_group',1), ('cadoles_core_config_registration',1), @@ -140,6 +140,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES ('cadoles_portal_config_alert',1), ('cadoles_portal_config_calendar',1), ('cadoles_portal_config_blog',1), +('cadoles_portal_config_project',1), ('cadoles_portal_config_flux',1), ('cadoles_portal_config_notice',1), ('cadoles_portal_config_icon',1), From be3cfa28142f9fc8a88860182efed887879a72d1 Mon Sep 17 00:00:00 2001 From: afornerot Date: Tue, 23 Jun 2020 12:21:45 +0200 Subject: [PATCH 5/7] correction mineure --- .../EventListener/sessionListener.php | 11 +++---- .../Controller/PageController.php | 32 ++++++++++--------- .../views/Pagewidget/viewchat.html.twig | 6 ++-- .../Controller/ChatController.php | 7 ++++ .../Resources/views/Chat/client.html.twig | 23 +++++++++++-- 5 files changed, 53 insertions(+), 26 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php index eafe98ca..55288b62 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php @@ -54,11 +54,6 @@ $session->set($config->getId(), strval($config->getValue())); } - - // Calcul des couleurs - $color = $this->container->get('cadoles.core.service.color'); - $color->setColor(); - // Utilisateur en cours $curentuserid=0; $token = $this->token_storage->getToken(); @@ -303,9 +298,13 @@ } - } + // Calcul des couleurs + $color = $this->container->get('cadoles.core.service.color'); + $color->setColor(); + + // Visite if($curentuser!="anon.") { $now=new \DateTime(); if(!$curentuser->getVisitedate()) { 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 f59166b9..7ebc3683 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php @@ -517,21 +517,23 @@ class PageController extends Controller // Compteur de visite if($this->getUser()) { - $group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid); - if($group && $group->getFgcanshare()) { - $usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["group"=>$group,"user"=>$this->getUser()]); - if($usergroup) { - $visitedate=$usergroup->getVisitedate(); - if($visitedate) $visitedate->add(new \DateInterval("PT1H")); - $now=new \DateTime(); - if($visitedate<$now) { - $usergroup->setVisitedate($now); - $usergroup->setVisitecpt($usergroup->getVisitecpt()+1); - $em->persist($usergroup); - $em->flush(); - } - } - } + if($groupid) { + $group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid); + if($group && $group->getFgcanshare()) { + $usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["group"=>$group,"user"=>$this->getUser()]); + if($usergroup) { + $visitedate=$usergroup->getVisitedate(); + if($visitedate) $visitedate->add(new \DateInterval("PT1H")); + $now=new \DateTime(); + if($visitedate<$now) { + $usergroup->setVisitedate($now); + $usergroup->setVisitecpt($usergroup->getVisitecpt()+1); + $em->persist($usergroup); + $em->flush(); + } + } + } + } } // Type Calendrier diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig index 94e0b66f..bc298d56 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig @@ -22,6 +22,8 @@ {% if colorbodyfont is null %} {% set colorbodyfont = color['fontcolorhover'] %} {% endif %} +{% set colorbody = color['colorbody'] %} +{% set colormain = color['main'] %} {% if app.user %} @@ -37,7 +39,7 @@ {% if onheader %}
- +
{% else %}
@@ -51,7 +53,7 @@
{% if group is not null %} - {{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont})) }} + {{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain})) }} {% endif %}