14 Commits

69 changed files with 1232 additions and 209 deletions

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
7

24
debian/control vendored Normal file
View File

@ -0,0 +1,24 @@
Source: eole-ninegate
Section: web
Priority: optional
Maintainer: Equipe Envole <eole@ac-dijon.fr>
Build-Depends: debhelper (>= 7.0.50)
Standards-Version: 3.8.4
Homepage: http://eole.orion.education.fr/diff/
Vcs-Git: http://dev-eole.ac-dijon.fr/git/ninegate
Vcs-Browser: http://dev-eole.ac-dijon.fr/projects/ninegate/repository
Package: ninegate-sso
Architecture: all
Depends: ${misc:Depends}, eole-sso
Description: Filtre SSO pour ninegate "EOLE".
Package: eole-ninegate
Architecture: all
Depends: ${misc:Depends}, eole-web (>= 2.6.1), ninegate-sso, eole-db, eole-client-annuaire, eole-sondepiwik, eole-posh-profil, eole-envole-themes
Description: Eolisation de l'application ninegate.
Package: ninegate-apps
Architecture: all
Depends: ${misc:Depends}, eole-web-pkg (>= 2.6.1), eole-client-annuaire-pkg, sondepiwik-apps, posh-profil-apps, composer, php-zip, php-mbstring
Description: Sources pour ninegate "EOLE".

44
debian/copyright vendored Normal file
View File

