This commit is contained in:
afornerot 2019-07-10 17:22:44 +02:00
parent 530962dc15
commit fefecc6cf7
33 changed files with 1131 additions and 125 deletions

View File

@ -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'),

View File

@ -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);

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -73,6 +73,10 @@
{
background-color: #{{ color['main'] }}
}
#page-wrapper {
background-color: #{{ color['colorbody'] }}
}
.navbar-default,
.panel-primary,

View File

@ -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);

View File

@ -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('');
}
}

View File

@ -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');

View File

@ -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());
}
}
}
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -148,6 +148,13 @@ class Page
}
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor

View File

@ -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
*/

View File

@ -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
])

View File

@ -30,6 +30,7 @@ class PagetemplateSubmitType extends AbstractType
"choices" => [
"Utilisateurs" => 'user',
"Groupes" => 'group',
"Application" => 'app',
],
])

View File

@ -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 }

View File

@ -47,6 +47,7 @@
<div class="col-md-8">
{{ form_row(form.title) }}
{{ form_row(form.subtitle) }}
{{ form_row(form.essential) }}
{{ form_row(form.content) }}
</div>

View File

@ -0,0 +1,334 @@
{% extends '@CadolesCore/base.html.twig' %}
{% set color = app.session.get('color') %}
{% set colormain = color['main'] %}
{% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div>
<div id="gridtemplate" style="max-width:1500px; margin:auto; margin-bottom:30px">
<div class="col-md-3">qsdfqsdfqsd</div>
<div class="col-md-9">
{% if bookmarks is not empty %}
<div class="bookmark-container">
{% if items is not empty %}
<h3 class="grid-title" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="bookmark-container" style="display:none">
<h3 class="grid-title" data-idcategory="bookmark"">Favoris</h3>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
</div>
</div>
{% endif %}
{% set mycategs = [] %}
{% for itemcategory in itemcategorys %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set mycategs = mycategs|merge({ (loop.index) : itemcategory}) %}
{% endif %}
{% endfor %}
{% endfor %}
{% for itemcategory in mycategs %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set haveitem=true %}
{% if mycategs|length > 1 or bookmarks is not empty %}
<h3 class="grid-title" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-small" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
{% if haveitem %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endblock %}
{% block localjavascript %}
$('document').ready(function(){
// Ajustement des frames
$(window).resize(function() {
AjustFrame();
});
// Création des grilles d'items
var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
$('body').imagesLoaded(function() {
var grid = $('.grid').masonry(optiongrid);
});
// Preview item de bureau
$( ".grid .item-preview" ).click(function() {
if($(this).parent().children(".grid-item-body").css('display') == 'none') {
$(this).html('<i style="color: #FFF" class="fa fa-minus" title="Informations sur ce service"></i>');
heightbody=$(this).parent().children(".grid-item-body").height()+30;
heightitem=$(this).parent().parent().height();
$(this).parent().children(".grid-item-body").show();
$(this).parent().parent().css("width","100%");
$(this).parent().parent().css("height",heightitem+heightbody);
$(this).parent().children(".grid-item-content").css("height",heightitem+heightbody);
$(this).parent().children(".item-preview").css("height",heightitem+heightbody);
var grid = $('.grid').masonry(optiongrid);
}
else {
$(this).html('<i style="color: #FFF" class="fa fa-plus" title="Informations sur ce service"></i>');
$(this).parent().children(".grid-item-body").hide();
$(this).parent().parent().css("width","");
$(this).parent().parent().css("height","");
$(this).parent().children(".grid-item-content").css("height","");
$(this).parent().children(".item-preview").css("height","");
var grid = $('.grid').masonry(optiongrid);
}
});
// Sur click item à sonder
{% if activate_widsonde %}
$( ".linktosonde" ).click(function() {
title=$(this).attr("data-sonde");
$.getScript( "{{ widsonde_url }}?appli="+title );
});
{% endif %}
});
// Ajout d'un bookmark
function addBookmark(idwidget,touser) {
var url="{{ path('cadoles_portal_user_bookmark_submit',{idpage:0,idwidget:'xx',touser:'yy'})}}";
url=url.replace('xx',idwidget);
url=url.replace('yy',touser);
$(location).attr('href', url);
}
// Modifciation d'un bookmark
function modBookmark(idbookmark) {
var url="{{ path('cadoles_portal_user_bookmark_update',{idpage:0,id:'xx'})}}";
url=url.replace('xx',idbookmark);
$(location).attr('href', url);
}
// Ajouter un item aux bookmark
function heartBookmark(iditem) {
var idbookmark;
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_user_bookmark_heart') }}",
data: {
iditem:iditem
},
success: function(idbookmark) {
location.reload();
}
});
}
// Supprimer un fichier
function delFile(directory,filename) {
var r = confirm("Confirmez-vous la suppression de ce fichier ?");
if (r == true) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_user_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
location.reload();
}
});
}
}
// Ajustement des frames
function AjustFrame() {
$('.frameajust').iframeAutoHeight({
minHeight: 500, // Sets the iframe height to this value if the calculated value is less
heightOffset: 0, // Optionally add some buffer to the bottom
callback: function(callbackObject) { $(this).parent().css("height",callbackObject.newFrameHeight) ;}
});
if($(".frameitem").length>0) {
var heightbody = $('html').height();
var heightheader = $('.header').height();
if($('.pagemenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('.pagemenu').height();
var heightframe = heightbody-heightheader-heightmenu;
$(".frameitem").height(heightframe);
}
}
// Affichage d'un Flux
function showFlux(idwidget, id) {
if(id=="all")
$(".widget[data-id="+idwidget+"]").find(".feed").show();
else {
$(".widget[data-id="+idwidget+"]").find(".feed").hide();
$(".widget[data-id="+idwidget+"]").find(".flux-"+id).show();
}
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid);
}
// Affichage des frames associés aux items de bureau
function resizeFrame() {
var iFrame = document.getElementById('frameContent');
var heightbody = $('html').height();
var heightheader = $('.header').height();
if($('#appmenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('#appmenu').height();
var heightframe = heightbody-heightheader-heightmenu;
$(".pageframe").each(function( index ) {
$(this).height(heightframe);
});
}
function showFrameitem(id,url,forcereload) {
$(".pageframe").hide();
// Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#frameitem-"+id).length)
$("#frameitem-"+id).remove();
// Si la frame en cours existe déjà on l'affiche
if($("#frameitem-"+id).length)
$("#frameitem-"+id).show();
// Sinon on la génère
else
$("#pagecontainer").append("<iframe id='frameitem-"+id+"' class='pageframe' src='"+url+"' style='border:none; width:100%'></iframe>");
resizeFrame();
}
{% endblock %}

View File

@ -463,5 +463,72 @@
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid);
}
// Affichage des items d'une catégorie
function showItemCat(idwidget, id) {
$(".widget[data-id="+idwidget+"]").find(".grid-sizer").show();
$(".widget[data-id="+idwidget+"]").find("#searchitems").val("");
if(id=="all") {
$(".widget[data-id="+idwidget+"]").find(".grid-item").show();
$(".widget[data-id="+idwidget+"]").find(".bookmark-container").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-container").show();
}
else if(id=="fav") {
$(".widget[data-id="+idwidget+"]").find(".grid-item").show();
$(".widget[data-id="+idwidget+"]").find(".bookmark-container").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-container").hide();
}
else {
$(".widget[data-id="+idwidget+"]").find(".grid-item").show();
$(".widget[data-id="+idwidget+"]").find(".bookmark-container").hide();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-container").hide();
$(".widget[data-id="+idwidget+"]").find("[data-idcategory="+id+"]").show();
/* Recherche
$(".widget[data-id="+idwidget+"]").find(".bookmark-container").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-container").show();
$(".widget[data-id="+idwidget+"]").find(".grid-item").hide();
$(".widget[data-id="+idwidget+"]").find(".grid-item[data-title*='Eportfolio']").show();
*/
}
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid);
}
// Affichage des items d'une catégorie
function searchItem(idwidget, label) {
$(".widget[data-id="+idwidget+"]").find(".bookmark-container").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-container").show();
if(label=="") {
$(".widget[data-id="+idwidget+"]").find(".grid-item").show();
$(".widget[data-id="+idwidget+"]").find(".grid-title").show();
$(".widget[data-id="+idwidget+"]").find(".grid-sizer").show();
}
else {
$(".widget[data-id="+idwidget+"]").find(".grid-title").hide();
$(".widget[data-id="+idwidget+"]").find(".grid-item").hide();
$(".widget[data-id="+idwidget+"]").find(".grid-sizer").hide();
items=$(".widget[data-id="+idwidget+"]").find(".grid-item[data-title*='"+label.toLowerCase()+"']");
if(items.length) {
items.show();
items.each(function() {
category=$(this).data("idcategory");
$(".widget[data-id="+idwidget+"]").find("h3[data-idcategory="+category+"]").show();
$(".widget[data-id="+idwidget+"]").find(".grid-sizer[data-idcategory="+category+"]").show();
});
//
}
}
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid);
}
{% endblock %}

