This commit is contained in:
afornerot 2019-07-09 11:02:21 +02:00
parent 8721f7cf98
commit ff5569bcae
31 changed files with 693 additions and 197 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107'); (-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}otHXvfP0WOEFQYGgcJCVwAZ8h4HHrHOP (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}wAHoMm5DBdK1+YoDHF+e40chzyBR/vhk
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -128,7 +128,8 @@ class CoreController extends Controller
'pagesuser' => $pagesuser, 'pagesuser' => $pagesuser,
'groupsshared' => $groupsshared, 'groupsshared' => $groupsshared,
'canadd' => $this->get('session')->get('cancreatepage'), 'canadd' => $this->get('session')->get('cancreatepage'),
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("user") 'widgetsuser' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("user"),
'widgetsgroup' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("group")
]); ]);
} }

View File

@ -6,7 +6,7 @@
<li><a>{{ filename }}</a></li> <li><a>{{ filename }}</a></li>
</ul> </ul>
<ul class="nav navbar-top-links navbar-right"> <ul class="nav navbar-top-links navbar-right" style="position:static">
<li><a href="{{ path('cadoles_core_'~access~'_file_download',{'directory':directory,'filename':filename }) }}" style="cursor:pointer"><i class="fa fa-download"></i></a></li> <li><a href="{{ path('cadoles_core_'~access~'_file_download',{'directory':directory,'filename':filename }) }}" style="cursor:pointer"><i class="fa fa-download"></i></a></li>
</ul> </ul>

View File

@ -361,7 +361,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]); $entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "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"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -612,11 +612,30 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]); $entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "Applications", "loc": "col1", "type": "appexternal", "label": "Applications à affichier", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "2", "mandatory": "true"},{"id": "Applications", "loc": "col1", "type": "appexternal", "label": "Applications à affichier", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
} }
// Widget Information
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1860);
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_info.png"]);
$entityWidget->setId(-1860);
$entityWidget->setRoworder(13);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Information Page');
$entityWidget->setDescription("Afficher les informations associées à la page");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_info");
$entityWidget->setHeight("630");
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
// Widget Séparateur // Widget Séparateur
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600);
if(!$entityWidget) $entityWidget = new Widget(); if(!$entityWidget) $entityWidget = new Widget();

View File

@ -21,6 +21,9 @@ class BookmarkController extends Controller
public function submitAction(Request $request,$idpage,$idwidget,$touser,$access="config") public function submitAction(Request $request,$idpage,$idwidget,$touser,$access="config")
{ {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Initialisation de l'enregistrement // Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$data = new Bookmark(); $data = new Bookmark();
@ -60,7 +63,7 @@ class BookmarkController extends Controller
$em->flush(); $em->flush();
// Retour à la page // Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage,"usage"=>$usage,"group"=>$group]));
} }
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]); $icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
@ -78,11 +81,16 @@ class BookmarkController extends Controller
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'form' => $form->createView(), 'form' => $form->createView(),
'usage' => $usage,
'group' => $group
]); ]);
} }
public function updateAction(Request $request,$idpage,$id,$access="config") public function updateAction(Request $request,$idpage,$id,$access="config")
{ {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$data=$this->getData($id); $data=$this->getData($id);
@ -91,12 +99,20 @@ class BookmarkController extends Controller
// Vérifier que cet enregistrement est modifiable // Vérifier que cet enregistrement est modifiable
$user=$data->getUser(); $user=$data->getUser();
if($user) { if($user) {
if($usage=="user")
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
elseif($access=="user") { elseif($access=="user") {
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser(); $user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
else {
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
}
}
// Création du formulaire // Création du formulaire
$form = $this->createForm(BookmarkType::class,$data,array( $form = $this->createForm(BookmarkType::class,$data,array(
@ -124,7 +140,7 @@ class BookmarkController extends Controller
$em->flush(); $em->flush();
// Retour à la page // Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage,"usage"=>$usage,"group"=>$group]));
} }
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]); $icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
@ -143,11 +159,16 @@ class BookmarkController extends Controller
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'form' => $form->createView(), 'form' => $form->createView(),
'usage' => $usage,
'group' => $group
]); ]);
} }
public function deleteAction(Request $request,$idpage,$id,$access="config") public function deleteAction(Request $request,$idpage,$id,$access="config")
{ {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$data=$this->getData($id); $data=$this->getData($id);
@ -159,9 +180,16 @@ class BookmarkController extends Controller
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
elseif($access=="user") { elseif($access=="user") {
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser(); $user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
else {
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
}
}
// Supprimer la donnée // Supprimer la donnée
@ -170,7 +198,7 @@ class BookmarkController extends Controller
$em->flush(); $em->flush();
// Retour à la page // Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage,"usage"=>$usage,"group"=>$group]));
} }
public function heartAction(Request $request) public function heartAction(Request $request)

View File

@ -7,6 +7,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\FormError;
use Cadoles\PortalBundle\Entity\Page; use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Form\PageSubmitType; use Cadoles\PortalBundle\Form\PageSubmitType;
@ -33,12 +34,11 @@ class PageController extends Controller
public function ajaxlistAction(Request $request,$access="config") public function ajaxlistAction(Request $request,$access="config")
{ {
/*
// S'assurer que c'est un appel ajax // S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) { if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400); return new JsonResponse(array('message' => 'Interdit'), 400);
} }
*/
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$start=$request->query->get('start'); $start=$request->query->get('start');
@ -208,7 +208,8 @@ class PageController extends Controller
else { else {
return $this->createForm(PageSubmitType::class, $entity, [ return $this->createForm(PageSubmitType::class, $entity, [
"mode" => "update", "mode" => "update",
"access" => $access "access" => $access,
"user" => $this->getUser()
]); ]);
} }
} }
@ -225,15 +226,36 @@ class PageController extends Controller
$form = $this->entityForm($entity,$access); $form = $this->entityForm($entity,$access);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) {
// Sur erreur
$this->getErrorForm(null,$form,$request,$entity,"submit");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
if($access=="user") $entity->setUser($this->getUser()); if($access=="user") $entity->setUser($this->getUser());
// Si template on duplique le template
if($entity->getPage()) {
$page=$em->getRepository("CadolesPortalBundle:Page")->clonePage($this->getUser(),$entity->getPage());
$page->setName($entity->getName());
$page->setRoworder($entity->getRoworder());
$page->setMaxwidth($entity->getMaxwidth());
foreach($entity->getGroups() as $group) {
$page->addGroup($group);
}
$em->persist($page);
$em->flush();
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
return $this->redirect($this->generateUrl($route.'_update',["id"=>$page->getId()]));
}
else {
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
$route=str_replace("_config_","_".$access."_",$this->routeprimary); $route=str_replace("_config_","_".$access."_",$this->routeprimary);
return $this->redirect($this->generateUrl($route.'_update',["id"=>$entity->getId()])); return $this->redirect($this->generateUrl($route.'_update',["id"=>$entity->getId()]));
}
} }
return $this->render($this->labelentity.':submit.html.twig', [ return $this->render($this->labelentity.':submit.html.twig', [
@ -420,7 +442,10 @@ class PageController extends Controller
return $response; return $response;
} }
public function viewAction($id,$access=null) { public function viewAction(Request $request,$id,$access=null) {
// usage soit portal / user / group
$usage=$request->query->get('usage');
$group=$request->query->get('group');
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id); $entity = $em->getRepository($this->labelentity)->find($id);
@ -457,7 +482,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'entity' => $entity, 'entity' => $entity,
'access' => $access, 'access' => $access,
'canupdate' => $canupdate 'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]); ]);
} }
@ -470,7 +497,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'entity' => $entity, 'entity' => $entity,
'access' => $access, 'access' => $access,
'canupdate' => $canupdate 'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]); ]);
} }
@ -482,7 +511,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'entity' => $entity, 'entity' => $entity,
'access' => $access, 'access' => $access,
'canupdate' => $canupdate 'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]); ]);
} }
// Type Widgets // Type Widgets
@ -495,7 +526,9 @@ class PageController extends Controller
'access' => $access, 'access' => $access,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'mode' => "view", 'mode' => "view",
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access) 'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access,'config'),
'usage' => $usage,
'group' => $group
]); ]);
} }
// Type Editeur // Type Editeur
@ -506,7 +539,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"), 'usesidebar' => ($access=="config"),
'entity' => $entity, 'entity' => $entity,
'access' => $access, 'access' => $access,
'canupdate' => $canupdate 'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]); ]);
} }
@ -538,4 +573,31 @@ class PageController extends Controller
return new Response($response); return new Response($response);
} }
protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked() && $mode=="submit") {
$usage = $form->get('usage')->getData();
// Une page d'usage groupe doit avoir au moins un group de selectionné
if($usage=="group"&&$data->getGroups()->isEmpty()) {
$form->addError(new FormError('Vous devez selectionner au minimum un groupe'));
}
}
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