@ -0,0 +1,44 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: {PROJECT}
Source: {URL}
Files: *
Copyright: YEAR {UPSTREAM} {AUTHOR} <{MAIL}>
License: {UPSTREAM LICENSE}
Files: debian/*
Copyright: 2012 Équipe EOLE <eole@ac-dijon.fr>
License: CeCILL-2
License: {UPSTREAM LICENSE}
{TEXT OF THE LICENSE}
License: CeCILL-2
This software is governed by the CeCILL-2 license under French law and
abiding by the rules of distribution of free software. You can use,
modify and or redistribute the software under the terms of the CeCILL-2
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info";.
.
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-2 license and that you accept its terms.
.
On Eole systems, the complete text of the CeCILL-2 License can be found
in '/usr/share/common-licenses/CeCILL-2-en'.

1
debian/eole-ninegate.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/eole

3
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,3 @@
# Set per distribution debian tag
[DEFAULT]
debian-tag = debian/envole/%(version)s

1
debian/ninegate-apps.install vendored Normal file
View File

@ -0,0 +1 @@
var/www/html

1
debian/ninegate-sso.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/sso

8
debian/rules vendored Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -62,8 +62,8 @@
<variable type='string' name='ninegate_niveau01name' description="Nom de la première orgranisation de Niveau 01 (idem valeur Cadoles ldap)" mandatory='True'><value>cadoles</value></variable> <variable type='string' name='ninegate_niveau01name' description="Nom de la première orgranisation de Niveau 01 (idem valeur Cadoles ldap)" mandatory='True'><value>cadoles</value></variable>
<variable type='string' name='ninegate_niveau01siren' description="SIREN de la première orgranisation de Niveau 01 (idem valeur Cadoles ldap)" mandatory='True'><value>cadoles</value></variable> <variable type='string' name='ninegate_niveau01siren' description="SIREN de la première orgranisation de Niveau 01 (idem valeur Cadoles ldap)" mandatory='True'><value>cadoles</value></variable>
<variable type='string' name='ninegate_niveau01label' description="Label singulier du niveau 01 d'organisation" mandatory='True'><value>Département</value></variable> <variable type='string' name='ninegate_niveau01label' description="Label singulier du niveau 01 d'organisation" mandatory='True'><value>Ecole</value></variable>
<variable type='string' name='ninegate_niveau01labels' description="Label pluriel du niveau 01 d'organisation" mandatory='True'><value>Départements</value></variable> <variable type='string' name='ninegate_niveau01labels' description="Label pluriel du niveau 01 d'organisation" mandatory='True'><value>Ecoles</value></variable>
<variable type='string' name='ninegate_niveau01icon' description="Icon du niveau 01 d'organisation" mandatory='True'><value>fa-building</value></variable> <variable type='string' name='ninegate_niveau01icon' description="Icon du niveau 01 d'organisation" mandatory='True'><value>fa-building</value></variable>
<variable type='oui/non' name='ninegate_niveau02view' description="Gérer un niveau 02 d'organisation"><value>non</value></variable> <variable type='oui/non' name='ninegate_niveau02view' description="Gérer un niveau 02 d'organisation"><value>non</value></variable>

View File

@ -154,7 +154,7 @@ ivory_ck_editor:
language: fr language: fr
toolbar: "my_toolbar_1" toolbar: "my_toolbar_1"
uiColor: "#ffffff" uiColor: "#ffffff"
extraPlugins: ["html5video","pastebase64"] extraPlugins: ["html5video"]
light_config: light_config:
language: fr language: fr
toolbar: "my_toolbar_2" toolbar: "my_toolbar_2"

View File

@ -22,6 +22,7 @@ composer install
./perm.sh www-data ./perm.sh www-data
# Nettoyage du cache # Nettoyage du cache
rm /var/www/html/ninegate/var/cache/* -rf
php bin/console cache:clear --env=prod --no-debug php bin/console cache:clear --env=prod --no-debug
# Migration si nécessaire du schéma de la base # Migration si nécessaire du schéma de la base
@ -55,13 +56,5 @@ fi
# Server Websocket # Server Websocket
if [[ "$ninegate_websocket" = 'oui' ]] if [[ "$ninegate_websocket" = 'oui' ]]
then then
echo "" /var/www/html/ninegate/scripts/ninegate-websocket.sh
echo WEBSOCKET = STOP
pid="$(pgrep -f gos:websocket)"
if [ -n "${pid}" ]; then
kill -9 ${pid};
fi
echo WEBSOCKET = START
bin/console gos:websocket:server --port $websocket_portinterne -a $websocket_url --no-debug -n -q --env=prod & disown
fi fi

View File

@ -3,11 +3,24 @@ websocket_url=$(CreoleGet adresse_ip_eth0 non)
websocket_portinterne=$(CreoleGet ninegate_websocket_portinterne non) websocket_portinterne=$(CreoleGet ninegate_websocket_portinterne non)
# Server Websocket # Server Websocket
echo WEBSOCKET = STOP if [[ "$1" != "restartifdown" ]]; then
pid="$(pgrep -f gos:websocket)" echo WEBSOCKET = STOP
if [ -n "${pid}" ]; then pid="$(pgrep -a -f gos:websocket | grep $websocket_portinterne)"
kill -9 ${pid}; if [ -n "${pid}" ]; then
IFS=' ' read -r -a array <<< "$pid"
kill -9 ${array[0]};
fi
fi fi
echo WEBSOCKET = START # Port LISTEN ?
bin/console gos:websocket:server --port $websocket_portinterne -a $websocket_url --no-debug -n -q --env=prod & disown pid="$(pgrep -a -f gos:websocket | grep $websocket_portinterne)"
restart="yes"
if [ "$1" == "restartifdown" ] && [ -n "${pid}" ] ; then
restart="no"
fi
if [[ "$restart" == "yes" ]]; then
echo WEBSOCKET = START
cd /var/www/html/ninegate
bin/console gos:websocket:server --port $websocket_portinterne -a $websocket_url --no-debug -n -q --env=prod & disown
fi

View File

@ -16,6 +16,11 @@ use Cadoles\CoreBundle\Entity\Niveau02;
use Cadoles\CoreBundle\Entity\User; use Cadoles\CoreBundle\Entity\User;
use Cadoles\CoreBundle\Entity\Group; use Cadoles\CoreBundle\Entity\Group;
use Cadoles\CoreBundle\Entity\UserGroup; use Cadoles\CoreBundle\Entity\UserGroup;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
global $bdd01; global $bdd01;
global $config; global $config;
@ -28,6 +33,8 @@ class SynchroCommand extends Command
private $output; private $output;
private $filesystem; private $filesystem;
private $rootlog; private $rootlog;
private $ldap;
private $ldap_basedn;
protected function configure() protected function configure()
{ {
@ -76,8 +83,9 @@ class SynchroCommand extends Command
$this->writeln('== SYNCHONISATION ANNUAIRE =========================='); $this->writeln('== SYNCHONISATION ANNUAIRE ==========================');
$this->writeln('====================================================='); $this->writeln('=====================================================');
$ldap = $this->container->get('cadoles.core.service.ldap'); $this->ldap = $this->container->get('cadoles.core.service.ldap');
if(!$ldap->isEnabled()) {
if(!$this->ldap->isEnabled()) {
if($masteridentity =="LDAP") { if($masteridentity =="LDAP") {
$this->writeln(''); $this->writeln('');
$this->writeln('====================================================='); $this->writeln('=====================================================');
@ -85,7 +93,7 @@ class SynchroCommand extends Command
$this->writeln('====================================================='); $this->writeln('=====================================================');
$ldap_basedn = $this->container->getParameter('ldap_basedn'); $this->ldap_basedn = $this->container->getParameter('ldap_basedn');
$ldap_template = $this->container->getParameter('ldap_template'); $ldap_template = $this->container->getParameter('ldap_template');
$ldap_username = $this->container->getParameter('ldap_username'); $ldap_username = $this->container->getParameter('ldap_username');
$ldap_firstname = $this->container->getParameter('ldap_firstname'); $ldap_firstname = $this->container->getParameter('ldap_firstname');
@ -126,7 +134,7 @@ class SynchroCommand extends Command
$this->writeln(''); $this->writeln('');
$this->writeln('== CLASSES =========================================='); $this->writeln('== CLASSES ==========================================');
$results = $ldap->search("type=Classe", ['cn','description','gidNumber'], $ldap_basedn); $results = $this->ldap->search("type=Classe", ['cn','description','gidNumber'], $this->ldap_basedn);
foreach($results as $result) { foreach($results as $result) {
$cn=$result["cn"]; $cn=$result["cn"];
$ldapfilter="(|(&(type=Classe)(cn=$cn))(&(type=Equipe)(cn=profs-$cn))(&(ENTPersonProfils=Administratif)(divcod=$cn)))"; $ldapfilter="(|(&(type=Classe)(cn=$cn))(&(type=Equipe)(cn=profs-$cn))(&(ENTPersonProfils=Administratif)(divcod=$cn)))";
@ -155,7 +163,7 @@ class SynchroCommand extends Command
// On execute le filtre d'appartenance à ce niveau // On execute le filtre d'appartenance à ce niveau
$this->writeln("== Récupération des utilisateurs de l'annuaire"); $this->writeln("== Récupération des utilisateurs de l'annuaire");
$niveau01=$this->em->getRepository('CadolesCoreBundle:Niveau01')->find($data["id"]); $niveau01=$this->em->getRepository('CadolesCoreBundle:Niveau01')->find($data["id"]);
$results = $ldap->search($niveau01->getLdapfilter(), $fieldstoread, $ldap_basedn); $results = $this->ldap->search($niveau01->getLdapfilter(), $fieldstoread, $this->ldap_basedn);
$nbuserstotal=count($results); $nbuserstotal=count($results);
// Pour chaque utilisateur ldap // Pour chaque utilisateur ldap
@ -247,7 +255,8 @@ class SynchroCommand extends Command
$this->writeln('== '.$group->getLabel()); $this->writeln('== '.$group->getLabel());
if(!is_null($ldapfilter)) { if(!is_null($ldapfilter)) {
$results = $ldap->search($ldapfilter,[$ldap_username,"memberuid"] , $ldap_basedn); $results = $this->ldap->search($ldapfilter,[$ldap_username,"memberuid"] , $this->ldap_basedn);
foreach($results as $result) { foreach($results as $result) {
if(isset($result["memberuid"])) { if(isset($result["memberuid"])) {
// Si memberid est un tableau il y a plusieur user dedans // Si memberid est un tableau il y a plusieur user dedans
@ -333,7 +342,7 @@ class SynchroCommand extends Command
} }
else { else {
//on peut unset les recherches suivantes seront plus rapide //on peut unset les recherches suivantes seront plus rapide
unset($flipped[$user->getUsername()]); unset($flipped[$data["username"]]);
} }
$this->em->clear(); $this->em->clear();
@ -360,17 +369,17 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseNiveau01; $subbranch=$baseNiveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getLabel()); $this->writeln(' - Modification dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->modifyNiveau01($data,$data->getLabel()); if(!$simulate) $this->ldap->modifyNiveau01($data,$data->getLabel());
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getLabel()); $this->writeln(' - Création dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->addNiveau01($data); if(!$simulate) $this->ldap->addNiveau01($data);
} }
} }
@ -387,17 +396,17 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseNiveau02; $subbranch=$baseNiveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getLabel()); $this->writeln(' - Modification dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->modifyNiveau02($data,$data->getLabel()); if(!$simulate) $this->ldap->modifyNiveau02($data,$data->getLabel());
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getLabel()); $this->writeln(' - Création dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->addNiveau02($data); if(!$simulate) $this->ldap->addNiveau02($data);
} }
} }
@ -414,17 +423,17 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseGroup; $subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getLabel()); $this->writeln(' - Modification dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->modifyGroup($data,$data->getLabel()); if(!$simulate) $this->ldap->modifyGroup($data,$data->getLabel());
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getLabel()); $this->writeln(' - Création dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->addGroup($data); if(!$simulate) $this->ldap->addGroup($data);
} }
} }
@ -441,7 +450,7 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(uid='.$data->getUsername().')'; $criteria = '(uid='.$data->getUsername().')';
$subbranch=$baseUser; $subbranch=$baseUser;
$results = $ldap->search($criteria, array('uid'), $subbranch); $results = $this->ldap->search($criteria, array('uid'), $subbranch);
// S'assurer que SIREN correspond au Niveau01 // S'assurer que SIREN correspond au Niveau01
if($data->getNiveau01()->getSiren()!=$data->getSiren()) { if($data->getNiveau01()->getSiren()!=$data->getSiren()) {
@ -458,16 +467,16 @@ class SynchroCommand extends Command
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getUsername()); $this->writeln(' - Modification dans annuaire >> '.$data->getUsername());
if(!$simulate) $ldap->modifyUser($data); if(!$simulate) $this->ldap->modifyUser($data);
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getUsername()); $this->writeln(' - Création dans annuaire >> '.$data->getUsername());
if(!$simulate) $ldap->addUser($data); if(!$simulate) $this->ldap->addUser($data);
} }
// Rattachement à Niveau01 et Niveau02 // Rattachement à Niveau01 et Niveau02
if(!$simulate) $ldap->addGroupUser($data); if(!$simulate) $this->ldap->addGroupUser($data);
} }
$this->writeln(''); $this->writeln('');
@ -483,21 +492,21 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau01; $subbranch=$baseniveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes // Mise à jour des membres du groupes
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel()); $this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau01DN($data->getLabel()); $dn=$this->ldap->getNiveau01DN($data->getLabel());
$attrs["memberuid"]=array(); $attrs["memberuid"]=array();
$attrs["cadolesMember"]=array(); $attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) { foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername()); array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01)); array_push($attrs["cadolesMember"],$this->ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername()); $this->writeln(' > '.$userniveau01->getUsername());
} }
if(!$simulate) $ldap->ldapModify($dn, $attrs); if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
} }
} }
@ -514,21 +523,21 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau02; $subbranch=$baseniveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes // Mise à jour des membres du groupes
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel()); $this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau02DN($data->getLabel()); $dn=$this->ldap->getNiveau02DN($data->getLabel());
$attrs["memberuid"]=array(); $attrs["memberuid"]=array();
$attrs["cadolesMember"]=array(); $attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) { foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername()); array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01)); array_push($attrs["cadolesMember"],$this->ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername()); $this->writeln(' > '.$userniveau01->getUsername());
} }
if(!$simulate) $ldap->ldapModify($dn, $attrs); if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
} }
} }
@ -546,21 +555,21 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseGroup; $subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes // Mise à jour des membres du groupes
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel()); $this->writeln(' - '.$data->getLabel());
$dn=$ldap->getGroupDN($data->getLabel()); $dn=$this->ldap->getGroupDN($data->getLabel());
$attrs["memberuid"]=array(); $attrs["memberuid"]=array();
$attrs["cadolesMember"]=array(); $attrs["cadolesMember"]=array();
foreach($data->getUsers() as $usergroupe) { foreach($data->getUsers() as $usergroupe) {
array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername()); array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($usergroupe->getUser())); array_push($attrs["cadolesMember"],$this->ldap->getUserDN($usergroupe->getUser()));
$this->writeln(' > '.$usergroupe->getUser()->getUsername()); $this->writeln(' > '.$usergroupe->getUser()->getUsername());
} }
if(!$simulate) $ldap->ldapModify($dn, $attrs); if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
} }
} }
@ -576,14 +585,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseNiveau01; $subbranch=$baseNiveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' => $result["cn"])); $data = $this->em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getNiveau01DN($result["cn"]); $dn=$this->ldap->getNiveau01DN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
@ -593,14 +602,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseNiveau02; $subbranch=$baseNiveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' => $result["cn"])); $data = $this->em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getNiveau02DN($result["cn"]); $dn=$this->ldap->getNiveau02DN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
@ -611,14 +620,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseGroup; $subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->search($criteria, array('cn'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' => $result["cn"])); $data = $this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getGroupDN($result["cn"]); $dn=$this->ldap->getGroupDN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
@ -628,14 +637,14 @@ class SynchroCommand extends Command
$criteria = '(uid=*)'; $criteria = '(uid=*)';
$subbranch=$baseUser; $subbranch=$baseUser;
$results = $ldap->search($criteria, array('uid'), $subbranch); $results = $this->ldap->search($criteria, array('uid'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:User')->findBy(array('username' => $result["uid"])); $data = $this->em->getRepository('CadolesCoreBundle:User')->findBy(array('username' => $result["uid"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["uid"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["uid"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["uid"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["uid"]);
$dn='uid='.$result["uid"].','.$baseUser; $dn='uid='.$result["uid"].','.$baseUser;
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
} }
@ -654,14 +663,14 @@ class SynchroCommand extends Command
} }
protected function addmodGroup($label,$ldapfilter,$fgcanshare) { protected function addmodGroup($label,$ldapfilter,$fgcanshare) {
$portal_activate = $this->container->getParameter('portal_activate');
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label)); $group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
if(!$group) { if(!$group) {
$group=new Group(); $group=new Group();
$group->setFgcanshare($fgcanshare); $group->setFgcanshare($fgcanshare);
$group->setFgcancreatepage(true); $group->setFgcancreatepage(false);
$group->setFgcancreateblog(true); $group->setFgcancreateblog(false);
$group->setFgcancreatecalendar(true); $group->setFgcancreatecalendar(false);
} }
$group->setLabel($label); $group->setLabel($label);
@ -669,9 +678,53 @@ class SynchroCommand extends Command
$group->setFgall(false); $group->setFgall(false);
$group->setLdapfilter($ldapfilter); $group->setLdapfilter($ldapfilter);
$group->setFgtemplate(true); $group->setFgtemplate(true);
if($portal_activate) {
$pagetemplate=$this->em->getRepository("CadolesPortalBundle:Page")->find(-110);
if($pagetemplate) $group->setPagetemplate($pagetemplate);
}
$this->em->persist($group); $this->em->persist($group);
$this->em->flush(); $this->em->flush();
if($fgcanshare && $portal_activate) {
// On regarde s'il a au moins une page
if($group->getPages()->isEmpty()) {
$page=$this->em->getRepository("CadolesPortalBundle:Page")->clonePage(null,$group->getPagetemplate());
$group->addPage($page);
$page->setName($group->getLabel());
$this->em->persist($page);
$this->em->persist($group);
$this->em->flush();
}
// On regarde s'il a au moins un calendrier
if($group->getCalendars()->isEmpty()) {
$calendar=new Calendar();
$key = Uuid::uuid4();
$calendar->setName($group->getLabel());
$calendar->setKeyvalue($key);
$calendar->addGroup($group);
$calendar->setColor($group->getColor());
$calendar->setType(0);
$this->em->persist($calendar);
$this->em->flush();
}
// On regarde s'il a au moins un blog
if($group->getBlogs()->isEmpty()) {
$blog=new Blog();
$blog->setName($group->getLabel());
$blog->addGroup($group);
$this->em->persist($blog);
$this->em->flush();
}
}
} }
protected function addtoGroup($user,$group) { protected function addtoGroup($user,$group) {
@ -680,10 +733,18 @@ class SynchroCommand extends Command
$member= new UserGroup(); $member= new UserGroup();
$member->setGroup($group); $member->setGroup($group);
$member->setUser($user); $member->setUser($user);
}
// Si modèle scribe
$ldap_template = $this->container->getParameter('ldap_template');
if($ldap_template=="scribe") {
$ldapfilter="(|(&(uid=".$user->getUsername().")(ENTPersonProfils=enseignant))(&(uid=".$user->getUsername().")(typeadmin=0))(&(uid=".$user->getUsername().")(typeadmin=2)))";
$results = $this->ldap->search($ldapfilter, ['uid'], $this->ldap_basedn);
if($results) $member->setFgmanager(true);
}
$this->em->persist($member); $this->em->persist($member);
$this->em->flush(); $this->em->flush();
}
} }
protected function addUser($niveau01,$username,$firstname,$lastname,$email,$usersadmin) { protected function addUser($niveau01,$username,$firstname,$lastname,$email,$usersadmin) {
@ -702,9 +763,18 @@ class SynchroCommand extends Command
if(in_array($username,$usersadmin)) if(in_array($username,$usersadmin))
$user->setRole("ROLE_ADMIN"); $user->setRole("ROLE_ADMIN");
else else {
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
// Si modèle scribe
$ldap_template = $this->container->getParameter('ldap_template');
if($ldap_template=="scribe") {
$ldapfilter="(|(&(uid=".$user->getUsername().")(ENTPersonProfils=enseignant))(&(uid=".$user->getUsername().")(typeadmin=0))(&(uid=".$user->getUsername().")(typeadmin=2)))";
$results = $this->ldap->search($ldapfilter, ['uid'], $this->ldap_basedn);
if($results) $user->setRole("ROLE_ANIM");
}
}
$this->em->persist($user); $this->em->persist($user);
$this->em->flush(); $this->em->flush();
} }

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107'); (-100, 'DRAAF', '130007107');
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}30Z8NQIFHi2TUxnZr8sENMbBiOWgonju (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}kiCU5m1uSvZhdgI1Ga9gdq/8HUBjSIpX
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -509,10 +509,28 @@ class GroupController extends Controller
$em->persist($usergroup); $em->persist($usergroup);
$em->flush(); $em->flush();
// Notification message
$user=$em->getRepository("CadolesCoreBundle:User")->find($userid); $user=$em->getRepository("CadolesCoreBundle:User")->find($userid);
$message="Inscription de l'utilisateur<br>".$user->getLastname()." ".$user->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $message="Inscription de l'utilisateur<br>".$user->getLastname()." ".$user->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key->toString(),$userid,$groupid,$message); $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 = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json'); $response->headers->set('Content-Type', 'application/json');
return $response; return $response;
@ -535,15 +553,36 @@ class GroupController extends Controller
if($group->getFgAll()||$group->getFgTemplate()) if($group->getFgAll()||$group->getFgTemplate())
throw $this->createNotFoundException('Permission denied'); throw $this->createNotFoundException('Permission denied');
// Notification message
$data = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$userid,"group"=>$groupid)); $data = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$userid,"group"=>$groupid));
$user=$em->getRepository("CadolesCoreBundle:User")->find($userid); $user=$em->getRepository("CadolesCoreBundle:User")->find($userid);
$message="Désinscription de l'utilisateur<br>".$user->getLastname()." ".$user->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();; $message="Désinscription de l'utilisateur<br>".$user->getLastname()." ".$user->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();;
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($data->getKeyvalue(),$userid,$groupid,$message); $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($data->getKeyvalue(),$userid,$groupid,$message);
// Desinscription
$em->remove($data); $em->remove($data);
$em->flush(); $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 = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json'); $response->headers->set('Content-Type', 'application/json');
@ -557,14 +596,39 @@ class GroupController extends Controller
if($group->getFgAll()||$group->getFgTemplate()) if($group->getFgAll()||$group->getFgTemplate())
throw $this->createNotFoundException('Permission denied'); throw $this->createNotFoundException('Permission denied');
// Notification message
$usergroup = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$this->getUser(),"group"=>$id)); $usergroup = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$this->getUser(),"group"=>$id));
$user=$em->getRepository("CadolesCoreBundle:User")->find($this->getUser()); $user=$em->getRepository("CadolesCoreBundle:User")->find($this->getUser());
$message="Désinscription de l'utilisateur<br>".$user->getLastname()." ".$user->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();; $message="Désinscription de l'utilisateur<br>".$user->getLastname()." ".$user->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();;
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($usergroup->getKeyvalue(),$this->getUser()->getId(),$id,$message); $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($usergroup->getKeyvalue(),$this->getUser()->getId(),$id,$message);
// Desinscription
$em->remove($usergroup); $em->remove($usergroup);
$em->flush(); $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")); return $this->redirect($this->generateUrl("cadoles_core_user_group"));
} }

View File

@ -298,10 +298,7 @@ class UserController extends Controller
$data->setVisible(true); $data->setVisible(true);
$data->setBelongingpopulation("authlevel"); $data->setBelongingpopulation("authlevel");
$data->setAuthlevel("simple"); $data->setAuthlevel("simple");
$fields=$this->getDefaultDatauser();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Création du formulaire // Création du formulaire
$form = $this->createForm(UserType::class,$data,array( $form = $this->createForm(UserType::class,$data,array(
@ -351,8 +348,25 @@ class UserController extends Controller
$em->persist($usergroup); $em->persist($usergroup);
$em->flush(); $em->flush();
// 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();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key->toString(),$iduser,$idgroup,$message); $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 // Ajout des modos
@ -393,9 +407,7 @@ class UserController extends Controller
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$oldpassword=$data->getPassword(); $oldpassword=$data->getPassword();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser"); $fields=$this->getDefaultDatauser();
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste // Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste
if($this->isGranted('ROLE_MODO')&&$access=="config") { if($this->isGranted('ROLE_MODO')&&$access=="config") {
@ -476,8 +488,25 @@ class UserController extends Controller
$em->persist($usergroup); $em->persist($usergroup);
$em->flush(); $em->flush();
// 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();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key->toString(),$id,$idgroup,$message); $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 // Suppression des groupes obsolètes
@ -494,11 +523,34 @@ class UserController extends Controller
->getQuery() ->getQuery()
->getResult(); ->getResult();
foreach($usergroups as $usergroup) { foreach($usergroups as $usergroup) {
// Notification message
$message="Désinscription de l'utilisateur<br>".$data->getLastname()." ".$data->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname(); $message="Désinscription de l'utilisateur<br>".$data->getLastname()." ".$data->getFirstname()."<br>Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();
$websocket = $this->container->get('cadoles.websocket.pushmessage')->send($usergroup->getKeyvalue(),$id,$idgroup,$message); $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($usergroup->getKeyvalue(),$id,$idgroup,$message);
// Déscription
$em->remove($usergroup); $em->remove($usergroup);
$em->flush(); $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);
}
} }
} }
@ -568,9 +620,7 @@ class UserController extends Controller
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser"); $fields=$this->getDefaultDatauser();
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste // Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste
if($this->isGranted('ROLE_MODO')&&$access=="config") { if($this->isGranted('ROLE_MODO')&&$access=="config") {
@ -843,7 +893,7 @@ class UserController extends Controller
$em->persist($user); $em->persist($user);
$em->flush(); $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); $url = $this->generateUrl('cadoles_core_resetpwd01', [], UrlGeneratorInterface::ABSOLUTE_URL);
$text ="Vous venez d'être inscrit au portail = ".$appname."\n\n"; $text ="Vous venez d'être inscrit au portail = ".$appname."\n\n";
$text.="Login = ".$username."\n"; $text.="Login = ".$username."\n";
@ -930,6 +980,64 @@ class UserController extends Controller
return $datas; return $datas;
} }
protected function getDefaultDatauser()
{
$em = $this->getDoctrine()->getManager();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
if($fields=="") {
// Valeur par défaut 0=caché / 1=falcultatif / 2=obligatoire
$fields["firstname"]["perm"]=1;
$fields["firstname"]["label"]="Prénom";
$fields["visible"]["perm"]=2;
$fields["visible"]["label"]="Visible";
$fields["authlevel"]["perm"]=2;
$fields["authlevel"]["label"]="Niveau d'authentification";
$fields["belongingpopulation"]["perm"]=2;
$fields["belongingpopulation"]["label"]="Population d'appartenance";
$fields["job"]["perm"]=1;
$fields["job"]["label"]="Métier";
$fields["position"]["perm"]=1;
$fields["position"]["label"]="Fonction";
$fields["niveau02"]["perm"]=1;
$fields["niveau02"]["label"]="Niveau 02";
$fields["usualname"]["perm"]=1;
$fields["usualname"]["label"]="Nom d'Usage";
$fields["gender"]["perm"]=1;
$fields["gender"]["label"]="Sexe";
$fields["givensname"]["perm"]=1;
$fields["givensname"]["label"]="Autre Prénom";
$fields["telephonenumber"]["perm"]=1;
$fields["telephonenumber"]["label"]="Téléphone";
$fields["postaladress"]["perm"]=1;
$fields["postaladress"]["label"]="Adresse";
$fields["birthdate"]["perm"]=1;
$fields["birthdate"]["label"]="Date de Naissance";
$fields["birthcountry"]["perm"]=1;
$fields["birthcountry"]["label"]="Pays de Naissance";
$fields["birthplace"]["perm"]=1;
$fields["birthplace"]["label"]="Ville de Naissance";
}
return $fields;
}
protected function getErrorForm($id,$form,$request,$data,$mode) { protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked()&&$mode=="delete") { if ($form->get('submit')->isClicked()&&$mode=="delete") {
} }

View File

@ -869,4 +869,38 @@ class Group
{ {
return $this->messages; 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;
}
} }

View File

@ -266,7 +266,11 @@ class User implements UserInterface, \Serializable
*/ */
protected $messagereaders; protected $messagereaders;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\WebsocketBundle\Entity\Message", mappedBy="sees")
*/
protected $messagesees;
//== CODE A NE PAS REGENERER //== CODE A NE PAS REGENERER
/** /**
* @ORM\PostLoad * @ORM\PostLoad
@ -1421,4 +1425,38 @@ class User implements UserInterface, \Serializable
{ {
return $this->messagereaders; 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;
}
} }

View File

@ -276,6 +276,10 @@ span.item-drag {
height: auto; height: auto;
} }
.grid-item-img {
filter: drop-shadow(1px 1px 1px #222);
}
.grid-item .grid-item-title { .grid-item .grid-item-title {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
@ -436,7 +440,7 @@ a.item-heart {
.grid .grid-image { .grid .grid-image {
width:19.2%; width:19.2%;
height:auto; height:auto;
margin: 1% 0px 0px 0px; /*margin: 1% 0px 0px 0px;*/
} }
.grid .grid-image .item-link { .grid .grid-image .item-link {
@ -591,7 +595,6 @@ a.item-heart {
position: absolute; position: absolute;
height:40px; height:40px;
width:40px; width:40px;
border-radius: 100%;
margin: 5px; margin: 5px;
cursor: pointer; cursor: pointer;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View File

@ -1,12 +1,12 @@
{% set logo = "transnum-logo.png" %} {% set logo = "transnum-logo.png" %}
{% set fgheader = "" %} {% set fgheader = "" %}
{% set header = "transnum-header.jpg" %} {% set header = "transnum-header.png" %}
{% set heightheader = "" %} {% set heightheader = "" %}
{% set colormain = "2176ad" %} {% set colormain = "2176ad" %}
{% set fontcolorhover = "" %} {% set fontcolorhover = "" %}
{% set colorbody = "" %} {% set colorbody = "eeeeee" %}
{% set fontfacetitle = "LexendDeca-Regular" %} {% set fontfacetitle = "LexendDeca-Regular" %}
{% set fontfacebody = "" %} {% set fontfacebody = "" %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -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 { .grid .grid-preview {
width: 15%; width: 15%;
min-width: 160px; min-width: 160px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -159,7 +159,7 @@
<h3>Mes Icônes</h3> <h3>Mes Icônes</h3>
{% for icon in iconsuser %} {% for icon in iconsuser %}
<a style="cursor:pointer" onClick="selIcon({{ icon.id }})"> <a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px; margin-bottom:2px; background-color: #{{ color["main"]}}">
</a> </a>
{% endfor %} {% endfor %}
@ -167,7 +167,7 @@
{% endif %} {% endif %}
{% for icon in icons %} {% for icon in icons %}
<a style="cursor:pointer" onClick="selIcon({{ icon.id }})"> <a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px; margin-bottom:2px; background-color: #{{ color["main"]}}">
</a> </a>
{% endfor %} {% endfor %}
</div> </div>

View File

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

View File

@ -156,8 +156,10 @@
<tbody> <tbody>
{% for group in user.groups %} {% for group in user.groups %}
<tr id="linkgroup{{ group.group.id }}"> <tr id="linkgroup{{ group.group.id }}">
{% 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 =="" %}
<td><a style="cursor:pointer" title="Se Désinscrire"><i class="fa fa-sign-out fa-fw" onclick="removeLinkGroup({{ group.group.id }})"></i></a></td> <td><a style="cursor:pointer" title="Se Désinscrire"><i class="fa fa-sign-out fa-fw" onclick="removeLinkGroup({{ group.group.id }})"></i></a></td>
{% 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 =="" %}
<td><a style="cursor:pointer" title="Se Désinscrire"><i class="fa fa-sign-out fa-fw" onclick="removeLinkGroup({{ group.group.id }})"></i></a></td>
{% else %} {% else %}
<td></td> <td></td>
{% endif %} {% endif %}

View File

@ -733,6 +733,25 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $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 // Widget Séparateur
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600);
if(!$entityWidget) $entityWidget = new Widget(); if(!$entityWidget) $entityWidget = new Widget();
@ -841,7 +860,74 @@ class InitDataCommand extends ContainerAwareCommand
$em->flush(); $em->flush();
} }
} }
// Template Group
$entityPage = $em->getRepository('CadolesPortalBundle:Page')->find(-110);
if(!$entityPage) {
$entityPagecategory = $em->getRepository('CadolesPortalBundle:Pagecategory')->find(2);
$entityPage = new Page();
$entityPage->setId(-110);
$entityPage->setRowOrder(0);
$entityPage->setName('Accueil Groupe');
$entityPage->setParentfor('Groupe');
$entityPage->setMaxwidth(1500);
$entityPage->setPagecategory($entityPagecategory);
$entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 4,"rows":[]},{"id":1,"size": 8,"rows":[{"id":0,"cols":[{"id":0,"size": 12}]},{"id":1,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]}]}]}');
$em->persist($entityPage);
$em->flush();
// Widget Nos Liens
$fields=["fields"=>[["id"=>"modedesktop","value"=>2]]];
$this->addWidget(-120,$entityPage,-1960,"R1C1",1,"Nos Liens",true,$fields);
// Widget Nos Fichiers
$fields=["fields"=>[]];
$this->addWidget(-130,$entityPage,-1920,"R1C1",2,"Nos Fichiers",true,$fields);
// Widget Info Page
$fields=["fields"=>[]];
$this->addWidget(-140,$entityPage,-1860,"R1C1",3,"Information Page",true,$fields);
// Widget Notre Blog
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$this->addWidget(-150,$entityPage,-1890,"R1C2R1C1",1,"Notre Blog",false,$fields);
// Widget Notre Calendrier
$fields=["fields"=>[["id"=>"nbday","value"=>30]]];
$this->addWidget(-160,$entityPage,-1900,"R1C2R2C1",1,"Notre Calendrier",true,$fields);
// Chat
$fields=["fields"=>[]];
$this->addWidget(-170,$entityPage,-1840,"R1C2R2C2",1,"Chat",true,$fields);
}
$output->writeln(''); $output->writeln('');
} }
private function addWidget($id,$entityPage,$widgetid,$loc,$order,$title,$border,$fields) {
$em = $this->getContainer()->get('doctrine')->getEntityManager();
$entityPagewidget = $em->getRepository('CadolesPortalBundle:Pagewidget')->find($id);
if(!$entityPagewidget) {
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find($widgetid);
$entityPagewidget = new Pagewidget();
$entityPagewidget->setId($id);
$entityPagewidget->setLoc($loc);
$entityPagewidget->setRoworder($order);
$entityPagewidget->setName($title);
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->getAutoajust());
$entityPagewidget->setBorder($border);
$entityPagewidget->setOpened($entityWidget->getOpened());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$entityPagewidget->setParameter($fields);
$em->persist($entityPagewidget);
$em->flush();
}
}
} }