View File

@ -140,6 +140,10 @@
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% if not entity.border %}
{% set colorbodyback = color['colorbody'] %}
{% endif %}
{% if colorbodyfont == colorbodyback %}
{% if colorbodyfont == color['main'] %}
{% set colorbodyfont=color['fontcolorhover'] %}
@ -167,6 +171,46 @@
{% endmacro %}`
{% macro mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %}
{% set colorbodyback = entity.colorbodyback %}
{% if colorbodyback is null %}
{% set colorbodyback = color['main'] %}
{% endif %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% if colorbodyfont == colorbodyback %}
{% if colorbodyfont == color['main'] %}
{% set colorbodyfont=color['fontcolorhover'] %}
{% else %}
{% set colorbodyfont=color['main'] %}
{% endif %}
{% endif %}
{% set stylewidgetbody = "" %}
{% set stylewidgetbody = stylewidgetbody ~ "background-color: #" ~ colorbodyback ~ "; " %}
{% set stylewidgetbody = stylewidgetbody ~ "color: #" ~ colorbodyfont ~ "; " %}
{% if not entity.autoajust %}
{% set stylewidgetbody = stylewidgetbody ~ "height: " ~ (entity.height-50-2) ~ "px; overflow-y: auto;" %}
{% endif %}
{% if entity.border %}
{% set stylewidgetbody = stylewidgetbody ~ "padding:10px" %}
{% endif %}
{% if not entity.opened %}
{% set stylewidgetbody = stylewidgetbody ~ "display:none" %}
{% endif %}
{{ stylewidgetbody }}
{% endmacro %}`
@ -193,6 +237,8 @@
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% set stylewidgetbodyframe = "" %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "background-color: #" ~ colorbodyback ~ "; " %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "color: #" ~ colorbodyfont ~ "; " %}

