Merge branch 'master' into dist/envole/6/master

This commit is contained in:
Arnaud Fornerot 2020-06-18 10:59:45 +02:00
commit 3a0c0c1458
11 changed files with 215 additions and 31 deletions

View File

@ -23,3 +23,6 @@ twig:
labelsniveau02: %labelsniveau02% labelsniveau02: %labelsniveau02%
iconniveau02: %iconniveau02% iconniveau02: %iconniveau02%
keyterm: %keyterm% keyterm: %keyterm%
activate_widonlyoffice: %activate_widonlyoffice%
widonlyoffice_url: %widonlyoffice_url%

View File

@ -258,6 +258,16 @@ class PurgeFileCommand extends Command
} }
} }
$directory=$this->container->get('kernel')->getRootDir()."/../web";
$icons=$this->em->getRepository("CadolesPortalBundle:Icon")->findAll();
foreach($icons as $icon) {
if(!$fs->exists($directory."/".$icon->getLabel())) {
$this->writeln($directory."/".$icon->getLabel());
$this->em->remove($icon);
$this->em->flush();
}
}
// /web/uploads/blogarticle // /web/uploads/blogarticle
$this->writelnred(''); $this->writelnred('');
$this->writelnred('== Directory = Blog Article'); $this->writelnred('== Directory = Blog Article');

View File

@ -46,6 +46,7 @@ class ScriptCommand extends Command
$this->filesystem = new Filesystem(); $this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/"; $this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/";
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"visibletrue"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"visibletrue"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = visibletrue"); $this->writelnred("== SCRIPT = visibletrue");

View File

@ -593,9 +593,14 @@ class SynchroCommand extends Command
$attrs["cadolesMember"]=array(); $attrs["cadolesMember"]=array();
foreach($data->getUsers() as $usergroupe) { foreach($data->getUsers() as $usergroupe) {
array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername()); if(!in_array($usergroupe->getUser()->getUsername(), $attrs["memberuid"])) {
array_push($attrs["cadolesMember"],$this->ldap->getUserDN($usergroupe->getUser())); array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername());
$this->writeln(' > '.$usergroupe->getUser()->getUsername()); array_push($attrs["cadolesMember"],$this->ldap->getUserDN($usergroupe->getUser()));
$this->writeln(' > '.$usergroupe->getUser()->getUsername());
}
else {
$this->writelnred(' > EXIST'.$usergroupe->getUser()->getUsername());
}
} }
if(!$simulate) $this->ldap->ldapModify($dn, $attrs); if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
} }

View File

