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 a4337b1f..f6d8a88f 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}wAHoMm5DBdK1+YoDHF+e40chzyBR/vhk +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}HNhgaEb5yI9ZX4o5Ydrf1+D/YeNPLIdF ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); @@ -83,6 +83,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type ('050', 1, 1, 1, 'color', 'colormain', '2c3e50', '', 'Couleur principale de votre site'), ('051', 1, 1, 1, 'color', 'fontcolorhover', 'ffffff', '', 'Couleur de la police sur couleur principale'), +('052', 1, 1, 1, 'color', 'colorbody', 'ffffff', '', 'Couleur de fond de vos pages'), ('060', 1, 1, 1, 'font', 'fontfacetitle', 'Anton-Regular', '', 'Police des titres de votre site'), ('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'), diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ThemeController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ThemeController.php index 0be58d49..e4f1e8d6 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ThemeController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ThemeController.php @@ -83,6 +83,9 @@ class ThemeController extends Controller $fontcolorhover=$request->query->get('fontcolorhover'); if(!empty($fontcolorhover)) $session->set('fontcolorhover',$fontcolorhover); + $colorbody=$request->query->get('colorbody'); + if(!empty($colorbody)) $session->set('colorbody',$colorbody); + $fontfacetitle=$request->query->get('fontfacetitle'); if(!empty($fontfacetitle)) $session->set('fontfacetitle',$fontfacetitle); 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 90d214c5..91f7fbfe 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php @@ -50,9 +50,11 @@ $configs = $this->em->getRepository("CadolesCoreBundle:Config")->findAll(); foreach($configs as $config) { + //dump($config->getId()." = ".strval($config->getValue())); $session->set($config->getId(), strval($config->getValue())); } - + + // Calcul des couleurs $color = $this->container->get('cadoles.core.service.color'); $color->setColor(); 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 4ac385e3..d55535d7 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 @@ -166,7 +166,7 @@ body { .list-item { min-height: 50px; - margin-top: 10px; + margin-top: 5px; color:#ffffff; border-radius: 0px; margin-bottom: 0px; @@ -207,7 +207,7 @@ span.item-drag { background: transparent; } -.grid-gutter-sizer { width: 0px } +.grid-gutter-sizer { width: 5px } .grid-title { background: transparent; @@ -219,7 +219,7 @@ span.item-drag { .grid .grid-item, .grid .grid-sizer { float: left; - margin: 0px; + margin: 5px 0px 0px 0px; padding: 0px; width: 290px; height: 150px; @@ -391,9 +391,13 @@ a.item-heart { .grid .grid-small .grid-item-title h2 { font-size:10px; border-bottom: none; } .grid .grid-small .grid-item-title span { display: none } + + + .grid .grid-image { - width:20%; + width:19.2%; height:auto; + margin: 1% 0px 0px 0px; } .grid .grid-image .item-link { @@ -413,12 +417,14 @@ a.item-heart { max-height:none; } +.grid-gutter-sizer-image { width: 1% } + + .grid .grid-preview { width:19.2%; min-width:220px; height:auto; - margin-bottom: 10px; text-align: left; } @@ -444,7 +450,7 @@ a.item-heart { } .grid .grid-image { - width:33.3333333333%; + width:32.666666667%; height:auto; } } @@ -456,7 +462,7 @@ a.item-heart { } .grid .grid-image { - width:50%; + width:49.5%; height:auto; } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/black/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/black/function.html.twig index 0d75e20d..b87d079f 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/black/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/black/function.html.twig @@ -6,6 +6,7 @@ {% set colormain = "2e3131" %} {% set fontcolorhover = "" %} +{% set colorbody = "" %} {% set fontfacetitle = "" %} {% set fontfacebody = "" %} @@ -19,6 +20,7 @@ 'heightheader': heightheader, 'colormain': colormain, 'fontcolorhover': fontcolorhover, + 'colorbody': colorbody, 'fontfacetitle': fontfacetitle, 'fontfacebody': fontfacebody } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/gray/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/gray/function.html.twig index 1647759e..f5d07e0c 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/gray/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/gray/function.html.twig @@ -6,11 +6,11 @@ {% set colormain = "6c7a89" %} {% set fontcolorhover = "" %} +{% set colorbody = "" %} {% set fontfacetitle = "" %} {% set fontfacebody = "" %} - {{ render(url("cadoles_core_theme_setconfig", { @@ -20,6 +20,7 @@ 'heightheader': heightheader, 'colormain': colormain, 'fontcolorhover': fontcolorhover, + 'colorbody': colorbody, 'fontfacetitle': fontfacetitle, 'fontfacebody': fontfacebody } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/green/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/green/function.html.twig index 5e7b86cb..f54b0c1e 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/green/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/green/function.html.twig @@ -6,6 +6,7 @@ {% set colormain = "1e824c" %} {% set fontcolorhover = "" %} +{% set colorbody = "" %} {% set fontfacetitle = "" %} {% set fontfacebody = "" %} @@ -19,6 +20,7 @@ 'heightheader': heightheader, 'colormain': colormain, 'fontcolorhover': fontcolorhover, + 'colorbody': colorbody, 'fontfacetitle': fontfacetitle, 'fontfacebody': fontfacebody } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/orange/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/orange/function.html.twig index c9f4abfa..0b2314d4 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/orange/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/orange/function.html.twig @@ -6,11 +6,11 @@ {% set colormain = "f15a22" %} {% set fontcolorhover = "" %} +{% set colorbody = "" %} {% set fontfacetitle = "" %} {% set fontfacebody = "" %} - {{ render(url("cadoles_core_theme_setconfig", { @@ -20,6 +20,7 @@ 'heightheader': heightheader, 'colormain': colormain, 'fontcolorhover': fontcolorhover, + 'colorbody': colorbody, 'fontfacetitle': fontfacetitle, 'fontfacebody': fontfacebody } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/red/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/red/function.html.twig index b12c549f..dce1ebc4 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/red/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/red/function.html.twig @@ -6,11 +6,11 @@ {% set colormain = "96281b" %} {% set fontcolorhover = "" %} +{% set colorbody = "" %} {% set fontfacetitle = "" %} {% set fontfacebody = "" %} - {{ render(url("cadoles_core_theme_setconfig", { @@ -20,6 +20,7 @@ 'heightheader': heightheader, 'colormain': colormain, 'fontcolorhover': fontcolorhover, + 'colorbody': colorbody, 'fontfacetitle': fontfacetitle, 'fontfacebody': fontfacebody } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/yellow/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/yellow/function.html.twig index c6bdbed9..b1f49ed9 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/yellow/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/yellow/function.html.twig @@ -6,11 +6,11 @@ {% set colormain = "f7ca18" %} {% set fontcolorhover = "171717" %} +{% set colorbody = "" %} {% set fontfacetitle = "" %} {% set fontfacebody = "" %} - {{ render(url("cadoles_core_theme_setconfig", { @@ -20,6 +20,7 @@ 'heightheader': heightheader, 'colormain': colormain, 'fontcolorhover': fontcolorhover, + 'colorbody': colorbody, 'fontfacetitle': fontfacetitle, 'fontfacebody': fontfacebody } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/head.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/head.html.twig index 453dbfad..fb406440 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/head.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/head.html.twig @@ -73,6 +73,10 @@ { background-color: #{{ color['main'] }} } + + #page-wrapper { + background-color: #{{ color['colorbody'] }} + } .navbar-default, .panel-primary, diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/colorService.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/colorService.php index a3894e8d..650021d2 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/colorService.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/colorService.php @@ -26,6 +26,7 @@ class colorService $colordarkrgb =$this->hexToRgb($colordark); $fontcolorhover =$session->get('fontcolorhover'); + $colorbody =$session->get('colorbody'); $tbcolor=array( "main" =>$colormain, @@ -37,7 +38,9 @@ class colorService "fontcolorhover" =>$fontcolorhover, "fontcolorhoverlight" =>$this->adjustBrightness($fontcolorhover,+50), - "fontcolorhoverdark" =>$this->adjustBrightness($fontcolorhover,-50) + "fontcolorhoverdark" =>$this->adjustBrightness($fontcolorhover,-50), + + "colorbody" =>$colorbody, ); $session->set('color', $tbcolor); 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 aa3e25af..bca31031 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -14,6 +14,8 @@ use Doctrine\ORM\Id\AssignedGenerator; use Cadoles\PortalBundle\Entity\Icon; use Cadoles\PortalBundle\Entity\Pagecategory; +use Cadoles\PortalBundle\Entity\Page; +use Cadoles\PortalBundle\Entity\PageWidget; use Cadoles\PortalBundle\Entity\Widget; use Cadoles\PortalBundle\Entity\Appexternal; use Cadoles\PortalBundle\Entity\Flux; @@ -53,6 +55,14 @@ class InitDataCommand extends ContainerAwareCommand $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); + $metadata = $em->getClassMetaData('CadolesPortalBundle:Page'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + + $metadata = $em->getClassMetaData('CadolesPortalBundle:Pagewidget'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + $metadata = $em->getClassMetaData('CadolesPortalBundle:Itemcategory'); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); @@ -193,6 +203,7 @@ class InitDataCommand extends ContainerAwareCommand $em->persist($entityPagecategory); } + //== ITEMCATEGORY======================================================================================================================================== $output->writeln(' > Creation Item Category'); @@ -214,6 +225,7 @@ class InitDataCommand extends ContainerAwareCommand $em->persist($entityItemcategoryadm); } + //== ITEM =============================================================================================================================================== $output->writeln(' > Creation Item'); @@ -358,10 +370,10 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_item"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); - $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "2", "mandatory": "true"},{"id": "withbookmark", "loc": "col1", "type": "withbookmark", "label": "Avec Favoris", "value": "0", "mandatory": "true"},{"id": "itemcategory", "loc": "col1", "type": "itemcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}'); + $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "2", "mandatory": "true"},{"id": "withbookmark", "loc": "col1", "type": "withbookmark", "label": "Avec Favoris", "value": "0", "mandatory": "true"},{"id": "itemcategory", "loc": "col1", "type": "itemcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"},{"id": "search", "loc": "col4", "type": "boolean", "label": "Zone de Recherche", "value": "0", "mandatory": "true"},{"id": "menu", "loc": "col4", "type": "boolean", "label": "Menu des Catégories", "value": "0", "mandatory": "true"},{"id": "menuall", "loc": "col4", "type": "boolean", "label": "Menu toutes les Catégories", "value": "1", "mandatory": "true"}]}'); $entityWidget->setParameter($parameter); $em->persist($entityWidget); @@ -378,7 +390,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_alert"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); $parameter = json_decode('{"fields": [{"id": "alertcategory", "loc": "col1", "type": "alertcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}'); @@ -398,7 +410,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_flux"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); $parameter = json_decode('{"fields": []}'); @@ -418,10 +430,10 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_bookmark"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); - $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}'); + $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "2", "mandatory": "true"}]}'); $entityWidget->setParameter($parameter); $em->persist($entityWidget); @@ -518,7 +530,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_galery"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); $parameter = json_decode('{"fields": []}'); @@ -557,7 +569,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_blog"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); $parameter = json_decode('{"fields": [{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}'); @@ -577,7 +589,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_rss"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); $parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés (0 pour tout)", "value": "10", "mandatory": "true"}]}'); @@ -608,7 +620,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_appexternal"); $entityWidget->setHeight("630"); $entityWidget->setAutoajust(true); - $entityWidget->setBorder(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); @@ -636,6 +648,30 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setParameter($parameter); $em->persist($entityWidget); + // Widget Bureau Essentiel + $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1850); + if(!$entityWidget) $entityWidget = new Widget(); + $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_computer.png"]); + $entityWidget->setId(-1850); + $entityWidget->setRoworder(2); + $entityWidget->setIcon($entityicon); + $entityWidget->setName('Bureau Essentiel'); + $entityWidget->setDescription("Affiche les items de bureau essentiel"); + $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_itemessential"); + $entityWidget->setHeight("630"); + $entityWidget->setAutoajust(true); + $entityWidget->setBorder(false); + $entityWidget->setOpened(true); + $entityWidget->setAccess(["config","user","group"]); + $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "2", "mandatory": "true"}]}'); + $entityWidget->setParameter($parameter); + $em->persist($entityWidget); + + + + + + // Widget Séparateur $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600); if(!$entityWidget) $entityWidget = new Widget(); @@ -694,11 +730,57 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setParameter($parameter); $em->persist($entityWidget); - - - - + // flush $em->flush(); + + +//== PAGETEMPALTE ======================================================================================================================================= + $output->writeln(' > Creation Pagetemplate'); + + // Template app + $entityPage = $em->getRepository('CadolesPortalBundle:Page')->find(-100); + if(!$entityPage) { + $entityPagecategory = $em->getRepository('CadolesPortalBundle:Pagecategory')->find(2); + $entityGroup = $em->getRepository('CadolesCoreBundle:Group')->findOneBy(["fgall"=>true]); + + $entityPage = new Page(); + $entityPage->setId(-100); + $entityPage->setRowOrder(0); + $entityPage->setName('Applications'); + $entityPage->setParentfor('app'); + $entityPage->setMaxwidth(1000); + $entityPage->setPagecategory($entityPagecategory); + $entityPage->addGroup($entityGroup); + $entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 12,"rows":[]}]}]}'); + + $em->persist($entityPage); + $em->flush(); + + $entityPagewidget = $em->getRepository('CadolesPortalBundle:Pagewidget')->find(-110); + if(!$entityPagewidget) { + $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1990); + + $entityPagewidget = new Pagewidget(); + $entityPagewidget->setId(-110); + $entityPagewidget->setLoc("R1C1"); + $entityPagewidget->setRoworder(1); + $entityPagewidget->setName("Applications"); + $entityPagewidget->setHeight($entityWidget->getHeight()); + $entityPagewidget->setAutoajust($entityWidget->getAutoajust()); + $entityPagewidget->setBorder($entityWidget->getBorder()); + $entityPagewidget->setOpened($entityWidget->getOpened()); + $entityPagewidget->setIcon($entityWidget->getIcon()); + $entityPagewidget->setPage($entityPage); + $entityPagewidget->setWidget($entityWidget); + + $param["fields"]=["fields"=>[["id"=>"modedesktop","value"=>2],["id"=>"withbookmark","value"=>0],["id"=>"itemcategory","value"=>null],["id"=>"menu","value"=>1],["id"=>"search","value"=>1],["id"=>"menuall","value"=>1]]]; + $entityPagewidget->setParameter($param["fields"]); + + $em->persist($entityPagewidget); + $em->flush(); + } + } + $output->writeln(''); } } 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 a8ea77fb..cb05ee67 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php @@ -289,6 +289,7 @@ class PageController extends Controller if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); + $em->flush(); if($access=="config") @@ -547,6 +548,37 @@ class PageController extends Controller } + public function applicationAction(Request $request,$access=null) { + // usage soit portal / user / group + $usage=$request->query->get('usage'); + $group=$request->query->get('group'); + + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository($this->labelentity)->findOneBy(["parentfor"=>"app"]); + if (!$entity) { + return $this->render('CadolesCoreBundle:Core:reconnect.html.twig', [ + 'useheader' => false, + 'usemenu' => false, + 'usesidebar' => false, + ]); + } + + $canupdate = false; + + return $this->render($this->labelentity.':viewwidget.html.twig', [ + 'useheader' => ($access=="config"), + 'usemenu' => false, + 'usesidebar' => ($access=="config"), + 'entity' => $entity, + 'access' => $access, + 'canupdate' => $canupdate, + 'mode' => "view", + 'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access,'config'), + 'usage' => $usage, + 'group' => $group + ]); + } + public function uploadAction(Request $request,$access=null) { // Fichier temporaire uploadé $tmpfile = $request->files->get('upload'); 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 a34692af..4377507f 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php @@ -7,6 +7,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Form\FormError; use Cadoles\PortalBundle\Entity\Page; use Cadoles\PortalBundle\Form\PagetemplateSubmitType; @@ -151,10 +152,13 @@ class PagetemplateController extends Controller $form = $this->entityForm($entity,$access); $form->handleRequest($request); - if ($form->isValid()) { + // Sur erreur + $this->getErrorForm(null,$form,$request,$entity,"submit"); + + if ($form->isValid() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); if($access=="user") $entity->setUser($this->getUser()); - + $em->persist($entity); $em->flush(); @@ -216,19 +220,27 @@ class PagetemplateController extends Controller $em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate); if(!$canupdate) throw $this->createNotFoundException('Permission denied'); } + - // On s'assure que le template est supprimable - $info=""; + $error=false; + $this->get('session')->getFlashBag()->clear(); + $group = $em->getRepository("CadolesCoreBundle:Group")->findOneBy(["pagetemplate"=>$entity]); - if(!$group) { + if($group ) { + $error=true; + $request->getSession()->getFlashBag()->add("error", "Impossible de supprimer ce modèle, il est utilisé par au moins un groupe"); + } + + if($entity->getParentfor()=="app") { + $error=true; + $request->getSession()->getFlashBag()->add("error", "Vous ne pouvez pas supprimer un template de type Application"); + } + + if(!$error) { // Suppression $em->remove($entity); $em->flush(); } - else { - $this->get('session')->getFlashBag()->clear(); - $request->getSession()->getFlashBag()->add("error", "Impossible de supprimer ce modèle, il est utilisé par au moins un groupe"); - } // Retour return $this->redirect($this->generateUrl($this->routeprimary)); @@ -288,4 +300,30 @@ class PagetemplateController extends Controller 'group' => "" ]); } + + protected function getErrorForm($id,$form,$request,$data,$mode) { + if ($form->get('submit')->isClicked()&&$mode=="delete") { + } + + if ($form->get('submit')->isClicked() && ($mode=="submit" )) { + if($data->getParentfor()=="app") { + $tmp=$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->findOneBy(["parentfor"=>"app"]); + if($tmp) $form->addError(new FormError("Il ne peut avoir qu'un seul template de type Application")); + } + } + + if ($form->get('submit')->isClicked() && !$form->isValid()) { + $this->get('session')->getFlashBag()->clear(); + $validator = $this->get('validator'); + $errors = $validator->validate($data); + foreach( $errors as $error ) { + $request->getSession()->getFlashBag()->add("error", $error->getMessage()); + } + + $errors = $form->getErrors(); + foreach( $errors as $error ) { + $request->getSession()->getFlashBag()->add("error", $error->getMessage()); + } + } + } } 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 99b877c5..917e3de3 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php @@ -47,8 +47,10 @@ class PagewidgetController extends Controller foreach($params->fields as $key => $param) { $tmp = $this->searchArray($values,"id",$param->id); - if(is_array($tmp)) + if(is_array($tmp)&&!empty($tmp)) $params->fields[$key]->value=$tmp[0]["value"]; + else + $params->fields[$key]->value=$param->value; } return $this->createForm(PagewidgetType::class, $entity, [ @@ -382,6 +384,9 @@ class PagewidgetController extends Controller // Récupération des paramétres du widget $modedesktop=0; $iditemcategory=null; + $search=false; + $menu=false; + $menuall=true; foreach($entity->getParameter()["fields"] as $parameter) { switch($parameter["id"]) { case "modedesktop": @@ -396,6 +401,19 @@ class PagewidgetController extends Controller $iditemcategory=$parameter["value"]; if($iditemcategory) $itemcategoryfilter=$em->getRepository("CadolesPortalBundle:Itemcategory")->findBy(["id"=>$iditemcategory]); break; + + case "search": + $search=($parameter["value"]==1); + break; + + case "menu": + $menu=($parameter["value"]==1); + break; + + case "menuall": + $menuall=($parameter["value"]==1); + break; + } } @@ -513,9 +531,135 @@ class PagewidgetController extends Controller 'itemcategorys' => $itemcategorys, 'bookmarks' => $bookmarks, 'access' => $access, + 'search' => $search, + 'menu' => $menu, + 'menuall' => $menuall, ]); } + public function viewitemessentialAction($id,$access="config") { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository($this->labelentity)->find($id); + if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); + + // Permissions + if($access=="config") { + $canupdate = true; + } + else { + // On s'assure que l'utilisateur à la permission de voir + $page=$entity->getPage(); + $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); + if(!$cansee) throw $this->createNotFoundException('Permission denied'); + } + + // Récupération des paramétres du widget + $modedesktop=0; + foreach($entity->getParameter()["fields"] as $parameter) { + switch($parameter["id"]) { + case "modedesktop": + $modedesktop=$parameter["value"]; + break; + } + } + + + // Profilage + $user=$this->getUser(); + $roles=($user?$user->getRoles():["ROLE_ANONYME"]); + $groups=($user?$user->getGroups():[]); + $niveau01=($user?$user->getNiveau01():[]); + + // Bookmark de l'utilisateur + $bookmarks = array(); + if($user) + $bookmarks=$em->getRepository("CadolesPortalBundle:Bookmark")->findBy(["user"=>$user]); + + // Bookmark lié à un item + $bookmarksitems=new ArrayCollection(); + foreach($bookmarks as $bookmark) { + if($bookmark->getItem()) $bookmarksitems->add($bookmark->getItem()); + } + + // Initialisation du calcul des items + $items=new ArrayCollection(); + + // Récupération des items par rôles + foreach($roles as $role) { + $qb = $em->createQueryBuilder(); + $qb->select('item') + ->from("CadolesPortalBundle:Item", 'item') + ->where($qb->expr()->like('item.roles', $qb->expr()->literal("%$role%"))) + ->andWhere("item.essential=:flag") + ->setParameter("flag",true); + + $itemsroles=$qb->getQuery()->getResult(); + foreach($itemsroles as $itemrole) { + if(!$bookmarksitems->contains($itemrole) && !$items->contains($itemrole)) $items->add($itemrole); + } + } + + // Récupération des items par group + foreach($groups as $group) { + $qb = $em->createQueryBuilder(); + $qb->select('item') + ->from("CadolesPortalBundle:Item", 'item') + ->where(":group MEMBER OF item.groups") + ->andWhere("item.essential=:flag") + ->setParameter("flag",true) + ->setParameter("group",$group->getGroup()); + + $itemsgroups=$qb->getQuery()->getResult(); + foreach($itemsgroups as $itemgroup) { + if(!$bookmarksitems->contains($itemgroup) && !$items->contains($itemgroup)) $items->add($itemgroup); + } + } + + // Récupération des items par niveau01 + if($niveau01) { + $qb = $em->createQueryBuilder(); + $qb->select('item') + ->from("CadolesPortalBundle:Item", 'item') + ->where(":niveau01 MEMBER OF item.niveau01s") + ->andWhere("item.essential=:flag") + ->setParameter("flag",true) + ->setParameter("niveau01",$niveau01); + + $itemsniveau01s=$qb->getQuery()->getResult(); + foreach($itemsniveau01s as $itemniveau01) { + if(!$bookmarksitems->contains($itemniveau01) && !$items->contains($itemniveau01)) $items->add($itemniveau01); + } + } + + // Trie des items + $itemsordered = $items->getIterator(); + $itemsordered->uasort(function ($first, $second) { + if((int) $first->getRowOrder() > (int) $second->getRowOrder()) + $return=1; + elseif((int) $first->getRowOrder() == (int) $second->getRowOrder()) { + if($first->getTitle() > $second->getTitle()) + $return=1; + else + $return=-1; + } + else + $return=-1; + + return $return; + }); + + // Render + return $this->render($this->labelentity.':viewitemessential.html.twig', [ + 'entity' => $entity, + 'canadd' => ($user), + 'canupdate' => $canupdate, + 'modedesktop' => $modedesktop, + 'items' => $itemsordered, + 'bookmarks' => $bookmarks, + 'access' => $access, + ]); + } + public function viewalertAction($id,$access="config") { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository($this->labelentity)->find($id); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php index 3d0849e0..a3f0cf40 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php @@ -74,12 +74,19 @@ class Item */ private $rowOrder; + /** + * @var boolean + * + * @ORM\Column(name="essential", type="boolean", nullable=true, options={"default":false}) + */ + private $essential = false; + /** * @var boolean * * @ORM\Column(name="protected", type="boolean", nullable=true, options={"default":false}) */ - protected $protected; + private $protected; /** * @var string @@ -549,4 +556,28 @@ class Item { return $this->niveau01s; } + + /** + * Set essential + * + * @param boolean $essential + * + * @return Item + */ + public function setEssential($essential) + { + $this->essential = $essential; + + return $this; + } + + /** + * Get essential + * + * @return boolean + */ + public function getEssential() + { + return $this->essential; + } } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Page.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Page.php index b3e4bcbc..d45b198c 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Page.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Page.php @@ -148,6 +148,13 @@ class Page } + // A garder pour forcer l'id en init + public function setId($id) + { + $this->id = $id; + return $this; + } + /** * Constructor diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Pagewidget.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Pagewidget.php index 320b32f5..d523ede6 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Pagewidget.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Pagewidget.php @@ -141,6 +141,13 @@ class Pagewidget private $slides; + // A garder pour forcer l'id en init + public function setId($id) + { + $this->id = $id; + return $this; + } + /** * Constructor */ diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/ItemType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/ItemType.php index f80dab17..e3b9db46 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/ItemType.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/ItemType.php @@ -113,7 +113,12 @@ class ItemType extends AbstractType ->add('url') ->add('protected', CheckboxType::class, [ - "label" => "Force l'authentification de l'utilisateur", + "label" => "Force l'authentification de l'utilisateur ?", + "required" => false + ]) + + ->add('essential', CheckboxType::class, [ + "label" => "Item essentiel ?", "required" => false ]) diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagetemplateSubmitType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagetemplateSubmitType.php index 2cfaf768..dfa104e0 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagetemplateSubmitType.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagetemplateSubmitType.php @@ -30,6 +30,7 @@ class PagetemplateSubmitType extends AbstractType "choices" => [ "Utilisateurs" => 'user', "Groupes" => 'group', + "Application" => 'app', ], ]) 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 2f1c2a8a..9598eccb 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 @@ -320,7 +320,10 @@ cadoles_portal_user_page_upload: path: /user/page/upload defaults: { _controller: CadolesPortalBundle:Page:upload, access: user } - +# Page spécifique +cadoles_portal_user_page_application: + path: /page/application + defaults: { _controller: CadolesPortalBundle:Page:application, access: user } #== BOOKMARK ============================================================================================================================================= @@ -688,6 +691,10 @@ cadoles_portal_config_panelwidget_view_item: path: /config/pagewidget/view/item/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewitem, access: config } +cadoles_portal_config_panelwidget_view_itemessential: + path: /config/pagewidget/view/itemessential/{id} + defaults: { _controller: CadolesPortalBundle:Pagewidget:viewitemessential, access: config } + cadoles_portal_config_panelwidget_view_alert: path: /config/pagewidget/view/alert/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewalert, access: config } @@ -783,6 +790,10 @@ cadoles_portal_user_panelwidget_view_item: path: /pagewidget/view/item/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewitem, access: user } +cadoles_portal_user_panelwidget_view_itemessential: + path: /pagewidget/view/itemessential/{id} + defaults: { _controller: CadolesPortalBundle:Pagewidget:viewitemessential, access: user } + cadoles_portal_user_panelwidget_view_alert: path: /pagewidget/view/alert/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewalert, access: user } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig index 7b9f889a..dd3173a2 100755 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig @@ -47,6 +47,7 @@