diff --git a/composer.json b/composer.json index 787d1f9..71bf8ca 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ "mcnd/notes-security": "dev-master", "mcnd/notes-tell": "dev-master", "swiftmailer/swiftmailer": "^6.2@dev", - "php-di/php-di": "dev-master", "league/route": "dev-master", "laminas/laminas-diactoros": "2.5.x-dev", "laminas/laminas-httphandlerrunner": "1.3.x-dev", diff --git a/meta/definitions/routes.php b/meta/definitions/routes.php index 46757d6..8712ff7 100644 --- a/meta/definitions/routes.php +++ b/meta/definitions/routes.php @@ -21,6 +21,8 @@ use Tuupola\Middleware\HttpBasicAuthentication; use Notes\Route\RouteFetcher; +use Ulmus\User\Lib\Authenticate; + use Storage\SessionMiddleware; return [ @@ -30,7 +32,7 @@ return [ $fetcher = new RouteFetcher(); $fetcher->setFolderList(array_map(function($item) { - return getenv("PROJECT_PATH") . $item; + return $item; }, $c->get(Lean\Lean::class)->getRoutable())); return $fetcher; @@ -66,11 +68,13 @@ return [ }; }, + 'routes.middlewares' => [ "errorHandler", "dump", SessionMiddleware::class, CronardMiddleware::class, HttpBasicAuthentication::class, JavascriptMiddleware::class ], + 'routes.list' => function($c) { return function (ContainerInterface $container) { $router = $container->get(Router::class); - foreach([ "errorHandler", "dump", SessionMiddleware::class, CronardMiddleware::class, HttpBasicAuthentication::class, JavascriptMiddleware::class ] as $middleware) { + foreach($container->get('routes.middlewares') as $middleware) { if ( $container->has($middleware) ) { $router->middleware($container->get($middleware)); } diff --git a/meta/definitions/software.php b/meta/definitions/software.php index 6b6984a..a70caa3 100644 --- a/meta/definitions/software.php +++ b/meta/definitions/software.php @@ -31,9 +31,7 @@ return [ ], ], - 'ulmus' => [ - 'entities' => [ 'Growlogs\\Entity' ] - ], + 'ulmus' => [], 'tell' => [ 'json' => [ @@ -56,11 +54,7 @@ return [ ] ], - 'routes' => [ - 'Growlogs\\Api' => '/src/Api/', - 'Growlogs\\Dev' => '/src/Dev/', - 'Growlogs\\Web' => '/src/Web/', - ], + 'routes' => [], ], Lean::class => autowire(Lean::class), diff --git a/meta/definitions/template.php b/meta/definitions/template.php index 02aa194..0d2c387 100644 --- a/meta/definitions/template.php +++ b/meta/definitions/template.php @@ -60,7 +60,6 @@ return [ LanguageHandler::class => function($c) { return new class( $c->get(Tell\I18n::class) ) implements LanguageHandler { - public Tell\I18n $tell; public function __construct(Tell\I18n $tell) { diff --git a/meta/i18n/en/lean.widget.json b/meta/i18n/en/lean.widget.json new file mode 100644 index 0000000..b476a87 --- /dev/null +++ b/meta/i18n/en/lean.widget.json @@ -0,0 +1,7 @@ +{ + "pagination": { + "next": "Next >", + "previous": "< Previous", + "shown": "elements shown" + } +} diff --git a/src/ControllerTrait.php b/src/ControllerTrait.php index 33684ea..4eea310 100644 --- a/src/ControllerTrait.php +++ b/src/ControllerTrait.php @@ -35,7 +35,7 @@ trait ControllerTrait { public ? MailerInterface $mailer; public array $contextList = []; - +#medias public function exportJson(ServerRequestInterface $request, string $entityClass, bool $includeRelations = true, ? callable $callback = null) : ResponseInterface { foreach($entityClass::repository()->filterServerRequest( $entityClass::searchRequest()->fromRequest($request->withQueryParams($request->getQueryParams() + ['limit' => PHP_INT_MAX,])) )->loadAll() as $entity) { diff --git a/src/Kernel.php b/src/Kernel.php index d78728e..4507b7b 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -59,7 +59,9 @@ class Kernel { // Paths and directories foreach($this->paths as $name => $envkey) { - static::putenv($name, realpath(getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . getenv($envkey))); + if ( ! getenv($name) ) { + static::putenv($name, realpath(getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . getenv($envkey))); + } } // Override using headers diff --git a/src/Lean.php b/src/Lean.php index d3d91b6..5d32238 100644 --- a/src/Lean.php +++ b/src/Lean.php @@ -41,7 +41,7 @@ class Lean public function getPiceaContext() : string { foreach(array_reverse($this->applications) as $apps) { - if ( $apps->piceaContext ) { + if ( $apps->piceaContext ?? null ) { return $apps->piceaContext; } } @@ -54,6 +54,11 @@ class Lean return array_merge(...array_map(fn($app) => $app->routes ?? [], $this->applications)); } + public function getEntities() : array + { + return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications)); + } + public function getViewPaths() : array { $list = array_merge(...array_map(fn($app) => $app->views ?? [], $this->applications)); diff --git a/view/lean/widget/message.phtml b/view/lean/widget/message.phtml index de7412b..d43e0cf 100644 --- a/view/lean/widget/message.phtml +++ b/view/lean/widget/message.phtml @@ -1,7 +1,11 @@ -
- {% foreach array_filter(array_merge($this->contextList, [ $context ?? null ])) as $name => $context %} - {% foreach $context->messages ?? [] as $message %} - {{= $message->render() }} - {% endforeach %} - {% endforeach %} -
\ No newline at end of file +{% php $messageList = array_filter(array_merge($this->contextList, [ $context ?? null ])) %} + +{% if $messageList %} +
{% php + foreach($messageList as $name => $context) { + foreach($context->messages ?? [] as $message) { + echo $message->render(); + } + } + %}
+{% endif %} \ No newline at end of file diff --git a/view/lean/widget/pagination.phtml b/view/lean/widget/pagination.phtml new file mode 100644 index 0000000..5c8c761 --- /dev/null +++ b/view/lean/widget/pagination.phtml @@ -0,0 +1,14 @@ +{% arguments string $url, int $page, int $pageCount, int $maxPage = 20 %} + + \ No newline at end of file