This commit is contained in:
afornerot 2019-07-04 16:11:50 +02:00
parent 3d77248b3d
commit c0936a53ba
42 changed files with 1731 additions and 233 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}KYFkIhUXbGQ8luMLxpsdl5OtVq4aZ/GN
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}otHXvfP0WOEFQYGgcJCVwAZ8h4HHrHOP
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
@ -32,14 +32,15 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1270, 1200, 1270, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'),
(1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Modèles de Page', 'cadoles_portal_config_pagetemplate', 'fa-copy', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'),
@ -103,6 +104,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_registration',1),
('cadoles_core_config_user',1),
('cadoles_core_config_importuser',0),
('cadoles_portal_config_pagetemplate',1),
('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1),

View File

@ -107,7 +107,7 @@ class CoreController extends Controller
// Calcul des pages de l'utilisateur
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,$id,$entity,$pagesuser,$pagesadmin,$pagesshared);
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,$id,$entity,$pagesuser,$pagesadmin,$groupsshared);
// si aucune page = page par défaut
if(!$entity) {
@ -126,9 +126,9 @@ class CoreController extends Controller
'access' => "user",
'pagesadmin' => $pagesadmin,
'pagesuser' => $pagesuser,
'pagesshared' => $pagesshared,
'groupsshared' => $groupsshared,
'canadd' => $this->get('session')->get('cancreatepage'),
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->findAll()
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("user")
]);
}

View File

@ -8,11 +8,14 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Form\FormError;
use Ramsey\Uuid\Uuid;
use Cadoles\CoreBundle\Entity\Group;
use Cadoles\CoreBundle\Entity\Usergroup;
use Cadoles\CoreBundle\Entity\Usermodo;
use Cadoles\CoreBundle\Form\GroupType;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
class GroupController extends Controller
{
@ -289,6 +292,7 @@ class GroupController extends Controller
$search= $request->query->get('search');
$draw= $request->query->get('draw');
$order= $request->query->get('order');
$fgcanshare= $request->query->get('fgcanshare');
// Nombre total d'enregistrement
$qb = $em->createQueryBuilder();
@ -380,6 +384,7 @@ class GroupController extends Controller
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
foreach($datas as $data) {
// Action
$action = "";
if($group->getLdapfilter()==""&&$group->getAttributes()=="")
@ -388,7 +393,16 @@ class GroupController extends Controller
// Avatar
$avatar="<img src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->getAvatar()."' style='width:30px;background-color:#337ab7;margin:auto;display:block;'>";
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail()));
// Flag manager
$fgmanager="";
if($fgcanshare) {
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$data->getId(),"group"=>$id]);
$checked=($usergroup->getFgmanager()?"checked":"");
$fgmanager="<input type='checkbox' class='switch' onChange='switchManager(".$data->getId().");' $checked>";
}
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),$fgmanager));
}
// Retour
@ -449,15 +463,41 @@ class GroupController extends Controller
return $response;
}
public function submitAction(Request $request)
public function switchmanagerAction(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();
$userid=$request->request->get('user');
$groupid=$request->request->get('group');
$data = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$userid,"group"=>$groupid));
if($data) $data->setFgmanager(!$data->getFgmanager());
$em->persist($data);
$em->flush();
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function submitAction(Request $request, $access="config")
{
$em = $this->getDoctrine()->getManager();
// Initialisation de l'enregistrement
$data = new Group();
$data->setFgopen(false);
$data->setFgcanshare(true);
$data->setFgcancreatepage(true);
$data->setFgcancreatecalendar(true);
$data->setFgcancreateblog(true);
$data->setFgcanshare(false);
$data->setFgcancreatepage(false);
$data->setFgcancreatecalendar(false);
$data->setFgcancreateblog(false);
// Création du formulaire
$form = $this->createForm(GroupType::class,$data,array(
@ -482,38 +522,54 @@ class GroupController extends Controller
if($data->getLdapfilter()!="") $data->setFgopen(false);
if($data->getAttributes()!="") $data->setFgopen(false);
$em = $this->getDoctrine()->getManager();
// Icon
$idicon = $form->get('idicon')->getData();
$icon=$em->getRepository("CadolesPortalBundle:Icon")->findoneby(["id"=>$idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->persist($data);
$em->flush();
// On s'assure que le groupe de travail à bien page d'accueil / calendrier / blog associé
// Sinon on les génère
$this->ctrlFgcanshare($data);
// Retour à la liste
return $this->redirectToRoute("cadoles_core_config_group_users",["id"=>$data->getId()]);
}
// Affichage du formulaire
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
$this->labeldata => $data,
'mode' => 'submit',
'access' => 'access',
'icons' => $icons,
'iconsuser' => $iconsuser,
'form' => $form->createView()
]);
}
public function updateAction($id,Request $request)
public function updateAction($id,Request $request,$access="config")
{
// Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager();
$data=$this->getData($id);
// Création du formulaire
$form = $this->createForm(GroupType::class,$data,array(
"mode"=>"update",
"updatelimite"=>($data->getFgAll()||$data->getFgTemplate()),
"masteridentity"=> $this->GetParameter("masteridentity"),
"portal_activate"=>$this->getParameter("portal_activate")
"mode" => "update",
"updatelimite" => ($data->getFgAll()||$data->getFgTemplate()),
"masteridentity" => $this->GetParameter("masteridentity"),
"portal_activate" => $this->getParameter("portal_activate"),
"idicon" => ($data->getIcon()?$data->getIcon()->getId():null),
)
);
@ -525,25 +581,34 @@ class GroupController extends Controller
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$masteridentity=$this->GetParameter("masteridentity");
$em = $this->getDoctrine()->getManager();
$data = $form->getData();
$masteridentity=$this->GetParameter("masteridentity");
if($masteridentity!="LDAP") $data->setLdapfilter(null);
if($masteridentity!="SSO") $data->setAttributes(null);
if($data->getLdapfilter()!="") $data->setFgopen(false);
if($data->getAttributes()!="") $data->setFgopen(false);
// Icon
$idicon = $form->get('idicon')->getData();
$icon=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findoneby(["id"=>$idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->persist($data);
$em->flush();
// On s'assure que le groupe de travail à bien page d'accueil / calendrier / blog associé
// Sinon on les génère
$this->ctrlFgcanshare($data);
// Retour à la liste
return $this->redirectToRoute($this->labelroute);
}
$icons=$em->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$em()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
// Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [
@ -552,6 +617,9 @@ class GroupController extends Controller
'usesidebar' => true,
$this->labeldata => $data,
'mode' => 'update',
'access' => $access,
'icons' => $icons,
'iconsuser' => $iconsuser,
'form' => $form->createView()
]);
}
@ -618,6 +686,49 @@ class GroupController extends Controller
]);
}
protected function ctrlFgcanshare($group) {
$em = $this->getDoctrine()->getManager();
if($group->getFgcanshare()) {
// On regarde s'il a au moins une page
if($group->getPages()->isEmpty()) {
$page=$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->clonePage(null,$group->getPagetemplate());
$group->addPage($page);
$page->setName("Groupe = ".$group->getLabel());
$em->persist($page);
$em->persist($group);
$em->flush();
}
// On regarde s'il a au moins un calendrier
if($group->getCalendars()->isEmpty()) {
$calendar=new Calendar();
$key = Uuid::uuid4();
$calendar->setName("Groupe = ".$group->getLabel());
$calendar->setKeyvalue($key);
$calendar->addGroup($group);
$calendar->setColor($group->getColor());
$calendar->setType(0);
$em->persist($calendar);
$em->flush();
}
// On regarde s'il a au moins un blog
if($group->getBlogs()->isEmpty()) {
$blog=new Blog();
$blog->setName("Groupe = ".$group->getLabel());
$blog->addGroup($group);
$em->persist($blog);
$em->flush();
}
}
}
protected function getDatas()
{
$em = $this->getDoctrine()->getManager();
@ -661,6 +772,9 @@ class GroupController extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
if($data->getFgcanshare()&&is_null($data->getPagetemplate()))
$form->addError(new FormError("Un groupe de travail doit avoir un modèle de page d'accueil"));
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {

View File

@ -314,7 +314,7 @@ class UserController extends Controller
$group->setUser($data);
$datagroup = $em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
$user->setGroup($datagroup);
$group->setGroup($datagroup);
$em->persist($group);
$em->flush();

View File

@ -29,6 +29,20 @@ class Group
*/
private $label;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="color", type="string", length=24, nullable=true)
*/
private $color;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
@ -74,6 +88,23 @@ class Group
*/
private $attributes;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Icon", inversedBy="groups")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="ownergroups")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Page", inversedBy="templategroups")
*/
private $pagetemplate;
/**
* @var ArrayCollection $users
* @var UserGroup
@ -97,7 +128,6 @@ class Group
*/
protected $pages;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Flux", mappedBy="groups")
*/
@ -671,4 +701,124 @@ class Group
{
return $this->blogs;
}
/**
* Set description
*
* @param string $description
*
* @return Group
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set icon
*
* @param \Cadoles\PortalBundle\Entity\Icon $icon
*
* @return Group
*/
public function setIcon(\Cadoles\PortalBundle\Entity\Icon $icon = null)
{
$this->icon = $icon;
return $this;
}
/**
* Get icon
*
* @return \Cadoles\PortalBundle\Entity\Icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Set owner
*
* @param \Cadoles\CoreBundle\Entity\User $owner
*
* @return Group
*/
public function setOwner(\Cadoles\CoreBundle\Entity\User $owner = null)
{
$this->owner = $owner;
return $this;
}
/**
* Get owner
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getOwner()
{
return $this->owner;
}
/**
* Set color
*
* @param string $color
*
* @return Group
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set pagetemplate
*
* @param \Cadoles\PortalBundle\Entity\Page $pagetemplate
*
* @return Group
*/
public function setPagetemplate(\Cadoles\PortalBundle\Entity\Page $pagetemplate = null)
{
$this->pagetemplate = $pagetemplate;
return $this;
}
/**
* Get pagetemplate
*
* @return \Cadoles\PortalBundle\Entity\Page
*/
public function getPagetemplate()
{
return $this->pagetemplate;
}
}

