diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php index 6491f39..3f07011 100755 --- a/Admin/Routes/Web/Api.php +++ b/Admin/Routes/Web/Api.php @@ -58,4 +58,24 @@ return [ ], ], ], + '^.*/tag/l11n$' => [ + [ + 'dest' => '\Modules\Tag\Controller\ApiController:apiTagL11nCreate', + 'verb' => RouteVerb::PUT, + 'permission' => [ + 'module' => ApiController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::TAG, + ], + ], + [ + 'dest' => '\Modules\Tag\Controller\ApiController:apiTagL11nUpdate', + 'verb' => RouteVerb::SET, + 'permission' => [ + 'module' => ApiController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::TAG, + ], + ], + ], ]; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index ef9793e..94d1fbf 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -33,7 +33,7 @@ use phpOMS\Views\View; final class BackendController extends Controller { /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -55,7 +55,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -73,34 +73,27 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Tag/Theme/Backend/tag-list'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response); + $mapper = TagMapper::getAll() + ->with('title') + ->where('title/language', $request->header->l11n->language) + ->limit(25); + if ($request->getData('ptype') === 'p') { - $view->data['tags'] = TagMapper::getAll() - ->with('title') - ->where('id', $request->getDataInt('id') ?? 0, '<') - ->where('title/language', $request->header->l11n->language) - ->limit(25) - ->execute(); + $view->data['tags'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<') + ->execute(); } elseif ($request->getData('ptype') === 'n') { - $view->data['tags'] = TagMapper::getAll() - ->with('title') - ->where('id', $request->getDataInt('id') ?? 0, '>') - ->where('title/language', $request->header->l11n->language) - ->limit(25) - ->execute(); + $view->data['tags'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>') + ->execute(); } else { - $view->data['tags'] = TagMapper::getAll() - ->with('title') - ->where('id', 0, '>') - ->where('title/language', $request->header->l11n->language) - ->limit(25) - ->execute(); + $view->data['tags'] = $mapper->where('id', 0, '>') + ->execute(); } return $view; } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -126,12 +119,14 @@ final class BackendController extends Controller $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response); $view->data['tag'] = $tag; - /** @var \phpOMS\Localization\BaseStringL11n[] $l11n */ - $l11n = TagL11nMapper::getAll() + $view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response); + + /** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */ + $l11nValues = TagL11nMapper::getAll() ->where('ref', $tag->id) ->execute(); - $view->data['l11n'] = $l11n; + $view->data['l11nValues'] = $l11nValues; return $view; } diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php index efa7d7a..7ad5b17 100755 --- a/Models/PermissionCategory.php +++ b/Models/PermissionCategory.php @@ -17,7 +17,7 @@ namespace Modules\Tag\Models; use phpOMS\Stdlib\Base\Enum; /** - * Permision state enum. + * Permission category enum. * * @package Modules\Tag\Models * @license OMS License 2.0 diff --git a/Theme/Backend/Components/TagSelector/base.tpl.php b/Theme/Backend/Components/TagSelector/base.tpl.php index 4d65644..c5be94d 100755 --- a/Theme/Backend/Components/TagSelector/base.tpl.php +++ b/Theme/Backend/Components/TagSelector/base.tpl.php @@ -14,12 +14,12 @@ ]' formaction="">book