diff --git a/src/ninegate-1.0/app/config/config.yml b/src/ninegate-1.0/app/config/config.yml index b8881c87..08147083 100644 --- a/src/ninegate-1.0/app/config/config.yml +++ b/src/ninegate-1.0/app/config/config.yml @@ -154,7 +154,7 @@ ivory_ck_editor: language: fr toolbar: "my_toolbar_1" uiColor: "#ffffff" - extraPlugins: ["html5video","pastebase64"] + extraPlugins: ["html5video"] light_config: language: fr toolbar: "my_toolbar_2" 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 c8e9650b..df141a43 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}vVciL1BZlGqITdyEI5am1J21xEgy2M02 +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}eyoxoh9yJzJyNAacnf9gxyZbtRWITzXF ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php index 4d96ab9d..6359fd22 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php @@ -509,10 +509,28 @@ class GroupController extends Controller $em->persist($usergroup); $em->flush(); + // Notification message $user=$em->getRepository("CadolesCoreBundle:User")->find($userid); $message="Inscription de l'utilisateur
".$user->getLastname()." ".$user->getFirstname()."
Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key->toString(),$userid,$groupid,$message); + // Notification mail auprès de la personne inscrite + if($group->getFgcanshare()) { + $text="Vous venez d'être inscrit dans le groupe de travail : ".$group->getLabel(); + $template="template"; + $mail_params=array( + "subject" => $this->get('session')->get('appname')." : Inscription au groupe de travail : ".$group->getLabel()."\n\n".$group->getDescription(), + "body_html"=>nl2br($text), + "body_text"=>$text + ); + $to = $user->getEmail(); + $from = $this->getParameter('noreply');; + $fromName = $this->get('session')->get('appname'); + $message = $this->container->get('cadoles.core.service.mail'); + $message->sendEmail($template, $mail_params, $to, $from, $fromName); + } + + // Retour $response = new Response(json_encode($output)); $response->headers->set('Content-Type', 'application/json'); return $response; @@ -535,15 +553,36 @@ class GroupController extends Controller if($group->getFgAll()||$group->getFgTemplate()) throw $this->createNotFoundException('Permission denied'); + // Notification message $data = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$userid,"group"=>$groupid)); $user=$em->getRepository("CadolesCoreBundle:User")->find($userid); $message="Désinscription de l'utilisateur
".$user->getLastname()." ".$user->getFirstname()."
Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();; $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($data->getKeyvalue(),$userid,$groupid,$message); - - + + // Desinscription $em->remove($data); $em->flush(); + // Notification mail auprès des managers + if($group->getFgcanshare()) { + $text=$user->getUsername()." a été désinscrit dugroupe de travail : ".$group->getLabel(); + $template="template"; + $mail_params=array( + "subject" => $this->get('session')->get('appname')." : ".$user->getUsername()." = Désinscription au groupe de travail ".$group->getLabel()."\n\n".$group->getDescription(), + "body_html"=>nl2br($text), + "body_text"=>$text + ); + $managers=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$groupid,"fgmanager"=>true)); + $to=array(); + foreach($managers as $manager) { + array_push($to,$manager->getUser()->getEmail()); + } + + $from = $this->getParameter('noreply');; + $fromName = $this->get('session')->get('appname'); + $message = $this->container->get('cadoles.core.service.mail'); + $message->sendEmail($template, $mail_params, $to, $from, $fromName); + } $response = new Response(json_encode($output)); $response->headers->set('Content-Type', 'application/json'); @@ -557,14 +596,39 @@ class GroupController extends Controller if($group->getFgAll()||$group->getFgTemplate()) throw $this->createNotFoundException('Permission denied'); + // Notification message $usergroup = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$this->getUser(),"group"=>$id)); $user=$em->getRepository("CadolesCoreBundle:User")->find($this->getUser()); $message="Désinscription de l'utilisateur
".$user->getLastname()." ".$user->getFirstname()."
Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();; $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($usergroup->getKeyvalue(),$this->getUser()->getId(),$id,$message); + // Desinscription $em->remove($usergroup); $em->flush(); + // Notification mail auprès des managers + if($group->getFgcanshare()) { + $text=$user->getUsername()." a été désinscrit dugroupe de travail : ".$group->getLabel(); + $template="template"; + $mail_params=array( + "subject" => $this->get('session')->get('appname')." : ".$user->getUsername()." = Désinscription au groupe de travail ".$group->getLabel()."\n\n".$group->getDescription(), + "body_html"=>nl2br($text), + "body_text"=>$text + ); + $managers=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$group,"fgmanager"=>true)); + $to=array(); + foreach($managers as $manager) { + array_push($to,$manager->getUser()->getEmail()); + } + + $from = $this->getParameter('noreply');; + $fromName = $this->get('session')->get('appname'); + $message = $this->container->get('cadoles.core.service.mail'); + $message->sendEmail($template, $mail_params, $to, $from, $fromName); + } + + + return $this->redirect($this->generateUrl("cadoles_core_user_group")); } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php index 1a69a58d..7b0ded5c 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php @@ -351,8 +351,25 @@ class UserController extends Controller $em->persist($usergroup); $em->flush(); + // Notification message $message="Inscription de l'utilisateur
".$data->getLastname()." ".$data->getFirstname()."
Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key->toString(),$iduser,$idgroup,$message); + + // Notification mail auprès de la personne inscrite + if($group->getFgcanshare()) { + $text="Vous venez d'être inscrit dans le groupe de travail : ".$group->getLabel(); + $template="template"; + $mail_params=array( + "subject" => $this->get('session')->get('appname')." : Inscription au groupe de travail : ".$group->getLabel()."\n\n".$group->getDescription(), + "body_html"=>nl2br($text), + "body_text"=>$text + ); + $to = $data->getEmail(); + $from = $this->getParameter('noreply');; + $fromName = $this->get('session')->get('appname'); + $message = $this->container->get('cadoles.core.service.mail'); + $message->sendEmail($template, $mail_params, $to, $from, $fromName); + } } // Ajout des modos @@ -476,8 +493,25 @@ class UserController extends Controller $em->persist($usergroup); $em->flush(); + // notification message $message="Inscription de l'utilisateur
".$data->getLastname()." ".$data->getFirstname()."
Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key->toString(),$id,$idgroup,$message); + + // Notification mail auprès de la personne inscrite + if($group->getFgcanshare()) { + $text="Vous venez d'être inscrit dans le groupe de travail : ".$group->getLabel(); + $template="template"; + $mail_params=array( + "subject" => $this->get('session')->get('appname')." : Inscription au groupe de travail : ".$group->getLabel()."\n\n".$group->getDescription(), + "body_html"=>nl2br($text), + "body_text"=>$text + ); + $to = $data->getEmail(); + $from = $this->getParameter('noreply');; + $fromName = $this->get('session')->get('appname'); + $message = $this->container->get('cadoles.core.service.mail'); + $message->sendEmail($template, $mail_params, $to, $from, $fromName); + } } // Suppression des groupes obsolètes @@ -494,11 +528,34 @@ class UserController extends Controller ->getQuery() ->getResult(); foreach($usergroups as $usergroup) { + // Notification message $message="Désinscription de l'utilisateur
".$data->getLastname()." ".$data->getFirstname()."
Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($usergroup->getKeyvalue(),$id,$idgroup,$message); + // Déscription $em->remove($usergroup); $em->flush(); + + // Notification mail auprès des managers + if($group->getFgcanshare()) { + $text=$data->getUsername()." a été désinscrit dugroupe de travail : ".$group->getLabel(); + $template="template"; + $mail_params=array( + "subject" => $this->get('session')->get('appname')." : ".$data->getUsername()." = Désinscription au groupe de travail ".$group->getLabel()."\n\n".$group->getDescription(), + "body_html"=>nl2br($text), + "body_text"=>$text + ); + $managers=$em->getRepository("CadolesCoreBundle:Usergroup")->findBy(array("group"=>$group,"fgmanager"=>true)); + $to=array(); + foreach($managers as $manager) { + array_push($to,$manager->getUser()->getEmail()); + } + + $from = $this->getParameter('noreply');; + $fromName = $this->get('session')->get('appname'); + $message = $this->container->get('cadoles.core.service.mail'); + $message->sendEmail($template, $mail_params, $to, $from, $fromName); + } } } @@ -843,7 +900,7 @@ class UserController extends Controller $em->persist($user); $em->flush(); - // Email à destination de l'inscript pour le prévenir qu'il dispose d'un compte + // Email à destination de l'inscrit pour le prévenir qu'il dispose d'un compte $url = $this->generateUrl('cadoles_core_resetpwd01', [], UrlGeneratorInterface::ABSOLUTE_URL); $text ="Vous venez d'être inscrit au portail = ".$appname."\n\n"; $text.="Login = ".$username."\n"; diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php index f92420ec..912d3c8d 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php @@ -869,4 +869,38 @@ class Group { return $this->messages; } + + /** + * Add calendarevent + * + * @param \Cadoles\PortalBundle\Entity\Calendarevent $calendarevent + * + * @return Group + */ + public function addCalendarevent(\Cadoles\PortalBundle\Entity\Calendarevent $calendarevent) + { + $this->calendarevents[] = $calendarevent; + + return $this; + } + + /** + * Remove calendarevent + * + * @param \Cadoles\PortalBundle\Entity\Calendarevent $calendarevent + */ + public function removeCalendarevent(\Cadoles\PortalBundle\Entity\Calendarevent $calendarevent) + { + $this->calendarevents->removeElement($calendarevent); + } + + /** + * Get calendarevents + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getCalendarevents() + { + return $this->calendarevents; + } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php index fd550b54..115e7114 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php @@ -266,7 +266,11 @@ class User implements UserInterface, \Serializable */ protected $messagereaders; - + /** + * @ORM\ManyToMany(targetEntity="Cadoles\WebsocketBundle\Entity\Message", mappedBy="sees") + */ + protected $messagesees; + //== CODE A NE PAS REGENERER /** * @ORM\PostLoad @@ -1421,4 +1425,38 @@ class User implements UserInterface, \Serializable { return $this->messagereaders; } + + /** + * Add messagesee + * + * @param \Cadoles\WebsocketBundle\Entity\Message $messagesee + * + * @return User + */ + public function addMessagesee(\Cadoles\WebsocketBundle\Entity\Message $messagesee) + { + $this->messagesees[] = $messagesee; + + return $this; + } + + /** + * Remove messagesee + * + * @param \Cadoles\WebsocketBundle\Entity\Message $messagesee + */ + public function removeMessagesee(\Cadoles\WebsocketBundle\Entity\Message $messagesee) + { + $this->messagesees->removeElement($messagesee); + } + + /** + * Get messagesees + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getMessagesees() + { + return $this->messagesees; + } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css index ea3b38a1..f611d414 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css @@ -591,7 +591,6 @@ a.item-heart { position: absolute; height:40px; width:40px; - border-radius: 100%; margin: 5px; cursor: pointer; } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/images/loadpoint.gif b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/images/loadpoint.gif index d7597f8d..25dfe6fc 100644 Binary files a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/images/loadpoint.gif and b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/images/loadpoint.gif differ diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig index 63e535fb..a5dc1715 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/function.html.twig @@ -1,12 +1,12 @@ {% set logo = "transnum-logo.png" %} {% set fgheader = "" %} -{% set header = "transnum-header.jpg" %} +{% set header = "transnum-header.png" %} {% set heightheader = "" %} {% set colormain = "2176ad" %} {% set fontcolorhover = "" %} -{% set colorbody = "" %} +{% set colorbody = "eeeeee" %} {% set fontfacetitle = "LexendDeca-Regular" %} {% set fontfacebody = "" %} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css index d93e64b6..66a1299b 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/style.css @@ -3,7 +3,16 @@ } - +body { + background-color: #2e3339 !important; +} +body.simple { + background-color: transparent !important; +} +.navbar-default,.sidebar ul li { + background-color: #2e3339 !important; + border-color: #2e3339 !important; +} @@ -50,6 +59,17 @@ } + +.widget-notbordered .widgetheader { + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); +} + +.widget-notbordered .widgetbody .list-item, .widget-notbordered .widgetbody .grid-item-content { + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); +} + + + .grid .grid-preview { width: 15%; min-width: 160px; diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/transnum-header.png b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/transnum-header.png new file mode 100644 index 00000000..327114a2 Binary files /dev/null and b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/transnum-header.png differ diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig index 4da37112..25f8f093 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig @@ -159,7 +159,7 @@