View File

@ -646,6 +646,27 @@ class PageController extends Controller
} }
public function msgcounterAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$user=$this->getUser();
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$entity,$pagesuser,$pagesadmin,$groupsshared);
$output=[];
foreach($groupsshared as $groupshared) {
$output[$groupshared->getId()]=$groupshared->pagesshared[0]->getCounterRead();
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
protected function getErrorForm($id,$form,$request,$data,$mode) { protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked() && $mode=="submit") { if ($form->get('submit')->isClicked() && $mode=="submit") {
$usage = $form->get('usage')->getData(); $usage = $form->get('usage')->getData();

View File

@ -1878,6 +1878,7 @@ class PagewidgetController extends Controller
$group=$em->getRepository("CadolesCoreBundle:Group")->find($group); $group=$em->getRepository("CadolesCoreBundle:Group")->find($group);
if($group) { if($group) {
$title=$group->getLabel(); $title=$group->getLabel();
$id=$group->getId();
if($group->getDescription()) if($group->getDescription())
$description="<strong>Description</strong><br>".$group->getDescription(); $description="<strong>Description</strong><br>".$group->getDescription();
if($group->getIcon()) if($group->getIcon())
@ -1893,6 +1894,7 @@ class PagewidgetController extends Controller
else { else {
$title=$entity->getPage()->getName(); $title=$entity->getPage()->getName();
$proprio=$entity->getPage()->getUser(); $proprio=$entity->getPage()->getUser();
$id=0;
if($proprio) { if($proprio) {
$description="Propriétaire de la page<br>".$proprio->getLastname()." ".$proprio->getLastname(); $description="Propriétaire de la page<br>".$proprio->getLastname()." ".$proprio->getLastname();
$icon="/uploads/avatar/".$proprio->getAvatar(); $icon="/uploads/avatar/".$proprio->getAvatar();
@ -1907,7 +1909,8 @@ class PagewidgetController extends Controller
'icon' => $icon, 'icon' => $icon,
'title' => $title, 'title' => $title,
'description' => $description, 'description' => $description,
'members' => $members 'members' => $members,
'id' => $id,
]); ]);
} }
@ -1930,11 +1933,10 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
if($usage!="group") { if($usage!="group"||!$group) {
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId(); $group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId();
} }
dump($group);
// Render // Render
return $this->render($this->labelentity.':viewchat.html.twig', [ return $this->render($this->labelentity.':viewchat.html.twig', [
@ -1992,5 +1994,86 @@ class PagewidgetController extends Controller
'groups' => $mygroups, '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);
if(is_array($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,
]);
}
} }

View File

@ -260,6 +260,20 @@ class PageRepository extends EntityRepository
$id=$pages->current()->getId(); $id=$pages->current()->getId();
$entity = $this->find($id); $entity = $this->find($id);
} }
// Si aucune page profilé on récupère la premiere page perso
if(!$entity) {
if($pagesuser)
$entity=$pagesuser[0];
}
// Si aucune page profilé on récupère la premiere page perso
if(!$entity) {
if($groupsshared) {
if($groupsshared[0])
$entity=$groupsshared[0]->pagesshared[0];
}
}
} }
// ou On récupère la premiere page de l'utilisateur // ou On récupère la premiere page de l'utilisateur