@ -400,15 +400,17 @@ class UserController extends Controller
foreach($lstgroups as $idgroup) { foreach($lstgroups as $idgroup) {
$group=$em->getRepository("CadolesCoreBundle:Group")->find($idgroup); $group=$em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
$key = Uuid::uuid4(); $usergroup=$em->getRepository('CadolesCoreBundle:UserGroup')->findBy(["user"=>$data,"group"=>$group]);
if(!$usergroup) {
$usergroup= new UserGroup(); $key = Uuid::uuid4();
$usergroup->setUser($data); $usergroup= new UserGroup();
$datagroup = $group; $usergroup->setUser($data);
$usergroup->setGroup($datagroup); $datagroup = $group;
$usergroup->setKeyvalue($key); $usergroup->setGroup($datagroup);
$em->persist($usergroup); $usergroup->setKeyvalue($key);
$em->flush(); $em->persist($usergroup);
$em->flush();
}
// Notification message // Notification message
$message="Inscription de l'utilisateur<br>".$data->getLastname()." ".$data->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $message="Inscription de l'utilisateur<br>".$data->getLastname()." ".$data->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();
@ -540,15 +542,18 @@ class UserController extends Controller
foreach($addgroups as $idgroup) { foreach($addgroups as $idgroup) {
$group=$em->getRepository("CadolesCoreBundle:Group")->find($idgroup); $group=$em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
$key = Uuid::uuid4(); $usergroup=$em->getRepository('CadolesCoreBundle:UserGroup')->findBy(["user"=>$data,"group"=>$group]);
if(!$usergroup) {
$key = Uuid::uuid4();
$usergroup= new UserGroup(); $usergroup= new UserGroup();
$usergroup->setUser($data); $usergroup->setUser($data);
$datagroup = $group; $datagroup = $group;
$usergroup->setGroup($datagroup); $usergroup->setGroup($datagroup);
$usergroup->setKeyvalue($key); $usergroup->setKeyvalue($key);
$em->persist($usergroup); $em->persist($usergroup);
$em->flush(); $em->flush();
}
// notification message // notification message
$message="Inscription de l'utilisateur<br>".$data->getLastname()." ".$data->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $message="Inscription de l'utilisateur<br>".$data->getLastname()." ".$data->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();

View File

@ -9,7 +9,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="usergroupe") * @ORM\Table(name="usergroupe",uniqueConstraints={@ORM\UniqueConstraint(columns={"user_id", "group_id"})})
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
* *
* @UniqueEntity(fields={"user", "group"}, message="Cette liaison existe déjà !") * @UniqueEntity(fields={"user", "group"}, message="Cette liaison existe déjà !")

View File

@ -83,6 +83,59 @@ class BlogcommentController extends Controller
]); ]);
} }
public function replyAction(Request $request,$idarticle,$idcomment,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = new Blogcomment();
// Recherche de l'article associé
$blogarticle=$em->getRepository("CadolesPortalBundle:Blogarticle")->find($idarticle);
if($blogarticle) $entity->setBlogarticle($blogarticle);
// Recherche du commentaire parent
$parent=$em->getRepository("CadolesPortalBundle:Blogcomment")->find($idcomment);
if($parent) $entity->setParent($parent);
$entity->setName("Réponse");
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$entity->setUser($this->getUser());
$entity->setSubmit(new \Datetime());
$em->persist($entity);
$em->flush();
foreach($entity->getBlogarticle()->getBlog()->getGroups() as $group) {
if($group->getFgcanshare()) {
$url=$this->generateUrl('cadoles_core_redirect', ['route'=>'cadoles_portal_user_blogarticle_view','id'=>$entity->getBlogarticle()->getId()], UrlGeneratorInterface::ABSOLUTE_URL);
$message="Création commentaire article<br><a href='$url' target='_top'>".$entity->getName()."</a>";
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$key=$usergroup->getKeyvalue();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key,$this->getUser()->getId(),$group->getId(),$message);
}
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getBlogarticle()->getId()]));
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
]);
}
public function updateAction(Request $request, $id,$access="config") public function updateAction(Request $request, $id,$access="config")
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();

View File