Mes Icônes

{% for icon in iconsuser %} - + {% endfor %} @@ -167,7 +167,7 @@ {% endif %} {% for icon in icons %} - + {% endfor %} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig index 0965f5a3..fc231628 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig @@ -156,8 +156,10 @@ {% for group in user.groups %} - {% if (access=="config" or group.group.fgopen or group.group.fgcanshare) and group.group.owner!=app.user and not group.group.fgall and group.group.ldapfilter=="" and group.group.attributes =="" %} - + {% if access=="config" and not group.group.fgall and group.group.ldapfilter=="" and group.group.attributes =="" %} + + {% elseif (group.group.fgopen or group.group.fgcanshare) and group.group.owner!=app.user and not group.group.fgall and group.group.ldapfilter=="" and group.group.attributes =="" %} + {% else %} {% endif %} 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 e00573b0..13f97aae 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -733,6 +733,25 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setParameter($parameter); $em->persist($entityWidget); + // Actualités des groupes + $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1820); + if(!$entityWidget) $entityWidget = new Widget(); + $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_megaphone2.png"]); + $entityWidget->setId(-1820); + $entityWidget->setRoworder(2); + $entityWidget->setIcon($entityicon); + $entityWidget->setName('Actualités de mes Groupes'); + $entityWidget->setDescription("Affiche la liste actualités de vos groupes de travail"); + $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_groupmessage"); + $entityWidget->setHeight("630"); + $entityWidget->setAutoajust(true); + $entityWidget->setBorder(false); + $entityWidget->setOpened(true); + $entityWidget->setAccess(["config","user","group"]); + $parameter = json_decode('{"fields": [{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'actualitées affichées (0 pour tout)", "value": "5", "mandatory": "true"},{"id": "modelist", "loc": "col1", "type": "modelist", "label": "Mode Affichage", "value": "1", "mandatory": "true"}]}'); + $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/PagewidgetController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php index 1fa1ae4d..1c3a3e22 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php @@ -1878,6 +1878,7 @@ class PagewidgetController extends Controller $group=$em->getRepository("CadolesCoreBundle:Group")->find($group); if($group) { $title=$group->getLabel(); + $id=$group->getId(); if($group->getDescription()) $description="Description
".$group->getDescription(); if($group->getIcon()) @@ -1893,6 +1894,7 @@ class PagewidgetController extends Controller else { $title=$entity->getPage()->getName(); $proprio=$entity->getPage()->getUser(); + $id=0; if($proprio) { $description="Propriétaire de la page
".$proprio->getLastname()." ".$proprio->getLastname(); $icon="/uploads/avatar/".$proprio->getAvatar(); @@ -1907,7 +1909,8 @@ class PagewidgetController extends Controller 'icon' => $icon, 'title' => $title, 'description' => $description, - 'members' => $members + 'members' => $members, + 'id' => $id, ]); } @@ -1992,5 +1995,83 @@ class PagewidgetController extends Controller 'groups' => $mygroups, ]); - } + } + + public function viewgroupmessageAction(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'); + } + + // Récupération des paramétres du widget + $modelist=1; + $nbarticle=5; + foreach($entity->getParameter()["fields"] as $parameter) { + switch($parameter["id"]) { + case "modelist": + $modelist=$parameter["value"]; + break; + case "nbarticle": + $nbarticle=$parameter["value"]; + break; + } + } + + $mygroups=[]; + $mymsg= []; + $this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared); + foreach($groupsshared as $groupshared) { + // On récupère l'ensemble des messages du groupes + $messages=$this->getDoctrine()->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$groupshared]); + foreach($messages as $key => $message) { + // persistante collection à revoir + if($message->getSees()->count()>0) { + if($message->getSees()->contains($user) ) { + + unset($messages[$key]); + } + } + } + + foreach($messages as $key => $message) { + $tmp=["id" => $message->getId(), "user" => $message->getUser(), "date"=>$message->getSubmitdate(), "topic"=>$message->getTopic()]; + array_push($mymsg,$tmp); + } + } + + $ord = array(); + foreach ($mymsg as $key => $value){ + $ord[] = $value['date']; + } + array_multisort($ord, SORT_DESC, $mymsg); + + // Render + return $this->render($this->labelentity.':viewgroupmessage.html.twig', [ + 'entity' => $entity, + 'canadd' => ($user), + 'canupdate' => $canupdate, + 'usage' => $usage, + 'modelist' => $modelist, + 'messages' => $mymsg, + 'nbarticle' => $nbarticle, + + ]); + } } + + + 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 bbb8fa1d..aa573960 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 @@ -771,6 +771,10 @@ cadoles_portal_config_panelwidget_view_group: path: /config/pagewidget/view/group/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroup, access: config } +cadoles_portal_config_panelwidget_view_groupmessage: + path: /config/pagewidget/view/groupmessage/{id} + defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroupmessage, access: config } + #-- Access user cadoles_portal_user_pagewidget_widget_sumbit: path: /user/pagewidget/submit/{idpage}/{idwidgettype} @@ -876,3 +880,7 @@ cadoles_portal_user_panelwidget_view_group: path: /pagewidget/view/group/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroup, access: user } +cadoles_portal_user_panelwidget_view_groupmessage: + path: /pagewidget/view/groupmessage/{id} + defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroupmessage, access: user } + diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Alertcategory/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Alertcategory/edit.html.twig index 22d7266b..f74b8bf1 100755 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Alertcategory/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Alertcategory/edit.html.twig @@ -80,7 +80,7 @@
{% for icon in icons %} - + {% endfor %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig index 06629d1c..7ead78e9 100755 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig @@ -47,7 +47,7 @@
- + {{ form_widget(form.label) }} Modifier
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig index 035596db..0bf0f0e1 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig @@ -7,7 +7,7 @@
{% for icon in icons %} - + {% endfor %}
{% endblock %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig index dd3173a2..565180e4 100755 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Item/edit.html.twig @@ -92,7 +92,7 @@
{% for icon in icons %} - + {% endfor %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/viewwidget.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/viewwidget.html.twig index daa15c5a..6762524d 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/viewwidget.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/viewwidget.html.twig @@ -531,4 +531,25 @@ var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'}; var grid = $('.grid').masonry(optiongrid); } + + // Place un message en leur + function hideMessage(id) { + $.ajax({ + method: "POST", + url: "{{ path('cadoles_websocket_message_see') }}", + data: { + id:id + }, + success: function() { + $(".msg-"+id).remove(); + var ele = $(".msg-hidden").first(); + ele.show(); + ele.removeClass("msg-hidden"); + + var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'}; + var grid = $('.grid').masonry(optiongrid); + + } + }); + } {% endblock %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/edit.html.twig index 0f2a1de6..7fd234c0 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/edit.html.twig @@ -54,7 +54,7 @@
-
+
{% if entity.icon %} {% endif %} @@ -110,7 +110,7 @@

Mes Icônes

{% for icon in iconsuser %} - + {% endfor %} @@ -119,7 +119,7 @@ {% for icon in icons %} - + {% endfor %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewalert.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewalert.html.twig index bc31707a..9c8c6f9f 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewalert.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewalert.html.twig @@ -12,7 +12,7 @@ {% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% if canupdate or alerts|length>0 %} -
+
{% if canupdate %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig index 38c2938c..f3d359c1 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig @@ -26,7 +26,7 @@ {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% endif %} -
+
{% if canupdate or canadd %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig index 6b700887..13e8a772 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig @@ -18,7 +18,7 @@ -
+
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig index 8d226469..1a3ef229 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig @@ -26,7 +26,7 @@ {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% endif %} -
+
{% if canupdate or canadd %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewcalendar.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewcalendar.html.twig index 35c2620e..1f6f4977 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewcalendar.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewcalendar.html.twig @@ -17,7 +17,7 @@ -
+
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig index c959c12a..c4773a76 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewchat.html.twig @@ -23,7 +23,7 @@ {% set colorbodyfont = color['fontcolorhover'] %} {% endif %} -
+
{% if canupdate %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/vieweditor.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/vieweditor.html.twig index 098a1741..d6bfea3e 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/vieweditor.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/vieweditor.html.twig @@ -10,7 +10,7 @@ {% set stylewidgetheader = constants.mystylewidgetheader(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %} -
+
{% if canupdate %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig index 0c48797d..59a378fe 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig @@ -24,7 +24,7 @@ {% set colorbodyfont = color['fontcolorhover'] %} {% endif %} -
+
{% if canupdate or canadd %}
{% if canupdate %} @@ -48,11 +48,16 @@ {{ entity.name }}
- {% if files|length >= 1 %} + {% if files|length >= 1 or canupdate %}
+ {% if canupdate %} +
+
+ {% endif %} + {% for file in files|sort %} - {% if loop.index==1 %} + {% if loop.index==1 and not canupdate%}
{% endif %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig index ea8444d5..8c1c9504 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig @@ -36,7 +36,7 @@ {% set stylegrid="grid-list" %} {% endif %} -
+
{% if canupdate %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewframe.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewframe.html.twig index 674a1787..5ae28e20 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewframe.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewframe.html.twig @@ -22,7 +22,7 @@ {% set colorbodyfont = color['fontcolorhover'] %} {% endif %} -
+
{% if canupdate %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgalery.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgalery.html.twig index b12cf400..21cfc1d3 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgalery.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgalery.html.twig @@ -24,7 +24,7 @@ {% set colorbodyfont = color['fontcolorhover'] %} {% endif %} -
+
{% if canupdate or canadd %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroup.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroup.html.twig index 1d7ac634..64f36588 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroup.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroup.html.twig @@ -17,7 +17,7 @@ {% set canadd = true %} {% endif %} -
+
{% if canupdate %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroupmessage.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroupmessage.html.twig new file mode 100644 index 00000000..4ae6f4ae --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroupmessage.html.twig @@ -0,0 +1,113 @@ +{% 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 stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} +{% set color = app.session.get('color') %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% set colorbodyfont = color['fontcolorhover'] %} +{% endif %} + +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = color['main'] %} +{% endif %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% if colorbodyback==color['fontcolorhover'] %} + {% set colorbodyfont = color['main'] %} + {% else %} + {% set colorbodyfont = color['fontcolorhover'] %} + {% endif %} +{% endif %} + +{% if modelist==0 %} + {% set stylegrid="grid-preview" %} +{% elseif modelist==1 %} + {% set stylegrid="grid-list" %} +{% endif %} + +
+ {% if canupdate %} +
+ + +
+ {% endif %} + + +
+ {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
+ + {% set firstflux="" %} + +
+ {% if fluxs is defined %} + {% if fluxs|length > 1 %} +
Tout
+ + {% for flux in fluxs %} + {% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %} + {% if flux.color is not null %} + {% set stylefeed = "background-color: #" ~ flux.color ~ ";" %} + {% endif %} + +
{{ flux.title }}
+ {% endfor %} + {% endif %} + {% endif %} + +
+
+
+ {% set nbaff=0 %} + {% for message in messages %} + {% set nbaff=nbaff+1 %} + {% set class="" %} + {% set style="" %} + {% if nbaff > nbarticle %} + {% set class="msg-hidden" %} + {% set style="display:none" %} + {% endif %} + +
+
+ +
+
+ {% endfor %} +
+
+
+ + + diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig index a784591b..b6ec3979 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig @@ -19,7 +19,7 @@ {% set stylelink = "color:#" ~ color['fontcolorhover'] %} {% endif %} -
+
{% if canupdate %}
@@ -37,6 +37,7 @@ {% endif %}
+ {% set canadd = false %}
{%if usage=="group" %}Groupe
{% endif %} @@ -55,13 +56,34 @@
- {%if member.fgmanager%}{%endif%}
+ {%if member.fgmanager%} + + {% if member.user==app.user %} + {% set canadd=true %} + {% endif %} + {%endif%}
{{ member.user.lastname }} {{ member.user.firstname }} -
{% endfor %} + + {% if canadd==true %} + + {% endif %}
{% endif %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig index bf4a4663..a4fcb112 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig @@ -27,7 +27,7 @@ {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% endif %} -
+
{% if canupdate or canadd %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitemessential.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitemessential.html.twig index 7f5e72b0..7f6d1b4f 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitemessential.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitemessential.html.twig @@ -27,7 +27,7 @@ {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% endif %} -
+
{% if canupdate or canadd %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewlink.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewlink.html.twig index a915909a..79fef849 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewlink.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewlink.html.twig @@ -18,7 +18,7 @@ {% set stylelink = "color:#" ~ color['fontcolorhover'] %} {% endif %} -
+
{% if canupdate %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewseparator.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewseparator.html.twig index 9bd622c1..244a220d 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewseparator.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewseparator.html.twig @@ -17,7 +17,7 @@ {% set colorbodyfont = color['main'] %} {% endif %} -
+
{% if canupdate %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewslide.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewslide.html.twig index 56e21808..88dba4fb 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewslide.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewslide.html.twig @@ -17,7 +17,7 @@ {% set stylelink = "color:#" ~ color['fontcolorhover'] ~ ";" %} {% endif %} -
+
{% if canupdate or canadd %}
{% if canupdate %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewurl.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewurl.html.twig index 05d8bec1..04aaa809 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewurl.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewurl.html.twig @@ -11,7 +11,7 @@ {% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} {% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} -
+
{% if canupdate %}
diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Controller/ChatController.php b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Controller/ChatController.php index 3bf42839..78617f9f 100644 --- a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Controller/ChatController.php +++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Controller/ChatController.php @@ -80,4 +80,29 @@ class ChatController extends Controller ]); } } + + public function seeAction(Request $request) + { + // S'assurer que c'est un appel ajax + if (!$request->isXmlHttpRequest()) { + return new JsonResponse(array('message' => 'Interdit'), 400); + } + + $em = $this->getDoctrine()->getManager(); + + $output=array(); + $id=$request->request->get('id'); + $user=$this->getUser(); + if($user) { + $message=$em->getRepository("CadolesWebsocketBundle:Message")->find($id); + $message->addSee($user); + // Sauvegarde + $em->persist($message); + $em->flush(); + } + + $response = new Response(json_encode($output)); + $response->headers->set('Content-Type', 'application/json'); + return $response; + } } diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Entity/Message.php b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Entity/Message.php index 3de5d076..5b15d9b0 100644 --- a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Entity/Message.php +++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Entity/Message.php @@ -42,15 +42,23 @@ class Message /** * @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="messagereaders", cascade={"persist"}) - * @ORM\JoinTable(name="messageuser", + * @ORM\JoinTable(name="messageuserread", * joinColumns={@ORM\JoinColumn(name="message", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")} * ) */ protected $readers; + /** + * @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="messagesees", cascade={"persist"}) + * @ORM\JoinTable(name="messageusersee", + * joinColumns={@ORM\JoinColumn(name="message", referencedColumnName="id")}, + * inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")} + * ) + */ + protected $sees; - + /** * Constructor */ @@ -200,4 +208,38 @@ class Message { return $this->readers; } + + /** + * Add see + * + * @param \Cadoles\CoreBundle\Entity\User $see + * + * @return Message + */ + public function addSee(\Cadoles\CoreBundle\Entity\User $see) + { + $this->sees[] = $see; + + return $this; + } + + /** + * Remove see + * + * @param \Cadoles\CoreBundle\Entity\User $see + */ + public function removeSee(\Cadoles\CoreBundle\Entity\User $see) + { + $this->sees->removeElement($see); + } + + /** + * Get sees + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSees() + { + return $this->sees; + } } diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/config/routing.yml index 4a2ad2b0..b249936e 100644 --- a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/config/routing.yml @@ -1,3 +1,7 @@ cadoles_websocket_chat: path: /websocket/chat/{id} defaults: { _controller: CadolesWebsocketBundle:Chat:client } + +cadoles_websocket_message_see: + path: /user/message/see + defaults: { _controller: CadolesWebsocketBundle:Chat:see } \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig index 28741ed2..a973b62c 100644 --- a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig +++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig @@ -118,27 +118,31 @@ {% endblock %} {% block localjavascript %} + var webSocket; + $(document).ready(function(){ if (CKEDITOR.instances["chat_message"]) CKEDITOR.instances["chat_message"].destroy(); if (CKEDITOR.instances["chat_messagemail"]) CKEDITOR.instances["chat_messagemail"].destroy(); - CKEDITOR.replace( 'chat_message', { - toolbar: [ - { name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] }, - { name: 'custo02', items: [ 'NumberedList','BulletedList' ] }, - { name: 'custo03', items: [ 'Smiley','Link','Unlink' ]} - ], - height: 100 - }); + setTimeout(function(){ + CKEDITOR.replace( 'chat_message', { + toolbar: [ + { name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] }, + { name: 'custo02', items: [ 'NumberedList','BulletedList' ] }, + { name: 'custo03', items: [ 'Smiley','Link','Unlink' ]} + ], + height: 100 + }); - CKEDITOR.replace( 'chat_messagemail', { - toolbar: [ - { name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] }, - { name: 'custo02', items: [ 'NumberedList','BulletedList' ] }, - { name: 'custo03', items: [ 'Smiley','Link','Unlink' ]} - ], - height: 150 - }); + CKEDITOR.replace( 'chat_messagemail', { + toolbar: [ + { name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] }, + { name: 'custo02', items: [ 'NumberedList','BulletedList' ] }, + { name: 'custo03', items: [ 'Smiley','Link','Unlink' ]} + ], + height: 150 + }); + },500); $(".switch").bootstrapSwitch(); var dateoptions = {weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" }; @@ -146,7 +150,7 @@ {% if websocket_activate and app.user %} var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}"; - var webSocket = WS.connect(_WS_URI); + webSocket = WS.connect(_WS_URI); var timer; webSocket.on("socket/connect", function (session) { @@ -228,12 +232,13 @@ session.publish("websocket/channel/{{groupid}}", event); CKEDITOR.instances["chat_message"].setData(''); + /* Ne plus envoyer d'event compteur on passe par de l'ajax event={type: "add", group:{{groupid}}}; parent.parent.counter(event); + */ + $("#sendbymail").bootstrapSwitch('state',false); - $('#mymodal-sendmail').modal('hide'); - } else alert("Sujet, corps et destinataire(s) obligatoire"); }); diff --git a/src/ninegate-1.0/web/uploads/icon/icon_add.png b/src/ninegate-1.0/web/uploads/icon/icon_add.png index 3bfa4fc8..51fa2e32 100644 Binary files a/src/ninegate-1.0/web/uploads/icon/icon_add.png and b/src/ninegate-1.0/web/uploads/icon/icon_add.png differ