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

This commit is contained in:
Arnaud Fornerot 2020-09-23 14:48:43 +02:00
commit d64c20519d
13 changed files with 444 additions and 159 deletions

View File

@ -25,34 +25,70 @@ class FileController extends Controller
$subdirectory=$request->get("subdirectory"); $subdirectory=$request->get("subdirectory");
$clear=$request->get("clear"); $clear=$request->get("clear");
$view=$request->get("view"); $view=$request->get("view");
$sort=$request->get("sort");
$defaultview=$request->get("defaultview"); $defaultview=$request->get("defaultview");
// Récupérer en session le dernier subdirectory visité // Récupérer les préférences utilisateur
$sessionsubdirectory = $this->get('session')->get('sessionsubdirectory'); $toupdate=false;
if(!is_array($sessionsubdirectory)) $sessionsubdirectory=[]; $preference=$this->getUser()->getPreference();
if(is_null($preference)) $preference=[];
if($clear) { // Préférence subdirectory
if(array_key_exists($directory,$sessionsubdirectory)) unset($sessionsubdirectory[$directory]); if(!array_key_exists("widgetsubdirectory",$preference)) {
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory); $toupdate=true;
$preference["widgetsubdirectory"]=[];
}
if((!array_key_exists($directory,$preference["widgetsubdirectory"]))) {
$toupdate=true;
$preference["widgetsubdirectory"][$directory]=null;
}
if($clear&&!is_null($preference["widgetsubdirectory"][$directory])) {
$toupdate=true;
$preference["widgetsubdirectory"][$directory]=null;
} }
else { else {
if(!$subdirectory) { if(!$subdirectory) $subdirectory = $preference["widgetsubdirectory"][$directory];
if(array_key_exists($directory,$sessionsubdirectory)) $subdirectory=$sessionsubdirectory[$directory]; elseif($subdirectory!=$preference["widgetsubdirectory"][$directory]) {
} $toupdate=true;
else { $preference["widgetsubdirectory"][$directory] = $subdirectory;
$sessionsubdirectory[$directory] = $subdirectory;
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
} }
} }
// Récupérer en session le mode de visualisation // Préférence mode de visualisation
$sessionviewdirectory = $this->get('session')->get('sessionviewdirectory'); if(!array_key_exists("widgetviewdirectory",$preference)) {
if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview]; $toupdate=true;
if(!array_key_exists($directory,$sessionviewdirectory)) $sessionviewdirectory[$directory]=$defaultview; $preference["widgetviewdirectory"]=[];
if($view) }
$sessionviewdirectory[$directory] = $view; if((!array_key_exists($directory,$preference["widgetviewdirectory"]))) {
$this->get('session')->set('sessionviewdirectory',$sessionviewdirectory); $toupdate=true;
$preference["widgetviewdirectory"][$directory]=$defaultview;
}
if($view&&$preference["widgetviewdirectory"][$directory]!=$view) {
$toupdate=true;
$preference["widgetviewdirectory"][$directory]=$view;
}
// Prérence trie
if(!array_key_exists("widgetsortdirectory",$preference)) {
$toupdate=true;
$preference["widgetsortdirectory"]=[];
}
if((!array_key_exists($directory,$preference["widgetsortdirectory"]))) {
$toupdate=true;
$preference["widgetsortdirectory"][$directory]="name";
}
if($sort&&$preference["widgetsortdirectory"][$directory]!=$sort) {
$toupdate=true;
$preference["widgetsortdirectory"][$directory]=$sort;
}
// Mise à jour des préferences
if($toupdate) {
$em = $this->getDoctrine()->getManager();
$this->getUser()->setPreference($preference);
$em->persist($this->getUser());
$em->flush();
}
// Construire le chemin réel // Construire le chemin réel
$iddirectory=explode("-",$directory)[1]; $iddirectory=explode("-",$directory)[1];
@ -79,6 +115,7 @@ class FileController extends Controller
if(is_dir($file)) { if(is_dir($file)) {
$tmp=[]; $tmp=[];
$tmp["name"]=$file->getRelativePathname(); $tmp["name"]=$file->getRelativePathname();
$tmp["date"]=date ("d/m/Y H:i", filemtime($file));
array_push($dirs,$tmp); array_push($dirs,$tmp);
} }
else { else {
@ -88,6 +125,7 @@ class FileController extends Controller
$fileinfo = new file($file->getPathname()); $fileinfo = new file($file->getPathname());
$tmp["minetype"]=$fileinfo->getMimeType(); $tmp["minetype"]=$fileinfo->getMimeType();
$tmp["minefamily"]=explode("/",$tmp["minetype"])[0]; $tmp["minefamily"]=explode("/",$tmp["minetype"])[0];
$tmp["date"] = date ("d/m/Y H:i", filemtime($file));
$tmp["thumb"]=""; $tmp["thumb"]="";
if($tmp["extension"]=="pdf") { if($tmp["extension"]=="pdf") {
@ -110,6 +148,13 @@ class FileController extends Controller
} }
} }
// Trie du tableu
$sort = array_column($files, $preference["widgetsortdirectory"][$directory]);
array_multisort($sort, SORT_ASC, $files);
$sort = array_column($dirs, $preference["widgetsortdirectory"][$directory]);
array_multisort($sort, SORT_ASC, $dirs);
return $this->render('CadolesCoreBundle:File:list.html.twig',[ return $this->render('CadolesCoreBundle:File:list.html.twig',[
'useheader' => false, 'useheader' => false,
'usemenu' => false, 'usemenu' => false,
@ -124,7 +169,8 @@ class FileController extends Controller
'files' => $files, 'files' => $files,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'canadd' => $canupdate, 'canadd' => $canupdate,
'view' => $sessionviewdirectory[$directory], 'view' => $preference["widgetviewdirectory"][$directory],
'sort' => $preference["widgetsortdirectory"][$directory],
]); ]);
} }

View File

@ -1206,6 +1206,42 @@ class UserController extends Controller
return new Response(); return new Response();
} }
public function preferenceAction(Request $request) {
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$key=$request->request->get('key');
$id=$request->request->get('id');
$value=$request->request->get('value');
$preference=$this->getUser()->getPreference();
$toupdate=false;
if(!array_key_exists($key,$preference)) {
$toupdate=true;
$preference[$key]=[];
}
if((!array_key_exists($id,$preference[$key]))) {
$toupdate=true;
$preference[$key][$id]=$value;
}
if($value&&$preference[$key][$id]!=$value) {
$toupdate=true;
$preference[$key][$id]=$value;
}
// Mise à jour des préferences
if($toupdate) {
$em = $this->getDoctrine()->getManager();
$this->getUser()->setPreference($preference);
$em->persist($this->getUser());
$em->flush();
}
return new Response();
}
protected function getDatas() protected function getDatas()
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();

View File

@ -129,7 +129,7 @@ class Registration implements UserInterface, \Serializable
private $niveau01other; private $niveau01other;
/** /**
* @ORM\Column(name="description", type="text", nullable=true) * @ORM\Column(name="motivation", type="text", nullable=true)
*/ */
private $motivation; private $motivation;

View File

@ -179,10 +179,15 @@ class User implements UserInterface, \Serializable
private $niveau01other; private $niveau01other;
/** /**
* @ORM\Column(name="description", type="text", nullable=true) * @ORM\Column(name="motivation", type="text", nullable=true)
*/ */
private $motivation; private $motivation;
/**
* @ORM\Column(name="preference", type="array", nullable=true)
*/
private $preference;
/** /**
* @ORM\ManyToOne(targetEntity="Country", inversedBy="users") * @ORM\ManyToOne(targetEntity="Country", inversedBy="users")
* @ORM\JoinColumn(nullable=true) * @ORM\JoinColumn(nullable=true)
@ -1952,4 +1957,28 @@ class User implements UserInterface, \Serializable
{ {
return $this->motivation; return $this->motivation;
} }
/**
* Set preference
*
* @param array $preference
*
* @return User
*/
public function setPreference($preference)
{
$this->preference = $preference;
return $this;
}
/**
* Get preference
*
* @return array
*/
public function getPreference()
{
return $this->preference;
}
} }

View File

@ -318,6 +318,11 @@ cadoles_core_user_viewcalendar:
path: /user/viewcalendar path: /user/viewcalendar
defaults: { _controller: CadolesCoreBundle:User:viewcalendar } defaults: { _controller: CadolesCoreBundle:User:viewcalendar }
cadoles_core_user_preference:
path: /user/preference
defaults: { _controller: CadolesCoreBundle:User:preference }
#== Niveau01 ============================================================================================================= #== Niveau01 =============================================================================================================
cadoles_core_config_niveau01: cadoles_core_config_niveau01:
path: /config/niveau01 path: /config/niveau01

View File

@ -5,20 +5,36 @@
min-height:0px !important; min-height:0px !important;
} }
.container-fluid {
padding:0px;
}
#explorer {
margin-right: -15px;
margin-left: -15px;
}
.grid .grid-list .grid-item-logo { .grid .grid-list .grid-item-logo {
margin:0px; margin:0px;
} }
.grid .grid-list .grid-item-title h2 { .grid .grid-list .grid-item-title h2 {
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 18px;
height: 22px; height: 18px
} }
.grid .grid-list .grid-item-title {
padding:0px 0px 0px 5px;
line-height: 10px;
}
.grid-item-title h2 { .grid-item-title h2 {
text-transform: initial !important; text-transform: initial !important;
} }
{% endblock %} {% endblock %}
{% block pagewrapper %} {% block pagewrapper %}
@ -43,19 +59,34 @@
{% else %} {% else %}
{%set action="small" %} {%set action="small" %}
{% endif %} {% endif %}
{% if not subdirectory is empty %} {% if not subdirectory is empty %}
<a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':subdirectory,'view':action }) }}" type="button" class="btn btn-primary"> <a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':subdirectory,'view':action }) }}" type="button" class="btn btn-primary">
{% else %} {% else %}
<a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'clear':true,'view':action }) }}" type="button" class="btn btn-primary"> <a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'clear':true,'view':action }) }}" type="button" class="btn btn-primary">
{% endif %} {% endif %}
{% if view=="small" %} {% if view=="small" %}
<i class="fas fa-list"></i> <i class="fas fa-list"></i>
{% else %} {% else %}
<i class="fas fa-th"></i> <i class="fas fa-th"></i>
{% endif %} {% endif %}
</a> </a>
{% if sort=="name" %}
{%set action="date" %}
{% else %}
{%set action="name" %}
{% endif %}
{% if not subdirectory is empty %}
<a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':subdirectory,'sort':action }) }}" type="button" class="btn btn-primary">
{% else %}
<a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'clear':true,'sort':action }) }}" type="button" class="btn btn-primary">
{% endif %}
{% if sort=="name" %}
<i class="fas fa-long-arrow-alt-down"></i> Nom
{% else %}
<i class="fas fa-long-arrow-alt-down"></i> Date
{% endif %}
</a>
</div> </div>
</div> </div>
@ -87,7 +118,7 @@
{% for dir in dirs|sort %} {% for dir in dirs %}
<div class="grid-item grid-{{view}}"> <div class="grid-item grid-{{view}}">
<div class="grid-item-content"> <div class="grid-item-content">
{% if canadd %} {% if canadd %}
@ -108,7 +139,7 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2>{{ dir.name }}</h2> <h2>{{ dir.name }}</h2>{% if view=="list" %}<small>le {{ dir.date }}</small>{%endif%}
</div> </div>
</div> </div>
</a> </a>
@ -116,7 +147,7 @@
</div> </div>
{% endfor %} {% endfor %}
{% for file in files|sort %} {% for file in files %}
<div class="grid-item grid-{{view}}"> <div class="grid-item grid-{{view}}">
<div class="grid-item-content"> <div class="grid-item-content">
{% if canadd %} {% if canadd %}
@ -140,7 +171,7 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2>{{ file.name }}</h2> <h2>{{ file.name }}</h2>{% if view=="list" %}<small>le {{ file.date }}</small>{%endif%}
</div> </div>
</div> </div>
</a> </a>
@ -191,10 +222,11 @@
function ajust(formodal) { function ajust(formodal) {
if(inIframe()) { if(inIframe()) {
if(!$("#frame-{{directory}}",window.parent.document).hasClass("notframeajust")) { frame=$("#frame-{{directory}}",window.parent.document);
widgetbody=frame.parent();
if(!frame.hasClass("notframeajust")&&widgetbody.css("display")=="block") {
if($('#mymodal').hasClass('in')) { if($('#mymodal').hasClass('in')) {
$("#frame-{{directory}}",window.parent.document).height($("#mymodal").find(".modal-content").height()+80); $("#frame-{{directory}}",window.parent.document).height($("#mymodal").find(".modal-content").height()+80);
} }

View File

@ -26,39 +26,103 @@ class FrameController extends Controller
$subdirectory=$request->get("subdirectory"); $subdirectory=$request->get("subdirectory");
$clear=$request->get("clear"); $clear=$request->get("clear");
$view=$request->get("view"); $view=$request->get("view");
$sort=$request->get("sort");
$defaultview=$request->get("defaultview"); $defaultview=$request->get("defaultview");
// Récupérer en session le dernier subdirectory visité // Récupérer les préférences utilisateur
$sessionsubdirectory = $this->get('session')->get('sessionsubdirectory'); $toupdate=false;
if(!is_array($sessionsubdirectory)) $sessionsubdirectory=[]; $preference=$this->getUser()->getPreference();
if(is_null($preference)) $preference=[];
if($clear) { // Préférence subdirectory
if(array_key_exists($directory,$sessionsubdirectory)) unset($sessionsubdirectory[$directory]); if(!array_key_exists("widgetsubdirectory",$preference)) {
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory); $toupdate=true;
$preference["widgetsubdirectory"]=[];
}
if((!array_key_exists($directory,$preference["widgetsubdirectory"]))) {
$toupdate=true;
$preference["widgetsubdirectory"][$directory]=null;
}
if($clear&&!is_null($preference["widgetsubdirectory"][$directory])) {
$toupdate=true;
$preference["widgetsubdirectory"][$directory]=null;
} }
else { else {
if(!$subdirectory) { if(!$subdirectory) $subdirectory = $preference["widgetsubdirectory"][$directory];
if(array_key_exists($directory,$sessionsubdirectory)) $subdirectory=$sessionsubdirectory[$directory]; elseif($subdirectory!=$preference["widgetsubdirectory"][$directory]) {
} $toupdate=true;
else { $preference["widgetsubdirectory"][$directory] = $subdirectory;
$sessionsubdirectory[$directory] = $subdirectory;
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
} }
} }
// Récupérer en session le mode de visualisation // Préférence mode de visualisation
$sessionviewdirectory = $this->get('session')->get('sessionviewdirectory'); if(!array_key_exists("widgetviewdirectory",$preference)) {
if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview]; $toupdate=true;
if(!array_key_exists($directory,$sessionviewdirectory)) $sessionviewdirectory[$directory]=$defaultview; $preference["widgetviewdirectory"]=[];
if($view) }
$sessionviewdirectory[$directory] = $view; if((!array_key_exists($directory,$preference["widgetviewdirectory"]))) {
$this->get('session')->set('sessionviewdirectory',$sessionviewdirectory); $toupdate=true;
$preference["widgetviewdirectory"][$directory]=$defaultview;
}
if($view&&$preference["widgetviewdirectory"][$directory]!=$view) {
$toupdate=true;
$preference["widgetviewdirectory"][$directory]=$view;
}
// Prérence trie
if(!array_key_exists("widgetsortdirectory",$preference)) {
$toupdate=true;
$preference["widgetsortdirectory"]=[];
}
if((!array_key_exists($directory,$preference["widgetsortdirectory"]))) {
$toupdate=true;
$preference["widgetsortdirectory"][$directory]="title";
}
if($sort&&$preference["widgetsortdirectory"][$directory]!=$sort) {
$toupdate=true;
$preference["widgetsortdirectory"][$directory]=$sort;
}
// Mise à jour des préferences
if($toupdate) {
$em = $this->getDoctrine()->getManager();
$this->getUser()->setPreference($preference);
$em->persist($this->getUser());
$em->flush();
}
// Initialiser le service only // Initialiser le service only
$onlyservice = $this->container->get('cadoles.portal.service.only'); $onlyservice = $this->container->get('cadoles.portal.service.only');
$firstfolder=($subdirectory?$subdirectory:null); $firstfolder=($subdirectory?$subdirectory:null);
$files=$onlyservice->getDocument($grp->getId(), $firstfolder, $parents, $tasks); $files=$onlyservice->getDocument($grp->getId(), $firstfolder, $parents, $tasks);
// Trie Fichier
$tmpfiles=$files[$firstfolder]["files"];
foreach($tmpfiles as $key => $value) {
$tmpfiles[$key]->author=$value->updatedBy->displayName;
$tmpfiles[$key]->updatedformat= date('d/m/Y h:i', strtotime($value->updated));
}
$sort = array_column($tmpfiles, $preference["widgetsortdirectory"][$directory]);
array_multisort($sort, SORT_ASC, $tmpfiles);
$files[$firstfolder]["files"] = $tmpfiles;
// Trie Dossier
$tmpdirs=$files[$firstfolder]["folders"];
foreach($tmpdirs as $key => $value) {
$tmpdirs[$key]["title"]=$value["info"]->title;
$tmpdirs[$key]["updated"]= $value["info"]->updated;
$tmpdirs[$key]["updatedformat"]= date('d/m/Y h:i', strtotime($value["info"]->updated));
$tmpdirs[$key]["author"]=$value["info"]->updatedBy->displayName;
}
$sort = array_column($tmpdirs, $preference["widgetsortdirectory"][$directory]);
array_multisort($sort, SORT_ASC, $tmpdirs);
$files[$firstfolder]["folders"] = $tmpdirs;
//$sort = array_column($tmpfiles, $preference["widgetsortdirectory"][$directory]);
//array_multisort($sort, SORT_ASC, $tmpfiles);
//$files[$firstfolder]["files"] = $tmpfiles;
// Récupération du numéro de groupe oo // Récupération du numéro de groupe oo
if($grp) $idonly= $grp->getIdOnlyoffice(); if($grp) $idonly= $grp->getIdOnlyoffice();
else $idonly=0; else $idonly=0;
@ -84,7 +148,8 @@ class FrameController extends Controller
'subdirectory' => $subdirectory, 'subdirectory' => $subdirectory,
'files' => $files, 'files' => $files,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'view' => $sessionviewdirectory[$directory], 'view' => $preference["widgetviewdirectory"][$directory],
'sort' => $preference["widgetsortdirectory"][$directory],
'tasks' => $tasks, 'tasks' => $tasks,
'apponly' => $apponly 'apponly' => $apponly
]); ]);

View File

@ -386,6 +386,22 @@ class PagewidgetController extends Controller
} }
} }
protected function getPreference(&$entity) {
$user=$this->getUser();
if($user) {
$preference=$user->getPreference();
$id=$entity->getId();
// Preference widgetshowhide
if(is_array($preference)) {
if(array_key_exists("widgetshowhide",$preference)) {
if(array_key_exists($id,$preference["widgetshowhide"]))
$entity->setOpened(($preference["widgetshowhide"][$id]=="true"));
}
}
}
}
public function viewurlAction($id,$access="config") { public function viewurlAction($id,$access="config") {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id); $entity = $em->getRepository($this->labelentity)->find($id);
@ -402,12 +418,17 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Récupération des paramétres du widget
$url=""; $url="";
foreach($entity->getParameter()["fields"] as $parameter) { foreach($entity->getParameter()["fields"] as $parameter) {
if($parameter["id"]=="url") if($parameter["id"]=="url")
$url=$parameter["value"]; $url=$parameter["value"];
} }
// Préference utilisateur
$this->getPreference($entity);
// Gestion des url youtuve // Gestion des url youtuve
$url=str_replace("http://www.youtube.com","https://www.youtube.com",$url); $url=str_replace("http://www.youtube.com","https://www.youtube.com",$url);
$url=str_replace("https://www.youtube.com/watch?v=","https://www.youtube.com/embed/",$url); $url=str_replace("https://www.youtube.com/watch?v=","https://www.youtube.com/embed/",$url);
@ -452,6 +473,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Récupération des paramétres du widget
$url=""; $url="";
$widgettype= $entity->getWidget(); $widgettype= $entity->getWidget();
$jsons=$widgettype->getParameter(); $jsons=$widgettype->getParameter();
@ -462,6 +484,9 @@ class PagewidgetController extends Controller
$url=$field->value; $url=$field->value;
} }
// Préference utilisateur
$this->getPreference($entity);
// Gestion des url youtuve // Gestion des url youtuve
$url=str_replace("http://www.youtube.com","https://www.youtube.com",$url); $url=str_replace("http://www.youtube.com","https://www.youtube.com",$url);
$url=str_replace("https://www.youtube.com/watch?v=","https://www.youtube.com/embed/",$url); $url=str_replace("https://www.youtube.com/watch?v=","https://www.youtube.com/embed/",$url);
@ -543,6 +568,8 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Profilage // Profilage
$user=$this->getUser(); $user=$this->getUser();
@ -705,7 +732,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Profilage // Profilage
$user=$this->getUser(); $user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); $roles=($user?$user->getRoles():["ROLE_ANONYME"]);
@ -829,7 +858,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Profilage // Profilage
$user=$this->getUser(); $user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); $roles=($user?$user->getRoles():["ROLE_ANONYME"]);
@ -950,6 +981,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Profilage // Profilage
$user=$this->getUser(); $user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); $roles=($user?$user->getRoles():["ROLE_ANONYME"]);
@ -1207,6 +1241,9 @@ class PagewidgetController extends Controller
break; break;
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// On regarde si le flux a été lu il y a peu // On regarde si le flux a été lu il y a peu
$toregen=true; $toregen=true;
@ -1405,6 +1442,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Profilage // Profilage
$user=$this->getUser(); $user=$this->getUser();
@ -1451,7 +1491,10 @@ class PagewidgetController extends Controller
break; break;
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Render // Render
return $this->render($this->labelentity.':viewlink.html.twig', [ return $this->render($this->labelentity.':viewlink.html.twig', [
'entity' => $entity, 'entity' => $entity,
@ -1489,7 +1532,10 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Render // Render
return $this->render($this->labelentity.':vieweditor.html.twig', [ return $this->render($this->labelentity.':vieweditor.html.twig', [
'entity' => $entity, 'entity' => $entity,
@ -1516,7 +1562,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Parametres // Récupération des paramétres du widget
$interval="2"; $interval="2";
foreach($entity->getParameter()["fields"] as $parameter) { foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) { switch($parameter["id"]) {
@ -1526,6 +1572,10 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Récupération des slides
$slides=$em->getRepository("CadolesPortalBundle:Slide")->findBy(["pagewidget"=>$entity],['roworder'=>'ASC','title'=>'ASC']); $slides=$em->getRepository("CadolesPortalBundle:Slide")->findBy(["pagewidget"=>$entity],['roworder'=>'ASC','title'=>'ASC']);
// Render // Render
@ -1555,58 +1605,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
/* // Récupération des paramétres du widget
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/widget-".$id;
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->depth('== 0')->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
foreach ($finder as $file) {
if(!is_dir($file)) {
$tmp=[];
$tmp["name"]=$file->getRelativePathname();
$tmp["extension"]=strtolower($file->getExtension());
$fileinfo = new file($file->getPathname());
$tmp["minetype"]=$fileinfo->getMimeType();
$tmp["minefamily"]=explode("/",$tmp["minetype"])[0];
$tmp["thumb"]="";
if($tmp["extension"]=="pdf") {
$tmp["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmp["extension"].".png";
}
elseif($fs->exists($directory."/thumbmini/".$tmp["name"])) {
$data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
$tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
}
elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
$data = file_get_contents($directory."/thumb/".$tmp["name"]);
$tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
}
elseif($fs->exists($this->get('kernel')->getRootDir()."/../web/bundles/cadolescore/images/files/".$tmp["extension"].".png")) {
$tmp["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmp["extension"].".png";
}
array_push($files,$tmp);
}
}
}
// Render
return $this->render($this->labelentity.':viewfile.html.twig', [
'entity' => $entity,
'canadd' => $canupdate,
'canupdate' => $canupdate,
'files' => $files,
'access' => $access,
]);
*/
// Parametres
$view="small"; $view="small";
foreach($entity->getParameter()["fields"] as $parameter) { foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) { switch($parameter["id"]) {
@ -1616,6 +1615,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
return $this->render($this->labelentity.':viewfile.html.twig', [ return $this->render($this->labelentity.':viewfile.html.twig', [
'entity' => $entity, 'entity' => $entity,
'canadd' => $canupdate, 'canadd' => $canupdate,
@ -1644,7 +1646,10 @@ class PagewidgetController extends Controller
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Préference utilisateur
$this->getPreference($entity);
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/widget-".$id; $directory=$this->get('kernel')->getRootDir()."/../uploads/file/widget-".$id;
$files=[]; $files=[];
$fs = new Filesystem(); $fs = new Filesystem();
@ -1703,7 +1708,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Parametres // Récupération des paramétres du widget
$nbday="0"; $nbday="0";
foreach($entity->getParameter()["fields"] as $parameter) { foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) { switch($parameter["id"]) {
@ -1713,6 +1718,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// On récupère soit les calendriers du group en cours soit l'ensemble des calendriers de l'utilisateur // On récupère soit les calendriers du group en cours soit l'ensemble des calendriers de l'utilisateur
if($usage=="group") { if($usage=="group") {
$calendars=$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsGroup($this->getUser(),$group); $calendars=$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsGroup($this->getUser(),$group);
@ -1822,7 +1830,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Parametres // Récupération des paramétres du widget
$nbarticle=10; $nbarticle=10;
foreach($entity->getParameter()["fields"] as $parameter) { foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) { switch($parameter["id"]) {
@ -1832,6 +1840,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// On récupère soit les blogs du group en cours soit l'ensemble des blogs de l'utilisateur // On récupère soit les blogs du group en cours soit l'ensemble des blogs de l'utilisateur
if($usage=="group") { if($usage=="group") {
$blogs=$em->getRepository("CadolesPortalBundle:Blog")->getBlogsGroup($this->getUser(),$group); $blogs=$em->getRepository("CadolesPortalBundle:Blog")->getBlogsGroup($this->getUser(),$group);
@ -1846,6 +1857,8 @@ class PagewidgetController extends Controller
// On récupère les nbarticle de ses blogs // On récupère les nbarticle de ses blogs
$em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles); $em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles);
// Render // Render
return $this->render($this->labelentity.':viewblog.html.twig', [ return $this->render($this->labelentity.':viewblog.html.twig', [
'entity' => $entity, 'entity' => $entity,
@ -1888,6 +1901,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// On récupère soit les projects du group en cours soit l'ensemble des projects de l'utilisateur // On récupère soit les projects du group en cours soit l'ensemble des projects de l'utilisateur
$user=$this->getUser(); $user=$this->getUser();
if($usage=="group") { if($usage=="group") {
@ -1960,6 +1976,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Render // Render
return $this->render($this->labelentity.':viewseparator.html.twig', [ return $this->render($this->labelentity.':viewseparator.html.twig', [
'entity' => $entity, 'entity' => $entity,
@ -1997,6 +2016,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
// Render // Render
return $this->render($this->labelentity.':viewurl.html.twig', [ return $this->render($this->labelentity.':viewurl.html.twig', [
'entity' => $entity, 'entity' => $entity,
@ -2024,6 +2046,8 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Préference utilisateur
$this->getPreference($entity);
// Render // Render
return $this->render($this->labelentity.':viewframe.html.twig', [ return $this->render($this->labelentity.':viewframe.html.twig', [
@ -2065,6 +2089,9 @@ class PagewidgetController extends Controller
} }
} }
// Préference utilisateur
$this->getPreference($entity);
$user=$this->getUser(); $user=$this->getUser();
$items=[]; $items=[];
$itemcategorys=[]; $itemcategorys=[];
@ -2154,6 +2181,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Préference utilisateur
$this->getPreference($entity);
$icon=null; $icon=null;
$title=null; $title=null;
$description=null; $description=null;
@ -2218,6 +2248,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Préference utilisateur
$this->getPreference($entity);
if($usage!="group"||!$group) { if($usage!="group"||!$group) {
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId(); $group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId();
} }
@ -2256,6 +2289,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Préference utilisateur
$this->getPreference($entity);
$mygroups=[]; $mygroups=[];
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared); $this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared);
if(is_array($groupsshared)) { if(is_array($groupsshared)) {
@ -2303,6 +2339,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Préference utilisateur
$this->getPreference($entity);
// Récupération des paramétres du widget // Récupération des paramétres du widget
$modelist=1; $modelist=1;
$nbarticle=5; $nbarticle=5;
@ -2387,18 +2426,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
/*
$onlyservice = $this->container->get('cadoles.portal.service.only');
$firstfolder=null;
$files=$onlyservice->getDocument($group, $firstfolder, $tasks);
$grp=null;
if($group) $grp=$em->getRepository("CadolesCoreBundle:Group")->find($group);
if($grp) $idonly= $grp->getIdOnlyoffice();
else $idonly=0;
*/
// Récupération des paramétres du widget // Récupération des paramétres du widget
$apponly=0; $apponly=0;
$view="small"; $view="small";
@ -2412,23 +2440,10 @@ class PagewidgetController extends Controller
break; break;
} }
} }
/*
// Render
return $this->render($this->labelentity.':viewonlydoc.html.twig', [
'entity' => $entity,
'canadd' => $cansee,
'canupdate' => $cansee,
'firstfolder' => $firstfolder,
'tasks' => $tasks,
'urlonly' => $this->getParameter("widonlyoffice_url")."/products/projects/projects.aspx?prjID=".$idonly,
'apponly' => $apponly,
'files' => $files,
'access' => $access,
]);
*/
// Préference utilisateur
$this->getPreference($entity);
return $this->render($this->labelentity.':viewonlydoc.html.twig', [ return $this->render($this->labelentity.':viewonlydoc.html.twig', [
'entity' => $entity, 'entity' => $entity,
'canadd' => $canupdate, 'canadd' => $canupdate,

View File

@ -5,16 +5,30 @@
min-height:0px !important; min-height:0px !important;
} }
.container-fluid {
padding:0px;
}
#explorer {
margin-right: -15px;
margin-left: -15px;
}
.grid .grid-list .grid-item-logo { .grid .grid-list .grid-item-logo {
margin:0px; margin:0px;
} }
.grid .grid-list .grid-item-title h2 { .grid .grid-list .grid-item-title h2 {
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 18px;
height: 22px; height: 18px
} }
.grid .grid-list .grid-item-title {
padding:0px 0px 0px 5px;
line-height: 10px;
}
.grid-item-title h2 { .grid-item-title h2 {
text-transform: initial !important; text-transform: initial !important;
} }
@ -39,19 +53,38 @@
{% else %} {% else %}
{%set action="small" %} {%set action="small" %}
{% endif %} {% endif %}
{% if not subdirectory is empty %} {% if not subdirectory is empty %}
<a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'subdirectory':subdirectory,'view':action }) }}" type="button" class="btn btn-primary"> <a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'subdirectory':subdirectory,'view':action }) }}" type="button" class="btn btn-primary">
{% else %} {% else %}
<a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'clear':true,'view':action }) }}" type="button" class="btn btn-primary"> <a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'clear':true,'view':action }) }}" type="button" class="btn btn-primary">
{% endif %} {% endif %}
{% if view=="small" %} {% if view=="small" %}
<i class="fas fa-list"></i> <i class="fas fa-list"></i>
{% else %} {% else %}
<i class="fas fa-th"></i> <i class="fas fa-th"></i>
{% endif %} {% endif %}
</a> </a>
{% if sort=="title" %}
{%set action="updated" %}
{% elseif sort=="updated" %}
{%set action="author" %}
{% else %}
{%set action="title" %}
{% endif %}
{% if not subdirectory is empty %}
<a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'subdirectory':subdirectory,'sort':action }) }}" type="button" class="btn btn-primary">
{% else %}
<a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'clear':true,'sort':action }) }}" type="button" class="btn btn-primary">
{% endif %}
{% if sort=="title" %}
<i class="fas fa-long-arrow-alt-down"></i> Nom
{% elseif sort=="updated" %}
<i class="fas fa-long-arrow-alt-down"></i> Date
{% else %}
<i class="fas fa-long-arrow-alt-down"></i> Utilisateur
{% endif %}
</a>
</div> </div>
</div> </div>
@ -83,7 +116,7 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2>{{ folder.info.title }}</h2> <h2>{{ folder.info.title }}</h2>{% if view=="list" %}<small>le {{ folder.updatedformat }} par {{ folder.author }}</small>{%endif%}
</div> </div>
</div> </div>
</a> </a>
@ -105,7 +138,7 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2>{{ file.title }}</h2> <h2>{{ file.title }}</h2>{% if view=="list" %}<small>le {{ file.updatedformat }} par {{ file.author }}</small>{%endif%}
</div> </div>
</div> </div>
</a> </a>
@ -158,6 +191,7 @@
} }
$(".grid-item-title > h2").css("color",color); $(".grid-item-title > h2").css("color",color);
$(".grid-item-title > small").css("color",color);
$("#onlytasks").css("color",color); $("#onlytasks").css("color",color);
}); });
@ -168,7 +202,10 @@
function ajust(formodal) { function ajust(formodal) {
if(inIframe()) { if(inIframe()) {
if(!$("#frame-{{directory}}",window.parent.document).hasClass("notframeajust")) { frame=$("#frame-{{directory}}",window.parent.document);
widgetbody=frame.parent();
if(!frame.hasClass("notframeajust")&&widgetbody.css("display")=="block") {
$("#frame-{{directory}}",window.parent.document).height($("#page-wrapper").height() + 10); $("#frame-{{directory}}",window.parent.document).height($("#page-wrapper").height() + 10);
} }
} }

View File

@ -281,12 +281,34 @@
} }
function showhideWidget(elem) { function showhideWidget(elem) {
// on récupère le parent widget conteneur
widget=$(elem).parent().parent(); widget=$(elem).parent().parent();
widget.children(".widgetbody" ).toggle(); idwidget= widget.data("id");
if(widget.children(".widgetbody").css("display")=='block')
value=false;
else
value=true;
{% if app.user %}
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_user_preference') }}",
data: {
id:idwidget,
key:'widgetshowhide',
value:value
},
success: function(idbookmark) {
// on récupère le parent widget conteneur
widget=$(elem).parent().parent();
//console.log(widget.children(".widgetbody").css("display"));
widget.children(".widgetbody" ).toggle();
// On recalcule les grilles // On recalcule les grilles
var grid = $('.grid').masonry(optiongrid); var grid = $('.grid').masonry(optiongrid);
}
});
{% endif %}
} }
// Modification de la localisation d'un widget // Modification de la localisation d'un widget

View File

@ -51,7 +51,7 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto; {%if entity.border %} padding-left: 10px; {%endif%}"> <div class="widgetbody" style="{{ stylewidgetbody }}; overflow-y:auto; {%if entity.border %} padding-left: 10px; {%endif%}">
{% if group is not null %} {% if group is not null %}
{{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain})) }} {{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain})) }}
{% endif %} {% endif %}

View File

@ -49,11 +49,9 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<iframe id="frame-{{directory}}" src="{{ path("cadoles_core_"~access~"_file_list",{'directory':directory,'defaultview':view}) }}" data-color="#{{colorbodyfont}}" style="{{ stylewidgetbodyframe }}" class="{% if not entity.autoajust %}notframeajust {% endif %}"></iframe>
<iframe id="frame-{{directory}}" src="{{ path("cadoles_core_"~access~"_file_list",{'directory':directory,'defaultview':view}) }}" data-color="#{{colorbodyfont}}" style="{{ stylewidgetbodyframe }}" class="{% if not entity.autoajust %}notframeajust {% endif %}"></iframe> </div>
</div>
</div> </div>

View File

@ -45,7 +45,7 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<iframe src="{{ path(tool) }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="{{ stylewidgetbodyframe }}"></iframe> <iframe src="{{ path(tool) }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="{{ stylewidgetbodyframe }}"></iframe>
</div> </div>
{% endif %} {% endif %}