@ -283,7 +283,9 @@ class PagetemplateController extends Controller
'access' => $access, 'access' => $access,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'mode' => "viewtemplate", 'mode' => "viewtemplate",
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access) 'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access),
'usage' => "config",
'group' => ""
]); ]);
} }
} }

View File

@ -159,6 +159,8 @@ class PagewidgetController extends Controller
public function updateAction(Request $request,$idpage,$idwidget,$access="config") public function updateAction(Request $request,$idpage,$idwidget,$access="config")
{ {
$by=$request->query->get('by'); $by=$request->query->get('by');
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Recherche du pagewidget // Recherche du pagewidget
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -203,7 +205,7 @@ class PagewidgetController extends Controller
$em->flush(); $em->flush();
if($by=="view") if($by=="view")
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage,"usage"=>$usage,"group"=>$group]));
else else
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_pagetemplate_view',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_pagetemplate_view',["id"=>$idpage]));
} }
@ -224,6 +226,8 @@ class PagewidgetController extends Controller
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'form' => $form->createView(), 'form' => $form->createView(),
'usage' => $usage,
'group' => $group
]); ]);
} }
@ -1210,7 +1214,6 @@ class PagewidgetController extends Controller
$finder = new Finder(); $finder = new Finder();
$finder->sortByName()->in($directory)->exclude('thumb'); $finder->sortByName()->in($directory)->exclude('thumb');
foreach ($finder as $file) { foreach ($finder as $file) {
$tmp=[]; $tmp=[];
$tmp["name"]=$file->getRelativePathname(); $tmp["name"]=$file->getRelativePathname();
@ -1281,6 +1284,7 @@ class PagewidgetController extends Controller
} }
} }
// Render // Render
return $this->render($this->labelentity.':viewgalery.html.twig', [ return $this->render($this->labelentity.':viewgalery.html.twig', [
'entity' => $entity, 'entity' => $entity,
@ -1291,7 +1295,10 @@ class PagewidgetController extends Controller
]); ]);
} }
public function viewcalendarAction($id,$access="config") { public function viewcalendarAction(Request $request,$id,$access="config") {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id); $entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
@ -1317,9 +1324,16 @@ class PagewidgetController extends Controller
} }
} }
// On charge le calendrier de l'utilisateur // On récupère soit les calendriers du group en cours soit l'ensemble des calendriers de l'utilisateur
if($usage=="group") {
$calendars=$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsGroup($this->getUser(),$group);
if($calendars) $firstcalendar=$calendars[0]->getId();
}
else {
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($this->getUser(),$calendarssuser,$calendarsadmin,$calendarsshared); $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($this->getUser(),$calendarssuser,$calendarsadmin,$calendarsshared);
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared); $calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
$firstcalendar="all";
}
// Début & fin // Début & fin
$start=new \DateTime(); $start=new \DateTime();
@ -1362,10 +1376,15 @@ class PagewidgetController extends Controller
'events' => $events, 'events' => $events,
'nbday' => $nbday, 'nbday' => $nbday,
'access' => $access, 'access' => $access,
'firstcalendar' => $firstcalendar,
'usage' => $usage
]); ]);
} }
public function viewblogAction($id,$access="config") { public function viewblogAction(Request $request,$id,$access="config") {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id); $entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
@ -1391,9 +1410,16 @@ class PagewidgetController extends Controller
} }
} }
// On récupère l'ensemble des blogs de l'utilisateur // On récupère soit les blogs du group en cours soit l'ensemble des blogs de l'utilisateur
if($usage=="group") {
$blogs=$em->getRepository("CadolesPortalBundle:Blog")->getBlogsGroup($this->getUser(),$group);
if($blogs) $firstblog=$blogs[0]->getId();
}
else {
$em->getRepository("CadolesPortalBundle:Blog")->getBlogsUser($this->getUser(),$blogsuser,$blogsadmin,$blogsshared); $em->getRepository("CadolesPortalBundle:Blog")->getBlogsUser($this->getUser(),$blogsuser,$blogsadmin,$blogsshared);
$blogs=array_merge($blogsuser,$blogsadmin->toArray(),$blogsshared); $blogs=array_merge($blogsuser,$blogsadmin->toArray(),$blogsshared);
$firstblog="all";
}
// On récupère les nbarticle de ses blogs // On récupère les nbarticle de ses blogs
$em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles); $em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles);
@ -1406,6 +1432,8 @@ class PagewidgetController extends Controller
'blogarticles' => $blogarticles, 'blogarticles' => $blogarticles,
'nbarticle' => $nbarticle, 'nbarticle' => $nbarticle,
'access' => $access, 'access' => $access,
'firstblog' => $firstblog,
'usage' => $usage
]); ]);
} }
@ -1609,4 +1637,64 @@ class PagewidgetController extends Controller
]); ]);
} }
public function viewinfoAction(Request $request,$id,$access="config") {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
$user=$this->getUser();
$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');
}
$icon=null;
$title=null;
$description=null;
$members=[];
if($usage=="group") {
$group=$em->getRepository("CadolesCoreBundle:Group")->find($group);
if($group) {
$title=$group->getLabel();
$description="<strong>Description</strong><br>".$group->getDescription();
if($group->getIcon())
$icon="/".$group->getIcon()->getLabel();
foreach($group->getUsers() as $usergroup) {
array_push($members,$usergroup->getUser());
}
}
}
else {
$title=$entity->getPage()->getName();
$proprio=$entity->getPage()->getUser();
if($proprio) {
$description="Propriétaire de la page<br>".$proprio->getLastname()." ".$proprio->getLastname();
$icon="/uploads/avatar/".$proprio->getAvatar();
}
}
// Render
return $this->render($this->labelentity.':viewinfo.html.twig', [
'entity' => $entity,
'canadd' => ($user),
'canupdate' => $canupdate,
'usage' => $usage,
'icon' => $icon,
'title' => $title,
'description' => $description,
'members' => $members
]);
}
} }