View File

@ -325,6 +325,10 @@ cadoles_portal_user_page_application:
path: /page/application path: /page/application
defaults: { _controller: CadolesPortalBundle:Page:application, access: user } defaults: { _controller: CadolesPortalBundle:Page:application, access: user }
cadoles_portal_user_page_ajax_msgcounter:
path: /page/ajax/msgcounter
defaults: { _controller: CadolesPortalBundle:Page:msgcounter, access: user }
#== BOOKMARK ============================================================================================================================================= #== BOOKMARK =============================================================================================================================================
@ -767,6 +771,10 @@ cadoles_portal_config_panelwidget_view_group:
path: /config/pagewidget/view/group/{id} path: /config/pagewidget/view/group/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroup, access: config } 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 #-- Access user
cadoles_portal_user_pagewidget_widget_sumbit: cadoles_portal_user_pagewidget_widget_sumbit:
path: /user/pagewidget/submit/{idpage}/{idwidgettype} path: /user/pagewidget/submit/{idpage}/{idwidgettype}
@ -872,3 +880,7 @@ cadoles_portal_user_panelwidget_view_group:
path: /pagewidget/view/group/{id} path: /pagewidget/view/group/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroup, access: user } 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 }

View File

@ -80,7 +80,7 @@
<div class="col-md-12"> <div class="col-md-12">
{% for icon in icons %} {% for icon in icons %}
<a href="#" onClick="selIcon({{ icon.id }})"> <a href="#" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px; margin-bottom:2px; background-color: #{{ color["main"]}}">
</a> </a>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -47,7 +47,7 @@
<div class="panel-body"> <div class="panel-body">
<div style="width:90px; margin:10px auto;"> <div style="width:90px; margin:10px auto;">
<img id="icon_label_img" src="/{{ alias }}/{{ icon.label }}" style="width:90px;height:auto;margin:auto;display:block;margin-bottom:5px;"> <img id="icon_label_img" src="/{{ alias }}/{{ icon.label }}" style="width:90px;height:auto;margin:auto;display:block;margin-bottom:5px;background-color: #{{color["main"]}}">
{{ form_widget(form.label) }} {{ form_widget(form.label) }}
<a class="btn btn-info" style="width:90px" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Icône','{{ path('cadoles_portal_config_icon_icon') }}');" title='Ajouter un Logo'>Modifier</a> <a class="btn btn-info" style="width:90px" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Icône','{{ path('cadoles_portal_config_icon_icon') }}');" title='Ajouter un Logo'>Modifier</a>
</div> </div>

