explorer de fichier

This commit is contained in:
afornerot 2020-09-16 09:33:46 +02:00
parent 8f69cb0bc9
commit 2aff9d641b
4 changed files with 15 additions and 4 deletions

View File

@ -25,6 +25,7 @@ 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");
$defaultview=$request->get("defaultview");
// Récupérer en session le dernier subdirectory visité // Récupérer en session le dernier subdirectory visité
$sessionsubdirectory = $this->get('session')->get('sessionsubdirectory'); $sessionsubdirectory = $this->get('session')->get('sessionsubdirectory');
@ -46,7 +47,7 @@ class FileController extends Controller
// Récupérer en session le mode de visualisation // Récupérer en session le mode de visualisation
$sessionviewdirectory = $this->get('session')->get('sessionviewdirectory'); $sessionviewdirectory = $this->get('session')->get('sessionviewdirectory');
if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>"small"]; if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview];
if($view) { if($view) {
$sessionviewdirectory[$directory] = $view; $sessionviewdirectory[$directory] = $view;
$this->get('session')->set('sessionviewdirectory',$sessionviewdirectory); $this->get('session')->set('sessionviewdirectory',$sessionviewdirectory);

View File

@ -1117,7 +1117,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]); $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); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);

View File

@ -1606,6 +1606,15 @@ 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', [ return $this->render($this->labelentity.':viewfile.html.twig', [
'entity' => $entity, 'entity' => $entity,
@ -1613,6 +1622,7 @@ class PagewidgetController extends Controller
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'access' => $access, 'access' => $access,
'directory' => "widget-".$id, 'directory' => "widget-".$id,
'view' => $view,
]); ]);

View File

@ -55,7 +55,7 @@
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}">
<iframe id="frame-{{directory}}" src="{{ path("cadoles_core_"~access~"_file_list",{'directory':directory}) }}" 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>