View File

@ -19,8 +19,11 @@ class SlideController extends Controller
private $labeldata = 'slide'; private $labeldata = 'slide';
private $labeldatas = 'slides'; private $labeldatas = 'slides';
public function listAction($idpage,$idwidget,$access="config") public function listAction(Request $request,$idpage,$idwidget,$access="config")
{ {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// On s'assure que le widget existe // On s'assure que le widget existe
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$pagewidget = $em->getRepository("CadolesPortalBundle:Pagewidget")->find($idwidget); $pagewidget = $em->getRepository("CadolesPortalBundle:Pagewidget")->find($idwidget);
@ -28,9 +31,16 @@ class SlideController extends Controller
// Vérifier que l'on générer un slide // Vérifier que l'on générer un slide
if($access=="user") { if($access=="user") {
$user=$pagewidget->getPage()->getUser(); if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
else {
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
}
}
// Recherche des slides du widget // Recherche des slides du widget
$datas = $em->getRepository($this->labelentity)->findBy(["pagewidget"=>$idwidget],["roworder"=>"ASC","title"=>"ASC"]); $datas = $em->getRepository($this->labelentity)->findBy(["pagewidget"=>$idwidget],["roworder"=>"ASC","title"=>"ASC"]);
@ -43,12 +53,17 @@ class SlideController extends Controller
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'idwidget' => $idwidget, 'idwidget' => $idwidget,
'usage' => $usage,
'group' => $group,
$this->labeldatas => $datas $this->labeldatas => $datas
]); ]);
} }
public function submitAction(Request $request,$idpage,$idwidget,$access="config") public function submitAction(Request $request,$idpage,$idwidget,$access="config")
{ {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Initialisation de l'enregistrement // Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$data = new Slide(); $data = new Slide();
@ -60,9 +75,16 @@ class SlideController extends Controller
// Vérifier que l'on générer un slide // Vérifier que l'on générer un slide
if($access=="user") { if($access=="user") {
$user=$pagewidget->getPage()->getUser(); if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
else {
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
}
}
// Création du formulaire // Création du formulaire
$form = $this->createForm(SlideType::class,$data,array("mode"=>"submit")); $form = $this->createForm(SlideType::class,$data,array("mode"=>"submit"));
@ -83,7 +105,7 @@ class SlideController extends Controller
$em->flush(); $em->flush();
// Retour à la page // Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_slide_list',["idpage"=>$idpage,"idwidget"=>$idwidget])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_slide_list',["idpage"=>$idpage,"idwidget"=>$idwidget,"usage"=>$usage,"group"=>$group]));
} }
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
@ -96,12 +118,17 @@ class SlideController extends Controller
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'idwidget' => $idwidget, 'idwidget' => $idwidget,
'usage' => $usage,
'group' => $group,
'form' => $form->createView(), 'form' => $form->createView(),
]); ]);
} }
public function updateAction(Request $request,$idpage,$id,$access="config") public function updateAction(Request $request,$idpage,$id,$access="config")
{ {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$data=$this->getData($id); $data=$this->getData($id);
@ -109,9 +136,16 @@ class SlideController extends Controller
// Vérifier que cet enregistrement est modifiable // Vérifier que cet enregistrement est modifiable
if($access=="user") { if($access=="user") {
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser(); $user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
else {
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
}
}
// Création du formulaire // Création du formulaire
$form = $this->createForm(SlideType::class,$data,array( $form = $this->createForm(SlideType::class,$data,array(
@ -133,7 +167,7 @@ class SlideController extends Controller
$em->flush(); $em->flush();
// Retour à la page // Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_slide_list',["idpage"=>$idpage,"idwidget"=>$data->getPagewidget()->getId()])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_slide_list',["idpage"=>$idpage,"idwidget"=>$data->getPagewidget()->getId(),"usage"=>$usage,"group"=>$group]));
} }
@ -148,12 +182,17 @@ class SlideController extends Controller
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'idwidget' => $data->getPagewidget()->getId(), 'idwidget' => $data->getPagewidget()->getId(),
'usage' => $usage,
'group' => $group,
'form' => $form->createView(), 'form' => $form->createView(),
]); ]);
} }
public function deleteAction(Request $request,$idpage,$id,$access="config") public function deleteAction(Request $request,$idpage,$id,$access="config")
{ {
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$data=$this->getData($id); $data=$this->getData($id);
@ -161,9 +200,16 @@ class SlideController extends Controller
// Vérifier que cet enregistrement est supprimable // Vérifier que cet enregistrement est supprimable
if($access=="user") { if($access=="user") {
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser(); $user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied'); if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
} }
else {
$groupentity=$this->getDoctrine()->getRepository("CadolesCoreBundle:Group")->find($group);
$fgmanager=$this->getDoctrine()->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["user"=>$this->getUser(),"group"=>$groupentity,"fgmanager"=>true]);
if(!$fgmanager) throw $this->createNotFoundException('Permission denied');
}
}
// Widget encours // Widget encours
$idwidget = $data->getPagewidget()->getId(); $idwidget = $data->getPagewidget()->getId();
@ -174,8 +220,7 @@ class SlideController extends Controller
$em->flush(); $em->flush();
// Retour à la page // Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_slide_list',["idpage"=>$idpage,"idwidget"=>$idwidget])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_slide_list',["idpage"=>$idpage,"idwidget"=>$idwidget,"usage"=>$usage,"group"=>$group]));
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage]));
} }
public function uploadAction($access="config") public function uploadAction($access="config")