View File

@ -7,7 +7,7 @@
<div class="row"> <div class="row">
{% for icon in icons %} {% for icon in icons %}
<a href="{{ path('cadoles_portal_'~access~'_icon_update', {id : icon.id}) }}"><img class="icon" height="90" src="/{{ alias }}/{{ icon.label }}" style="padding:10px"></a> <a href="{{ path('cadoles_portal_'~access~'_icon_update', {id : icon.id}) }}"><img class="icon" height="90" src="/{{ alias }}/{{ icon.label }}" style="padding:10px; margin-bottom:2px; background-color: #{{color["main"]}}"></a>
{% endfor %} {% endfor %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -92,7 +92,7 @@
<div class="col-md-12"> <div class="col-md-12">
{% for icon in icons %} {% for icon in icons %}
<a href="#" onClick="selIcon({{ icon.id }})"> <a href="#" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px;; margin-bottom:2px; background-color: #{{ color["main"]}}">
</a> </a>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -269,7 +269,14 @@
order: [[ 1, "asc" ]], order: [[ 1, "asc" ]],
}); });
{% if app.user %}
setInterval(function(){
loadmsgCounter()
}, 10000);
{% endif %}
// Init socket de counter // Init socket de counter
/* Désactiver car il semble préférable de faire un appel ajax régulier plutot qu'ouvrir un channel websocket
{% if websocket_activate %} {% if websocket_activate %}
var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}"; var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}";
@ -309,6 +316,7 @@
}); });
}); });
{% endif %} {% endif %}
*/
}); });
$(window).resize(function() { $(window).resize(function() {
@ -336,6 +344,7 @@
// Affichage des frames associés aux items de bureau // Affichage des frames associés aux items de bureau
function showFrameitem(id,url,forcereload) { function showFrameitem(id,url,forcereload) {
$(".pageframereload").remove();
$(".pageframe").hide(); $(".pageframe").hide();
// Si force le rechargement et frame existante on la détruit // Si force le rechargement et frame existante on la détruit
@ -346,9 +355,11 @@
if($("#frameitem-"+id).length) if($("#frameitem-"+id).length)
$("#frameitem-"+id).show(); $("#frameitem-"+id).show();
// Sinon on la génère // Sinon on la génère
else else {
$("#pagecontainer").append("<iframe id='frameitem-"+id+"' class='pageframe' src='"+url+"' style='border:none; width:100%'></iframe>"); var myclass="";
if(forcereload) myclass="pageframereload";
$("#pagecontainer").append("<iframe id='frameitem-"+id+"' class='pageframe "+myclass+"' src='"+url+"' style='border:none; width:100%'></iframe>");
}
resizeFrame(); resizeFrame();
} }
@ -359,6 +370,7 @@
idpage=id; idpage=id;
// Cacher toutes les pages // Cacher toutes les pages
$(".pageframereload").remove();
$(".pageframe").hide(); $(".pageframe").hide();
// Rendre actif le page en cours dans le menu // Rendre actif le page en cours dans le menu
@ -378,8 +390,11 @@
if($("#page-"+id).length) if($("#page-"+id).length)
$("#page-"+id).show(); $("#page-"+id).show();
// Sinon on la génère // Sinon on la génère
else else {
$("#pagecontainer").append("<iframe id='page-"+id+"' data-category='"+catid+"' class='pageframe' src='"+url+"' style='border:none; width:100%'></iframe>"); var myclass="";
if(forcereload) myclass="pageframereload";
$("#pagecontainer").append("<iframe id='page-"+id+"' data-category='"+catid+"' class='pageframe "+myclass+"' src='"+url+"' style='border:none; width:100%'></iframe>");
}
// Détruire le badge associé car normalement de fait on a lu les notif // Détruire le badge associé car normalement de fait on a lu les notif
if(usage=="group") { if(usage=="group") {
@ -455,9 +470,73 @@
$(location).attr('href', url); $(location).attr('href', url);
}; };
function loadmsgCounter() {
/*
menu=$("a[data-group='"+payload.group+"']");
if(menu.length) {
if(payload.add) {
console.log("Ajout counter pour group "+payload.group+" by "+payload.from);
if(menu.children(".badge").length) {
menu.children(".badge").html(+(menu.children(".badge").html())+1);
}
else menu.append("<span id='badge-"+payload.group+"' class='badge'>1</span");
}
}
*/
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_user_page_ajax_msgcounter') }}",
success: function(data) {
$.each(data, function(group, counter) {
menu=$("a[data-group='"+group+"']");
if(menu.length) {
if(menu.children(".badge").length) {
if(counter==0)
menu.remove();
else
menu.children(".badge").html(counter);
}
else if(counter>0)
menu.append("<span id='badge-"+group+"' class='badge'>"+counter+"</span");
}
});
}
});
/*
$.ajax({
method: "GET",
url: "process.php?process=process-notifuser.php",
success: function(data, dataType)
{
if(data.trim()!="") {
var result=data.split(",");
if(parseInt(result[0])) {
$("#notif").show();
if(result[1]!=0) {
$("#notifbadge").html(result[1]);
$("#notifbadge").css('display', 'inline-block');
}
else {
$("#notifbadge").hide();
}
}
else $("#notifbadge").hide();
}
else {
$("#notif").hide();
}
}
});
*/
}
// Permet de déclencher l'évenement de modification des counter // Permet de déclencher l'évenement de modification des counter
/* Plus nécessaire on passe par de l'ajax
function counter(event) { function counter(event) {
$('#refreshcounter').data("event",event); $('#refreshcounter').data("event",event);
$('#refreshcounter').click(); $('#refreshcounter').click();
}; };
*/
{% endblock %} {% endblock %}

View File

@ -531,4 +531,25 @@
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'}; var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid); 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 %} {% endblock %}

View File

@ -242,9 +242,6 @@
{% set stylewidgetbodyframe = "" %} {% set stylewidgetbodyframe = "" %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "background-color: #" ~ colorbodyback ~ "; " %} {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "background-color: #" ~ colorbodyback ~ "; " %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "color: #" ~ colorbodyfont ~ "; " %} {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "color: #" ~ colorbodyfont ~ "; " %}
{% if entity.border %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "padding: 0px 0px 0px 10px; " %}
{% endif %}
{% if not entity.autoajust %} {% if not entity.autoajust %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "height: " ~ (entity.height-50-2) ~ "px;" %} {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "height: " ~ (entity.height-50-2) ~ "px;" %}
{% endif %} {% endif %}

View File

@ -54,7 +54,7 @@
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<div id="diviconsel" class="col-md-12 text-left" style="height:140px; padding:20px; text-align:center; background-color: {{ entity.colorheaderback ? entity.colorheaderback : '#000000' }};"> <div id="diviconsel" class="col-md-12 text-left" style="height:140px; padding:20px; text-align:center; background-color: #{{ color["main"] }};">
{% if entity.icon %} {% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" height="100" /> <img src="/{{ alias }}/{{ entity.icon.label }}" height="100" />
{% endif %} {% endif %}
@ -110,7 +110,7 @@
<h3>Mes Icônes</h3> <h3>Mes Icônes</h3>
{% for icon in iconsuser %} {% for icon in iconsuser %}
<a style="cursor:pointer" onClick="selIcon({{ icon.id }})"> <a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px; margin-bottom:2px; background-color: #{{ color["main"]}}">
</a> </a>
{% endfor %} {% endfor %}
@ -119,7 +119,7 @@
{% for icon in icons %} {% for icon in icons %}
<a href="#" onClick="selIcon({{ icon.id }})"> <a href="#" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px"> <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px; margin-bottom:2px; background-color: #{{ color["main"]}}">
</a> </a>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -12,7 +12,7 @@
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% if canupdate or alerts|length>0 %} {% if canupdate or alerts|length>0 %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>

View File

@ -26,7 +26,7 @@
{% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %} {% if canupdate or canadd %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -18,7 +18,7 @@
</style> </style>
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>

View File

@ -26,7 +26,7 @@
{% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %} {% if canupdate or canadd %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -17,7 +17,7 @@
</style> </style>
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>

View File

@ -23,7 +23,8 @@
{% set colorbodyfont = color['fontcolorhover'] %} {% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> {% if app.user %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
@ -46,8 +47,10 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto;"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto; {%if entity.border %} padding-left: 10px; {%endif%}">
{% if group is not null %}
{{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont})) }} {{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont})) }}
{% endif %}
<!-- <!--
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
--> -->
@ -56,7 +59,4 @@
{% endif %} {% endif %}
</div> </div>
<script> {%endif%}
</script>

View File

@ -10,7 +10,7 @@
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} {% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
<div class="widget {%if entity.border %} widget-bordered {%endif%} widget-editor" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-editor" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -9,7 +9,7 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} {% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} {% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %} {% set color = app.session.get('color') %}
@ -24,7 +24,7 @@
{% set colorbodyfont = color['fontcolorhover'] %} {% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %} {% if canupdate or canadd %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}
@ -48,11 +48,16 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% if files|length >= 1 %} {% if files|length >= 1 or canupdate %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix"> <div class="grid clearfix">
{% if canupdate %}
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
{% for file in files|sort %} {% for file in files|sort %}
{% if loop.index==1 %} {% if loop.index==1 and not canupdate%}
<div class="grid-sizer grid-small"></div> <div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div> <div class="grid-gutter-sizer"></div>
{% endif %} {% endif %}
@ -60,8 +65,8 @@
<div class="grid-item grid-small"> <div class="grid-item grid-small">
<div class="grid-item-content"> <div class="grid-item-content">
{% if canadd %} {% if canadd %}
<a style="{{ stylewidgetbody }} cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete"> <a style="color:#{{colorbodyfont}}; cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete">
<i style="{{ stylewidgetbody }}" class="fa fa-trash" title="Supprimer le fichier"></i> <i style="color:#{{colorbodyfont}}" class="fa fa-trash" title="Supprimer le fichier"></i>
</a> </a>
{% endif %} {% endif %}
@ -81,7 +86,7 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2 style="{{ stylewidgetbody }}">{{ file.name }}</h2> <h2 style="color:#{{colorbodyfont}}">{{ file.name }}</h2>
</div> </div>
</div> </div>
</a> </a>
@ -91,19 +96,16 @@
{% if canadd %} {% if canadd %}
<div class="grid-item grid-small"> <div class="grid-item grid-small">
<div class="grid-item-content"> <div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'all'}) }}');" title='Ajouter des fichiers' class="grid-item-content" style="background-color: #{{color['main']}};cursor:pointer;">
<a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'all'}) }}');" title='Ajouter des fichiers'> <div class="item-link clearfix">
<div class="item-link clearfix"> <div class="grid-item-logo">
<div class="grid-item-logo"> <img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbody }}">Ajouter un fichier</h2>
</div>
</div> </div>
</a> <div class="grid-item-title">
</div> <h2>Ajouter un fichier</h2>
</div>
</div>
</div>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -36,7 +36,7 @@
{% set stylegrid="grid-list" %} {% set stylegrid="grid-list" %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
@ -56,6 +56,7 @@
{% set firstflux="" %} {% set firstflux="" %}
{% if fluxs is defined and fluxs is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }} "> <div class="widgetbody" style="{{ stylewidgetbody }} ">
{% if fluxs is defined %} {% if fluxs is defined %}
{% if fluxs|length > 1 %} {% if fluxs|length > 1 %}
@ -116,6 +117,7 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %}
</div> </div>