View File

@ -87,7 +87,7 @@ class Niveau01
private $modos;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Item", mappedBy="groups")
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Item", mappedBy="niveau01s")
*/
protected $items;

View File

@ -78,7 +78,7 @@ class Registration implements UserInterface, \Serializable
private $keyvalue;
/**
* @ORM\ManyToOne(targetEntity="Statut")
* @ORM\ManyToOne(targetEntity="Statut", inversedBy="registrations")
* @ORM\JoinColumn(nullable=false)
*/
private $statut;

View File

@ -179,6 +179,14 @@ class User implements UserInterface, \Serializable
*/
private $groups;
/**
* @var ArrayCollection $ownergroups
* @var Group
*
* @ORM\OneToMany(targetEntity="Group", mappedBy="owner", cascade={"persist"}, orphanRemoval=false)
*/
private $ownergroups;
/**
* @var ArrayCollection $groups
* @var UserGroup
@ -1297,4 +1305,38 @@ class User implements UserInterface, \Serializable
{
return $this->icons;
}
/**
* Add ownergroup
*
* @param \Cadoles\CoreBundle\Entity\Group $ownergroup
*
* @return User
*/
public function addOwnergroup(\Cadoles\CoreBundle\Entity\Group $ownergroup)
{
$this->ownergroups[] = $ownergroup;
return $this;
}
/**
* Remove ownergroup
*
* @param \Cadoles\CoreBundle\Entity\Group $ownergroup
*/
public function removeOwnergroup(\Cadoles\CoreBundle\Entity\Group $ownergroup)
{
$this->ownergroups->removeElement($ownergroup);
}
/**
* Get ownergroups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOwnergroups()
{
return $this->ownergroups;
}
}

View File

@ -35,6 +35,10 @@ class UserGroup
*/
private $group;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $fgmanager = false;
/**
@ -94,4 +98,28 @@ class UserGroup
{
return $this->group;
}
/**
* Set fgmanager
*
* @param boolean $fgmanager
*
* @return UserGroup
*/
public function setFgmanager($fgmanager)
{
$this->fgmanager = $fgmanager;
return $this;
}
/**
* Get fgmanager
*
* @return boolean
*/
public function getFgmanager()
{
return $this->fgmanager;
}
}

View File

@ -35,13 +35,26 @@ class GroupType extends AbstractType
$choices=array("oui" => "1","non" => "0");
$builder->add("fgcanshare",
ChoiceType::class,array(
"label" =>"Partage dans le groupe activé",
"label" =>"Groupe de Travail",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('pagetemplate',
EntityType::class,[
"class" => "CadolesPortalBundle:Page",
"label" => "Modèle de Page pour l'accueil du groupe",
"required" => false,
"choice_label" => "name",
"query_builder"=> function (EntityRepository $er) {
return $er->createQueryBuilder('page')->where('page.parentfor=:parentfor')->setParameter('parentfor', 'group');
},
"disabled" => ($options["mode"]=="delete"||$options["masteridentity"]!="SQL"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false))
]);
$builder->add("fgcancreatepage",
ChoiceType::class,array(
"label" =>"Permission de créer des Pages",
@ -190,6 +203,21 @@ class GroupType extends AbstractType
]);
}
$builder->add('idicon', HiddenType::class,['mapped'=> false,'data' => $options["idicon"]]);
$builder->add('color', TextType::class, [
'label' => "Couleur",
'required' => false,
'attr' => array("class" => "pick-a-color")
]);
$builder->add("description", TextareaType::class, [
"label" => 'Description',
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("rows" => '4')
]);
if(!$options["updatelimite"]) {
$builder->add('label',
TextType::class, array(
@ -267,7 +295,8 @@ class GroupType extends AbstractType
'mode' => "string",
'masteridentity' => "string",
'portal_activate' => "boolean",
'updatelimite' => "boolean"
'updatelimite' => "boolean",
'idicon' => "string",
));
}
}

View File

@ -41,6 +41,7 @@ cadoles_core_ldap_login:
path: /ldaplogin
defaults: { _controller: CadolesCoreBundle:Security:login }
#== Crop Image ===========================================================================================================
cadoles_core_crop01:
path: /crop01
@ -50,6 +51,7 @@ cadoles_core_crop02:
path: /crop02
defaults: { _controller: CadolesCoreBundle:Crop:crop02 }
#== File =================================================================================================================
#-- Access config
cadoles_core_config_file_upload:
@ -93,6 +95,7 @@ cadoles_core_user_file_show:
path: file/show/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:show, access: user }
#== Ajax =================================================================================================================
cadoles_core_ajax_country_list:
path: /ajax/country/list
@ -128,6 +131,7 @@ cadoles_core_config:
path: /config/home
defaults: { _controller: CadolesCoreBundle:Config:home }
#== Commun Config Commun =================================================================================================
cadoles_core_config_commun:
path: /config/commun
@ -165,6 +169,7 @@ cadoles_core_config_datausers:
path: /config/commun/datausers
defaults: { _controller: CadolesCoreBundle:Config:datausers }
#== Registration =========================================================================================================
#-- Access config
cadoles_core_config_registration:
@ -282,6 +287,7 @@ cadoles_core_config_niveau01_logo:
path: /config/niveau01/logo
defaults: { _controller: CadolesCoreBundle:Niveau01:logo }
#== Niveau02 =============================================================================================================
cadoles_core_config_niveau02:
path: /config/niveau02
@ -303,6 +309,7 @@ cadoles_core_config_niveau02_ajax_list:
path: /config/niveau02/ajax/list
defaults: { _controller: CadolesCoreBundle:Niveau02:ajaxlist }
#== Group ================================================================================================================
cadoles_core_config_group:
path: /config/group
@ -344,6 +351,11 @@ cadoles_core_config_group_ajax_usergroup_del:
path: /config/group/ajax/usergroupdel
defaults: { _controller: CadolesCoreBundle:Group:usergroupdel }
cadoles_core_config_group_ajax_switchmanager:
path: /config/group/ajax/switchmanager
defaults: { _controller: CadolesCoreBundle:Group:switchmanager }
#== Whitelist ============================================================================================================
cadoles_core_config_whitelist:
path: /config/whitelist

View File

@ -35,19 +35,16 @@
{% endif %}
<div class="row">
{% if form.label is defined %}
<div class="col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_label(form.label) }}
{{ form_widget(form.label) }}
{{ form_label(form.fgopen) }}
{{ form_widget(form.fgopen) }}
{% if form.label is defined %}
{{ form_row(form.label) }}
{% if form.fgassoc is defined %}
{% if masteridentity=="LDAP" %}
@ -60,13 +57,63 @@
{{ form_row(form.attributes) }}
{% endif %}
{% endif %}
{% endif %}
{{ form_row(form.description) }}
{{ form_row(form.color) }}
</div>
</div>
{% if form.fgcanshare is defined or form.fgopen is defined %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Configuration du Groupe
</div>
<div class="panel-body">
{% if form.fgopen is defined %}
{{ form_row(form.fgopen) }}
{% endif %}
{% if form.fgcanshare is defined %}
{{ form_row(form.fgcanshare) }}
<div id="pagetemplate">{{ form_row(form.pagetemplate) }}</div>
{% endif %}
</div>
</div>
{% endif %}
{% if form.fgcanshare is defined %}
<div id="diviconsel" class="col-md-12 text-left" style="height:140px; padding:20px; text-align:center; background-color: {{ group.color ? "#"~group.color : '#000000' }};">
{% if group.icon %}
<img src="/{{ alias }}/{{ group.icon.label }}" height="100" />
{% endif %}
</div>
<div class="col-md-12" style="text-align:center;padding:0px">
{{ form_row(form.idicon) }}
<a class="btn btn-success" data-toggle="modal" data-target="#selicon" title='Ajouter' style="width:100%">Selectionner un Icône</a>
<a class="btn btn-danger" onClick="delIcon()" title='Détacher' style="width:100%">Détacher l'Icône</a>
</div>
</div>
<div class="col-sm-6">
{% if form.fgcanshare is defined %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Permissions Portail
</div>
<div class="panel-body">
{{ form_label(form.fgcancreatepage) }}
{{ form_widget(form.fgcancreatepage) }}
{{ form_label(form.fgcancreatecalendar) }}
{{ form_widget(form.fgcancreatecalendar) }}
{{ form_label(form.fgcancreateblog) }}
{{ form_widget(form.fgcancreateblog) }}
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Elements du Portail
@ -82,37 +129,55 @@
{{ form_row(form.notices) }}
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Permissions Portail
</div>
<div class="panel-body">
{{ form_label(form.fgcanshare) }}
{{ form_widget(form.fgcanshare) }}
{{ form_label(form.fgcancreatepage) }}
{{ form_widget(form.fgcancreatepage) }}
{{ form_label(form.fgcancreatecalendar) }}
{{ form_widget(form.fgcancreatecalendar) }}
{{ form_label(form.fgcancreateblog) }}
{{ form_widget(form.fgcancreateblog) }}
</div>
</div>
</div>
{% endif %}
</div>
</div>
<div id="selicon" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">SELECTIONNER UN ICONE</h4>
</div>
<div class="modal-body">
<div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selicon').modal('hide');" class="btn btn-default">Annuler</a>
{% if access=="user" %}
<a href="{{ path('cadoles_portal_user_icon') }}" target="_parent" class="btn btn-default">Gérer mes Icônes</a>
{% endif %}
</div>
<div class="col-md-12">
{% if iconsuser is not empty %}
<h3>Mes Icônes</h3>
{% for icon in iconsuser %}
<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">
</a>
{% endfor %}
<h3>Icônes Communs</h3>
{% endif %}
{% for icon in icons %}
<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">
</a>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$('document').ready(function(){
{% if masteridentity=="LDAP" %}
fgaff=($("#group_ldapfilter").val()!="");
if(!fgaff) {
@ -161,8 +226,34 @@
}
});
{% endif %}
hideshow();
});
$(document.body).on("change","#group_fgcanshare",function(){
hideshow();
});
function selIcon(idicon) {
$("#group_idicon").val(idicon);
$("#diviconsel img").remove();
$("#icon-"+idicon).clone().appendTo($("#diviconsel"));
$("#diviconsel img").attr("height","100px");
$('#selicon').modal('hide');
}
function delIcon() {
$("#diviconsel img").remove();
$("#group_idicon").val(null);
}
function hideshow() {
if($("#group_fgcanshare").val()==1)
$("#pagetemplate").show();
else {
$("#pagetemplate").hide();
}
}
{% endblock %}

View File

@ -18,9 +18,9 @@
<th width="130px" class="no-sort">Action</th>
<th>Label</th>
<th>Ouvert</th>
<th class="no-sort">Filtre</th>
<th class="no-sort {% if masteridentity=="SQL" %} no-visible {% endif %}">Filtre</th>
{% if portal_activate %}
<th>Partage</th>
<th>Groupe de Travail</th>
<th>Création Pages</th>
<th>Création Calendriers</th>
<th>Création Blogs</th>
@ -37,7 +37,7 @@
{% block localjavascript %}
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]],

View File

@ -45,6 +45,7 @@
<th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th>
<th>Email</th>
<th class="no-sort {% if not group.fgcanshare %}no-visible{% endif %}">Manager</th>
</tr>
</thead>
</table>
@ -68,14 +69,25 @@
});
$('#dataTablesin').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 2, "asc" ]],
processing: true,
serverSide: true,
ajax: "{{ path('cadoles_core_config_group_ajax_usersin',{'id':group.id}) }}",
ajax: {
"url": "{{ path('cadoles_core_config_group_ajax_usersin',{'id':group.id}) }}",
"data": function ( d ) {
return $.extend( {}, d, {
"fgcanshare": {{ group.fgcanshare }}
});
}
},
"drawCallback": function(settings) {
$(".switch").bootstrapSwitch();
},
});
});
@ -122,4 +134,15 @@
}
});
}
function switchManager(id) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_config_group_ajax_switchmanager') }}",
data: {
"group": {{ group.id }},
"user": id,
}
});
}
{% endblock %}

View File

@ -43,7 +43,7 @@
<br>
{% endif %}
{% if info %}
{% if info is defined and info %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{{ info }}<br>

View File

@ -27,17 +27,17 @@
{% if access=="config" %}
<th width="90px" class="no-sort">Action</th>
{% endif %}
<th width="70px" class="no-sort {% if fields["avatar"].perm==0 %}no-visible{% endif %}">Avatar</th>
<th width="200px class=="{% if fields["login"].perm==0 %}no-visible{% endif %}">Login</th>
<th class="{% if fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th>
<th class="{% if fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th>
<th class="{% if fields["email"].perm==0 %}no-visible{% endif %}">Email</th>
<th class="{% if fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th>
<th width="70px" class="no-sort {% if fields["avatar"] is defined and fields["avatar"].perm==0 %}no-visible{% endif %}">Avatar</th>
<th width="200px class=="{% if fields["login"] is defined and fields["login"].perm==0 %}no-visible{% endif %}">Login</th>
<th class="{% if fields["lastname"] is defined and fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th>
<th class="{% if fields["firstname"] is defined and fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th>
<th class="{% if fields["email"] is defined and fields["email"].perm==0 %}no-visible{% endif %}">Email</th>
<th class="{% if fields["niveau01"] is defined and fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th>
{% if viewniveau02 %}
<th class="no-sort {% if fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
<th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
{% endif %}
<th class="no-sort {% if fields["group"].perm==0 %}no-visible{% endif %}">Groupes</th>
<th class="{% if fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th>
<th class="no-sort {% if fields["group"] is defined and fields["group"].perm==0 %}no-visible{% endif %}">Groupes</th>
<th class="{% if fields["role"] is defined and fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th>
</tr>
</thead>
</table>

View File

@ -340,6 +340,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -359,6 +360,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "withbookmark", "loc": "col1", "type": "withbookmark", "label": "Avec Favoris", "value": "0", "mandatory": "true"},{"id": "itemcategory", "loc": "col1", "type": "itemcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -378,6 +380,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "alertcategory", "loc": "col1", "type": "alertcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -397,6 +400,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -416,6 +420,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -435,6 +440,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"},{"id": "target", "loc": "col1", "type": "target", "label": "Ouvrir le lien dans", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -454,6 +460,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "html", "loc": "col5", "type": "ckeditor", "label": "Texte", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -473,6 +480,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "interval", "loc": "col1", "type": "integer", "label": "Interval en seconde entre 2 images", "value": "5", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -492,6 +500,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -511,6 +520,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -530,6 +540,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "nbday", "loc": "col1", "type": "integer", "label": "Nombre de jours affichés", "value": "15", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -548,6 +559,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -567,6 +579,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés (0 pour tout)", "value": "10", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -597,6 +610,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "Applications", "loc": "col1", "type": "appexternal", "label": "Applications à affichier", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter);
@ -617,6 +631,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$entityWidget->setColorbodyback("ffffff");
$parameter = json_decode('{"fields": [{"id": "seetitle", "loc": "col1", "type": "boolean", "label": "Afficher le titre", "value": "0", "mandatory": "true"},{"id": "seeicon", "loc": "col1", "type": "boolean", "label": "Afficher l\'icone", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
@ -636,6 +651,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "clock", "loc": "col1", "type": "clock", "label": "Mode d\'affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);
@ -654,6 +670,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget);

View File

@ -27,6 +27,7 @@ class PageController extends Controller
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'istemplate' => false,
]);
}
@ -53,7 +54,10 @@ class PageController extends Controller
if($alluser=="false") {
$qbase->where("table.user is null");
$qbase->andWhere('table.parentfor is null') ;
$qsearch->where("table.user is null");
$qsearch->andWhere('table.parentfor is null') ;
}
else {
$qbase->from('CadolesCoreBundle:User','user')
@ -68,6 +72,7 @@ class PageController extends Controller
else
$qsearch->andWhere('table.id LIKE :value OR table.name LIKE :value OR user.username LIKE :value') ;
$qsearch->setParameter("value", "%".$search["value"]."%");
// Nombre total d'enregistrement
@ -474,7 +479,7 @@ class PageController extends Controller
'canupdate' => $canupdate
]);
}
// Type Editeur
// Type Widgets
if($entity->getPageCategory()->getId()==2) {
return $this->render($this->labelentity.':viewwidget.html.twig', [
'useheader' => ($access=="config"),
@ -483,7 +488,8 @@ class PageController extends Controller
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate,
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->findAll()
'mode' => "view",
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access)
]);
}
// Type Editeur

View File

@ -0,0 +1,288 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem;
use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Form\PagetemplateSubmitType;
use Cadoles\PortalBundle\Form\PageSubmitType;
use Cadoles\PortalBundle\Form\PageUpdateToolType;
use Cadoles\PortalBundle\Form\PageUpdateURLType;
use Cadoles\PortalBundle\Form\PageUpdateWidgetType;
use Cadoles\PortalBundle\Form\PageUpdateEditorType;
use Cadoles\PortalBundle\Form\PageShareType;
class PagetemplateController extends Controller
{
private $labelentity="CadolesPortalBundle:Page";
private $routeprimary="cadoles_portal_config_pagetemplate";
public function listAction()
{
return $this->render('CadolesPortalBundle:Pagetemplate:list.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
]);
}
public function ajaxlistAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$em = $this->getDoctrine()->getManager();
$start=$request->query->get('start');
$length= $request->query->get('length');
$search= $request->query->get('search');
$draw= $request->query->get('draw');
$order= $request->query->get('order');
// Query de base
$qbase=$em->createQueryBuilder()->from($this->labelentity,'table');
$qsearch=$em->createQueryBuilder()->from($this->labelentity,'table');
$qbase->where("table.user is null");
$qbase->andWhere('table.parentfor is not null') ;
$qsearch->where("table.user is null");
$qsearch->andWhere('table.parentfor is not null') ;
$qsearch->andwhere('table.id LIKE :value OR table.name LIKE :value OR table.parentfor LIKE :value');
$qsearch->setParameter("value", "%".$search["value"]."%");
// Nombre total d'enregistrement
$total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Nombre d'enregistrement filtré
if($search["value"]=="")
$totalf = $total;
else
$totalf= $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Parcours des Enregistrement
if($search["value"]=="")
$qb = $qbase->select('table');
else
$qb = $qsearch->select('table');
// Order
switch($order[0]["column"]) {
case 1 :
$qb->orderBy('table.roworder',$order[0]["dir"]);
break;
case 2 :
$qb->orderBy('table.name',$order[0]["dir"]);
break;
case 3 :
$qb->orderBy('table.parentfor',$order[0]["dir"]);
break;
}
// Execution de la requete d'affichage
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
// Construction du tableau de retour
$output = array(
'draw' => $draw,
'recordsFiltered' => $totalf,
'recordsTotal' => $total,
'data' => array(),
);
foreach($datas as $data) {
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
$action = "";
//$action.="<a href='".$this->generateUrl($route.'_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
$action.="<a href='".$this->generateUrl($route.'_delete', array('id'=>$data->getId()))."' data-method='delete'><i class='fa fa-trash fa-fw fa-2x'></i></a>";
$action.="<a href='".$this->generateUrl($route.'_view', array('id'=>$data->getId()))."'><i class='fa fa-eye fa-2x'></i></a>";
array_push($output["data"],[
$action,
$data->getRoworder(),
$data->getName(),
$data->getParentfor(),
]);
}
// Retour
return new Response(json_encode($output), 200);
}
public function ajaxseleclistAction(Request $request)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$output=array();
$em = $this->getDoctrine()->getManager();
$page_limit=$request->query->get('page_limit');
$q=$request->query->get('q');
$qb = $em->createQueryBuilder();
$qb->select('table')->from("CadolesPortalBundle:Page",'table')
->where('table.name LIKE :value')
->setParameter("value", "%".$q."%")
->orderBy('table.name');
$datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach($datas as $data) {
array_push($output,array("id"=>$data->getId(),"text"=>$data->getName()));
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
private function entityForm(Page $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
if ($this->getDoctrine()->getManager()->contains($entity)) {
return $this->createForm(PageUpdateWidgetType::class, $entity, [
"mode" => "update",
"access" => $access,
"for" => $entity->getParentfor(),
]);
}
else {
return $this->createForm(PagetemplateSubmitType::class, $entity, [
"mode" => "update",
"access" => $access
]);
}
}
public function submitAction(Request $request,$access="config")
{
if($access=="user"&&!$this->get('session')->get('cancreatepage'))
throw $this->createNotFoundException('Permission denied');
$pagecategory=$this->getDoctrine()->getRepository("CadolesPortalBundle:Pagecategory")->find(2);
$entity = new Page();
$entity->setMaxwidth(0);
$entity->setRoworder(0);
$entity->setParentfor("user");
$entity->setPagecategory($pagecategory);
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
if($access=="user") $entity->setUser($this->getUser());
$em->persist($entity);
$em->flush();
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
return $this->redirect($this->generateUrl($route.'_update',["id"=>$entity->getId()]));
}
return $this->render('CadolesPortalBundle:Pagetemplate:submit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
]);
}
public function updateAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// Création du formulaire
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl($this->routeprimary.'_view',["id"=>$id]));
}
return $this->render('CadolesPortalBundle:Page:updatewidget.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'mode' => "updatetemplate",
'form' => $form->createView(),
]);
}
public function deleteAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de supprimer
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// On s'assure que le template est supprimable
$info="";
$group = $em->getRepository("CadolesCoreBundle:Group")->findOneBy(["pagetemplate"=>$entity]);
if(!$group) {
// Suppression
$em->remove($entity);
$em->flush();
}
else {
$this->get('session')->getFlashBag()->clear();
$request->getSession()->getFlashBag()->add("error", "Impossible de supprimer ce modèle, il est utilisé par au moins un groupe");
}
// Retour
return $this->redirect($this->generateUrl($this->routeprimary));
}
public function viewAction($id,$access=null) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// Permissions
$canupdate = true;
return $this->render($this->labelentity.':viewwidget.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate,
'mode' => "viewtemplate",
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access)
]);
}
}

View File

@ -38,7 +38,7 @@ class PagewidgetController extends Controller
return $results;
}
private function entityForm(Pagewidget $entity,$idpage,$id,$access="config")
private function entityForm(Pagewidget $entity,$idpage,$id,$access="config",$by="view")
{
if ($this->getDoctrine()->getManager()->contains($entity)) {
$widgettype= $this->getDoctrine()->getManager()->getRepository("CadolesPortalBundle:Pagewidget")->find($id)->getWidget();
@ -73,7 +73,7 @@ class PagewidgetController extends Controller
$param = $widgettype->getParameter();
return $this->createForm(PagewidgetType::class, $entity, [
'param' => $param,
'mode' => "submit",
'mode' => ($by=="view"?"submit":"submittemplate"),
'access' => $access,
'idicon' => $widgettype->getIcon()->getId(),
'method' => 'POST',
@ -83,10 +83,12 @@ class PagewidgetController extends Controller
public function submitAction(Request $request,$idpage,$idwidgettype,$access="config")
{
$by=$request->query->get('by');
$entity = new Pagewidget();
$form = $this->entityForm($entity,$idpage,$idwidgettype,$access);
$form = $this->entityForm($entity,$idpage,$idwidgettype,$access,$by);
$form->handleRequest($request);
// On s'assure que la page où l'on souhaite insérer un widget est bien du bon type
$page=$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->findoneby(["id"=>$idpage]);
if (!$page)
@ -125,8 +127,12 @@ class PagewidgetController extends Controller
$em->persist($entity);
$em->flush();
if($access=="config")
if($access=="config") {
if($by=="view")
return $this->redirect($this->generateUrl('cadoles_portal_config_page_view',["id"=>$idpage]));
else
return $this->redirect($this->generateUrl('cadoles_portal_config_pagetemplate_view',["id"=>$idpage]));
}
else
return $this->redirect($this->generateUrl('cadoles_core_home',["id"=>$idpage]));
}
@ -143,7 +149,7 @@ class PagewidgetController extends Controller
'entity' => $entity,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => "submit",
'mode' => ($by=="view"?"submit":"submittemplate"),
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
@ -152,6 +158,8 @@ class PagewidgetController extends Controller
public function updateAction(Request $request,$idpage,$idwidget,$access="config")
{
$by=$request->query->get('by');
// Recherche du pagewidget
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($idwidget);
@ -164,7 +172,7 @@ class PagewidgetController extends Controller
}
// Création du formulaire
$form = $this->entityForm($entity,$idpage,$idwidget,$access);
$form = $this->entityForm($entity,$idpage,$idwidget,$access,$by);
$form->handleRequest($request);
// Validation
@ -194,7 +202,10 @@ class PagewidgetController extends Controller
$em->persist($entity);
$em->flush();
if($by=="view")
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage]));
else
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_pagetemplate_view',["id"=>$idpage]));
}
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
@ -209,7 +220,7 @@ class PagewidgetController extends Controller
'entity' => $entity,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => "update",
'mode' => ($by=="view"?"update":"updatetemplate"),
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
@ -985,7 +996,7 @@ class PagewidgetController extends Controller
"image" => $imgurl,
// "color" => $flux->getColor(),
"fluxid" => 0,
"fluxname" => $entity->getName(),
"fluxtitle" => $entity->getName(),
));
$nbflux++;
@ -1023,12 +1034,14 @@ class PagewidgetController extends Controller
$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
$modedesktop=0;
foreach($entity->getParameter()["fields"] as $parameter) {
@ -1048,7 +1061,7 @@ class PagewidgetController extends Controller
// Render
return $this->render($this->labelentity.':viewbookmark.html.twig', [
'entity' => $entity,
'canadd' => ($user),
'canadd' => $canupdate,
'canupdate' => $canupdate,
'modedesktop' => $modedesktop,
'bookmarks' => $bookmarks,
@ -1333,6 +1346,10 @@ class PagewidgetController extends Controller
$tmp['calendar'] = $calendar->getId();
$tmp['editable'] = $calendar->getCanupdate();
// Si évènement sur la journée on enlève une 1 seconde à la date de fin
if($tmp['allDay'])
$tmp['end']->sub(new \DateInterval('PT1S'));
array_push($events,$tmp);
}
}

View File

@ -73,7 +73,6 @@ class Icon
*/
private $widgets;
/**
* @var ArrayCollection $bookmarks
* @var Bookmark
@ -81,6 +80,16 @@ class Icon
* @ORM\OneToMany(targetEntity="Bookmark", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $bookmarks;
/**
* @var ArrayCollection $groups
* @var Group
*
* @ORM\OneToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $groups;
/**
* Constructor
*/
@ -355,4 +364,38 @@ class Icon
{
return $this->bookmarks;
}
/**
* Add group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*
* @return Icon
*/
public function addGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*/
public function removeGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
}

View File

@ -67,6 +67,13 @@ class Page
*/
private $template;
/**
* @var string
*
* @ORM\Column(name="parentfor", type="string", nullable=true)
*/
protected $parentfor;
/**
* @var string
*
@ -96,13 +103,37 @@ class Page
/**
* @var ArrayCollection $pagewidgets
* @var Order
* @var Pagewidget
*
* @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="page", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"loc" = "ASC", "roworder" = "ASC"})
*/
private $pagewidgets;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="pages")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $page;
/**
* @var ArrayCollection $pages
* @var Page
*
* @ORM\OneToMany(targetEntity="Page", mappedBy="page", cascade={"persist"}, orphanRemoval=false)
*/
private $pages;
/**
* @var ArrayCollection $templategroups
* @var Group
*
* @ORM\OneToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", mappedBy="pagetemplate", cascade={"persist"}, orphanRemoval=false)
*/
private $templategroups;
/* champs calculé non stocké en base */
private $canupdate;
@ -118,7 +149,6 @@ class Page
/**
* Constructor
*/
@ -126,6 +156,7 @@ class Page
{
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
$this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection();
$this->pages = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
@ -282,6 +313,30 @@ class Page
return $this->template;
}
/**
* Set parentfor
*
* @param string $parentfor
*
* @return Page
*/
public function setParentfor($parentfor)
{
$this->parentfor = $parentfor;
return $this;
}
/**
* Get parentfor
*
* @return string
*/
public function getParentfor()
{
return $this->parentfor;
}
/**
* Set roles
*
@ -421,4 +476,96 @@ class Page
{
return $this->pagewidgets;
}
/**
* Set page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*
* @return Page
*/
public function setPage(\Cadoles\PortalBundle\Entity\Page $page = null)
{
$this->page = $page;
return $this;
}
/**
* Get page
*
* @return \Cadoles\PortalBundle\Entity\Page
*/
public function getPage()
{
return $this->page;
}
/**
* Add page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*
* @return Page
*/
public function addPage(\Cadoles\PortalBundle\Entity\Page $page)
{
$this->pages[] = $page;
return $this;
}
/**
* Remove page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*/
public function removePage(\Cadoles\PortalBundle\Entity\Page $page)
{
$this->pages->removeElement($page);
}
/**
* Get pages
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPages()
{
return $this->pages;
}
/**
* Add templategroup
*
* @param \Cadoles\CoreBundle\Entity\Group $templategroup
*
* @return Page
*/
public function addTemplategroup(\Cadoles\CoreBundle\Entity\Group $templategroup)
{
$this->templategroups[] = $templategroup;
return $this;
}
/**
* Remove templategroup
*
* @param \Cadoles\CoreBundle\Entity\Group $templategroup
*/
public function removeTemplategroup(\Cadoles\CoreBundle\Entity\Group $templategroup)
{
$this->templategroups->removeElement($templategroup);
}
/**
* Get templategroups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getTemplategroups()
{
return $this->templategroups;
}
}

View File

@ -12,6 +12,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
* @ORM\Table(name="widget")
* @ORM\HasLifecycleCallbacks
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\WidgetRepository")
*/
class Widget
{
@ -108,6 +109,13 @@ class Widget
*/
protected $colorbodyfont;
/**
* @var string
*
* @ORM\Column(name="access", type="array", nullable=true)
*/
protected $access;
/**
* @var string
*
@ -136,7 +144,6 @@ class Widget
return $this;
}
/**
* Constructor
*/
@ -443,6 +450,30 @@ class Widget
return $this->colorbodyfont;
}
/**
* Set access
*
* @param string $access
*
* @return Widget
*/
public function setAccess($access)
{
$this->access = $access;
return $this;
}
/**
* Get access
*
* @return string
*/
public function getAccess()
{
return $this->access;
}
/**
* Set parameter
*

View File

@ -31,18 +31,6 @@ class BlogWriterType extends AbstractType
'class' => 'CadolesCoreBundle:User',
'query_builder' => function(EntityRepository $er) use ($id,$access) {
$qb= $er->createQueryBuilder('user');
if($access=="config")
return $qb->select('user')
->from('CadolesPortalBundle:Blog','blog')
->where('blog.id=:blog')
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere("usergroup.group MEMBER OF blog.groups AND usergroup.user=user")
->orwhere($qb->expr()->like('blog.roles', $qb->expr()->concat($qb->expr()->literal('%'),$qb->expr()->concat('user.role',$qb->expr()->literal('%')))))
->setParameter('blog',$id);
else
return $qb->select('user')
->from('CadolesPortalBundle:Blog','blog')

View File

@ -64,17 +64,18 @@ class BlogarticleType extends AbstractType
'query_builder' => function(EntityRepository $er) use ($user) {
$qb=$er->createQueryBuilder('blog');
return $qb->select('blog')
->andwhere(':user MEMBER OF blog.writers')
->where('blog.user=:user')
->orwhere(':user MEMBER OF blog.writers')
->from('CadolesCoreBundle:UserGroup','usergroup')
->orwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user AND usergroup.fgmanager=:flag')
->from('CadolesCoreBundle:User','user')
->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user')
->orwhere($qb->expr()->like('blog.roles', $qb->expr()->concat($qb->expr()->literal('%'),$qb->expr()->concat('user.role',$qb->expr()->literal('%')))))
->orwhere('blog.user=:user')
->setparameter('user',$user)
->setparameter('flag',true);
->setparameter('user',$user);
},
]);
}

View File

@ -40,7 +40,7 @@ class PageUpdateWidgetType extends AbstractType
'required' => false
]);
if($options["access"]=="config") {
if($options["access"]=="config"&&$options["for"]!="group") {
$builder
->add('roles', ChoiceType::class, [
"label" => 'Visible pour les Rôles',
@ -80,7 +80,8 @@ class PageUpdateWidgetType extends AbstractType
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Page',
'access' => 'string',
'mode' => 'string'
'mode' => 'string',
'for' => 'string'
]);
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PagetemplateSubmitType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('name', TextType::class, [
'label' => 'Nom'
])
->add('parentfor', ChoiceType::class, [
"label" => 'Modèle pour les',
"choices" => [
"Utilisateurs" => 'user',
"Groupes" => 'group',
],
])
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
->add('maxwidth', IntegerType::class, [
'label' => "Largeur maximum (0 pour largeur de l'écran)",
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Page',
'mode' => 'string',
'access' => 'string'
]);
}
}

View File

@ -120,6 +120,7 @@ class BlogRepository extends EntityRepository
$groups=($user?$user->getGroups():[]);
// La blog est-elle dans les blogs associées à un partage de group ?
/*
$inblogsshared=$this->createQueryBuilder('blog')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
@ -138,6 +139,7 @@ class BlogRepository extends EntityRepository
->setParameter('user',$user)
->getQuery()->getResult();
if($inblogsshared) $cansee=true;
*/
// La blog est-elle dans les blogs associées au role de l'utilisateur ?
foreach($roles as $role) {
@ -162,7 +164,14 @@ class BlogRepository extends EntityRepository
->setParameter("group",$group->getGroup());
$inbloggroup=$qb->getQuery()->getResult();
if($inbloggroup) $cansee=true;
if($inbloggroup) {
$cansee=true;
// Est-il manager du groupe
if($group->getGroup()->getFgcanshare()) {
if($group->getFgmanager()) $canadd=true;
}
}
}
// utilisateur a-t-il la permission d'écriture
@ -175,6 +184,7 @@ class BlogRepository extends EntityRepository
$canadd=false;
if($user) {
// Peut ecrire ceux qui sont déclaré comme écrivain
$qb = $this->createQueryBuilder("blog");
$qb ->andWhere("blog.id=:id")
->andwhere(':user MEMBER OF blog.writers')
@ -183,13 +193,37 @@ class BlogRepository extends EntityRepository
->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user')
->orwhere($qb->expr()->like('blog.roles', $qb->expr()->concat($qb->expr()->literal('%'),$qb->expr()->concat('user.role',$qb->expr()->literal('%')))))
->andwhere('usergroup.group MEMBER OF blog.groups')
->andwhere('usergroup.user=:user')
->setParameter("id",$blog->getId())
->setparameter('user',$user);
$inblogwriters=$qb->getQuery()->getResult();
if($inblogwriters) $canadd=true;
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le blog
$qb = $this->createQueryBuilder("blog");
$qb ->andWhere("blog.id=:id")
->from('CadolesCoreBundle:User','user')
->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF blog.groups')
->andwhere('usergroup.user=:user')
->andwhere('usergroup.fgmanager=:flag')
->from('CadolesCoreBundle:Group','groupe')
->andwhere('groupe=usergroup.group')
->andwhere('groupe.fgcanshare=:flag')
->setParameter("id",$blog->getId())
->setparameter('user',$user)
->setparameter('flag',true);
$inblogwriters=$qb->getQuery()->getResult();
if($inblogwriters) $canadd=true;
}
return $canadd;

View File

@ -90,7 +90,7 @@ class CalendarRepository extends EntityRepository
// Permission sur les calendars
foreach($calendarsadmin as $calendaradmin) {
$calendaradmin->setCanupdate(false);
$calendaradmin->setCanupdate($this->getInwriter($user,$calendaradmin));
}
}
@ -108,27 +108,8 @@ class CalendarRepository extends EntityRepository
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// La calendar est-elle dans les calendars associées à un partage de group ?
$incalendarsshared=$this->createQueryBuilder('calendar')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->from('CadolesCoreBundle:UserGroup','proprio')
->where('g.fgcanshare=:fgcanshare')
->andWhere('calendar.id = :id')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('g MEMBER OF calendar.groups')
->andWhere('calendar.user != :user')
->andWhere('calendar.user is not null')
->andWhere('proprio.user=calendar.user')
->andWhere('proprio.group=g')
->setParameter("id",$calendar->getId())
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->getQuery()->getResult();
if($incalendarsshared) $cansee=true;
// La calendar est-elle dans les calendars associées au role de l'utilisateur ?
// Le calendar est-il dans les calendars associées au role de l'utilisateur ?
foreach($roles as $role) {
$qb = $this->createQueryBuilder("calendar");
$qb ->where($qb->expr()->like('calendar.roles', $qb->expr()->literal("%$role%")))
@ -139,8 +120,7 @@ class CalendarRepository extends EntityRepository
if($incalendarrole) $cansee=true;
}
// La calendar est-elle dans les calendars associées aux groupes de l'utilisateur ?
// Le calendar est-il dans les calendars associées aux groupes de l'utilisateur ?
foreach($groups as $group) {
$qb = $this->createQueryBuilder("calendar");
$qb ->where(":group MEMBER OF calendar.groups")
@ -151,8 +131,46 @@ class CalendarRepository extends EntityRepository
->setParameter("group",$group->getGroup());
$incalendargroup=$qb->getQuery()->getResult();
if($incalendargroup) $cansee=true;
if($incalendargroup) {
$cansee=true;
// Est-il manager du groupe
if($group->getGroup()->getFgcanshare()) {
if($group->getFgmanager()) $canupdate=true;
}
}
}
}
}
public function getInwriter($user,$calendar) {
$canadd=false;
if($user) {
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le calendar
$qb = $this->createQueryBuilder("calendar");
$qb ->andWhere("calendar.id=:id")
->from('CadolesCoreBundle:User','user')
->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF calendar.groups')
->andwhere('usergroup.user=:user')
->andwhere('usergroup.fgmanager=:flag')
->from('CadolesCoreBundle:Group','groupe')
->andwhere('groupe=usergroup.group')
->andwhere('groupe.fgcanshare=:flag')
->setParameter("id",$calendar->getId())
->setparameter('user',$user)
->setparameter('flag',true);
$inblogwriters=$qb->getQuery()->getResult();
if($inblogwriters) $canadd=true;
}
return $canadd;
}
}

View File

@ -5,6 +5,7 @@ namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Entity\Pagewidget;
use Cadoles\PortalBundle\Entity\Pagecategory;
class PageRepository extends EntityRepository
@ -17,13 +18,58 @@ class PageRepository extends EntityRepository
// &$pages = les pages système de l'utilistauer
// &$pagesshared = les pages partagées pour l'utilisateur
public function getPagesUser($user,$id,&$entity,&$pagesuser,&$pages,&$pagesshared)
public function getPagesUser($user,$id,&$entity,&$pagesuser,&$pages,&$groupsshared)
{
// Profilage
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]);
// Récupération des pages de l'utilisateur
// CREATION DES PAGES TEMPLATE UTILISATEUR
if($user) {
// Initialisation du calcul des templates
$templatesnotorder=new ArrayCollection();
// Récupération des templates par rôles
foreach($roles as $role) {
$qb = $this->createQueryBuilder("page");
$qb ->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%")))
->andWhere("page.user is null")
->andWhere("page.parentfor='user'");
$templatesroles=$qb->getQuery()->getResult();
foreach($templatesroles as $templaterole) {
if(!$templatesnotorder->contains($templaterole)) $templatesnotorder->add($templaterole);
}
}
// Récupération des templates par group
foreach($groups as $group) {
$qb = $this->createQueryBuilder("page");
$qb ->where(":group MEMBER OF page.groups")
->andWhere("page.user is null")
->andWhere("page.parentfor='user'")
->setParameter("group",$group->getGroup());
$templatesgroups=$qb->getQuery()->getResult();
foreach($templatesgroups as $templategroup) {
if(!$templatesnotorder->contains($templategroup)) $templatesnotorder->add($templategroup);
}
}
// Pour chaque template associé au profil de l'utilisateur on s'assure qu'il possède bien la page
foreach($templatesnotorder as $template) {
$exist=$this->getEntityManager()->getRepository("CadolesPortalBundle:Page")->findBy(["page"=>$template]);
if(!$exist) {
$page=$this->clonePage($user,$template);
}
}
}
// GENERATION DES PAGES UTILISATEURS
// Une page utilisateur est une page dont il est le propriétaire mais qui n'est pas partagé dans un groupe
$pagesuser=false;
if($user) {
$qb = $this->createQueryBuilder('page');
@ -32,16 +78,64 @@ class PageRepository extends EntityRepository
->orderBy('page.roworder', 'ASC')
->addOrderBy('page.name', 'ASC');
$pagesuser=$qb->getQuery()->getResult();
foreach($pagesuser as $key => $pageuser) {
if(!($pageuser->getGroups()->isEmpty()))
unset($pagesuser[$key]);
}
}
// Permission sur les pages
// Permission sur les pages = il a forcement le droit des les modifier : elles sont à lui
if($pagesuser) {
foreach($pagesuser as $pageuser) {
$pageuser->setCanupdate(true);
}
}
// Pages partagées
// GENERATION DES PAGES GROUPES DE TRAVAIL
// Une page groupe de travail est une page associée à un groupe fgcanshare sur lequel l'utilisateur est inscrit
if($user) {
// En premier lieu on liste les groupes de travail de l'utilisateur
$groupsshared=$this ->getEntityManager()->createQueryBuilder()
->select('g')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->getQuery()->getResult();
// Pour chaque groupe de travail : on s'assure que le groupe possède au moins une page
// Sinon création de la page template associée au groupe
foreach($groupsshared as $key => $groupshared) {
$pagesshared=$this ->createQueryBuilder('page')
->from('CadolesCoreBundle:Group','g')
->where('g.id=:id')
->andWhere('g MEMBER OF page.groups')
->setParameter('id',$groupshared->getId())
->getQuery()->getResult();
if(empty($pagesshared)) {
unset($groupsshared[$key]);
}
else {
// Si l'utilisateur est manager du group il aura les permissions de modification sur la page
$usergroup=$this->getEntityManager()->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$user,"group"=>$groupshared]);
if($usergroup&&$usergroup->getFgmanager()) {
foreach($pagesshared as $key2 => $pageshared) {
$pagesshared[$key2]->setCanupdate(true);
}
}
$groupsshared[$key]->pagesshared=$pagesshared;
}
}
}
$pagesshared=false;
if($user) {
$pagesshared=$this->createQueryBuilder('page')
@ -63,7 +157,7 @@ class PageRepository extends EntityRepository
->getQuery()->getResult();
}
// GENERATION DES PAGES ADMINISTRATEUR
// Initialisation du calcul des pages
$pagesnotorder=new ArrayCollection();
@ -71,7 +165,8 @@ class PageRepository extends EntityRepository
foreach($roles as $role) {
$qb = $this->createQueryBuilder("page");
$qb ->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%")))
->andWhere("page.user is null");
->andWhere("page.user is null")
->andWhere("page.parentfor is null");
$pagesroles=$qb->getQuery()->getResult();
foreach($pagesroles as $pagerole) {
@ -81,9 +176,11 @@ class PageRepository extends EntityRepository
// Récupération des pages par group
foreach($groups as $group) {
if(!$group->getGroup()->getFgcanshare()) {
$qb = $this->createQueryBuilder("page");
$qb ->where(":group MEMBER OF page.groups")
->andWhere("page.user is null")
->andWhere("page.parentfor is null")
->setParameter("group",$group->getGroup());
$pagesgroups=$qb->getQuery()->getResult();
@ -91,6 +188,7 @@ class PageRepository extends EntityRepository
if(!$pagesnotorder->contains($pagegroup)) $pagesnotorder->add($pagegroup);
}
}
}
// Permission sur les pages
foreach($pagesnotorder as $pageadmin) {
@ -120,12 +218,14 @@ class PageRepository extends EntityRepository
$have=true;
}
}
if($pagesshared) {
foreach($pagesshared as $v) {
if($groupsshared) {
foreach($groupsshared as $groupshared) {
foreach($groupshared->pagesshared as $v) {
if($v == $entity)
$have=true;
}
}
}
if(!$have) $entity=false;
}
@ -141,12 +241,12 @@ class PageRepository extends EntityRepository
// ou On récupère la premiere page de l'utilisateur
if(!$entity && !empty($pagesuser)) {
$entity=$pagesuser[0];
$entity=$pagesuser[$this->firstkey($pagesuser)];
}
// ou On récupère la premiere page partagées
if(!$entity && !empty($pagesshared)) {
$entity=$pagesshared[0];
$entity=$pagesshared[$this->firstkey($pagesshared)];
}
}
@ -165,6 +265,7 @@ class PageRepository extends EntityRepository
$groups=($user?$user->getGroups():[]);
// La page est-elle dans les pages associées à un partage de group ?
/*
$inpagesshared=$this->createQueryBuilder('page')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
@ -183,6 +284,7 @@ class PageRepository extends EntityRepository
->setParameter('user',$user)
->getQuery()->getResult();
if($inpagesshared) $cansee=true;
*/
// La page est-elle dans les pages associées au role de l'utilisateur ?
foreach($roles as $role) {
@ -207,8 +309,64 @@ class PageRepository extends EntityRepository
->setParameter("group",$group->getGroup());
$inpagegroup=$qb->getQuery()->getResult();
if($inpagegroup) $cansee=true;
if($inpagegroup) {
$cansee=true;
// Est-il manager du groupe
if($group->getGroup()->getFgcanshare()) {
if($group->getFgmanager()) $canupdate=true;
}
}
}
}
}
public function clonePage($user,$template) {
$page=new Page();
$page->setName($template->getName());
$page->setRoworder($template->getRoworder());
$page->setMaxwidth($template->getMaxwidth());
$page->setUrl($template->getUrl());
$page->setHtml($template->getHtml());
$page->setTemplate($template->getTemplate());
$page->setPagecategory($template->getPagecategory());
$page->setUser($user);
$page->setPage($template);
$this->getEntityManager()->persist($page);
$this->getEntityManager()->flush();
$widgets=$template->getPagewidgets();
foreach($widgets as $widget) {
$pagewidget=new Pagewidget();
$pagewidget->setName($widget->getName());
$pagewidget->setLoc($widget->getLoc());
$pagewidget->setRoworder($widget->getRoworder());
$pagewidget->setHeight($widget->getHeight());
$pagewidget->setAutoajust($widget->getAutoajust());
$pagewidget->setBorder($widget->getBorder());
$pagewidget->setOpened($widget->getOpened());
$pagewidget->setColorheaderback($widget->getColorheaderback());
$pagewidget->setColorheaderfont($widget->getColorheaderfont());
$pagewidget->setColorbodyback($widget->getColorbodyback());
$pagewidget->setColorbodyfont($widget->getColorbodyfont());
$pagewidget->setParameter($widget->getParameter());
$pagewidget->setPage($page);
$pagewidget->setWidget($widget->getWidget());
$pagewidget->setIcon($widget->getIcon());
$this->getEntityManager()->persist($pagewidget);
$this->getEntityManager()->flush();
// dupliquer slide et bookmarks ??
}
return $page;
}
private function firstkey($array) {
foreach($array as $key => $unused) {
return $key;
}
return NULL;
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
class WidgetRepository extends EntityRepository
{
// getWidgetAccess
public function getWidgetAccess($access)
{
$qb = $this->createQueryBuilder("widget");
$qb ->where($qb->expr()->like('widget.access', $qb->expr()->literal("%$access%")));
$widgets=$qb->getQuery()->getResult();
return $widgets;
}
}

View File

@ -220,6 +220,32 @@ cadoles_portal_config_ajax_notice_seleclist:
path: /config/notice/ajax/selectlist
defaults: { _controller: CadolesPortalBundle:Notice:ajaxseleclist }
#== PAGE TEMPLATE ========================================================================================================================================
#-- Access config
cadoles_portal_config_pagetemplate:
path: /config/template
defaults: { _controller: CadolesPortalBundle:Pagetemplate:list }
cadoles_portal_config_pagetemplate_ajax_list:
path: /config/template/ajax/list
defaults: { _controller: CadolesPortalBundle:Pagetemplate:ajaxlist, access: config }
cadoles_portal_config_pagetemplate_submit:
path: /config/template/submit
defaults: { _controller: CadolesPortalBundle:Pagetemplate:submit, access: config }
cadoles_portal_config_pagetemplate_update:
path: /config/template/update/{id}
defaults: { _controller: CadolesPortalBundle:Pagetemplate:update, access: config }
cadoles_portal_config_pagetemplate_delete:
path: /config/template/delete/{id}
defaults: { _controller: CadolesPortalBundle:Pagetemplate:delete, access: config }
cadoles_portal_config_pagetemplate_view:
path: /config/template/view/{id}
defaults: { _controller: CadolesPortalBundle:Pagetemplate:view, access: config }
#== PAGE =================================================================================================================================================
@ -670,7 +696,7 @@ cadoles_portal_config_panelwidget_view_rss:
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewrss, access: config }
cadoles_portal_config_panelwidget_view_bookmark:
path: /pagewidget/view/bookmark/{id}
path: /config/pagewidget/view/bookmark/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewbookmark, access: config }
cadoles_portal_config_panelwidget_view_link:
@ -710,11 +736,11 @@ cadoles_portal_config_panelwidget_view_clock:
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewclock, access: config }
cadoles_portal_config_panelwidget_view_calculator:
path: config/pagewidget/view/calculator/{id}
path: /config/pagewidget/view/calculator/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalculator, access: config }
cadoles_portal_config_panelwidget_view_appexternal:
path: config/pagewidget/view/appexternal/{id}
path: /config/pagewidget/view/appexternal/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: config }
#-- Access user

View File

@ -104,6 +104,7 @@
function showBlog(id,canupdate) {
// Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active");
$(".nav-pills li").removeClass("active");
$("#menublog-"+id).addClass("active");
}

View File

@ -36,12 +36,26 @@
{% endfor %}
</ul>
{% if pagesshared is not empty %}
<ul id="pagesgroup" class="nav navbar-top-links navbar-left">
{% for groupshared in groupsshared %}
{% if groupshared.pagesshared|length == 1 %}
{% set page = groupshared.pagesshared[0] %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=false %}
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">Groupe = {{ groupshared.label }}</a></li>
{% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">Groupe = {{ groupshared.label }}</a></li>
{% endif %}
{% else %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Partagés <span class="caret"></span></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Groupe = {{ groupshared.label }}<span class="caret"></span></a>
<ul class="dropdown-menu">
{% for page in pagesshared %}
{% for page in groupshared.pagesshared %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=false %}
@ -57,6 +71,9 @@
</li>
</ul>
{% endif %}
{% endfor %}
</ul>
<div id="menupageaction">
{% if canadd %}
@ -136,6 +153,14 @@
{% endif %}
{% endfor %}
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }});
{% endif %}
{% endfor %}
{% endfor %}
// Rendre les pages user déplacable
$("#pagesuser").sortable({
axis: "x",

View File

@ -143,6 +143,8 @@
<h1 class="page-header">
{% if mode=="update" %}
Modification Page Widget
{% elseif mode=="updatetemplate" %}
Modification Modèle de Page
{% elseif mode=="submit" %}
Création Page Widget
{% endif %}
@ -151,7 +153,11 @@
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
{% if mode=="updatetemplate" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_pagetemplate_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
@ -164,6 +170,15 @@
Supprimer
</a>
{% endif %}
{% if mode=="updatetemplate" %}
<a href={{ path('cadoles_portal_'~access~'_pagetemplate_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer ce modèle ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}

View File

@ -5,10 +5,15 @@
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_page_view', {id:entity.id})}}">{{ entity.name }}</a>
{% set template="" %}
{% if mode=="viewtemplate" %}
{% set template="template" %}
{% endif %}
<a href='{{ path('cadoles_portal_config_page_update', {id:entity.id}) }}' title='Modifier le panel'><i class='fa fa-file fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_page_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer le panel'><i class='fa fa-trash fa-fw'></i></a>
<a href="{{ path('cadoles_portal_config_page'~template~'_view', {id:entity.id})}}">{{ entity.name }}</a>
<a href='{{ path('cadoles_portal_config_page'~template~'_update', {id:entity.id}) }}' title='Modifier le panel'><i class='fa fa-file fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_page'~template~'_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer le panel'><i class='fa fa-trash fa-fw'></i></a>
<a href='' style='cursor:pointer' data-toggle='modal' data-target='#selwidget' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
</div>
{% endif %}
@ -21,7 +26,7 @@
<div id="tolocalize" style="display:none">
{% for pagewidget in entity.pagewidgets %}
{{ render(url(pagewidget.widget.routeview|replace({'_config_':'_'~access~'_'}),{id:pagewidget.id})) }}
{{ render(url(pagewidget.widget.routeview|replace({'_config_':'_'~access~'_'}),{id:pagewidget.id,by:mode})) }}
{% endfor %}
</div>
@ -301,7 +306,7 @@
// Création d'un widget selectionné
function selWidget(idwidgettype) {
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_sumbit',{idpage:entity.id,idwidgettype:'xx'})}}";
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_sumbit',{idpage:entity.id,idwidgettype:'xx','by':mode})}}";
url=url.replace('xx',idwidgettype);
$(location).attr('href', url);
@ -309,7 +314,7 @@
// Modifciation d'un widget
function modWidget(idwidget) {
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_update',{idpage:entity.id,idwidget:'xx'})}}";
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_update',{idpage:entity.id,idwidget:'xx','by':mode})}}";
url=url.replace('xx',idwidget);
$(location).attr('href', url);

View File

@ -0,0 +1,56 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
<h1>
Gestion des Modèles de Page
</h1>
<p>
<a href="{{ path('cadoles_portal_config_pagetemplate_submit') }}" class="btn btn-success">Ajouter un Modèle</a>
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Liste des Modèles
</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="100px" class="no-sort">Action</th>
<th>Ordre</th>
<th>Nom</th>
<th>Pour</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]],
processing: true,
serverSide: true,
ajax: "{{ path('cadoles_portal_config_pagetemplate_ajax_list') }}",
});
});
{% endblock %}

View File

@ -0,0 +1,49 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Nouvelle Modèle de Page
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_pagetemplate') }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home') }}">Annuler</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.name) }}
{{ form_row(form.parentfor) }}
{{ form_row(form.roworder) }}
{{ form_row(form.maxwidth) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -3,9 +3,9 @@
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
{% if mode=="update" or mode=="updatetemplate" %}
Modification Widget
{% elseif mode=="submit" %}
{% elseif mode=="submit" or mode=="submittemplate" %}
Création Widget
{% endif %}
</h1>
@ -14,7 +14,11 @@
{{ form_widget(form.submit) }}
{% if access=="config" %}
{% if mode=="update" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_pagetemplate_view',{id:idpage}) }}">Annuler</a>
{% endif %}
{% else %}
{% if mode=="update" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage}) }}">Annuler</a>

View File

@ -47,7 +47,7 @@
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="widgetbody" style="{{ stylewidgetbody }} {% if not entity.border %} padding-top:10px; {% endif %}">
{% if bookmarks is not empty %}
<div class="bookmark-container">
<div class="grid clearfix">
@ -56,7 +56,9 @@
{% for bookmark in bookmarks %}
<div class="grid-item {{ stylegrid }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#000' }};">
{% if canupdate %}
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% endif %}
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">

View File

@ -32,8 +32,9 @@
> Favorie sur appexternal
> Montée de version LemonLDAP
> France Connect Agent
> Page Blanche paramétrable
> Fiche user paramétrable
> Index sur group.fgall
> Pb sur widget editor et la couleur du texte si fond pas blanc
> Pb sur widget flux et la couleur du texte si fond pas blanc

View File

@ -43,14 +43,15 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1270, 1200, 1270, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'),
(1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Modèles de Page', 'cadoles_portal_config_pagetemplate', 'fa-copy', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'),
@ -120,6 +121,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_registration',1),
('cadoles_core_config_user',1),
('cadoles_core_config_importuser',0),
('cadoles_portal_config_pagetemplate',1),
('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1),