View File

@ -35,6 +35,7 @@ class BlogShareType extends AbstractType
->where('g.fgcanshare=:fgcanshare') ->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group') ->andWhere('g=ug.group')
->andWhere('ug.user=:user') ->andWhere('ug.user=:user')
->andWhere('ug.fgmanager=:fgcanshare')
->setParameter('fgcanshare',true) ->setParameter('fgcanshare',true)
->setParameter('user',$user); ->setParameter('user',$user);
}, },

View File

@ -35,6 +35,7 @@ class CalendarShareType extends AbstractType
->where('g.fgcanshare=:fgcanshare') ->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group') ->andWhere('g=ug.group')
->andWhere('ug.user=:user') ->andWhere('ug.user=:user')
->andWhere('ug.fgmanager=:fgcanshare')
->setParameter('fgcanshare',true) ->setParameter('fgcanshare',true)
->setParameter('user',$user); ->setParameter('user',$user);
}, },

View File

@ -35,6 +35,7 @@ class PageShareType extends AbstractType
->where('g.fgcanshare=:fgcanshare') ->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group') ->andWhere('g=ug.group')
->andWhere('ug.user=:user') ->andWhere('ug.user=:user')
->andWhere('ug.fgmanager=:fgcanshare')
->setParameter('fgcanshare',true) ->setParameter('fgcanshare',true)
->setParameter('user',$user); ->setParameter('user',$user);
}, },

View File

@ -20,6 +20,7 @@ class PageSubmitType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$access=$options["access"]; $access=$options["access"];
$user=$options['user'];
$builder $builder
->add('submit', SubmitType::class, [ ->add('submit', SubmitType::class, [
@ -60,10 +61,10 @@ class PageSubmitType extends AbstractType
Select2EntityType::class, array( Select2EntityType::class, array(
'label' => "Modèle de Page", 'label' => "Modèle de Page",
'disabled' => ($options["mode"]=="delete"?true:false), 'disabled' => ($options["mode"]=="delete"?true:false),
"required" => false, 'required' => false,
'multiple' => false, 'multiple' => false,
'remote_route' => 'cadoles_portal_user_pagetemplate_ajax_selectlist', 'remote_route' => 'cadoles_portal_user_pagetemplate_ajax_selectlist',
'class' => 'Cadoles\PortalBundle\Entity\PageTemplate', 'class' => 'Cadoles\PortalBundle\Entity\Page',
'req_params' => ['usage' => 'parent.children[usage]'], 'req_params' => ['usage' => 'parent.children[usage]'],
'primary_key' => 'id', 'primary_key' => 'id',
'text_property' => 'name', 'text_property' => 'name',
@ -74,11 +75,32 @@ class PageSubmitType extends AbstractType
'cache' => false, 'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true 'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr', 'language' => 'fr',
'placeholder' => 'Selectionner un modèle de page', 'placeholder' => '-- Selectionner un modèle de page --',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px") 'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
) )
) )
->add('groups', EntityType::class, [
'label' => 'Partager avec les Groupes',
'class' => 'CadolesCoreBundle:Group',
'choice_label' => 'label',
'required' => false,
'multiple' => true,
'expanded' => true,
'placeholder' => '-- Selectionner un groupe --',
'query_builder' => function(EntityRepository $er) use ($user) {
return $er->createQueryBuilder('g')
->select('g')
->From('CadolesCoreBundle:UserGroup','ug')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('ug.fgmanager=:fgcanshare')
->setParameter('fgcanshare',true)
->setParameter('user',$user);
},
])
->add('roworder', IntegerType::class, [ ->add('roworder', IntegerType::class, [
'label' => 'Ordre', 'label' => 'Ordre',
]) ])
@ -94,7 +116,8 @@ class PageSubmitType extends AbstractType
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Page', 'data_class' => 'Cadoles\PortalBundle\Entity\Page',
'mode' => 'string', 'mode' => 'string',
'access' => 'string' 'access' => 'string',
'user' => 'Cadoles\CoreBundle\Entity\User'
]); ]);
} }
} }

View File

