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

View File

@ -128,7 +128,8 @@ class CoreController extends Controller
'pagesuser' => $pagesuser,
'groupsshared' => $groupsshared,
'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>
</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>
</ul>

View File

@ -361,7 +361,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setBorder(true);
$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"},{"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);
$em->persist($entityWidget);
@ -612,11 +612,30 @@ class InitDataCommand extends ContainerAwareCommand
$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"},{"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);
$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
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600);
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")
{
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = new Bookmark();
@ -60,7 +63,7 @@ class BookmarkController extends Controller
$em->flush();
// 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]);
@ -78,11 +81,16 @@ class BookmarkController extends Controller
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
'usage' => $usage,
'group' => $group
]);
}
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
$em = $this->getDoctrine()->getManager();
$data=$this->getData($id);
@ -91,11 +99,19 @@ class BookmarkController extends Controller
// Vérifier que cet enregistrement est modifiable
$user=$data->getUser();
if($user) {
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
if($usage=="user")
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
}
elseif($access=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
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
@ -124,7 +140,7 @@ class BookmarkController extends Controller
$em->flush();
// 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]);
@ -143,11 +159,16 @@ class BookmarkController extends Controller
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
'usage' => $usage,
'group' => $group
]);
}
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
$em = $this->getDoctrine()->getManager();
$data=$this->getData($id);
@ -159,8 +180,15 @@ class BookmarkController extends Controller
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
}
elseif($access=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
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');
}
}
@ -170,7 +198,7 @@ class BookmarkController extends Controller
$em->flush();
// 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)

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\PageSubmitType;
@ -33,12 +34,11 @@ class PageController extends Controller
public function ajaxlistAction(Request $request,$access="config")
{
/*
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
*/
$em = $this->getDoctrine()->getManager();
$start=$request->query->get('start');
@ -208,7 +208,8 @@ class PageController extends Controller
else {
return $this->createForm(PageSubmitType::class, $entity, [
"mode" => "update",
"access" => $access
"access" => $access,
"user" => $this->getUser()
]);
}
}
@ -225,15 +226,36 @@ class PageController extends Controller
$form = $this->entityForm($entity,$access);
$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();
if($access=="user") $entity->setUser($this->getUser());
$em->persist($entity);
$em->flush();
// 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->flush();
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
return $this->redirect($this->generateUrl($route.'_update',["id"=>$entity->getId()]));
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
return $this->redirect($this->generateUrl($route.'_update',["id"=>$entity->getId()]));
}
}
return $this->render($this->labelentity.':submit.html.twig', [
@ -420,7 +442,10 @@ class PageController extends Controller
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();
$entity = $em->getRepository($this->labelentity)->find($id);
@ -457,7 +482,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate
'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]);
}
@ -470,7 +497,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate
'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]);
}
@ -482,7 +511,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate
'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]);
}
// Type Widgets
@ -495,7 +526,9 @@ class PageController extends Controller
'access' => $access,
'canupdate' => $canupdate,
'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
@ -506,7 +539,9 @@ class PageController extends Controller
'usesidebar' => ($access=="config"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate
'canupdate' => $canupdate,
'usage' => $usage,
'group' => $group
]);
}
@ -538,4 +573,31 @@ class PageController extends Controller
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,
'canupdate' => $canupdate,
'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")
{
$by=$request->query->get('by');
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Recherche du pagewidget
$em = $this->getDoctrine()->getManager();
@ -203,7 +205,7 @@ class PagewidgetController extends Controller
$em->flush();
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
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_pagetemplate_view',["id"=>$idpage]));
}
@ -224,6 +226,8 @@ class PagewidgetController extends Controller
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
'usage' => $usage,
'group' => $group
]);
}
@ -1210,7 +1214,6 @@ class PagewidgetController extends Controller
$finder = new Finder();
$finder->sortByName()->in($directory)->exclude('thumb');
foreach ($finder as $file) {
$tmp=[];
$tmp["name"]=$file->getRelativePathname();
@ -1281,6 +1284,7 @@ class PagewidgetController extends Controller
}
}
// Render
return $this->render($this->labelentity.':viewgalery.html.twig', [
'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();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
@ -1317,9 +1324,16 @@ class PagewidgetController extends Controller
}
}
// On charge le calendrier de l'utilisateur
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($this->getUser(),$calendarssuser,$calendarsadmin,$calendarsshared);
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
// 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);
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
$firstcalendar="all";
}
// Début & fin
$start=new \DateTime();
@ -1362,10 +1376,15 @@ class PagewidgetController extends Controller
'events' => $events,
'nbday' => $nbday,
'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();
$entity = $em->getRepository($this->labelentity)->find($id);
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
$em->getRepository("CadolesPortalBundle:Blog")->getBlogsUser($this->getUser(),$blogsuser,$blogsadmin,$blogsshared);
$blogs=array_merge($blogsuser,$blogsadmin->toArray(),$blogsshared);
// 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);
$blogs=array_merge($blogsuser,$blogsadmin->toArray(),$blogsshared);
$firstblog="all";
}
// On récupère les nbarticle de ses blogs
$em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles);
@ -1406,6 +1432,8 @@ class PagewidgetController extends Controller
'blogarticles' => $blogarticles,
'nbarticle' => $nbarticle,
'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 $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
$em = $this->getDoctrine()->getManager();
$pagewidget = $em->getRepository("CadolesPortalBundle:Pagewidget")->find($idwidget);
@ -28,8 +31,15 @@ class SlideController extends Controller
// Vérifier que l'on générer un slide
if($access=="user") {
$user=$pagewidget->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
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
@ -43,12 +53,17 @@ class SlideController extends Controller
'access' => $access,
'idpage' => $idpage,
'idwidget' => $idwidget,
'usage' => $usage,
'group' => $group,
$this->labeldatas => $datas
]);
}
public function submitAction(Request $request,$idpage,$idwidget,$access="config")
{
$usage=$request->query->get('usage');
$group=$request->query->get('group');
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = new Slide();
@ -60,8 +75,15 @@ class SlideController extends Controller
// Vérifier que l'on générer un slide
if($access=="user") {
$user=$pagewidget->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
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
@ -83,7 +105,7 @@ class SlideController extends Controller
$em->flush();
// 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', [
@ -96,12 +118,17 @@ class SlideController extends Controller
'access' => $access,
'idpage' => $idpage,
'idwidget' => $idwidget,
'usage' => $usage,
'group' => $group,
'form' => $form->createView(),
]);
}
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
$em = $this->getDoctrine()->getManager();
$data=$this->getData($id);
@ -109,8 +136,15 @@ class SlideController extends Controller
// Vérifier que cet enregistrement est modifiable
if($access=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
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
@ -133,7 +167,7 @@ class SlideController extends Controller
$em->flush();
// 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,
'idpage' => $idpage,
'idwidget' => $data->getPagewidget()->getId(),
'usage' => $usage,
'group' => $group,
'form' => $form->createView(),
]);
}
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
$em = $this->getDoctrine()->getManager();
$data=$this->getData($id);
@ -161,8 +200,15 @@ class SlideController extends Controller
// Vérifier que cet enregistrement est supprimable
if($access=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
if($user!=$this->getUser()) throw $this->createNotFoundException('Permission denied');
if($usage=="user") {
$user=$data->getPagewidget()->getPage()->getUser();
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
@ -174,8 +220,7 @@ class SlideController extends Controller
$em->flush();
// 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.'_page_view',["id"=>$idpage]));
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_slide_list',["idpage"=>$idpage,"idwidget"=>$idwidget,"usage"=>$usage,"group"=>$group]));
}
public function uploadAction($access="config")

View File

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

View File

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

View File

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

View File

@ -20,6 +20,7 @@ class PageSubmitType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$access=$options["access"];
$user=$options['user'];
$builder
->add('submit', SubmitType::class, [
@ -60,10 +61,10 @@ class PageSubmitType extends AbstractType
Select2EntityType::class, array(
'label' => "Modèle de Page",
'disabled' => ($options["mode"]=="delete"?true:false),
"required" => false,
'required' => false,
'multiple' => false,
'remote_route' => 'cadoles_portal_user_pagetemplate_ajax_selectlist',
'class' => 'Cadoles\PortalBundle\Entity\PageTemplate',
'class' => 'Cadoles\PortalBundle\Entity\Page',
'req_params' => ['usage' => 'parent.children[usage]'],
'primary_key' => 'id',
'text_property' => 'name',
@ -74,11 +75,32 @@ class PageSubmitType extends AbstractType
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'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")
)
)
->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, [
'label' => 'Ordre',
])
@ -94,7 +116,8 @@ class PageSubmitType extends AbstractType
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Page',
'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
{
// 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
// $user = l'utilisateur en cours
// &$blogsuser = les blogs de l'utilisateur

View File

@ -9,6 +9,24 @@ use Cadoles\PortalBundle\Entity\Pagecategory;
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
// $user = l'utilisateur en cours
// &$calendarsuser = les calendars de l'utilisateur

View File

@ -748,6 +748,12 @@ cadoles_portal_config_panelwidget_view_appexternal:
path: /config/pagewidget/view/appexternal/{id}
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
cadoles_portal_user_pagewidget_widget_sumbit:
path: /user/pagewidget/submit/{idpage}/{idwidgettype}
@ -836,3 +842,7 @@ cadoles_portal_user_panelwidget_view_calculator:
cadoles_portal_user_panelwidget_view_appexternal:
path: /pagewidget/view/appexternal/{id}
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" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Annuler</a>
{% 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 %}
{% 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"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cet item ?">

View File

@ -14,9 +14,9 @@
{% endif %}
{% 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 %}
<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 %}
{% endfor %}
</ul>
@ -29,9 +29,9 @@
{% endif %}
{% 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 %}
<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 %}
{% endfor %}
</ul>
@ -46,9 +46,9 @@
{% endif %}
{% 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 %}
<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 %}
{% else %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
@ -62,9 +62,9 @@
{% endif %}
{% 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 %}
<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 %}
{% endfor %}
</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="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="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>
{% endblock %}
{% block pagewrapper %}
<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-content">
<div class="modal-header">
@ -100,7 +101,7 @@
<div class="modal-body">
<div class="form-group row clearfix">
<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
</a>
</div>
@ -116,7 +117,54 @@
</thead>
<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>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
@ -143,20 +191,20 @@
$('document').ready(function(){
{% for page in pagesadmin %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }});
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','portal');
{% endif %}
{% endfor %}
{% for page in pagesuser %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }});
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','user');
{% endif %}
{% endfor %}
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% 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 %}
{% endfor %}
{% endfor %}
@ -182,7 +230,7 @@
});
// Initialisation du tableau des widgets selectionnable à la création
$('#dataTables').DataTable({
$('.table').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ],
responsive: true,
iDisplayLength: 10,
@ -233,7 +281,7 @@
}
// Affichages des pages
function showPage(id,catid,canupdate,forcereload) {
function showPage(id,catid,canupdate,usage,forcereload,groupid) {
// Sauvegarder la page en cours
idpage=id;
@ -244,8 +292,10 @@
$(".navbar-top-links li").removeClass("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('yy',usage);
url=url.replace('zz',groupid);
// Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#page-"+id).length)
@ -263,7 +313,8 @@
$("#menuupdate").hide();
$("#menushare").hide();
$("#menudelete").hide();
$("#menuwidget").hide();
$("#menuwidgetuser").hide();
$("#menuwidgetgroup").hide();
if(canupdate) {
$("#menuupdate").show();
@ -272,8 +323,12 @@
}
// Si page de type widget on affiche la selection des widgets à insérer
if($("#page-"+id).data('category')==2&&canupdate)
$("#menuwidget").show();
if($("#page-"+id).data('category')==2&&canupdate) {
if(usage=="user") $("#menuwidgetuser").show();
if(usage=="group") $("#menuwidgetgroup").show();
}
// On resize les frame
resizeFrame();

View File

@ -41,9 +41,41 @@
<div class="panel-body">
{{ form_row(form.name) }}
{{ 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.maxwidth) }}
</div>
</div>
{{ form_end(form) }}
{% 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' %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
@ -26,56 +25,58 @@
<div id="tolocalize" style="display:none">
{% 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 %}
</div>
<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-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>
{% if access=="config" %}
<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-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="$('#selwidget').modal('hide');" class="btn btn-default">
Annuler
</a>
</div>
<div class="modal-body">
<div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selwidget').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>
<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 widgets %}
<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>
<tbody>
{% for widget in widgets %}
<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>
{% endif %}
{% endblock %}
{% block localjavascript %}
@ -254,6 +255,9 @@
});
{% endif %}
// balise h des widget editor
$(".widget-editor .widgetbody :header").css("color",$(".widgetbody").css("color"));
// cacher le loader
$("#loader").hide();
});
@ -314,9 +318,11 @@
// Modifciation d'un widget
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(/&amp;/g,"&");
$(location).attr('href', url);
}
@ -339,18 +345,21 @@
// Ajout d'un bookmark
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('yy',touser);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Modifciation d'un bookmark
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(/&amp;/g,"&");
$(location).attr('href', url);
}
@ -391,8 +400,10 @@
// Liste des slides
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(/&amp;/g,"&");
$(location).attr('href', url);
}

View File

@ -79,17 +79,14 @@
{% set colorheaderfont = color['fontcolorhover'] %}
{% endif %}
{% set colorbodyback = entity.colorbodyback %}
{% if colorbodyback is null %}
{% set colorbodyback = color['main'] %}
{% if colorheaderfont == colorheaderback %}
{% if colorheaderfont == 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 %}
{% set stylewidgetmenu = "" %}
{% set stylewidgetmenu = stylewidgetmenu ~ "color: #" ~ colorheaderfont ~ "; " %}
{% set stylewidgetmenu = stylewidgetmenu ~ "cursor: pointer; " %}
@ -112,14 +109,12 @@
{% set colorheaderfont = color['fontcolorhover'] %}
{% endif %}
{% 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'] %}
{% if colorheaderfont == colorheaderback %}
{% if colorheaderfont == color['main'] %}
{% set colorheaderfont=color['fontcolorhover'] %}
{% else %}
{% set colorheaderfont=color['main'] %}
{% endif %}
{% endif %}
{% set stylewidgetheader = "" %}
@ -135,16 +130,6 @@
{% macro mystylewidgetbody(entity) %}
{% 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 %}
{% if colorbodyback is null %}
{% set colorbodyback = color['main'] %}
@ -155,6 +140,14 @@
{% 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 ~ "; " %}

View File

@ -21,7 +21,7 @@
{% endif %}
{% else %}
{% 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 %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:idpage}) }}">Annuler</a>
{% endif %}

View File

@ -46,7 +46,12 @@
{% if access=="config" %}
<a href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% 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 %}
</div>

View File

@ -24,9 +24,13 @@
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% 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 %}
<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 %}
</div>

View File

@ -10,7 +10,7 @@
{% set stylewidgetheader = constants.mystylewidgetheader(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 %}
<div class="widgetmenu">
{% if canupdate %}

View File

@ -49,43 +49,47 @@
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for file in files|sort %}
{% if loop.index==1 %}
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
{% if files|length >= 1 %}
<div class="grid clearfix">
{% for file in files|sort %}
{% if loop.index==1 %}
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-small">
<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 %}
<div class="grid-item grid-small">
<div class="grid-item-content">
{% if canadd %}
<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 %}
{% if file.minefamily=="text" or file.minefamily=="image" or file.minetype == "application/pdf" %}
<a style="cursor:pointer" onClick="showFrameitem('file-{{entity.id}}-{{loop.index}}','{{ path('cadoles_core_'~access~'_file_view',{'directory':'widget-'~entity.id,'filename':file.name }) }}')">
{% else %}
<a style="cursor:pointer" href="{{ path('cadoles_core_'~access~'_file_download',{'directory':'widget-'~entity.id,'filename':file.name }) }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if file.thumb is not empty %}
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
{% else %}
{% if file.minefamily=="text" or file.minefamily=="image" or file.minetype == "application/pdf" %}
<a style="cursor:pointer" onClick="showFrameitem('file-{{entity.id}}-{{loop.index}}','{{ path('cadoles_core_'~access~'_file_view',{'directory':'widget-'~entity.id,'filename':file.name }) }}')">
{% else %}
<a style="cursor:pointer" href="{{ path('cadoles_core_'~access~'_file_download',{'directory':'widget-'~entity.id,'filename':file.name }) }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if file.thumb is not empty %}
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/_blank.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ file.name }}</h2>
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/_blank.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbody }}">{{ file.name }}</h2>
</div>
</div>
</a>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endif %}
</div>
</div>

View File

@ -59,7 +59,7 @@
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% if fluxs is defined %}
{% 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 %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
@ -67,7 +67,7 @@
{% set stylefeed = "background-color: #" ~ flux.color ~ ";" %}
{% 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 %}
{% else %}
<p></p>
@ -99,7 +99,7 @@
<img src="{{feed.image}}" width="100%">
{% endif %}
<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>
{{ feed.description | nl2br }}
</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>
{{ 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" %}
<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"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cet item ?">

View File

@ -7,14 +7,14 @@
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Retour</a>
{% 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 %}
<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>
{% 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 %}
{% endblock %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB