Compare commits

..

No commits in common. "a97ba39dbd752fd78295491afbd390c86b47ca74" and "3e35acb028c70785710e9eb12e36ed29795cce53" have entirely different histories.

10 changed files with 5 additions and 278 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'Interne', 'SIREN'); (-100, 'Interne', 'SIREN');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}o85pP7Lzbqw8J8wr8jlgxl8NFvCcJlve (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}Kvz21GjhkryG4l7EKniMJzVfwDufa+eI
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -1,79 +0,0 @@
<?php
namespace Cadoles\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormError;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Cadoles\CoreBundle\Entity\Mail;
use Cadoles\CoreBundle\Form\MailType;
class MailController extends Controller
{
public function invitationgroupAction($id,Request $request)
{
// Recherche du groupe
$em = $this->getDoctrine()->getManager();
$group = $em->getRepository("CadolesCoreBundle:Group")->find($id);
if (!$group) {
throw $this->createNotFoundException('Unable to find '.$this->labeldata);
}
// Création du formulaire
$form = $this->createForm(MailType::class);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sujet
$subject = $this->get('session')->get('appname')." : Invitation au groupe de travail ".$group->getLabel();
// Sujet
$url = $this->generateUrl('cadoles_core_registration',[], UrlGeneratorInterface::ABSOLUTE_URL)."?group=".$group->getId();
$message = "Bonjour,<br><br>Vous êtes invité à participer au groupe de travail = <b>".$group->getLabel()."</b><br><br>";
$message.= "Pour cela vous devez vous inscrire sur <b>".$this->get('session')->get('appname')."</b> en suivant le lien suivant<br>";
$message.= "<a href='$url'>$url</a><br><br>";
$message.= "Une foi le processus d'inscription complété, vous serez automatiquement rattaché à notre groupe de travail<br><br>";
$message.= "Cordialement<br>";
$message.= $this->getUser()->getFirstname()." ".$this->getUser()->getLastname();
// To close ?
$closed = false;
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$closed = true;
$destinataires=$form->get("destinataire")->getData();
$to=explode(";",$destinataires);
$text=$form->get("message")->getData();
$subject=$form->get("subject")->getData();
$template="template";
$mail_params=array(
"subject" => $subject,
"body_html"=>nl2br($text),
"body_text"=>$text
);
$from = $this->getUser()->getEmail();
$fromName = $this->getUser()->getFirstname()." ".$this->getUser()->getLastname();
$message = $this->container->get('cadoles.core.service.mail');
$message->sendEmail($template, $mail_params, $to, $from, $fromName);
}
return $this->render('CadolesCoreBundle:Mail:mail.html.twig',[
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'closed' => $closed,
'subject' => $subject,
'message' => $message,
'form' => $form->createView()
]);
}
}

View File

@ -13,7 +13,6 @@ use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Cadoles\CoreBundle\Entity\User; use Cadoles\CoreBundle\Entity\User;
use Cadoles\CoreBundle\Entity\Usergroup;
use Cadoles\CoreBundle\Entity\Registration; use Cadoles\CoreBundle\Entity\Registration;
use Cadoles\CoreBundle\Form\RegistrationType; use Cadoles\CoreBundle\Form\RegistrationType;
use Cadoles\CoreBundle\Form\UserType; use Cadoles\CoreBundle\Form\UserType;
@ -177,8 +176,6 @@ class RegistrationController extends Controller
$moderegistration = $this->getParameter('moderegistration'); $moderegistration = $this->getParameter('moderegistration');
$masteridentity = $this->getParameter('masteridentity'); $masteridentity = $this->getParameter('masteridentity');
$groupid = $request->query->get('group');
if($moderegistration=="none"||$masteridentity!="SQL") if($moderegistration=="none"||$masteridentity!="SQL")
throw $this->createNotFoundException('Permission denied'); throw $this->createNotFoundException('Permission denied');
@ -203,9 +200,6 @@ class RegistrationController extends Controller
$data = $form->getData(); $data = $form->getData();
// On enregistre l'invitation à un groupe dans l'inscription
$data->setGroupid($groupid);
$appname = $this->get('session')->get('appname'); $appname = $this->get('session')->get('appname');
$noreply = $this->getParameter('noreply'); $noreply = $this->getParameter('noreply');
$keyterm = $this->getParameter('keyterm'); $keyterm = $this->getParameter('keyterm');
@ -512,31 +506,11 @@ class RegistrationController extends Controller
$user->setAuthlevel("simple"); $user->setAuthlevel("simple");
$user->setBelongingpopulation("agent"); $user->setBelongingpopulation("agent");
// Sauvegarde // Sauvegarde
$em->persist($user); $em->persist($user);
$em->flush(); $em->flush();
// Si invitation à un groupe : on le rattache directement à ce groupe
$groupid=$data[0]->getGroupid();
$userid=$user->getId();
if($groupid) {
$group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid);
if($group) {
$key = Uuid::uuid4();
$usergroup=new Usergroup;
$user=$em->getRepository("CadolesCoreBundle:User")->find($userid);
$usergroup->setUser($user);
$usergroup->setGroup($group);
$usergroup->setKeyvalue($key);
$em->persist($usergroup);
$em->flush();
// Notification message
$message="Inscription de l'utilisateur<br>".$user->getLastname()." ".$user->getFirstname()."<br>Inscription via inviation";
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key->toString(),$userid,$groupid,$message);
}
}
$em->remove($data[0]); $em->remove($data[0]);
$em->flush(); $em->flush();
} }

View File

@ -123,11 +123,6 @@ class Registration implements UserInterface, \Serializable
*/ */
private $position; private $position;
/**
* @ORM\Column(type="integer", length=60, nullable=true)
*/
private $groupid;
/** /**
* @ORM\ManyToOne(targetEntity="Country", inversedBy="registrations") * @ORM\ManyToOne(targetEntity="Country", inversedBy="registrations")
* @ORM\JoinColumn(nullable=true) * @ORM\JoinColumn(nullable=true)
@ -714,28 +709,4 @@ class Registration implements UserInterface, \Serializable
{ {
return $this->niveau02; return $this->niveau02;
} }
/**
* Set groupid
*
* @param integer $groupid
*
* @return Registration
*/
public function setGroupid($groupid)
{
$this->groupid = $groupid;
return $this;
}
/**
* Get groupid
*
* @return integer
*/
public function getGroupid()
{
return $this->groupid;
}
} }

View File

@ -1,63 +0,0 @@
<?php
namespace Cadoles\CoreBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class MailType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, array(
"label" => "Envoyer l'inviation",
"attr" => array("class" => "btn btn-success")
)
);
$builder->add('destinataire',
TextType::class, array(
"label" =>"Destinataires",
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"mapped" => false
)
);
$builder->add('subject',
TextType::class, array(
"label" =>"Sujet",
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"mapped" => false
)
);
$builder
->add("message",CKEditorType::class,[
'config_name' => 'small_config',
'label' => "Message",
'mapped'=> false,
'required' => false,
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px"),
'config' => ["height" => "150px",'filebrowserUploadRoute' => 'cadoles_portal_user_pagewidget_upload']
]);
}
public function configureOptions(OptionsResolver $resolver)
{
}
}

View File

@ -132,12 +132,6 @@ cadoles_core_config:
defaults: { _controller: CadolesCoreBundle:Config:home } defaults: { _controller: CadolesCoreBundle:Config:home }
#== Mail =================================================================================================================
cadoles_core_mail_invitationgroup:
path: /user/mail/invitationgroup/{id}
defaults: { _controller: CadolesCoreBundle:Mail:invitationgroup }
#== Commun Config Commun ================================================================================================= #== Commun Config Commun =================================================================================================
cadoles_core_config_commun: cadoles_core_config_commun:
path: /config/commun path: /config/commun

View File

@ -4,9 +4,6 @@
<h1 class="page-header">Gestion des Utilisateurs</h1> <h1 class="page-header">Gestion des Utilisateurs</h1>
<h2>Groupe = {{ group.label }}</h2> <h2>Groupe = {{ group.label }}</h2>
<a class="btn btn-default" href={{ path('cadoles_core_'~access~'_group') }}>Fermer</a> <a class="btn btn-default" href={{ path('cadoles_core_'~access~'_group') }}>Fermer</a>
{% if moderegistration!="none" and masteridentity=="SQL"%}
<a class="btn btn-primary" style="cursor:pointer" onClick="showMail();">Inviter des personnes non inscrites</a>
{%endif%}
<br><br> <br><br>
<div class="col-sm-6"> <div class="col-sm-6">
@ -152,11 +149,4 @@
} }
}); });
} }
function showMail() {
$("#mymodal").find(".modal-title").html("INVITATION");
var url="{{ path('cadoles_core_mail_invitationgroup',{id:group.id}) }}";
$("#mymodal").find("#framemodal").attr("src",url);
$("#mymodal").modal().show();
}
{% endblock %} {% endblock %}

View File

@ -1,54 +0,0 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
{{ form_widget(form.submit) }} <a class="btn btn-default" onClick="closeModal()">Annuler</a>
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{{ form_row(form.destinataire) }}
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Séparer les adresses mails par des ;
</div>
{{ form_row(form.subject) }}
{{ form_row(form.message) }}
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
{% if closed %}
closeModal();
{% else %}
$("#mail_subject").val("{{ subject }}");
$("#mail_message").val("{{ message | raw }}");
$("#mail_destinataire").focus();
{% endif %}
});
function closeModal() {
window.parent.$("#mymodal").modal('hide');;
}
{% endblock %}

View File

@ -133,7 +133,7 @@ class Widget
* @var ArrayCollection $pagewidgets * @var ArrayCollection $pagewidgets
* @var Order * @var Order
* *
* @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="widget", cascade={"persist"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="widget", cascade={"persist"}, orphanRemoval=false)
*/ */
private $pagewidgets; private $pagewidgets;

View File

@ -219,6 +219,7 @@
{% block localjavascript %} {% block localjavascript %}
var idpage; var idpage;
$('document').ready(function(){ $('document').ready(function(){
{% for page in pagesadmin %} {% for page in pagesadmin %}
{% if page.id==entity.id %} {% if page.id==entity.id %}
@ -240,7 +241,6 @@
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
// Rendre les pages user déplacable // Rendre les pages user déplacable
$("#pagesuser").sortable({ $("#pagesuser").sortable({
axis: "x", axis: "x",
@ -369,8 +369,6 @@
// Sauvegarder la page en cours // Sauvegarder la page en cours
idpage=id; idpage=id;
// Cacher toutes les pages // Cacher toutes les pages
$(".pageframereload").remove(); $(".pageframereload").remove();
$(".pageframe").hide(); $(".pageframe").hide();
@ -384,10 +382,6 @@
url=url.replace('yy',usage); url=url.replace('yy',usage);
url=url.replace('zz',groupid); url=url.replace('zz',groupid);
passurl="{{ path('cadoles_core_home',{id:'xx'}) }}";
passurl=passurl.replace('xx',id);
history.pushState('data to be passed', 'Title of the page', passurl);
// Si force le rechargement et frame existante on la détruit // Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#page-"+id).length) if(forcereload&&$("#page-"+id).length)
$("#page-"+id).remove(); $("#page-"+id).remove();