X-Git-Url: https://git.rapsys.eu/treebundle/blobdiff_plain/08adf12f23646afa31a2e1d189d8d710bec88453..0315ccbb69b5a24a5a073f7b3da82a062e62825c:/Controller/TreeController.php diff --git a/Controller/TreeController.php b/Controller/TreeController.php index 267cffa..a6e2ac1 100644 --- a/Controller/TreeController.php +++ b/Controller/TreeController.php @@ -156,12 +156,15 @@ class TreeController extends AbstractController { /** * The index page * - * Display file tree + * Display index * * @param Request $request The request instance * @return Response The rendered view */ - public function index(Request $request, string $path): Response { + public function index(Request $request): Response { + //Get roots + $this->context['roots'] = $this->config['roots']; + //Render template $response = $this->render('@RapsysTree/index.html.twig', $this->context); @@ -173,6 +176,52 @@ class TreeController extends AbstractController { return $response; } + /** + * The directory page + * + * Display directory + * + * @param Request $request The request instance + * @param string $path The directory path + * @return Response The rendered view + */ + public function directory(Request $request, string $path): Response { + header('Content-Type: text/plain'); + var_dump($path); + exit; + + //Render template + $response = $this->render('@RapsysTree/directory.html.twig', $this->context); + + $response->setEtag(md5($response->getContent())); + $response->setPublic(); + $response->isNotModified($request); + + //Return response + return $response; + } + + /** + * The document page + * + * Display document + * + * @param Request $request The request instance + * @param string $path The directory path + * @return Response The rendered view + */ + public function document(Request $request, string $path): Response { + //Render template + $response = $this->render('@RapsysTree/document.html.twig', $this->context); + + $response->setEtag(md5($response->getContent())); + $response->setPublic(); + $response->isNotModified($request); + + //Return response + return $response; + } + /** * Renders a view * @@ -227,9 +276,9 @@ class TreeController extends AbstractController { } //With empty facebook title and title - if (empty($parameters['facebook']['og:title']) && !empty($parameters['title'])) { + if (empty($parameters['facebook']['og:title']) && !empty($parameters['title']['page'])) { //Set facebook title - $parameters['facebook']['og:title'] = $parameters['title']; + $parameters['facebook']['og:title'] = $parameters['title']['page']; } //With empty facebook description and description