View File

@ -9,27 +9,9 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% set colorbodyback = entity.colorbodyback %}
{% if colorbodyback is null %}
{% set colorbodyback = color['main'] %}
{% endif %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% if colorbodyback==color['fontcolorhover'] %}
{% set colorbodyfont = color['main'] %}
{% else %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% endif %}
<style>
@ -64,7 +46,7 @@
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }} {% if not entity.border %} padding-top:10px; {% endif %}">
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for blogarticle in blogarticles %}
{% if loop.index==1 %}
@ -77,8 +59,8 @@
{% if blogarticle.image is not empty %}
<img src="/{{alias}}/{{blogarticle.image|replace({"/blogarticle/":"/blogarticle/thumb-"})}}" width="100%">
{% endif %}
<div class="caption" style="background-color: #{{ colorbodyfont }}; color: #{{ colorbodyback }};">
<h1 class="grid-preview-title" style="color: #{{ colorbodyback }};">{{ blogarticle.name}}</h1>
<div class="caption" style="{{ stylewidgetbodyreverse }}">
<h1 class="grid-preview-title" style="color: #{{ stylewidgetbodyreverse }};">{{ blogarticle.name}}</h1>
<small>publié par {{ blogarticle.user.username }} le {{ blogarticle.submit|date("d/m/Y à H:i") }}<br>dans le blog {{blogarticle.blog.name }}</small>
</div>
</a>

View File

@ -47,9 +47,9 @@
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% if files|length >= 1 %}
{% if files|length >= 1 %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for file in files|sort %}
{% if loop.index==1 %}
@ -89,8 +89,8 @@
</div>
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>

View File

@ -48,33 +48,35 @@
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for file in files|sort %}
{% if loop.index==1 %}
<div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-image">
<div class="grid-item-content">
{% if canadd %}
<a style="cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le fichier"></i></a>
{% endif %}
{% if files|length>0 %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for file in files|sort %}
{% if loop.index==1 %}
<div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-image"></div>
{% endif %}
<div class="grid-item grid-image">
<div class="grid-item-content">
{% if canadd %}
<a style="cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le fichier"></i></a>
{% endif %}
<a style="cursor:pointer" onClick="showFrameitem('file-{{entity.id}}-{{loop.index}}','{{ path('cadoles_core_'~access~'_file_view',{'directory':'widget-'~entity.id,'filename':file.name,'navigation':true }) }}',true)">
<a style="cursor:pointer" onClick="showFrameitem('file-{{entity.id}}-{{loop.index}}','{{ path('cadoles_core_'~access~'_file_view',{'directory':'widget-'~entity.id,'filename':file.name,'navigation':true }) }}',true)">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
</div>
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
</div>
</div>
</a>
</div>
</a>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>

View File

@ -28,10 +28,11 @@
<div class="widgetheader" style="{{ stylewidgetbodyimage }}; height:100%;">
{% set style = "width: 90px;display: block;margin: 0px auto 10px auto; padding-top: 10px; position: inherit;height: auto;" %}
{% if icon %}
<img src="/{{ alias }}{{ icon }}" style="max-width: 90px; border-radius: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
<img src="/{{ alias }}{{ icon }}" class="logo" style="{{ style }}" />
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_users.png" style="max-height: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
<img src="/{{ alias }}/uploads/icon/icon_users.png" style="{{ style }}" />
{% endif %}
</div>