View File

@ -22,7 +22,7 @@
{% set colorbodyfont = color['fontcolorhover'] %} {% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
@ -33,7 +33,7 @@
{% if onheader %} {% if onheader %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}"> <div class="widgetheader" style="{{ stylewidgetbodyimage }}">
<iframe src="{{ path(tool,{'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ path(tool,{'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px; {{ stylewidgetbodyframe }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
</div> </div>
{% else %} {% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
@ -46,7 +46,7 @@
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}">
<iframe src="{{ path(tool) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ path(tool) }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="{{ stylewidgetbodyframe }}"></iframe>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -9,7 +9,7 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} {% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} {% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %} {% set color = app.session.get('color') %}
@ -24,7 +24,7 @@
{% set colorbodyfont = color['fontcolorhover'] %} {% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %} {% if canupdate or canadd %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}
@ -48,11 +48,16 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% if files|length>0 %} {% if files|length>0 or canupdate %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix"> <div class="grid clearfix">
{% if canupdate %}
<div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
{% for file in files|sort %} {% for file in files|sort %}
{% if loop.index==1 %} {% if loop.index==1 and not canupdate %}
<div class="grid-sizer grid-image"></div> <div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-image"></div> <div class="grid-gutter-sizer grid-gutter-sizer-image"></div>
{% endif %} {% endif %}
@ -74,6 +79,24 @@
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% if canadd %}
<div class="grid-item grid-list" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'image'}) }}');" title='Ajouter des fichiers'>
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }}">Ajouter une image</h2>
</div>
</div>
</a>
</div>
</div>
{% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -17,7 +17,7 @@
{% set canadd = true %} {% set canadd = true %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%} widget-editor" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-editor" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -0,0 +1,99 @@
{% 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 %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %}
<div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
</div>
{% endif %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if messages is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }} ">
<div class="grid clearfix">
<div class="grid-sizer {{stylegrid}}"></div>
<div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div>
{% 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 %}
<div class="grid-item {{ stylegrid }} msg-{{ message.id }} {{class}}" style="{{ stylewidgetbodyreverse }}; {{style}};">
<div class="grid-item-content">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img avatar" src="/{{alias}}/uploads/avatar/{{message.user.avatar}}" width="100%">
<a onClick="hideMessage({{message.id}})" style="cursor:pointer;" title="Ne plus afficher"><i class="fa fa-eye-slash"></i></a>
</div>
<div class="caption">
<div class="grid-item-title" style="position:inherit; width:85%">
{{message.user.lastname}} {{message.user.firstname}}<br>
<small>{{message.date|date('d/m/Y H:i')}}</small><br><br>
{{ message.topic | raw }}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>

View File

@ -19,7 +19,8 @@
{% set stylelink = "color:#" ~ color['fontcolorhover'] %} {% set stylelink = "color:#" ~ color['fontcolorhover'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
@ -27,8 +28,8 @@
</div> </div>
{% endif %} {% endif %}
{% set canadd = false %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}; height:100%;"> <div class="widgetheader" style="{{ stylewidgetheader }};">
{% set style = "width: 90px;display: block;margin: auto; padding: 10px 0px 10px 0px; position: inherit;height: auto;" %} {% set style = "width: 90px;display: block;margin: auto; padding: 10px 0px 10px 0px; position: inherit;height: auto;" %}
{% if icon %} {% if icon %}
<img src="/{{ alias }}{{ icon }}" class="logo" style="{{ style }}" /> <img src="/{{ alias }}{{ icon }}" class="logo" style="{{ style }}" />
@ -37,8 +38,11 @@
{% endif %} {% endif %}
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div style="text-align: center;">
<div style="text-align: center; margin-top:40px;">
{%if usage=="group" %}<small>Groupe<br></small>{% endif %} {%if usage=="group" %}<small>Groupe<br></small>{% endif %}
<span style="font-size:120%">{{ title }}</span><br><br> <span style="font-size:120%">{{ title }}</span><br><br>
{{ description | raw }} {{ description | raw }}
@ -55,13 +59,37 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
{%if member.fgmanager%}<i style="color: #FFF" class="fa fa-star" title="Manager"></i>{%endif%}<br> <h2 style="{{ stylewidgetbodyreverse }};">
{{ member.user.lastname }} {{ member.user.firstname }} {{ member.user.lastname }} {{ member.user.firstname }}
{%if member.fgmanager%}
<br>
<i style="{{ stylewidgetbodyreverse }};" class="fa fa-star" title="Manager"></i>
{% if member.user==app.user %}
{% set canadd=true %}
{% endif %}
{%endif%}
</h2>
</div> </div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% if canadd==true %}
<div class="grid-item grid-small" style="{{ stylewidgetbodyreverse }};">
<a href="{{path('cadoles_core_user_group_users',{'id':id})}}" target="_top" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }};">Ajouter un membre</h2>
</div>
</div>
</a>
</div>
{% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -27,7 +27,7 @@
{% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %} {% if canupdate or canadd %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -27,7 +27,7 @@
{% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %} {% if canupdate or canadd %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}
@ -53,6 +53,7 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% if canadd or bookmarks is not empty or items is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix"> <div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div> <div class="grid-sizer {{ stylegrid }}"></div>
@ -162,6 +163,8 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endif %}
</div> </div>

View File

@ -18,7 +18,7 @@
{% set stylelink = "color:#" ~ color['fontcolorhover'] %} {% set stylelink = "color:#" ~ color['fontcolorhover'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -17,7 +17,7 @@
{% set colorbodyfont = color['main'] %} {% set colorbodyfont = color['main'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>

View File

@ -17,7 +17,7 @@
{% set stylelink = "color:#" ~ color['fontcolorhover'] ~ ";" %} {% set stylelink = "color:#" ~ color['fontcolorhover'] ~ ";" %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %} {% if canupdate or canadd %}
<div class="widgetmenu"> <div class="widgetmenu">
{% if canupdate %} {% if canupdate %}

View File

@ -11,7 +11,7 @@
{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} {% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %}
{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} {% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i> <i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
@ -46,7 +46,7 @@
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}">
<iframe src="{{ url }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ url }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="{{ stylewidgetbodyframe }}"></iframe>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -48,12 +48,11 @@ class ChatController extends Controller
// Génération d'une clé temporaire d'accès au chat // Génération d'une clé temporaire d'accès au chat
$key = Uuid::uuid4(); $key = Uuid::uuid4();
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["group"=>$group,"user"=>$user]); $usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["group"=>$group,"user"=>$user]);
if(!$usergroup) die("noingroup".$user->getUserName()); if($usergroup) {
$usergroup->setKeyvalue($key); $usergroup->setKeyvalue($key);
$em->persist($usergroup);
// Sauvegarde $em->flush();
$em->persist($usergroup); }
$em->flush();
// Récupération des message du groupe // Récupération des message du groupe
@ -75,9 +74,35 @@ class ChatController extends Controller
'border' => $border, 'border' => $border,
'colorbodyback' => $colorbodyback, 'colorbodyback' => $colorbodyback,
'colorbodyfont' => $colorbodyfont, 'colorbodyfont' => $colorbodyfont,
'fgmanager' => ($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO"), 'ingroup' => ($usergroup),
'fgmanager' => ($usergroup&&($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO")),
'form' => $form->createView() 'form' => $form->createView()
]); ]);
} }
} }
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;
}
} }

View File

@ -42,15 +42,23 @@ class Message
/** /**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\User", inversedBy="messagereaders", cascade={"persist"}) * @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")}, * joinColumns={@ORM\JoinColumn(name="message", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")} * inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")}
* ) * )
*/ */
protected $readers; 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 * Constructor
*/ */
@ -200,4 +208,38 @@ class Message
{ {
return $this->readers; 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;
}
} }

View File

@ -1,3 +1,7 @@
cadoles_websocket_chat: cadoles_websocket_chat:
path: /websocket/chat/{id} path: /websocket/chat/{id}
defaults: { _controller: CadolesWebsocketBundle:Chat:client } defaults: { _controller: CadolesWebsocketBundle:Chat:client }
cadoles_websocket_message_see:
path: /user/message/see
defaults: { _controller: CadolesWebsocketBundle:Chat:see }

View File

@ -51,13 +51,14 @@
{% endblock %} {% endblock %}
{% block pagewrapper %} {% block pagewrapper %}
{% if app.user and ingroup %}
{{ form_start(form) }} {{ form_start(form) }}
<div class='row'> <div class='row'>
{{ form_widget(form.message) }} {{ form_widget(form.message) }}
<input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input> <input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input>
<label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label> <label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label>
<a id="sendbtn" class="btn btn-success" style="margin-top:5px; width:100%; margin-bottom:15px">Envoyer</a> <a id="sendbtn" class="btn btn-success" style="margin-top:5px; width:100%; margin-bottom:15px">Envoyer</a>
</div> </div>
@ -109,6 +110,7 @@
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
{% endif %}
{% endblock %} {% endblock %}
{% block localexternalscript %} {% block localexternalscript %}
@ -118,27 +120,31 @@
{% endblock %} {% endblock %}
{% block localjavascript %} {% block localjavascript %}
var webSocket;
$(document).ready(function(){ $(document).ready(function(){
if (CKEDITOR.instances["chat_message"]) CKEDITOR.instances["chat_message"].destroy(); if (CKEDITOR.instances["chat_message"]) CKEDITOR.instances["chat_message"].destroy();
if (CKEDITOR.instances["chat_messagemail"]) CKEDITOR.instances["chat_messagemail"].destroy(); if (CKEDITOR.instances["chat_messagemail"]) CKEDITOR.instances["chat_messagemail"].destroy();
CKEDITOR.replace( 'chat_message', { setTimeout(function(){
toolbar: [ CKEDITOR.replace( 'chat_message', {
{ name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] }, toolbar: [
{ name: 'custo02', items: [ 'NumberedList','BulletedList' ] }, { name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] },
{ name: 'custo03', items: [ 'Smiley','Link','Unlink' ]} { name: 'custo02', items: [ 'NumberedList','BulletedList' ] },
], { name: 'custo03', items: [ 'Smiley','Link','Unlink' ]}
height: 100 ],
}); height: 100
});
CKEDITOR.replace( 'chat_messagemail', { CKEDITOR.replace( 'chat_messagemail', {
toolbar: [ toolbar: [
{ name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] }, { name: 'custo01', items: [ 'Bold','Italic','Underline','RemoveFormat' ] },
{ name: 'custo02', items: [ 'NumberedList','BulletedList' ] }, { name: 'custo02', items: [ 'NumberedList','BulletedList' ] },
{ name: 'custo03', items: [ 'Smiley','Link','Unlink' ]} { name: 'custo03', items: [ 'Smiley','Link','Unlink' ]}
], ],
height: 150 height: 150
}); });
},500);
$(".switch").bootstrapSwitch(); $(".switch").bootstrapSwitch();
var dateoptions = {weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" }; var dateoptions = {weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" };
@ -146,10 +152,14 @@
{% if websocket_activate and app.user %} {% if websocket_activate and app.user %}
var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}"; var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}";
webSocket = WS.connect(_WS_URI);
var webSocket = WS.connect(_WS_URI); var timer;
webSocket.on("socket/connect", function (session) { webSocket.on("socket/connect", function (session) {
// Reinit du tps de tentative de reco
$('#modalinfo').modal('hide');
clearInterval(timer);
//the callback function in "subscribe" is called everytime an event is published in that channel. //the callback function in "subscribe" is called everytime an event is published in that channel.
session.subscribe("websocket/channel/{{groupid}}", function (uri, payload) { session.subscribe("websocket/channel/{{groupid}}", function (uri, payload) {
if(payload.msg) { if(payload.msg) {
@ -206,8 +216,10 @@
session.publish("websocket/channel/{{groupid}}", event); session.publish("websocket/channel/{{groupid}}", event);
CKEDITOR.instances["chat_message"].setData(''); CKEDITOR.instances["chat_message"].setData('');
/* Ne plus envoyer d'event compteur on passe par de l'ajax
event={type: "add", group:{{groupid}}}; event={type: "add", group:{{groupid}}};
parent.parent.counter(event); parent.parent.counter(event);
*/
} }
} }
}); });
@ -222,12 +234,13 @@
session.publish("websocket/channel/{{groupid}}", event); session.publish("websocket/channel/{{groupid}}", event);
CKEDITOR.instances["chat_message"].setData(''); CKEDITOR.instances["chat_message"].setData('');
/* Ne plus envoyer d'event compteur on passe par de l'ajax
event={type: "add", group:{{groupid}}}; event={type: "add", group:{{groupid}}};
parent.parent.counter(event); parent.parent.counter(event);
*/
$("#sendbymail").bootstrapSwitch('state',false); $("#sendbymail").bootstrapSwitch('state',false);
$('#mymodal-sendmail').modal('hide'); $('#mymodal-sendmail').modal('hide');
} }
else alert("Sujet, corps et destinataire(s) obligatoire"); else alert("Sujet, corps et destinataire(s) obligatoire");
}); });
@ -243,7 +256,42 @@
$("#mailto").val($("#mailto").val().replace(mail, "")); $("#mailto").val($("#mailto").val().replace(mail, ""));
$(this).remove(); $(this).remove();
}); });
}) });
webSocket.on("socket/disconnect", function(error){
laberror="Disconnected for " + error.reason + " with code " + error.code;
console.log(laberror);
$('#modalinfo').modal('show');
if(error.code==2) {
$('#modalinfotext').html("<center>Impossible de se connecter au serveur.<br>Vous avez dépassé le nombre de reconnexion maximum<br><br>Veuillez retentez d'ici quelques secondes<br><br><code>"+laberror+"</code><br><br><div id='modalinfotimer'></div><br><a class='btn btn-primary' onclick='location.reload(true);'>Forcer la tentative de reconnexion</a></center>");
clearInterval(timer);
var nbtentative=10;
timer=setInterval(function(){ $('#modalinfotimer').html((nbtentative--)+"s") }, 1000);
setTimeout(function(){ location.reload(true); }, 10000);
}
if(error.code==3) {
$('#modalinfotext').html("<center>Impossible de se connecter au serveur.<br>Veuillez retentez d'ici quelques secondes<br><br><code>"+laberror+"</code><br><br><div id='modalinfotimer'></div><br><a class='btn btn-primary' onclick='location.reload(true);'>Forcer la tentative de reconnexion</a></center>");
clearInterval(timer);
var nbtentative=10;
timer=setInterval(function(){ $('#modalinfotimer').html((nbtentative--)+"s") }, 1000);
setTimeout(function(){ location.reload(true); }, 10000);
}
if(error.code==6 || error.code==5) {
$('#modalinfotext').html("<center>Impossible de se connecter au serveur.<br>Vous allez être reconnecté d'ici quelques secondes<br><br><code>"+laberror+"</code><br><br><div id='modalinfotimer'></div><br><a class='btn btn-primary' onclick='location.reload(true);'>Forcer la tentative de reconnexion</a></center>");
clearInterval(timer);
var nbtentative=5;
timer=setInterval(function(){ $('#modalinfotimer').html((nbtentative--)+"s") }, 1000);
}
});
{% endif %} {% endif %}
}); });

View File

@ -37,7 +37,7 @@ class WebsocketTopic implements TopicInterface
public function onSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request) public function onSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)
{ {
//this will broadcast the message to ALL subscribers of this topic. //this will broadcast the message to ALL subscribers of this topic.
//$topic->broadcast(['log' => $connection->resourceId." has joined ".$topic->getId()]); $topic->broadcast(['log' => $connection->resourceId." has joined ".$topic->getId()]);
} }
@ -52,7 +52,7 @@ class WebsocketTopic implements TopicInterface
public function onUnSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request) public function onUnSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)
{ {
//this will broadcast the message to ALL subscribers of this topic. //this will broadcast the message to ALL subscribers of this topic.
//$topic->broadcast(['msg' => $connection->resourceId . " has left " . $topic->getId()]); $topic->broadcast(['log' => $connection->resourceId . " has left " . $topic->getId()]);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1 +1,6 @@
* * * * * root /var/www/html/ninegate/scripts/ninegate-cron.sh &>/dev/null * * * * * root /var/www/html/ninegate/scripts/ninegate-cron.sh &>/dev/null
%if %%getVar("ninegate_activate_websocket", 'non') == "oui"
* * * * * root /var/www/html/ninegate/scripts/ninegate-websocket.sh restartifdown &>/dev/null
0 5 * * * root /var/www/html/ninegate/scripts/ninegate-websocket.sh &>/dev/null
%end if