diff --git a/.gitignore b/.gitignore index 299762e..314c779 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,8 @@ themes/ dist/ asset/static -# Local editor checkout fetched during build -exelearning/ +# Local editor checkout fetched during build (anchored to repo root so it +# does not also ignore view/exelearning/ or similar subtrees). +/exelearning/ .env .playwright-mcp/ diff --git a/Module.php b/Module.php index 0b820bc..1fee147 100644 --- a/Module.php +++ b/Module.php @@ -706,7 +706,36 @@ public function getConfigForm(PhpRenderer $renderer) $formHtml = $renderer->formCollection($form, false); - return $this->renderEditorStatusSection($renderer, $settings) . $formHtml; + return $this->renderEditorStatusSection($renderer, $settings) + . $this->renderStylesSection($renderer) + . $formHtml; + } + + /** + * Render a short section pointing to the dedicated Styles admin page. + */ + protected function renderStylesSection(PhpRenderer $renderer): string + { + $translate = function ($text) use ($renderer) { + return $renderer->translate($text); + }; + $stylesUrl = $renderer->url('admin/exelearning-styles'); + $html = '
'; + return $html; } /** diff --git a/config/module.config.php b/config/module.config.php index 2e271bc..b20a34f 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -22,23 +22,29 @@ Controller\ApiController::class => Controller\ApiControllerFactory::class, Controller\EditorController::class => Controller\EditorControllerFactory::class, Controller\ContentController::class => Controller\ContentControllerFactory::class, + Controller\StylesServeController::class => Controller\StylesServeControllerFactory::class, + Controller\Admin\StylesController::class => Controller\Admin\StylesControllerFactory::class, ], 'aliases' => [ 'ExeLearning\Controller\Editor' => Controller\EditorController::class, 'ExeLearning\Controller\Api' => Controller\ApiController::class, 'ExeLearning\Controller\Content' => Controller\ContentController::class, + 'ExeLearning\Controller\StylesServe' => Controller\StylesServeController::class, + 'ExeLearning\Controller\Admin\Styles' => Controller\Admin\StylesController::class, ], ], 'service_manager' => [ 'factories' => [ Service\ElpFileService::class => Service\ElpFileServiceFactory::class, + Service\StylesService::class => Service\StylesServiceFactory::class, ], ], 'form_elements' => [ 'invokables' => [ Form\ConfigForm::class => Form\ConfigForm::class, + Form\StylesUploadForm::class => Form\StylesUploadForm::class, ], ], @@ -74,6 +80,19 @@ ], ], ], + 'exelearning-styles-serve' => [ + 'type' => Regex::class, + 'options' => [ + 'regex' => '/exelearning/styles/(?= $escape($translate('Upload eXeLearning style packages and control which styles the embedded editor exposes. Disabled built-ins are hidden from the editor selector; uploaded styles can be enabled, disabled, or deleted at any time.')) ?>
+ ++ = sprintf( + $escape($translate('Maximum file size: %s. Only .zip packages containing a valid config.xml are accepted.')), + $escape($sizeHint) + ) ?> +
+ += $escape($translate('No uploaded styles yet.')) ?>
+ +| = $escape($translate('Title')) ?> | += $escape($translate('Id')) ?> | += $escape($translate('Version')) ?> | += $escape($translate('Installed')) ?> | += $escape($translate('Enabled')) ?> | += $escape($translate('Actions')) ?> | +
|---|---|---|---|---|---|
| = $escape($style['title'] ?? $style['id']) ?> | += $escape($style['id']) ?> |
+ = $escape($style['version'] ?? '') ?> | += $escape($style['installed_at'] ?? '') ?> | ++ + | ++ + | +
= $escape($translate('Built-in styles are not available because the embedded editor is not installed.')) ?>
+ +| = $escape($translate('Title')) ?> | += $escape($translate('Id')) ?> | += $escape($translate('Version')) ?> | += $escape($translate('Enabled')) ?> | +
|---|---|---|---|
| = $escape($style['title']) ?> | += $escape($style['id']) ?> |
+ = $escape($style['version']) ?> | ++ + | +