diff --git a/dicos/90_ninegate.xml b/dicos/90_ninegate.xml index 41b3d0ff..c8dc1eae 100644 --- a/dicos/90_ninegate.xml +++ b/dicos/90_ninegate.xml @@ -7,6 +7,8 @@ + ninegate-apps + diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/OnlyCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/OnlyCommand.php new file mode 100644 index 00000000..7248b5c1 --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/OnlyCommand.php @@ -0,0 +1,126 @@ +setName('Core:Only') + ->setDescription('Synchronisation Only Office') + ->setHelp('This command Synchro Only Office for Core') + ->addArgument('simulate', InputArgument::OPTIONAL, 'true to simulate / false to run') + ->addArgument('cronid', InputArgument::OPTIONAL, 'ID Cron Job') + ->addArgument('lastchance', InputArgument::OPTIONAL, 'Lastchance to run the cron') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->container = $this->getApplication()->getKernel()->getContainer(); + $this->em = $this->container->get('doctrine')->getEntityManager(); + $this->output = $output; + $this->filesystem = new Filesystem(); + $this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/"; + + $this->writelnred(''); + $this->writelnred('== Core:Only'); + $this->writelnred('=========================================================================================================='); + + setlocale( LC_CTYPE, 'fr_FR' ); + + $simulate = $input->getArgument('simulate'); + if($simulate=="") $simulate="true"; + + if($simulate!="true"&&$simulate!="false") { + $this->writeln('Paramétre incorrect'); + return; + } + $simulate=($simulate=="true"); + + $this->writeln(''); + if($simulate) $this->writeln('** SIMULATION'); + else $this->writeln('** REEL'); + + $this->writeln(''); + $this->writeln('====================================================='); + $this->writeln('== SYNCHONISATION ONLY OFFICE ======================='); + $this->writeln('====================================================='); + + $this->only_sync = true; + $this->only_url = "https://transnum.oo.pp.ac-dijon.fr"."/api/2.0/"; + $this->only_user = "admin"; + $this->only_password = "brigitte89!"; + + if($this->only_sync) { + // Only Office est-il dans le domaine + if(stripos($this->only_url,"/")===0) + $this->only_url="https://".$this->container->getParameter("weburl").$this->only_url; + $indomaine = (stripos($this->only_url,$this->container->getParameter("weburl"))!==false); + + // Si hors domaine on utilise le proxy si proxy il y a + if(!$indomaine) { + $PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue(); + if($PROXYactivate) { + $PROXYserver = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYserver")->getValue(); + $PROXYport = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYport")->getValue(); + \Unirest\Request::proxy($PROXYserver, $PROXYport, CURLPROXY_HTTP, true); + } + } + + // Récupération des informations utilisateurs issus du masteridentity + $headers = ['Accept' => 'application/json']; + $query = array('userName' => $this->only_user, 'password' => $this->only_password); + $body = json_encode($query); + $response = \Unirest\Request::post($this->only_url.'/authentication',$headers,$body); + } + + $this->writeln(''); + return 1; + } + + private function writelnred($string) { + $this->output->writeln(''.$string.''); + $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); + } + private function writeln($string) { + $this->output->writeln($string); + $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); + } + + +} 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 8132b7b9..d132f69b 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, 'Interne', 'SIREN'); INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES -(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}YAgr/O4uRUcWbNTTnUPNUYGt9TyvjbjJ +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}CqD7Yyh4UJXaQKOfEdvF1diU7vvDmj8V ', '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 8693d5d7..105c1e3b 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php @@ -849,6 +849,36 @@ class GroupController extends Controller // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { + // Si le groupe est un groupe de travail + if($data->getFgcanshare()) { + // Sur l'ensemble des pages liés + $pages=$data->getPages(); + foreach($pages as $page) { + $groups=$page->getGroups(); + // si la page est lié qu'à un seul group on peut la supprimer + if($groups->count()==1) + $em->remove($page); + } + + // Sur l'ensemble des calendar liés + $calendars=$data->getCalendars(); + foreach($calendars as $calendar) { + $groups=$calendar->getGroups(); + // si la page est lié qu'à un seul group on peut la supprimer + if($groups->count()==1) + $em->remove($calendar); + } + + // Sur l'ensemble des blog liés + $blogs=$data->getBlogs(); + foreach($blogs as $blog) { + $groups=$blog->getGroups(); + // si la page est lié qu'à un seul group on peut la supprimer + if($groups->count()==1) + $em->remove($blog); + } + } + $em->remove($data); $em->flush(); 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 61e9ee82..d558a470 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php @@ -962,6 +962,31 @@ class UserController extends Controller return $response; } + public function viewcalendarAction (Request $request) + { + // S'assurer que c'est un appel ajax + if (!$request->isXmlHttpRequest()) { + return new JsonResponse(array('message' => 'Interdit'), 400); + } + + $user=$this->getUser(); + if($user) { + $em = $this->getDoctrine()->getManager(); + + $view=$request->request->get('view'); + $idview=1; + if($view=="month") $idview=1; + if($view=="agendaWeek") $idview=2; + if($view=="agendaDay") $idview=3; + + $user->setViewcalendar($idview); + $em->persist($user); + $em->flush(); + } + + return new Response(); + } + protected function getDatas() { $em = $this->getDoctrine()->getManager(); 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 115e7114..0cc8b049 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php @@ -147,6 +147,11 @@ class User implements UserInterface, \Serializable */ private $belongingpopulation; + /** + * @ORM\Column(type="integer", nullable=true) + */ + private $viewcalendar; + /** * @ORM\ManyToOne(targetEntity="Country", inversedBy="users") * @ORM\JoinColumn(nullable=true) @@ -888,6 +893,30 @@ class User implements UserInterface, \Serializable return $this->belongingpopulation; } + /** + * Set viewcalendar + * + * @param integer $viewcalendar + * + * @return User + */ + public function setViewcalendar($viewcalendar) + { + $this->viewcalendar = $viewcalendar; + + return $this; + } + + /** + * Get viewcalendar + * + * @return integer + */ + public function getViewcalendar() + { + return $this->viewcalendar; + } + /** * Set birthcountry * diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/uploadListener.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/uploadListener.php index 4399d585..33d89303 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/uploadListener.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/uploadListener.php @@ -115,6 +115,19 @@ class uploadListener $this->resizeImage($pathname."/".$directory."/thumb/".$filename,$width,$height,$scale); } + + if (in_array(strtolower($file->GetExtension()), array('pdf'))) { + $im = new \Imagick(); + $im->setResolution(350, 350); + $im->readImage($pathname."/".$directory."/".$filename."[0]"); + $im->setImageBackgroundColor('#ffffff'); + $im = $im->flattenImages(); + $im->setImageFormat('jpeg'); + $fs->mkdir($pathname."/".$directory."/thumb"); + $im->writeImage($pathname."/".$directory."/thumb/".$filename.".jpg"); + $fs->rename($pathname."/".$directory."/thumb/".$filename.".jpg", $pathname."/".$directory."/thumb/".$filename); + } + if (strpos($directory, 'widget') === 0) { $tmp=explode("-",$directory); $widgetid=$tmp[1]; diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml index b6fc83ec..9333f7ee 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml @@ -269,6 +269,9 @@ cadoles_core_user_view: path: /user/view/{id} defaults: { _controller: CadolesCoreBundle:User:view } +cadoles_core_user_viewcalendar: + path: /user/viewcalendar + defaults: { _controller: CadolesCoreBundle:User:viewcalendar } #== Niveau01 ============================================================================================================= cadoles_core_config_niveau01: 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 335c07cc..460e6bb3 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 @@ -308,8 +308,9 @@ span.item-drag { a.item-preview { display: none; position: absolute; - right: 5px; + right: 0px; top: 2px; + width:20px; z-index: 1000; } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig index 1704bbfc..0dbabee1 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig @@ -10,7 +10,7 @@ {% set permgroup = app.session.get('permgroup') %} - {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ADMIN" or permgroup=="ROLE_ANIM")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %} + {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_USER" or permgroup=="ROLE_ANIM")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %}

