From 47e0c5f61c4f28f65a2a7589d4e0a72dbd1798c3 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 13 Jun 2019 13:15:55 +0200 Subject: [PATCH] svg --- dicos/90_ninegate.xml | 91 ++++++++++++++++++- src/ninegate-1.0/app/config/config.yml | 2 + .../CoreBundle/Command/PurgeFileCommand.php | 29 +++++- .../CoreBundle/Command/data/core-init-01.sql | 2 +- .../Controller/Niveau01Controller.php | 9 ++ .../Cadoles/CoreBundle/Entity/Niveau01.php | 59 ++++++++++++ .../EventListener/sessionListener.php | 10 ++ .../Cadoles/CoreBundle/Form/Niveau01Type.php | 15 ++- .../CoreBundle/Resources/config/routing.yml | 4 + .../CoreBundle/Resources/public/css/style.css | 16 +++- .../Resources/views/Niveau01/edit.html.twig | 16 +++- .../Resources/views/Niveau01/logo.html.twig | 36 ++++++++ .../Resources/views/User/list.html.twig | 2 +- .../CoreBundle/Resources/views/base.html.twig | 14 ++- src/ninegate-1.0/todo.txt | 27 +++++- tmpl/ninegate-init-01.sql | 6 +- tmpl/ninegate-template.yml | 12 ++- 17 files changed, 333 insertions(+), 17 deletions(-) create mode 100755 src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/logo.html.twig diff --git a/dicos/90_ninegate.xml b/dicos/90_ninegate.xml index 0cb1c37c..c84a2fa4 100644 --- a/dicos/90_ninegate.xml +++ b/dicos/90_ninegate.xml @@ -67,26 +67,75 @@ none 8 + + + oui + + oui + oui + + oui + + + oui + + + oui + + + oui + + + oui + + + + + + oui + + + + + + + + oui + + + + + + non + + + + + non + + + + @@ -95,6 +144,9 @@ + + + @@ -155,7 +207,15 @@ ninegate_keyterm ninegate_activate_portal + ninegate_activate_page ninegate_activate_item + ninegate_activate_alert + ninegate_activate_calendar + ninegate_activate_blog + ninegate_activate_flux + ninegate_activate_notice + ninegate_activate_syncenvole + ninegate_activate_cron ninegate_noreply ninegate_smtphost @@ -235,7 +295,7 @@ - + non @@ -246,11 +306,26 @@ oui + ninegate_activate_page ninegate_activate_item + ninegate_activate_alert + ninegate_activate_calendar + ninegate_activate_blog + ninegate_activate_flux + ninegate_activate_notice + + + non + + ninegate_widmoodle_syncenvole + ninegate_widlimesurvey_syncenvole + + + @@ -266,6 +341,7 @@ ninegate_widmoodle_url ninegate_widmoodle_apikey + ninegate_widmoodle_syncenvole @@ -282,6 +358,12 @@ None + + oui + activer_moodle + /posh-profil + None + @@ -300,6 +382,7 @@ ninegate_widlimesurvey_url ninegate_widlimesurvey_apiuser ninegate_widlimesurvey_apikey + ninegate_widlimesurvey_syncenvole @@ -323,6 +406,12 @@ None + + oui + activer_limesurvey + /posh-profil + None + diff --git a/src/ninegate-1.0/app/config/config.yml b/src/ninegate-1.0/app/config/config.yml index ea0adbca..b156393d 100644 --- a/src/ninegate-1.0/app/config/config.yml +++ b/src/ninegate-1.0/app/config/config.yml @@ -86,6 +86,8 @@ oneup_uploader: frontend: dropzone # or any uploader you use in the frontend logo: frontend: dropzone # or any uploader you use in the frontend + niveau01: + frontend: dropzone # or any uploader you use in the frontend header: frontend: dropzone # or any uploader you use in the frontend icon: 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 70650395..7fea6bcc 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php @@ -137,7 +137,7 @@ class PurgeFileCommand extends Command } } - // /web/uploads/header + // /web/uploads/logo $this->writelnred(''); $this->writelnred('== Directory = Logo'); @@ -164,6 +164,33 @@ class PurgeFileCommand extends Command } } + // /web/uploads/niveau01 + $this->writelnred(''); + $this->writelnred('== Directory = Niveau01'); + + $directory=$this->container->get('kernel')->getRootDir()."/../web/uploads/niveau01"; + $files=[]; + $fs = new Filesystem(); + + if($fs->exists($directory)) { + $finder = new Finder(); + $finder->in($directory)->files(); + + 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) { + $this->writeln($name); + $url=$directory."/".$name; + if($fs->exists($url)) { + $fs->remove($url); + } + } + } + } + } + // /web/uploads/slide $this->writelnred(''); $this->writelnred('== Directory = Slide'); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql index fe450887..597a096b 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql @@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES (-100, 'DRAAF', '130007107'); INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES -(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}/Ord89DmD7WPXj/gZEt7CEvzfhNztOLv +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}cj+q8n2VNxVgxAnOvUTqa4Omf/YCfNkC ', 'admin@transnum.cadol.es', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); 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 a769e30f..4e08c28b 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau01Controller.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau01Controller.php @@ -219,6 +219,15 @@ class Niveau01Controller extends Controller ]); } + public function logoAction() + { + return $this->render('CadolesCoreBundle:Niveau01:logo.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/Entity/Niveau01.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Niveau01.php index b182ff64..3cbe96a8 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Niveau01.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Niveau01.php @@ -34,6 +34,16 @@ class Niveau01 */ private $siren; + /** + * @ORM\Column(type="boolean") + */ + private $showsubappname; + + /** + * @ORM\Column(type="text", nullable=true) + */ + private $logo; + /** * @ORM\Column(type="text", nullable=true) */ @@ -81,6 +91,7 @@ class Niveau01 */ protected $items; + /** * Constructor */ @@ -151,6 +162,54 @@ class Niveau01 return $this->siren; } + /** + * Set showsubappname + * + * @param boolean $showsubappname + * + * @return Niveau01 + */ + public function setShowsubappname($showsubappname) + { + $this->showsubappname = $showsubappname; + + return $this; + } + + /** + * Get showsubappname + * + * @return boolean + */ + public function getShowsubappname() + { + return $this->showsubappname; + } + + /** + * Set logo + * + * @param string $logo + * + * @return Niveau01 + */ + public function setLogo($logo) + { + $this->logo = $logo; + + return $this; + } + + /** + * Get logo + * + * @return string + */ + public function getLogo() + { + return $this->logo; + } + /** * Set ldapfilter * 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 c1245a73..b236ee90 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php @@ -90,6 +90,7 @@ $iconniveau02 =$this->container->getParameter('iconniveau02'); $labelsniveau02 =$this->container->getParameter('labelsniveau02'); $labelniveau02 =$this->container->getParameter('labelsniveau02'); + $session->set('viewniveau02',$viewniveau02); $session->set('labelniveau02',$labelniveau02); $moderegistration =$this->container->getParameter('moderegistration'); @@ -204,6 +205,7 @@ $session->set('cancreatepage',false); $session->set('cancreatecalendar',false); $session->set('cancreateblog',false); + $session->remove("sublogo"); if($curentuser!="anon.") { $groups=$curentuser->getGroups(); @@ -213,6 +215,14 @@ if($group->getFgcancreatecalendar()) $session->set('cancreatecalendar',true); if($group->getFgcancreateblog()) $session->set('cancreateblog',true); } + + $niveau01=$curentuser->getNiveau01(); + if($niveau01->getShowsubappname()) + $session->set("subappname", $niveau01->getLabel()); + + if(!is_null($niveau01->getLogo())) + $session->set("sublogo", $niveau01->getLogo()); + } } } 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 2a1e1b0a..e12e5ab7 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau01Type.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/Niveau01Type.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\ButtonType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Doctrine\ORM\EntityRepository; @@ -44,7 +45,19 @@ class Niveau01Type extends AbstractType "attr" => array("class" => "form-control", "style" => "margin-bottom:15px") ) ); - + + $choices=array("oui" => "1","non" => "0"); + $builder->add("showsubappname", + ChoiceType::class,array( + "label" =>"Afficher en tant que sous-titre ? ", + 'disabled' => ($options["mode"]=="delete"?true:false), + "attr" => array("class" => "form-control", "style" => "margin-bottom:15px"), + "choices" => $choices + ) + ); + + $builder->add('logo',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/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml index 5379067d..dd76221a 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 @@ -243,6 +243,10 @@ cadoles_core_config_niveau01_ajax_list: path: /config/niveau01/ajax/list defaults: { _controller: CadolesCoreBundle:Niveau01:ajaxlist } +cadoles_core_config_niveau01_logo: + path: /config/niveau01/logo + defaults: { _controller: CadolesCoreBundle:Niveau01:logo } + #== Niveau02 ============================================================================================================= cadoles_core_config_niveau02: path: /config/niveau02 diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css index 2a368d46..0ef2cb2c 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css @@ -35,12 +35,25 @@ body { .header #logo{ text-decoration: none; - margin:10px 10px 0px 10px; + margin:20px 0px 0px 0px; float:left; +} + +.header #logo:nth-of-type(1){ + margin-left:10px; } .header span { float:left; + padding-left: 10px; +} + +.header small { + position: absolute; + top: 35px; + font-size: 20px; + margin-left: 5px; + height: 20px; } @media (max-width: 767px) { @@ -56,7 +69,6 @@ body { } .navbar-brand img { - width:40px; height:40px; margin-right:10px; margin-top: -10px; 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 998c01ff..759a25be 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 @@ -41,6 +41,7 @@
{{ form_row(form.label) }} {{ form_row(form.siren) }} + {{ form_row(form.showsubappname) }} {% if masteridentity=="LDAP" %} {{ form_row(form.ldapfilter) }} {% endif %} @@ -48,10 +49,23 @@ {% if masteridentity=="SSO" %} {{ form_row(form.attributes) }} {% endif %} + +
+ + {{ form_widget(form.logo) }} + Modifier + Détacher le Logo + +
+
{{ form_end(form) }} {% endblock %} {% block localjavascript %} -{% endblock %} + function delLogo() { + $("#niveau01_logo_img").attr("src",""); + $("#niveau01_logo").val(null); + } +{% endblock %} \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/logo.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/logo.html.twig new file mode 100755 index 00000000..6374ff92 --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau01/logo.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_logo").val("uploads/niveau01/"+response["file"]); + parent.$("#niveau01_logo_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/User/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/list.html.twig index cc6461fa..145dbc0a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/list.html.twig @@ -25,7 +25,7 @@ {% if access=="config" %} - Action + Action {% endif %} Avatar Login diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig index 89d2b3a4..077062f2 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig @@ -29,6 +29,7 @@ {{ include('@CadolesCore/Include/head.html.twig') }}