@ -56,7 +56,15 @@ class Blogcomment
*/ */
private $blogarticle; private $blogarticle;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Blogcomment", inversedBy="childs")
*/
private $parent;
/**
* @ORM\OneToMany(targetEntity="Cadoles\PortalBundle\Entity\Blogcomment", mappedBy="parent", cascade={"persist"}, orphanRemoval=true)
*/
protected $childs;
/** /**
* Get id * Get id
@ -188,4 +196,69 @@ class Blogcomment
{ {
return $this->blogarticle; return $this->blogarticle;
} }
/**
* Constructor
*/
public function __construct()
{
$this->childs = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Set parent
*
* @param \Cadoles\PortalBundle\Entity\Blogcomment $parent
*
* @return Blogcomment
*/
public function setParent(\Cadoles\PortalBundle\Entity\Blogcomment $parent = null)
{
$this->parent = $parent;
return $this;
}
/**
* Get parent
*
* @return \Cadoles\PortalBundle\Entity\Blogcomment
*/
public function getParent()
{
return $this->parent;
}
/**
* Add child
*
* @param \Cadoles\PortalBundle\Entity\Blogcomment $child
*
* @return Blogcomment
*/
public function addChild(\Cadoles\PortalBundle\Entity\Blogcomment $child)
{
$this->childs[] = $child;
return $this;
}
/**
* Remove child
*
* @param \Cadoles\PortalBundle\Entity\Blogcomment $child
*/
public function removeChild(\Cadoles\PortalBundle\Entity\Blogcomment $child)
{
$this->childs->removeElement($child);
}
/**
* Get childs
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getChilds()
{
return $this->childs;
}
} }

View File

@ -566,6 +566,10 @@ cadoles_portal_config_blogcomment_submit:
path: /config/blogcomment/submit/{idarticle} path: /config/blogcomment/submit/{idarticle}
defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: config} defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: config}
cadoles_portal_config_blogcomment_reply:
path: /config/blogcomment/reply/{idarticle}/{idcomment}
defaults: { _controller: CadolesPortalBundle:Blogcomment:reply, access: config}
cadoles_portal_config_blogcomment_update: cadoles_portal_config_blogcomment_update:
path: /config/blogcomment/update/{id} path: /config/blogcomment/update/{id}
defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: config } defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: config }
@ -583,6 +587,10 @@ cadoles_portal_user_blogcomment_submit:
path: /user/blogcomment/submit/{idarticle} path: /user/blogcomment/submit/{idarticle}
defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: user } defaults: { _controller: CadolesPortalBundle:Blogcomment:submit, access: user }
cadoles_portal_user_blogcomment_reply:
path: /user/blogcomment/reply/{idarticle}/{idcomment}
defaults: { _controller: CadolesPortalBundle:Blogcomment:reply, access: user}
cadoles_portal_user_blogcomment_update: cadoles_portal_user_blogcomment_update:
path: /user/blogcomment/update/{id} path: /user/blogcomment/update/{id}
defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: user } defaults: { _controller: CadolesPortalBundle:Blogcomment:update, access: user }

View File

@ -78,16 +78,37 @@
{% endif %} {% endif %}
{% if not entity.blogcomments is empty %} {% if not entity.blogcomments is empty %}
{% for comment in entity.blogcomments|reverse %} {% for comment in entity.blogcomments|reverse %}
<div class="blogtitle"> {% if comment.parent is empty %}
<legend><h2>{{comment.name}}</h2></legend> <div class="blogtitle">
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small> <legend><h2>{{comment.name}}</h2></legend>
{% if canadd or app.user==comment.user%} <small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a> {% if canadd or app.user==comment.user%}
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
{% endif %}
</div>
<div class="blogbody">
{{ comment.description | raw }}
</div>
<div class="blogreply" style="width:80%; margin:auto">
{% for reply in comment.childs|reverse %}
<div class="blogtitle">
<legend><h2 style="font-size:85%">{{reply.name}}</h2></legend>
<small>publié par {{ reply.user.username }} le {{ reply.submit|date("d/m/Y à H:i") }}</small>
{% if canadd or app.user==reply.user%}
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':reply.id}) }}"><i class="fa fa-file"></i></a>
{% endif %}
</div>
<div class="blogbody" style="font-size:85%">
{{ reply.description | raw }}
</div>
{% endfor %}
</div>
{% if entity.fgcomment %}
<a href="{{path('cadoles_portal_'~access~'_blogcomment_reply',{"idarticle":entity.id,"idcomment":comment.id}) }}" class="btn btn-success">Répondre</a>
{% endif %} {% endif %}
</div> {% endif %}
<div class="blogbody">
{{ comment.description | raw }}
</div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div> </div>

View File

@ -134,6 +134,11 @@
{% block pagewrapper %} {% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div> <div id="pagecontainer" style="margin: 0px -30px;"></div>
{% if activate_widonlyoffice %}
<iframe src="{{ widonlyoffice_url }}/sso/login" style="display:none"></iframe>
{% endif %}
<div id="selwidgetuser" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div id="selwidgetuser" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">