View File

@ -10,6 +10,7 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set color = app.session.get('color') %}
{% if modedesktop==0 %}
{% set stylegrid="" %}
@ -49,18 +50,52 @@
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% set mycategs = [] %}
{% for itemcategory in itemcategorys %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set mycategs = mycategs|merge({ (loop.index) : itemcategory}) %}
{% endif %}
{% endfor %}
{% endfor %}
{% if menu %}
{% if menuall %}
<div class="cat-list-feed" onClick="showItemCat({{ entity.id}},'all')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">Tout</div>
{% endif %}
{% if bookmarks is not empty %}
<div class="cat-list-feed" onClick="showItemCat({{ entity.id}},'fav')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}"><i class="fa fa-heart"></i></div>
{% endif %}
{% for itemcategory in mycategs %}
<div class="cat-list-feed" onClick="showItemCat({{ entity.id}},{{itemcategory.id}})" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">{{itemcategory.label}}</div>
{% endfor %}
{% endif %}
{% if search %}
<div class="input-group">
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
<input onKeyup="searchItem({{ entity.id}},$(this).val());" type="text" id="searchitems" name="searchitems" class="form-control" placeholder="Recherche" aria-describedby="basic-addon1">
</div>
{% endif %}
{% if bookmarks is not empty %}
<div class="bookmark-container">
{% if items is not empty %}
<h3 class="grid-title" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
<h3 class="grid-title bookmark-container" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div>
<div class="grid-sizer {{ stylegrid }}" data-idcategory="bookmark"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item {{ stylegrid }}">
<div class="grid-item {{ stylegrid }}" data-idcategory="bookmark" data-title="{{ bookmark.title|lower }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
@ -92,48 +127,53 @@
{% endfor %}
</div>
</div>
{% else %}
<div class="bookmark-container" style="display:none">
<h3 class="grid-title" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
<div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div>
<div class="grid-gutter-sizer"></div>
</div>
</div>
{% endif %}
{% set mycategs = [] %}
{% for itemcategory in itemcategorys %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set mycategs = mycategs|merge({ (loop.index) : itemcategory}) %}
{% endif %}
{% endfor %}
{% endfor %}
{% set firstcat=true %}
{% for itemcategory in mycategs %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set haveitem=true %}
{% set haveitem=true %}
{% if bookmarks is not empty %}
{% set toview=true %}
{% if menu and not menuall%}
{% set toview=false %}
{% endif %}
{% else %}
{% if menu and not menuall%}
{% if firstcat %}
{% set toview=true %}
{% else %}
{% set toview=false %}
{% endif %}
{% else %}
{% set toview=true %}
{% endif %}
{% endif %}
{% set firstcat=false %}
{% if mycategs|length > 1 or bookmarks is not empty %}
<h3 class="grid-title" style="{{ colorbodyfont }}" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% else %}
<p></p>
{% endif %}
{% set style="" %}
{% if not toview %}
{% set style="display:none;" %}
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div>
<div class="grid-gutter-sizer"></div>
{% if mycategs|length > 1 or bookmarks is not empty %}
<h3 class="grid-title itemcategory-container" style="{{ colorbodyfont }} {{ style }}" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix itemcategory-container" data-idcategory="{{ item.itemcategory.id }}" style="{{ style }}">
<div class="grid-sizer {{ stylegrid }}" data-idcategory="{{ item.itemcategory.id }}"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item {{ stylegrid }}" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item {{ stylegrid }}" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}" data-title="{{ item.title|lower }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>

View File

@ -0,0 +1,147 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
{% set colormain = constants.mycolormain() %}
{% set stylewidget = constants.mystylewidget(entity) %}
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% if modedesktop==0 %}
{% set stylegrid="" %}
{% elseif modedesktop==1 %}
{% set stylegrid="grid-medium" %}
{% elseif modedesktop==2 %}
{% set stylegrid="grid-small" %}
{% endif %}
{% set colorbodyfont = "" %}
{% if entity.colorbodyfont is not null %}
{% set colorbodyfont = "color: #" ~ entity.colorbodyfont %}
{% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %}
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canadd and access!="config"%}
<a href="{{ path('cadoles_portal_user_page_application') }}">
<i class="fa fa-plus fa-fw" style="{{ stylewidgetmenu }}"></i>
</a>
{% endif %}
</div>
{% endif %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item {{ stylegrid }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
{% for item in items %}
<div class="grid-item {{ stylegrid }}" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if canadd %}
<a style="cursor:pointer" onClick="heartBookmark({{ item.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-heart" title="Ajouter aux favoris"></i></a>
{% endif %}
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>

View File

@ -94,6 +94,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'),