@ -9,6 +9,33 @@ use Cadoles\PortalBundle\Entity\Pagecategory;
class BlogRepository extends EntityRepository class BlogRepository extends EntityRepository
{ {
// getBlogsGroup
// $user = l'utilisateur en cours
// $groupid = id du group
public function getBlogsGroup($user,$groupid)
{
$blogsshared=$this->createQueryBuilder('blog')
->from('CadolesCoreBundle:Group','g')
->andWhere('g MEMBER OF blog.groups')
->andWhere('g.id=:id')
->setParameter('id',$groupid)
->addOrderBy('blog.name', 'ASC')
->getQuery()->getResult();
// Permission sur les blogs
if($blogsshared) {
foreach($blogsshared as $blogshared) {
$blogshared->setCanupdate(false);
$blogshared->setCanadd($this->getInwriter($user,$blogshared));
}
}
return $blogsshared;
}
// getBlogsUser // getBlogsUser
// $user = l'utilisateur en cours // $user = l'utilisateur en cours
// &$blogsuser = les blogs de l'utilisateur // &$blogsuser = les blogs de l'utilisateur

View File

@ -9,6 +9,24 @@ use Cadoles\PortalBundle\Entity\Pagecategory;
class CalendarRepository extends EntityRepository class CalendarRepository extends EntityRepository
{ {
// getCalendarsGroup
// $user = l'utilisateur en cours
// $groupid = id du group
public function getCalendarsGroup($user,$groupid)
{
$calendarsshared=$this->createQueryBuilder('calendar')
->from('CadolesCoreBundle:Group','g')
->andWhere('g MEMBER OF calendar.groups')
->andWhere('g.id=:id')
->setParameter('id',$groupid)
->addOrderBy('calendar.name', 'ASC')
->getQuery()->getResult();
return $calendarsshared;
}
// getCalendarsUser // getCalendarsUser
// $user = l'utilisateur en cours // $user = l'utilisateur en cours
// &$calendarsuser = les calendars de l'utilisateur // &$calendarsuser = les calendars de l'utilisateur

View File

@ -748,6 +748,12 @@ cadoles_portal_config_panelwidget_view_appexternal:
path: /config/pagewidget/view/appexternal/{id} path: /config/pagewidget/view/appexternal/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: config }
cadoles_portal_config_panelwidget_view_info:
path: /config/pagewidget/view/info/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewinfo, access: config }
#-- Access user #-- Access user
cadoles_portal_user_pagewidget_widget_sumbit: cadoles_portal_user_pagewidget_widget_sumbit:
path: /user/pagewidget/submit/{idpage}/{idwidgettype} path: /user/pagewidget/submit/{idpage}/{idwidgettype}
@ -836,3 +842,7 @@ cadoles_portal_user_panelwidget_view_calculator:
cadoles_portal_user_panelwidget_view_appexternal: cadoles_portal_user_panelwidget_view_appexternal:
path: /pagewidget/view/appexternal/{id} path: /pagewidget/view/appexternal/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: user } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: user }
cadoles_portal_user_panelwidget_view_info:
path: /pagewidget/view/info/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewinfo, access: user }

View File

@ -14,11 +14,11 @@
{% if access=="config" %} {% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Annuler</a> <a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Annuler</a>
{% else %} {% else %}
<a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage}) }}">Annuler</a> <a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage,usage:usage,group:group}) }}">Annuler</a>
{% endif %} {% endif %}
{% if mode=="update" %} {% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_bookmark_delete',{'idpage':idpage,'id':entity.id }) }} <a href={{ path('cadoles_portal_'~access~'_bookmark_delete',{'idpage':idpage,'id':entity.id,usage:usage,group:group}) }}
class="btn btn-danger pull-right" class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}" data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cet item ?"> data-confirm="Êtes-vous sûr de vouloir supprimer cet item ?">

View File

