Compare commits

...

2 Commits

Author SHA1 Message Date
Arnaud Fornerot 03e0a1dc7c Merge branch 'master' into dist/envole/6/master 2019-11-19 10:26:14 +01:00
afornerot 0fd29ec35f svg 2019-11-19 10:24:45 +01:00
16 changed files with 414 additions and 51 deletions

View File

@ -7,6 +7,8 @@
<containers>
<container name='web'>
<package>ninegate-apps</package>
<file filelist='ninegate' name='/etc/apache2/sites-available/ninegate' source='ninegate-apache.conf' rm="True"/>
<file filelist="ninegate" name="/var/www/html/ninegate/app/config/parameters.yml" source="ninegate-parameters.yml" rm="True"/>
<file filelist="ninegate" name="/var/www/html/ninegate/app/config/template.yml" source="ninegate-template.yml" rm="True"/>

View File

@ -0,0 +1,126 @@
<?php
namespace Cadoles\CoreBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\KernelInterface;
use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\ORM\EntityManager;
use Cadoles\CoreBundle\Entity\Niveau01;
use Cadoles\CoreBundle\Entity\Niveau02;
use Cadoles\CoreBundle\Entity\User;
use Cadoles\CoreBundle\Entity\Group;
use Cadoles\CoreBundle\Entity\UserGroup;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
use Unirest\Request;
global $bdd01;
global $config;
class OnlyCommand extends Command
{
private $container;
private $em;
private $em2;
private $output;
private $filesystem;
private $rootlog;
private $only_sync;
private $only_url;
private $only_user;
private $only_password;
protected function configure()
{
$this
->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('<fg=red>'.$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");
}
}

View File

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

View File

@ -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();

View File

@ -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();

View File

@ -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
*

View File

@ -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];

View File

@ -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:

View File

@ -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;
}

View File

@ -10,7 +10,7 @@
</h1>
{% 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") %}
<p><a class="btn btn-success" href={{ path('cadoles_core_'~access~'_group_submit') }}>
{% if access=="config" %}
Ajouter

View File

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

View File

@ -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)) {

View File

@ -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);
},

View File

@ -224,7 +224,7 @@
var grid = $('.grid').masonry(optiongrid);
}
else {
$(this).html('<i style="color: #FFF" class="fa fa-plus" title="Informations sur ce service"></i>');
$(this).html('<i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i>');
$(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(/&amp;/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 ?");

View File

@ -101,9 +101,50 @@
<div class="grid-sizer {{ stylegrid }}" data-idcategory="bookmark"></div>
<div class="grid-gutter-sizer {{ stylegrid }}-gutter-sizer"></div>
{% for bookmark in bookmarks %}
{% if bookmark.item %}
<div class="grid-item {{ stylegrid }}" data-idcategory="bookmark" data-title="{{ bookmark.item.title|lower }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
{% if bookmark.item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if canadd %}
<a style="cursor:pointer" onClick="delBookmark({{ bookmark.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-trash" title="Supprimer des favoris"></i></a>
{% endif %}
{% if bookmark.item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.item.id }}','{{ bookmark.item.url|replace({'#login#': username}) }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" href="{{ bookmark.item.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" href="{{ bookmark.item.url|replace({'#login#': username}) }}" target="{{ bookmark.item.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.item.icon %}
<img class="grid-item-img" src="/{{ alias }}/{{ bookmark.item.icon.label }}">
{% else %}
<img class="grid-item-img" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.item.title }}</h2>
<span>{{ bookmark.item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ bookmark.item.content|raw }}
</div>
</div>
</div>
{%else%}
<div class="grid-item {{ stylegrid }}" data-idcategory="bookmark" data-title="{{ bookmark.title|lower }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
<a style="cursor:pointer" onClick="delBookmark({{ bookmark.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url|replace({'#login#': username}) }}')">
@ -130,11 +171,12 @@
</a>
</div>
</div>
{% endif %}
{% endfor %}
{% if (canadd and access!="config") %}
<div class="grid-item {{ stylegrid }}">
<div onClick="addBookmark({{ entity.id }},false)" class="grid-item-content" style="background-color: #{{color['main']}};cursor:pointer;">
<div onClick="addBookmark({{ entity.id }},true)" class="grid-item-content" style="background-color: #{{color['main']}};cursor:pointer;">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png">

View File

@ -66,9 +66,50 @@
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
{% if bookmark.item %}
<div class="grid-item {{ stylegrid }}" data-idcategory="bookmark" data-title="{{ bookmark.item.title|lower }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
{% if bookmark.item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if canadd %}
<a style="cursor:pointer" onClick="delBookmark({{ bookmark.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-trash" title="Supprimer des favoris"></i></a>
{% endif %}
{% if bookmark.item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.item.id }}','{{ bookmark.item.url|replace({'#login#': username}) }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" href="{{ bookmark.item.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" href="{{ bookmark.item.url|replace({'#login#': username}) }}" target="{{ bookmark.item.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.item.icon %}
<img class="grid-item-img" src="/{{ alias }}/{{ bookmark.item.icon.label }}">
{% else %}
<img class="grid-item-img" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.item.title }}</h2>
<span>{{ bookmark.item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ bookmark.item.content|raw }}
</div>
</div>
</div>
{%else%}
<div class="grid-item {{ stylegrid }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
<a style="cursor:pointer" onClick="delBookmark({{ bookmark.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url|replace({'#login#': username}) }}')">
@ -95,6 +136,7 @@
</a>
</div>
</div>
{%endif%}
{% endfor %}