{% if access=="config" %} Ajouter 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 615631d2..8e1cc10c 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BookmarkController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BookmarkController.php @@ -29,6 +29,7 @@ class BookmarkController extends Controller $data = new Bookmark(); // On s'assure que le widget existe + $pagewidget=null; if($touser=="false") { $pagewidget = $em->getRepository("CadolesPortalBundle:Pagewidget")->find($idwidget); if (!$pagewidget) throw $this->createNotFoundException('Unable to find entity.'); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/PageRepository.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/PageRepository.php index 820c1368..49eebe6c 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/PageRepository.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/PageRepository.php @@ -107,6 +107,7 @@ class PageRepository extends EntityRepository ->andWhere('ug.user=:user') ->setParameter('fgcanshare',true) ->setParameter('user',$user) + ->orderBy('g.label') ->getQuery()->getResult(); // Pour chaque groupe de travail : on s'assure que le groupe possède au moins une page @@ -117,6 +118,8 @@ class PageRepository extends EntityRepository ->where('g.id=:id') ->andWhere('g MEMBER OF page.groups') ->setParameter('id',$groupshared->getId()) + ->orderBy('page.roworder') + ->addOrderBy('page.name') ->getQuery()->getResult(); if(empty($pagesshared)) { diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/view.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/view.html.twig index 181de3f4..8b3b05e8 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/view.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/view.html.twig @@ -203,6 +203,15 @@ {% block localjavascript %} var idcalendar; + var defautView='month'; + {% if app.user %} + {% if app.user.viewcalendar == 2 %} + var defautView='agendaWeek'; + {% elseif app.user.viewcalendar == 3 %} + var defautView='agendaDay'; + {% endif %} + {% endif %} + $('document').ready(function(){ {% if entity.id is defined %} {% for calendar in calendars %} @@ -252,6 +261,8 @@ // Affichages des calendars function showCalendar(id,canupdate) { + + idcalendar=id; urltoload="{{ path('cadoles_portal_'~access~'_calendarevent_load',{'idcalendar':'xx'}) }}"; urltoload=urltoload.replace('xx',idcalendar); @@ -279,6 +290,7 @@ selectHelper: true, editable: canupdate, eventLimit: true, + defaultView: defautView, header: { left: 'prev,next today', @@ -358,6 +370,22 @@ }); }, + {% if app.user %} + viewRender: function( view, element ) { + if(view.name!=defautView) { + $.ajax({ + method: "POST", + url: "{{ path('cadoles_core_user_viewcalendar') }}", + data: { + "view": view.name, + } + }); + + defautView=view.name; + } + }, + {% endif %} + eventRender: function(event, element) { element.attr('title', event.description); }, 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 15866960..11c4927d 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 @@ -224,7 +224,7 @@ var grid = $('.grid').masonry(optiongrid); } else { - $(this).html(''); + $(this).html(''); $(this).parent().children(".grid-item-body").hide(); $(this).parent().parent().css("width",""); @@ -379,6 +379,24 @@ } + // Supprimer un bookmark + function delBookmark(idbookmark) { + if (confirm('Êtes-vous sûr de vouloir supprimer cet item ?')) { + var url="{{ path('cadoles_portal_'~access~'_bookmark_delete',{idpage:entity.id,id:'xx',group:group,usage:usage,by:mode})}}"; + + url=url.replace('xx',idbookmark); + url=url.replace(/&/g,"&"); + + $.ajax({ + method: "POST", + url: url, + success: function(idbookmark) { + location.reload(); + } + }); + } + } + // Supprimer un fichier function delFile(directory,filename) { var r = confirm("Confirmez-vous la suppression de ce fichier ?"); 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 bebed711..6d2c7e25 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 @@ -101,40 +101,82 @@

{% for bookmark in bookmarks %} -
-
- + {% if bookmark.item %} +
+ + {%else%} + + {% endif %} {% endfor %} {% if (canadd and access!="config") %}
-
+