@ -14,9 +14,9 @@
{% endif %} {% endif %}
{% if entity.id is defined and page.id==entity.id %} {% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li> <li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','portal',{{forcereload}})">{{ page.name }}</a></li>
{% else %} {% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li> <li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','portal',{{forcereload}})">{{ page.name }}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
@ -29,9 +29,9 @@
{% endif %} {% endif %}
{% if entity.id is defined and page.id==entity.id %} {% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li> <li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user',{{forcereload}})">{{ page.name }}</a></li>
{% else %} {% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li> <li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user',{{forcereload}})">{{ page.name }}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
@ -46,9 +46,9 @@
{% endif %} {% endif %}
{% if entity.id is defined and page.id==entity.id %} {% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">Groupe = {{ groupshared.label }}</a></li> <li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group',{{forcereload}},{{groupshared.id}})">Groupe = {{ groupshared.label }}</a></li>
{% else %} {% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">Groupe = {{ groupshared.label }}</a></li> <li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group',{{forcereload}},{{groupshared.id}})">Groupe = {{ groupshared.label }}</a></li>
{% endif %} {% endif %}
{% else %} {% else %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left"> <ul id="pagesshared" class="nav navbar-top-links navbar-left">
@ -62,9 +62,9 @@
{% endif %} {% endif %}
{% if entity.id is defined and page.id==entity.id %} {% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li> <li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group',{{forcereload}},{{groupshared.id}})">{{ page.name }}</a></li>
{% else %} {% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li> <li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group',{{forcereload}},{{groupshared.id}})">{{ page.name }}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
@ -82,14 +82,15 @@
<a id="menuupdate" style="cursor:pointer;display:none" onclick="updatePage()" title='Modifier une page'><i class='fa fa-file fa-fw'></i></a> <a id="menuupdate" style="cursor:pointer;display:none" onclick="updatePage()" title='Modifier une page'><i class='fa fa-file fa-fw'></i></a>
<a id="menushare" style="cursor:pointer;display:none" onclick="sharePage()" title='Partager une page'><i class='fa fa-share-alt fa-fw'></i></a> <a id="menushare" style="cursor:pointer;display:none" onclick="sharePage()" title='Partager une page'><i class='fa fa-share-alt fa-fw'></i></a>
<a id="menudelete" style="cursor:pointer;display:none" onclick="deletePage()" title='Supprimer une page'><i class='fa fa-trash fa-fw'></i></a> <a id="menudelete" style="cursor:pointer;display:none" onclick="deletePage()" title='Supprimer une page'><i class='fa fa-trash fa-fw'></i></a>
<a id="menuwidget" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidget' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a> <a id="menuwidgetuser" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidgetuser' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
<a id="menuwidgetgroup" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidgetgroup' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
</div> </div>
{% endblock %} {% endblock %}
{% block pagewrapper %} {% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div> <div id="pagecontainer" style="margin: 0px -30px;"></div>
<div id="selwidget" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div id="selwidgetuser" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -100,7 +101,7 @@
<div class="modal-body"> <div class="modal-body">
<div class="form-group row clearfix"> <div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px"> <div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selwidget').modal('hide');" class="btn btn-default"> <a onclick="$('#selwidgetuser').modal('hide');" class="btn btn-default">
Annuler Annuler
</a> </a>
</div> </div>
@ -116,7 +117,54 @@
</thead> </thead>
<tbody> <tbody>
{% for widget in widgets %} {% for widget in widgetsuser %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
<img id="widgettype-{{ widget.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ widget.icon.label }}" style="padding:2px">
</a>
</td>
<td>{{ widget.name }}</td>
<td>{{ widget.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="selwidgetgroup" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">SELECTIONNER UN WIDGET</h4>
</div>
<div class="modal-body">
<div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selwidgetgroup').modal('hide');" class="btn btn-default">
Annuler
</a>
</div>
<div class="dataTable_wrapper col-md-12">
<table id="dataTables" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th width="100px">#</th>
<th>Nom</th>
<th class="no-sort">Description</th>
</tr>
</thead>
<tbody>
{% for widget in widgetsgroup %}
<tr> <tr>
<td> <td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;"> <a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
@ -143,20 +191,20 @@
$('document').ready(function(){ $('document').ready(function(){
{% for page in pagesadmin %} {% for page in pagesadmin %}
{% if page.id==entity.id %} {% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }}); showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','portal');
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% for page in pagesuser %} {% for page in pagesuser %}
{% if page.id==entity.id %} {% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }}); showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','user');
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% for groupshared in groupsshared %} {% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %} {% for page in groupshared.pagesshared %}
{% if page.id==entity.id %} {% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }}); showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','group',true,{{groupshared.id}});
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
@ -182,7 +230,7 @@
}); });
// Initialisation du tableau des widgets selectionnable à la création // Initialisation du tableau des widgets selectionnable à la création
$('#dataTables').DataTable({ $('.table').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ], columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ],
responsive: true, responsive: true,
iDisplayLength: 10, iDisplayLength: 10,
@ -233,7 +281,7 @@
} }
// Affichages des pages // Affichages des pages
function showPage(id,catid,canupdate,forcereload) { function showPage(id,catid,canupdate,usage,forcereload,groupid) {
// Sauvegarder la page en cours // Sauvegarder la page en cours
idpage=id; idpage=id;
@ -244,8 +292,10 @@
$(".navbar-top-links li").removeClass("active"); $(".navbar-top-links li").removeClass("active");
$("#menupage-"+id).addClass("active"); $("#menupage-"+id).addClass("active");
var url="{{ path('cadoles_portal_user_page_view',{id:'xx'}) }}"; var url="{{ path('cadoles_portal_user_page_view',{id:'xx',usage:'yy','group':'zz'}) }}";
url=url.replace('xx',id); url=url.replace('xx',id);
url=url.replace('yy',usage);
url=url.replace('zz',groupid);
// Si force le rechargement et frame existante on la détruit // Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#page-"+id).length) if(forcereload&&$("#page-"+id).length)
@ -263,7 +313,8 @@
$("#menuupdate").hide(); $("#menuupdate").hide();
$("#menushare").hide(); $("#menushare").hide();
$("#menudelete").hide(); $("#menudelete").hide();
$("#menuwidget").hide(); $("#menuwidgetuser").hide();
$("#menuwidgetgroup").hide();
if(canupdate) { if(canupdate) {
$("#menuupdate").show(); $("#menuupdate").show();
@ -272,8 +323,12 @@
} }
// Si page de type widget on affiche la selection des widgets à insérer // Si page de type widget on affiche la selection des widgets à insérer
if($("#page-"+id).data('category')==2&&canupdate) if($("#page-"+id).data('category')==2&&canupdate) {
$("#menuwidget").show(); if(usage=="user") $("#menuwidgetuser").show();
if(usage=="group") $("#menuwidgetgroup").show();
}
// On resize les frame // On resize les frame
resizeFrame(); resizeFrame();

View File

@ -41,9 +41,41 @@
<div class="panel-body"> <div class="panel-body">
{{ form_row(form.name) }} {{ form_row(form.name) }}
{{ form_row(form.pagecategory) }} {{ form_row(form.pagecategory) }}
{{ form_row(form.usage) }}
<div id="pagegroup">{{ form_row(form.page) }}</div>
<div id="groupworkgroup">{{ form_row(form.groups) }}</div>
{{ form_row(form.roworder) }} {{ form_row(form.roworder) }}
{{ form_row(form.maxwidth) }} {{ form_row(form.maxwidth) }}
</div> </div>
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
{% endblock %} {% endblock %}
{% block localjavascript %}
$('document').ready(function(){
hideshow();
});
$(document.body).on("change","#page_submit_pagecategory",function(){
hideshow();
});
$(document.body).on("change","#page_submit_usage",function(){
hideshow();
});
function hideshow() {
if($("#page_submit_pagecategory").val()==2)
$("#pagegroup").show();
else {
$("#pagegroup").hide();
}
if($("#page_submit_usage").val()=="group")
$("#groupworkgroup").show();
else {
$("#groupworkgroup").hide();
}
}
{% endblock %}

View File

@ -1,7 +1,6 @@
{% extends '@CadolesCore/base.html.twig' %} {% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %} {% block pagewrapper %}
{% if access=="config" %} {% if access=="config" %}
<div class="pagemenu"> <div class="pagemenu">
@ -26,10 +25,11 @@
<div id="tolocalize" style="display:none"> <div id="tolocalize" style="display:none">
{% for pagewidget in entity.pagewidgets %} {% for pagewidget in entity.pagewidgets %}
{{ render(url(pagewidget.widget.routeview|replace({'_config_':'_'~access~'_'}),{id:pagewidget.id,by:mode})) }} {{ render(url(pagewidget.widget.routeview|replace({'_config_':'_'~access~'_'}),{id:pagewidget.id,by:mode,usage:usage,group:group})) }}
{% endfor %} {% endfor %}
</div> </div>
{% if access=="config" %}
<div id="selwidget" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div id="selwidget" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
@ -76,6 +76,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %}
{% endblock %} {% endblock %}
{% block localjavascript %} {% block localjavascript %}
@ -254,6 +255,9 @@
}); });
{% endif %} {% endif %}
// balise h des widget editor
$(".widget-editor .widgetbody :header").css("color",$(".widgetbody").css("color"));
// cacher le loader // cacher le loader
$("#loader").hide(); $("#loader").hide();
}); });
@ -314,9 +318,11 @@
// Modifciation d'un widget // Modifciation d'un widget
function modWidget(idwidget) { function modWidget(idwidget) {
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_update',{idpage:entity.id,idwidget:'xx','by':mode})}}";
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_update',{idpage:entity.id,idwidget:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget); url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url); $(location).attr('href', url);
} }
@ -339,18 +345,21 @@
// Ajout d'un bookmark // Ajout d'un bookmark
function addBookmark(idwidget,touser) { function addBookmark(idwidget,touser) {
var url="{{ path('cadoles_portal_'~access~'_bookmark_submit',{idpage:entity.id,idwidget:'xx',touser:'yy'})}}"; var url="{{ path('cadoles_portal_'~access~'_bookmark_submit',{idpage:entity.id,idwidget:'xx',touser:'yy',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget); url=url.replace('xx',idwidget);
url=url.replace('yy',touser); url=url.replace('yy',touser);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url); $(location).attr('href', url);
} }
// Modifciation d'un bookmark // Modifciation d'un bookmark
function modBookmark(idbookmark) { function modBookmark(idbookmark) {
var url="{{ path('cadoles_portal_'~access~'_bookmark_update',{idpage:entity.id,id:'xx'})}}"; var url="{{ path('cadoles_portal_'~access~'_bookmark_update',{idpage:entity.id,id:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idbookmark); url=url.replace('xx',idbookmark);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url); $(location).attr('href', url);
} }
@ -391,8 +400,10 @@
// Liste des slides // Liste des slides
function listSlide(idwidget) { function listSlide(idwidget) {
var url="{{ path('cadoles_portal_'~access~'_slide_list',{idpage:entity.id,idwidget:'xx'})}}"; var url="{{ path('cadoles_portal_'~access~'_slide_list',{idpage:entity.id,idwidget:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget); url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url); $(location).attr('href', url);
} }

