From 2aff9d641b5e32cb59d3e957e3d93350fa1645c3 Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 16 Sep 2020 09:33:46 +0200 Subject: [PATCH] explorer de fichier --- .../Cadoles/CoreBundle/Controller/FileController.php | 3 ++- .../Cadoles/PortalBundle/Command/InitDataCommand.php | 2 +- .../PortalBundle/Controller/PagewidgetController.php | 12 +++++++++++- .../Resources/views/Pagewidget/viewfile.html.twig | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php index a9c0e37c..2cba35a8 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/FileController.php @@ -25,6 +25,7 @@ class FileController extends Controller $subdirectory=$request->get("subdirectory"); $clear=$request->get("clear"); $view=$request->get("view"); + $defaultview=$request->get("defaultview"); // Récupérer en session le dernier subdirectory visité $sessionsubdirectory = $this->get('session')->get('sessionsubdirectory'); @@ -46,7 +47,7 @@ class FileController extends Controller // Récupérer en session le mode de visualisation $sessionviewdirectory = $this->get('session')->get('sessionviewdirectory'); - if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>"small"]; + if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview]; if($view) { $sessionviewdirectory[$directory] = $view; $this->get('session')->set('sessionviewdirectory',$sessionviewdirectory); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php index a02da500..4e3df55f 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -1117,7 +1117,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setBorder(true); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); - $parameter = json_decode('{"fields": []}'); + $parameter = json_decode('{"fields": [{"id": "modelist", "loc": "col1", "type": "modelist", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}'); $entityWidget->setParameter($parameter); $em->persist($entityWidget); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php index d88f6fb6..49c28fc1 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php @@ -1606,13 +1606,23 @@ class PagewidgetController extends Controller ]); */ - + // Parametres + $view="small"; + foreach($entity->getParameter()["fields"] as $parameter) { + switch($parameter["id"]) { + case "modelist": + $view=($parameter["value"]==0?"small":"list"); + break; + } + } + return $this->render($this->labelentity.':viewfile.html.twig', [ 'entity' => $entity, 'canadd' => $canupdate, 'canupdate' => $canupdate, 'access' => $access, 'directory' => "widget-".$id, + 'view' => $view, ]); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig index 4b09b210..a13eaf62 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewfile.html.twig @@ -55,7 +55,7 @@
- +