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");
$clear=$request->get("clear");
$view=$request->get("view");
$sort=$request->get("sort");
$defaultview=$request->get("defaultview");
// Récupérer en session le dernier subdirectory visité
$sessionsubdirectory = $this->get('session')->get('sessionsubdirectory');
if(!is_array($sessionsubdirectory)) $sessionsubdirectory=[];
// Récupérer les préférences utilisateur
$toupdate=false;
$preference=$this->getUser()->getPreference();
if(is_null($preference)) $preference=[];
if($clear) {
if(array_key_exists($directory,$sessionsubdirectory)) unset($sessionsubdirectory[$directory]);
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
// Préférence subdirectory
if(!array_key_exists("widgetsubdirectory",$preference)) {
$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 {
if(!$subdirectory) {
if(array_key_exists($directory,$sessionsubdirectory)) $subdirectory=$sessionsubdirectory[$directory];
}
else {
$sessionsubdirectory[$directory] = $subdirectory;
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
if(!$subdirectory) $subdirectory = $preference["widgetsubdirectory"][$directory];
elseif($subdirectory!=$preference["widgetsubdirectory"][$directory]) {
$toupdate=true;
$preference["widgetsubdirectory"][$directory] = $subdirectory;
}
}
// Récupérer en session le mode de visualisation
$sessionviewdirectory = $this->get('session')->get('sessionviewdirectory');
if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview];
if(!array_key_exists($directory,$sessionviewdirectory)) $sessionviewdirectory[$directory]=$defaultview;
if($view)
$sessionviewdirectory[$directory] = $view;
$this->get('session')->set('sessionviewdirectory',$sessionviewdirectory);
// Préférence mode de visualisation
if(!array_key_exists("widgetviewdirectory",$preference)) {
$toupdate=true;
$preference["widgetviewdirectory"]=[];
}
if((!array_key_exists($directory,$preference["widgetviewdirectory"]))) {
$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
$iddirectory=explode("-",$directory)[1];
@ -79,6 +115,7 @@ class FileController extends Controller
if(is_dir($file)) {
$tmp=[];
$tmp["name"]=$file->getRelativePathname();
$tmp["date"]=date ("d/m/Y H:i", filemtime($file));
array_push($dirs,$tmp);
}
else {
@ -88,6 +125,7 @@ class FileController extends Controller
$fileinfo = new file($file->getPathname());
$tmp["minetype"]=$fileinfo->getMimeType();
$tmp["minefamily"]=explode("/",$tmp["minetype"])[0];
$tmp["date"] = date ("d/m/Y H:i", filemtime($file));
$tmp["thumb"]="";
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',[
'useheader' => false,
'usemenu' => false,
@ -124,7 +169,8 @@ class FileController extends Controller
'files' => $files,
'canupdate' => $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();
}
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()
{
$em = $this->getDoctrine()->getManager();

View File

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

View File

@ -179,10 +179,15 @@ class User implements UserInterface, \Serializable
private $niveau01other;
/**
* @ORM\Column(name="description", type="text", nullable=true)
* @ORM\Column(name="motivation", type="text", nullable=true)
*/
private $motivation;
/**
* @ORM\Column(name="preference", type="array", nullable=true)
*/
private $preference;
/**
* @ORM\ManyToOne(targetEntity="Country", inversedBy="users")
* @ORM\JoinColumn(nullable=true)
@ -1952,4 +1957,28 @@ class User implements UserInterface, \Serializable
{
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
defaults: { _controller: CadolesCoreBundle:User:viewcalendar }
cadoles_core_user_preference:
path: /user/preference
defaults: { _controller: CadolesCoreBundle:User:preference }
#== Niveau01 =============================================================================================================
cadoles_core_config_niveau01:
path: /config/niveau01

View File

@ -5,20 +5,36 @@
min-height:0px !important;
}
.container-fluid {
padding:0px;
}
#explorer {
margin-right: -15px;
margin-left: -15px;
}
.grid .grid-list .grid-item-logo {
margin:0px;
}
.grid .grid-list .grid-item-title h2 {
font-size: 14px;
line-height: 22px;
height: 22px;
line-height: 18px;
height: 18px
}
.grid .grid-list .grid-item-title {
padding:0px 0px 0px 5px;
line-height: 10px;
}
.grid-item-title h2 {
text-transform: initial !important;
}
{% endblock %}
{% block pagewrapper %}
@ -43,19 +59,34 @@
{% else %}
{%set action="small" %}
{% endif %}
{% 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">
{% else %}
<a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'clear':true,'view':action }) }}" type="button" class="btn btn-primary">
{% endif %}
{% if view=="small" %}
<i class="fas fa-list"></i>
{% else %}
<i class="fas fa-th"></i>
{% endif %}
</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>
@ -87,7 +118,7 @@
{% for dir in dirs|sort %}
{% for dir in dirs %}
<div class="grid-item grid-{{view}}">
<div class="grid-item-content">
{% if canadd %}
@ -108,7 +139,7 @@
</div>
<div class="grid-item-title">
<h2>{{ dir.name }}</h2>
<h2>{{ dir.name }}</h2>{% if view=="list" %}<small>le {{ dir.date }}</small>{%endif%}
</div>
</div>
</a>
@ -116,7 +147,7 @@
</div>
{% endfor %}
{% for file in files|sort %}
{% for file in files %}
<div class="grid-item grid-{{view}}">
<div class="grid-item-content">
{% if canadd %}
@ -140,7 +171,7 @@
</div>
<div class="grid-item-title">
<h2>{{ file.name }}</h2>
<h2>{{ file.name }}</h2>{% if view=="list" %}<small>le {{ file.date }}</small>{%endif%}
</div>
</div>
</a>
@ -191,10 +222,11 @@
function ajust(formodal) {
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')) {
$("#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");
$clear=$request->get("clear");
$view=$request->get("view");
$sort=$request->get("sort");
$defaultview=$request->get("defaultview");
// Récupérer en session le dernier subdirectory visité
$sessionsubdirectory = $this->get('session')->get('sessionsubdirectory');
if(!is_array($sessionsubdirectory)) $sessionsubdirectory=[];
// Récupérer les préférences utilisateur
$toupdate=false;
$preference=$this->getUser()->getPreference();
if(is_null($preference)) $preference=[];
if($clear) {
if(array_key_exists($directory,$sessionsubdirectory)) unset($sessionsubdirectory[$directory]);
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
// Préférence subdirectory
if(!array_key_exists("widgetsubdirectory",$preference)) {
$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 {
if(!$subdirectory) {
if(array_key_exists($directory,$sessionsubdirectory)) $subdirectory=$sessionsubdirectory[$directory];
}
else {
$sessionsubdirectory[$directory] = $subdirectory;
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
if(!$subdirectory) $subdirectory = $preference["widgetsubdirectory"][$directory];
elseif($subdirectory!=$preference["widgetsubdirectory"][$directory]) {
$toupdate=true;
$preference["widgetsubdirectory"][$directory] = $subdirectory;
}
}
// Récupérer en session le mode de visualisation
$sessionviewdirectory = $this->get('session')->get('sessionviewdirectory');
if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview];
if(!array_key_exists($directory,$sessionviewdirectory)) $sessionviewdirectory[$directory]=$defaultview;
if($view)
$sessionviewdirectory[$directory] = $view;
$this->get('session')->set('sessionviewdirectory',$sessionviewdirectory);
// Préférence mode de visualisation
if(!array_key_exists("widgetviewdirectory",$preference)) {
$toupdate=true;
$preference["widgetviewdirectory"]=[];
}
if((!array_key_exists($directory,$preference["widgetviewdirectory"]))) {
$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
$onlyservice = $this->container->get('cadoles.portal.service.only');
$firstfolder=($subdirectory?$subdirectory:null);
$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
if($grp) $idonly= $grp->getIdOnlyoffice();
else $idonly=0;
@ -84,7 +148,8 @@ class FrameController extends Controller
'subdirectory' => $subdirectory,
'files' => $files,
'canupdate' => $canupdate,
'view' => $sessionviewdirectory[$directory],
'view' => $preference["widgetviewdirectory"][$directory],
'sort' => $preference["widgetsortdirectory"][$directory],
'tasks' => $tasks,
'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") {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
@ -402,12 +418,17 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Récupération des paramétres du widget
$url="";
foreach($entity->getParameter()["fields"] as $parameter) {
if($parameter["id"]=="url")
$url=$parameter["value"];
}
// Préference utilisateur
$this->getPreference($entity);
// Gestion des url youtuve
$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);
@ -452,6 +473,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Récupération des paramétres du widget
$url="";
$widgettype= $entity->getWidget();
$jsons=$widgettype->getParameter();
@ -462,6 +484,9 @@ class PagewidgetController extends Controller
$url=$field->value;
}
// Préference utilisateur
$this->getPreference($entity);
// Gestion des url youtuve
$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);
@ -543,6 +568,8 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Profilage
$user=$this->getUser();
@ -705,7 +732,9 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Profilage
$user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
@ -829,7 +858,9 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Profilage
$user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
@ -950,6 +981,9 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Profilage
$user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
@ -1207,6 +1241,9 @@ class PagewidgetController extends Controller
break;
}
}
// Préference utilisateur
$this->getPreference($entity);
// On regarde si le flux a été lu il y a peu
$toregen=true;
@ -1405,6 +1442,9 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Profilage
$user=$this->getUser();
@ -1451,7 +1491,10 @@ class PagewidgetController extends Controller
break;
}
}
// Préference utilisateur
$this->getPreference($entity);
// Render
return $this->render($this->labelentity.':viewlink.html.twig', [
'entity' => $entity,
@ -1489,7 +1532,10 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Render
return $this->render($this->labelentity.':vieweditor.html.twig', [
'entity' => $entity,
@ -1516,7 +1562,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Parametres
// Récupération des paramétres du widget
$interval="2";
foreach($entity->getParameter()["fields"] as $parameter) {
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']);
// Render
@ -1555,58 +1605,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
/*
$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
// Récupération des paramétres du widget
$view="small";
foreach($entity->getParameter()["fields"] as $parameter) {
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', [
'entity' => $entity,
'canadd' => $canupdate,
@ -1644,7 +1646,10 @@ class PagewidgetController extends Controller
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Préference utilisateur
$this->getPreference($entity);
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/widget-".$id;
$files=[];
$fs = new Filesystem();
@ -1703,7 +1708,7 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Parametres
// Récupération des paramétres du widget
$nbday="0";
foreach($entity->getParameter()["fields"] as $parameter) {
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
if($usage=="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');
}
// Parametres
// Récupération des paramétres du widget
$nbarticle=10;
foreach($entity->getParameter()["fields"] as $parameter) {
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
if($usage=="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
$em->getRepository("CadolesPortalBundle:Blogarticle")->getBlogsArticles($blogs,0,$nbarticle,$count,$blogarticles);
// Render
return $this->render($this->labelentity.':viewblog.html.twig', [
'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
$user=$this->getUser();
if($usage=="group") {
@ -1960,6 +1976,9 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Render
return $this->render($this->labelentity.':viewseparator.html.twig', [
'entity' => $entity,
@ -1997,6 +2016,9 @@ class PagewidgetController extends Controller
}
}
// Préference utilisateur
$this->getPreference($entity);
// Render
return $this->render($this->labelentity.':viewurl.html.twig', [
'entity' => $entity,
@ -2024,6 +2046,8 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Préference utilisateur
$this->getPreference($entity);
// Render
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();
$items=[];
$itemcategorys=[];
@ -2154,6 +2181,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Préference utilisateur
$this->getPreference($entity);
$icon=null;
$title=null;
$description=null;
@ -2218,6 +2248,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Préference utilisateur
$this->getPreference($entity);
if($usage!="group"||!$group) {
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId();
}
@ -2256,6 +2289,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Préference utilisateur
$this->getPreference($entity);
$mygroups=[];
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared);
if(is_array($groupsshared)) {
@ -2303,6 +2339,9 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Préference utilisateur
$this->getPreference($entity);
// Récupération des paramétres du widget
$modelist=1;
$nbarticle=5;
@ -2387,18 +2426,7 @@ class PagewidgetController extends Controller
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
$apponly=0;
$view="small";
@ -2412,23 +2440,10 @@ class PagewidgetController extends Controller
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', [
'entity' => $entity,
'canadd' => $canupdate,

View File

@ -5,16 +5,30 @@
min-height:0px !important;
}
.container-fluid {
padding:0px;
}
#explorer {
margin-right: -15px;
margin-left: -15px;
}
.grid .grid-list .grid-item-logo {
margin:0px;
}
.grid .grid-list .grid-item-title h2 {
font-size: 14px;
line-height: 22px;
height: 22px;
line-height: 18px;
height: 18px
}
.grid .grid-list .grid-item-title {
padding:0px 0px 0px 5px;
line-height: 10px;
}
.grid-item-title h2 {
text-transform: initial !important;
}
@ -39,19 +53,38 @@
{% else %}
{%set action="small" %}
{% endif %}
{% 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">
{% else %}
<a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'clear':true,'view':action }) }}" type="button" class="btn btn-primary">
{% endif %}
{% if view=="small" %}
<i class="fas fa-list"></i>
{% else %}
<i class="fas fa-th"></i>
{% endif %}
</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>
@ -83,7 +116,7 @@
</div>
<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>
</a>
@ -105,7 +138,7 @@
</div>
<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>
</a>
@ -158,6 +191,7 @@
}
$(".grid-item-title > h2").css("color",color);
$(".grid-item-title > small").css("color",color);
$("#onlytasks").css("color",color);
});
@ -168,7 +202,10 @@
function ajust(formodal) {
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);
}
}

View File

@ -281,12 +281,34 @@
}
function showhideWidget(elem) {
// on récupère le parent widget conteneur
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
var grid = $('.grid').masonry(optiongrid);
// On recalcule les grilles
var grid = $('.grid').masonry(optiongrid);
}
});
{% endif %}
}
// Modification de la localisation d'un widget

View File

@ -51,7 +51,7 @@
<span class="title">{{ entity.name }}</span>
</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 %}
{{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain})) }}
{% endif %}

View File

@ -49,11 +49,9 @@
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}">
<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 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>
</div>
</div>

View File

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