From 6faf8fa9595c36d8fde186d84a68fd6b68a48758 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 25 Jun 2020 19:41:45 +0200 Subject: [PATCH] add pseudo de help doc --- Controller/BackendController.php | 20 ++++++++++++++++---- Docs/Help/de/SUMMARY.md | 3 +++ Docs/Help/de/documentation.md | 17 +++++++++++++++++ Docs/Help/de/introduction.md | 11 +++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 Docs/Help/de/SUMMARY.md create mode 100644 Docs/Help/de/documentation.md create mode 100644 Docs/Help/de/introduction.md diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 49c6048..65ba2b4 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -158,7 +158,7 @@ final class BackendController extends Controller $summaryPath = __DIR__ . '/../../' . $request->getData('id') . '/Docs/Help/en/SUMMARY.md'; $devSummaryPath = __DIR__ . '/../../' . $request->getData('id') . '/Docs/Dev/en/SUMMARY.md'; - $toParse = \file_get_contents($path); + $toParse = $path === '' ? '' : \file_get_contents($path); $summary = \file_exists($summaryPath) ? \file_get_contents($summaryPath) : ''; $devSummary = \file_exists($devSummaryPath) ? \file_get_contents($devSummaryPath) : ''; @@ -190,14 +190,26 @@ final class BackendController extends Controller if ($request->getData('page') === 'table-of-contencts' || $request->getData('page') === null) { $page = 'introduction'; } else { - $typePos = \stripos($request->getData('page'), '/'); + $decoded = \urldecode($request->getData('page')); + $typePos = \stripos($decoded, '/'); $typePos = $typePos === false ? -1 : $typePos; - $page = \substr($request->getData('page'), $typePos + 1); - $type = \substr($request->getData('page'), 0, $typePos); + $page = \substr($decoded, $typePos + 1); + $type = \substr($decoded, 0, $typePos); } $basePath = __DIR__ . '/../../' . $request->getData('id') . '/Docs/' . $type . '/' . $request->getHeader()->getL11n()->getLanguage(); $path = \realpath($basePath . '/' . $page . '.md'); + + if ($path === false) { + $basePath = __DIR__ . '/../../' . $request->getData('id') . '/Docs/' . $type . '/' . $this->app->l11nServer->getLanguage(); + $path = \realpath($basePath . '/' . $page . '.md'); + } + + if ($path === false) { + $basePath = __DIR__ . '/../../' . $request->getData('id') . '/Docs/' . $type . '/en'; + $path = \realpath($basePath . '/' . $page . '.md'); + } + if ($path === false) { $path = \realpath($basePath . '/introduction.md'); } diff --git a/Docs/Help/de/SUMMARY.md b/Docs/Help/de/SUMMARY.md new file mode 100644 index 0000000..ee41ebe --- /dev/null +++ b/Docs/Help/de/SUMMARY.md @@ -0,0 +1,3 @@ +# User Content + +* [Documentation]({%}&page=Help/documentation) \ No newline at end of file diff --git a/Docs/Help/de/documentation.md b/Docs/Help/de/documentation.md new file mode 100644 index 0000000..25d1dca --- /dev/null +++ b/Docs/Help/de/documentation.md @@ -0,0 +1,17 @@ +# Documentation + +A documentation can be added to every module by adding the `Docs/Help/{lang}` directory in the module. The language directory needs to be a 2 character ISO code. Inside of this directory you can add/find all the documentation files provided by the module. + +Mandatory files are a `SUMMARY.md` file which contains the list of all documents and a `introduction.md` file which contains a general description of the module. + +## SUMMARY.md example + +```md +# Table of Contents + +* [Link Name 1]({%}&page=Help/document_name_1) +* [Link Name 2]({%}&page=Help/document_name_2) +* [Link Name 3]({%}&page=Help/document_name_3) +``` + +![Directory Structure](Modules/Help/Docs/Help/img/directory_structure.png) \ No newline at end of file diff --git a/Docs/Help/de/introduction.md b/Docs/Help/de/introduction.md new file mode 100644 index 0000000..e23d9b5 --- /dev/null +++ b/Docs/Help/de/introduction.md @@ -0,0 +1,11 @@ +# Introduction + +The **Help** module is one of the essential core modules that is always required. This module allows other modules to provide helpful documentation for users, administrators and developers. + +## Target Group + +The target group for this module is everyone. + +# Setup + +This module doesn't have any additional setup requirements since it is installed during the application install process. This module cannot be uninstalled if it is manually deleted from the hard drive please manually download the module from the page and put it into the `Modules/` directory. \ No newline at end of file