View File

@ -79,17 +79,14 @@
{% set colorheaderfont = color['fontcolorhover'] %} {% set colorheaderfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
{% set colorbodyback = entity.colorbodyback %} {% if colorheaderfont == colorheaderback %}
{% if colorbodyback is null %} {% if colorheaderfont == color['main'] %}
{% set colorbodyback = color['main'] %} {% set colorheaderfont=color['fontcolorhover'] %}
{% else %}
{% set colorheaderfont=color['main'] %}
{% endif %} {% endif %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
{% set stylewidgetmenu = "" %} {% set stylewidgetmenu = "" %}
{% set stylewidgetmenu = stylewidgetmenu ~ "color: #" ~ colorheaderfont ~ "; " %} {% set stylewidgetmenu = stylewidgetmenu ~ "color: #" ~ colorheaderfont ~ "; " %}
{% set stylewidgetmenu = stylewidgetmenu ~ "cursor: pointer; " %} {% set stylewidgetmenu = stylewidgetmenu ~ "cursor: pointer; " %}
@ -112,14 +109,12 @@
{% set colorheaderfont = color['fontcolorhover'] %} {% set colorheaderfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
{% set colorbodyback = entity.colorbodyback %} {% if colorheaderfont == colorheaderback %}
{% if colorbodyback is null %} {% if colorheaderfont == color['main'] %}
{% set colorbodyback = color['main'] %} {% set colorheaderfont=color['fontcolorhover'] %}
{% else %}
{% set colorheaderfont=color['main'] %}
{% endif %} {% endif %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
{% set stylewidgetheader = "" %} {% set stylewidgetheader = "" %}
@ -135,16 +130,6 @@
{% macro mystylewidgetbody(entity) %} {% macro mystylewidgetbody(entity) %}
{% set color = app.session.get('color') %} {% set color = app.session.get('color') %}
{% set colorheaderback = entity.colorheaderback %}
{% if colorheaderback is null %}
{% set colorheaderback = color['main'] %}
{% endif %}
{% set colorheaderfont = entity.colorheaderfont %}
{% if colorheaderfont is null %}
{% set colorheaderfont = color['fontcolorhover'] %}
{% endif %}
{% set colorbodyback = entity.colorbodyback %} {% set colorbodyback = entity.colorbodyback %}
{% if colorbodyback is null %} {% if colorbodyback is null %}
{% set colorbodyback = color['main'] %} {% set colorbodyback = color['main'] %}
@ -155,6 +140,14 @@
{% set colorbodyfont = color['fontcolorhover'] %} {% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
{% if colorbodyfont == colorbodyback %}
{% if colorbodyfont == color['main'] %}
{% set colorbodyfont=color['fontcolorhover'] %}
{% else %}
{% set colorbodyfont=color['main'] %}
{% endif %}
{% endif %}
{% set stylewidgetbody = "" %} {% set stylewidgetbody = "" %}
{% set stylewidgetbody = stylewidgetbody ~ "background-color: #" ~ colorbodyback ~ "; " %} {% set stylewidgetbody = stylewidgetbody ~ "background-color: #" ~ colorbodyback ~ "; " %}
{% set stylewidgetbody = stylewidgetbody ~ "color: #" ~ colorbodyfont ~ "; " %} {% set stylewidgetbody = stylewidgetbody ~ "color: #" ~ colorbodyfont ~ "; " %}

View File

@ -21,7 +21,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
{% if mode=="update" %} {% if mode=="update" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage}) }}">Annuler</a> <a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage,usage:usage,group:group}) }}">Annuler</a>
{% else %} {% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:idpage}) }}">Annuler</a> <a class="btn btn-default" href="{{ path('cadoles_core_home',{id:idpage}) }}">Annuler</a>
{% endif %} {% endif %}

View File

@ -46,7 +46,12 @@
{% if access=="config" %} {% if access=="config" %}
<a href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a> <a href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% else %} {% else %}
<a onClick="showFrameitem('blog','{{ path('cadoles_portal_user_blog_view') }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a> {% set idblog = "" %}
{% set url= path('cadoles_portal_user_blog_view') %}
{% if usage=="group" and firstblog is defined %}
{% set url= path('cadoles_portal_user_blog_view',{id:firstblog}) %}
{% endif %}
<a onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% endif %} {% endif %}
</div> </div>

View File

@ -26,7 +26,11 @@
{% if access=="config" %} {% if access=="config" %}
<a href='{{ path('cadoles_portal_config_calendar') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a> <a href='{{ path('cadoles_portal_config_calendar') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% else %} {% else %}
<a onClick="showFrameitem('calendar','{{ path('cadoles_portal_'~access~'_calendar_view') }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-calendar fa-fw"></i></a> {% set url= path('cadoles_portal_'~access~'_calendar_view') %}
{% if usage=="group" and firstcalendar is defined %}
{% set url= path('cadoles_portal_'~access~'_calendar_view',{id:firstcalendar}) %}
{% endif %}
<a onClick="showFrameitem('calendar','{{url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-calendar fa-fw"></i></a>
{% endif %} {% endif %}
</div> </div>

View File

@ -10,7 +10,7 @@
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} {% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%endif%} widget-editor" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -49,6 +49,7 @@
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
{% if files|length >= 1 %}
<div class="grid clearfix"> <div class="grid clearfix">
{% for file in files|sort %} {% for file in files|sort %}
{% if loop.index==1 %} {% if loop.index==1 %}
@ -59,7 +60,9 @@
<div class="grid-item grid-small"> <div class="grid-item grid-small">
<div class="grid-item-content"> <div class="grid-item-content">
{% if canadd %} {% 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> <a style="{{ stylewidgetbody }} cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete">
<i style="{{ stylewidgetbody }}" class="fa fa-trash" title="Supprimer le fichier"></i>
</a>
{% endif %} {% endif %}
{% if file.minefamily=="text" or file.minefamily=="image" or file.minetype == "application/pdf" %} {% if file.minefamily=="text" or file.minefamily=="image" or file.minetype == "application/pdf" %}
@ -78,7 +81,7 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2>{{ file.name }}</h2> <h2 style="{{ stylewidgetbody }}">{{ file.name }}</h2>
</div> </div>
</div> </div>
</a> </a>
@ -86,6 +89,7 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
</div> </div>
</div> </div>

View File

@ -59,7 +59,7 @@
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
{% if fluxs is defined %} {% if fluxs is defined %}
{% if fluxs|length > 1 %} {% if fluxs|length > 1 %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="background-color: #{{ color['main'] }}">Tout</div> <div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">Tout</div>
{% for flux in fluxs %} {% for flux in fluxs %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %} {% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
@ -67,7 +67,7 @@
{% set stylefeed = "background-color: #" ~ flux.color ~ ";" %} {% set stylefeed = "background-color: #" ~ flux.color ~ ";" %}
{% endif %} {% endif %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }}">{{ flux.title }}</div> <div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }} color:#{{ color['fontcolorhover'] }};">{{ flux.title }}</div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<p></p> <p></p>
@ -99,7 +99,7 @@
<img src="{{feed.image}}" width="100%"> <img src="{{feed.image}}" width="100%">
{% endif %} {% endif %}
<div class="caption" style="{{ stylecolor }}"> <div class="caption" style="{{ stylecolor }}">
<h1 class="grid-preview-title" style="color: #{{ colorbodyback }};">{{ feed.title }}</h1> <h1 class="grid-preview-title" style="{{ stylewidgetbody }};padding:0px;">{{ feed.title }}</h1>
<small>le {{ feed.date|date("d/m/Y à H:i") }}</small><br> <small>le {{ feed.date|date("d/m/Y à H:i") }}</small><br>
{{ feed.description | nl2br }} {{ feed.description | nl2br }}
</div> </div>

View File

@ -0,0 +1,66 @@
{% 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 stylewidget = constants.mystylewidget(entity) %}
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %}
{% set color = app.session.get('color') %}
{% set stylelink = "color:#" ~ entity.colorheaderfont %}
{% if entity.colorheaderfont is null %}
{% set stylelink = "color:#" ~ color['fontcolorhover'] %}
{% 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 %}
<div class="widgetmenu">
<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>
</div>
{% endif %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}; height:100%;">
{% if icon %}
<img src="/{{ alias }}{{ icon }}" style="max-width: 90px; border-radius: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_users.png" style="max-height: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
{% endif %}
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div style="text-align: center;">
{%if usage=="group" %}<small>Groupe<br></small>{% endif %}
<span style="font-size:120%">{{ title }}</span><br><br>
{{ description | raw }}
{%if usage=="group" %}
<br><br><br>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for user in members %}
<div class="grid-item grid-small">
<div class="grid-item-content">
<img src="/{{ alias }}/uploads/avatar/{{ user.avatar}}" class="avatar">
</div>
<div class="grid-item-title">
{{ user.lastname }} {{ user.firstname }}
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
</div>
</div>

View File

@ -11,10 +11,10 @@
</h1> </h1>
{{ form_widget(form.submit) }} {{ form_widget(form.submit) }}
<a class="btn btn-default" href="{{ path('cadoles_portal_'~access~'_slide_list',{'idpage':idpage,'idwidget':idwidget }) }}">Annuler</a> <a class="btn btn-default" href="{{ path('cadoles_portal_'~access~'_slide_list',{'idpage':idpage,'idwidget':idwidget,'usage':usage,'group':group}) }}">Annuler</a>
{% if mode=="update" %} {% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_slide_delete',{'idpage':idpage,'id':entity.id }) }} <a href={{ path('cadoles_portal_'~access~'_slide_delete',{'idpage':idpage,'id':entity.id,'usage':usage,'group':group}) }}
class="btn btn-danger pull-right" class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}" data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cet item ?"> data-confirm="Êtes-vous sûr de vouloir supprimer cet item ?">

View File

@ -7,14 +7,14 @@
{% if access=="config" %} {% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Retour</a> <a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Retour</a>
{% else %} {% else %}
<a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage}) }}">Retour</a> <a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage,usage:usage,group:group}) }}">Retour</a>
{% endif %} {% endif %}
<a class="btn btn-success" href={{ path('cadoles_portal_'~access~'_slide_submit',{idpage:idpage,idwidget:idwidget}) }}>Ajouter</a> <a class="btn btn-success" href={{ path('cadoles_portal_'~access~'_slide_submit',{idpage:idpage,idwidget:idwidget,usage:usage,group:group}) }}>Ajouter</a>
</p> </p>
{% for slide in slides %} {% for slide in slides %}
<a href="{{ path('cadoles_portal_'~access~'_slide_update', {idpage : idpage, id : slide.id}) }}"><img class="icon" height="200px" src="/{{ alias }}/{{ slide.image }}"></a> <a href="{{ path('cadoles_portal_'~access~'_slide_update', {idpage:idpage,id:slide.id,usage:usage,group:group}) }}"><img class="icon" height="200px" src="/{{ alias }}/{{ slide.image }}"></a>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB