diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql
index 19653747..a4337b1f 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql
@@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
-(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}otHXvfP0WOEFQYGgcJCVwAZ8h4HHrHOP
+(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}wAHoMm5DBdK1+YoDHF+e40chzyBR/vhk
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php
index 92d7fe32..d2c6755a 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php
@@ -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")
]);
}
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/view.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/view.html.twig
index e4d0ccb1..ae24a55c 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/view.html.twig
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/File/view.html.twig
@@ -6,7 +6,7 @@
{{ filename }}
-
+
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php
index 677c6cfa..aa3e25af 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php
@@ -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();
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BookmarkController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BookmarkController.php
index 651e3865..9321b816 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BookmarkController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BookmarkController.php
@@ -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)
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php
index 6dba0ef5..a8ea77fb 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PageController.php
@@ -7,6 +7,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem;
+use Symfony\Component\Form\FormError;
use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Form\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();
- $route=str_replace("_config_","_".$access."_",$this->routeprimary);
- return $this->redirect($this->generateUrl($route.'_update',["id"=>$entity->getId()]));
+ // 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()]));
+
+ }
}
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());
+ }
+ }
+ }
}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php
index 04f65663..a34692af 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php
@@ -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' => ""
]);
}
}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php
index d4b5cff7..99b877c5 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php
@@ -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="Description
".$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
".$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
+ ]);
+ }
+
}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/SlideController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/SlideController.php
index e643142a..7b51e373 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/SlideController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/SlideController.php
@@ -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")
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/BlogShareType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/BlogShareType.php
index 9c73aec8..4260b41c 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/BlogShareType.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/BlogShareType.php
@@ -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);
},
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarShareType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarShareType.php
index c146cfed..63eae56f 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarShareType.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarShareType.php
@@ -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);
},
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageShareType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageShareType.php
index e3c768fd..25487ee4 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageShareType.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageShareType.php
@@ -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);
},
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php
index 17dd2fec..1fd03b1e 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PageSubmitType.php
@@ -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'
]);
}
}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/BlogRepository.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/BlogRepository.php
index f8343e4c..41fc8eea 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/BlogRepository.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/BlogRepository.php
@@ -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
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/CalendarRepository.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/CalendarRepository.php
index 8edf73a8..6fc928f0 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/CalendarRepository.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/CalendarRepository.php
@@ -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
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml
index 06ce3c66..2f1c2a8a 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml
@@ -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 }
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Bookmark/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Bookmark/edit.html.twig
index 325b4c73..c1d2eb6a 100755
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Bookmark/edit.html.twig
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Bookmark/edit.html.twig
@@ -14,11 +14,11 @@
{% if access=="config" %}
Annuler
{% else %}
- Annuler
+ Annuler
{% endif %}
{% if mode=="update" %}
-
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/pages.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/pages.html.twig
index b0a4a068..8911f561 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/pages.html.twig
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/pages.html.twig
@@ -14,9 +14,9 @@
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
-
+
{% else %}
-
+
{% endif %}
{% endfor %}
@@ -29,9 +29,9 @@
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
-
+
{% else %}
-
+
{% endif %}
{% endfor %}
@@ -46,9 +46,9 @@
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
-
+
{% else %}
-
+
{% endif %}
{% else %}
@@ -62,9 +62,9 @@
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
-
+
{% else %}
-
+
{% endif %}
{% endfor %}
@@ -82,14 +82,15 @@
-
+
+
{% endblock %}
{% block pagewrapper %}
-