From c9cdc83cd49c9c5014f2c82aad69a723c9752900 Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 15 Apr 2020 17:41:57 +0200 Subject: [PATCH] svg --- .../CoreBundle/Command/ScriptCommand.php | 83 ++++++++++++++++++- .../CoreBundle/Controller/GroupController.php | 11 ++- .../CoreBundle/Resources/config/routing.yml | 2 +- .../CoreBundle/Resources/public/css/style.css | 9 +- .../Resources/views/File/upload.html.twig | 2 + .../PortalBundle/Command/InitDataCommand.php | 10 ++- .../Controller/PagewidgetController.php | 2 +- .../views/Pagewidget/viewproject.html.twig | 70 +++++++++------- 8 files changed, 149 insertions(+), 40 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php index 402f030e..9fbf3e7a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php @@ -11,9 +11,13 @@ use Symfony\Component\HttpKernel\KernelInterface; use Doctrine\DBAL\Connection as DBALConnection; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\Id\AssignedGenerator; + use Cadoles\CoreBundle\Entity\Script; use Cadoles\CoreBundle\Entity\User; use Cadoles\PortalBundle\Entity\Project; +use Cadoles\PortalBundle\Entity\Pagewidget; global $bdd01; global $config; @@ -102,7 +106,18 @@ class ScriptCommand extends Command $this->writeln(""); } - $this->writeln(''); + $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createwidgetproject"]); + if(!$script) { + $this->writelnred("== SCRIPT = createwidgetproject"); + $this->createwidgetproject(); + + $script=new Script(); + $script->setName("createwidgetproject"); + $this->em->persist($script); + $this->em->flush(); + $this->writeln(""); + } + return 1; } @@ -188,7 +203,27 @@ class ScriptCommand extends Command } } } + } + private function createwidgetproject(){ + + $entityPage = $this->em->getRepository('CadolesPortalBundle:Page')->find(-110); + if($entityPage) { + $fields=["fields"=>[]]; + + $metadata = $this->em->getClassMetaData('CadolesPortalBundle:Pagewidget'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); + $pages=$this->em->getRepository('CadolesPortalBundle:Page')->findBy(["page"=>$entityPage]); + foreach($pages as $page) { + $this->addWidget2Page($page,-1800,"R1C1",1,"Taches du groupe",true,$fields); + } + + $metadata = $this->em->getClassMetaData('CadolesPortalBundle:Pagewidget'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + $this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields); + + } } @@ -270,5 +305,51 @@ class ScriptCommand extends Command return $image; } + private function addWidget($id,$entityPage,$widgetid,$loc,$order,$title,$border,$fields) { + $entityPagewidget = $this->em->getRepository('CadolesPortalBundle:Pagewidget')->find($id); + if(!$entityPagewidget) { + $entityWidget = $this->em->getRepository('CadolesPortalBundle:Widget')->find($widgetid); + if($entityWidget) { + $entityPagewidget = new Pagewidget(); + $entityPagewidget->setId($id); + $entityPagewidget->setLoc($loc); + $entityPagewidget->setRoworder($order); + $entityPagewidget->setName($title); + $entityPagewidget->setHeight($entityWidget->getHeight()); + $entityPagewidget->setAutoajust($entityWidget->getAutoajust()); + $entityPagewidget->setBorder($border); + $entityPagewidget->setOpened($entityWidget->getOpened()); + $entityPagewidget->setIcon($entityWidget->getIcon()); + $entityPagewidget->setPage($entityPage); + $entityPagewidget->setWidget($entityWidget); + $entityPagewidget->setParameter($fields); + $this->em->persist($entityPagewidget); + $this->em->flush(); + } + } + } + + private function addWidget2Page($entityPage,$widgetid,$loc,$order,$title,$border,$fields) { + $entityWidget = $this->em->getRepository('CadolesPortalBundle:Widget')->find($widgetid); + if($entityWidget) { + $entityPagewidget = $this->em->getRepository('CadolesPortalBundle:Pagewidget')->findOneBy(["page"=>$entityPage,"widget"=>$entityWidget]); + if(!$entityPagewidget) { + $entityPagewidget = new Pagewidget(); + $entityPagewidget->setLoc($loc); + $entityPagewidget->setRoworder($order); + $entityPagewidget->setName($title); + $entityPagewidget->setHeight($entityWidget->getHeight()); + $entityPagewidget->setAutoajust($entityWidget->getAutoajust()); + $entityPagewidget->setBorder($border); + $entityPagewidget->setOpened($entityWidget->getOpened()); + $entityPagewidget->setIcon($entityWidget->getIcon()); + $entityPagewidget->setPage($entityPage); + $entityPagewidget->setWidget($entityWidget); + $entityPagewidget->setParameter($fields); + $this->em->persist($entityPagewidget); + $this->em->flush(); + } + } + } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php index 636fb850..b9a15619 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php @@ -910,7 +910,16 @@ class GroupController extends Controller // si la page est lié qu'à un seul group on peut la supprimer if($groups->count()==1) $em->remove($blog); - } + } + + // Sur l'ensemble des project liés + $projects=$data->getProjects(); + foreach($projects as $project) { + $groups=$blog->getGroups(); + // si la page est lié qu'à un seul group on peut la supprimer + if($groups->count()==1) + $em->remove($project); + } } $em->remove($data); 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 f3078eaa..338aacdc 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 @@ -79,7 +79,7 @@ cadoles_core_config_file_download: #-- Access user cadoles_core_user_file_upload: - path: /user/config/file/upload/{id}/{type} + path: /user/file/upload/{id}/{type} defaults: { _controller: CadolesCoreBundle:File:upload, access: user } cadoles_core_user_file_delete: 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 1bf8e30c..9bf27d27 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 @@ -452,7 +452,12 @@ a.item-heart { text-align:center; width: 100%; } -.grid .grid-small .grid-item-title h2 { font-size:10px; border-bottom: none; } +.grid .grid-small .grid-item-title h2 { + font-size:10px; + border-bottom: none; + max-height: 55px; + overflow-y: hidden; +} .grid .grid-small .grid-item-title span { display: none } @@ -691,6 +696,8 @@ a.item-heart { margin-left:50px; cursor: pointer; font-size: 1.5vw; + height: 50px; + overflow-y: hidden; } .widgetheader iframe, diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/upload.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/upload.html.twig index e2c00a82..e1f0c5c6 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/upload.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/upload.html.twig @@ -41,6 +41,8 @@ } function closeModal() { + window.parent.$("#mymodal").removeClass("in"); + window.parent.$(".modal-backdrop").remove(); window.parent.$("#mymodal").modal('hide'); } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php index 891a08a5..520e409e 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -1223,15 +1223,15 @@ class InitDataCommand extends ContainerAwareCommand $em->remove($entityWidget); } - // Widget Project + // Widget Tâche $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1800); if(!$entityWidget) $entityWidget = new Widget(); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_check.png"]); $entityWidget->setId(-1800); $entityWidget->setRoworder(0); $entityWidget->setIcon($entityicon); - $entityWidget->setName('Projet'); - $entityWidget->setDescription("Gestion de projet"); + $entityWidget->setName('Tâche'); + $entityWidget->setDescription("Gestion de projet par tâches"); $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_project"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); @@ -1380,6 +1380,10 @@ class InitDataCommand extends ContainerAwareCommand $fields=["fields"=>[]]; $this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields); + // Widget Tâche + $fields=["fields"=>[]]; + $this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields); + // Widget Notre Blog $fields=["fields"=>[["id"=>"nbarticle","value"=>5]]]; $this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php index c45477b6..c84f85b0 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php @@ -1476,7 +1476,7 @@ class PagewidgetController extends Controller } elseif($fs->exists($directory."/thumbmini/".$tmp["name"])) { $data = file_get_contents($directory."/thumbmini/".$tmp["name"]); - $tmp["thumb"]=$data; + $tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data); } elseif($fs->exists($directory."/thumb/".$tmp["name"])) { $data = file_get_contents($directory."/thumb/".$tmp["name"]); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewproject.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewproject.html.twig index e7f55288..90edb129 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewproject.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewproject.html.twig @@ -62,41 +62,47 @@ {% endif %}
+