Commit 1ef2fd54 authored by Tino Goratsch's avatar Tino Goratsch

Merge branch 'release/v4.17.0'

parents 0043bd00 bc193876
......@@ -25,8 +25,9 @@ exclude_paths:
- "ACP3/Modules/ACP3/System/Resources/Assets/js/dataTables.bootstrap.js"
- "ACP3/Modules/ACP3/System/Resources/Assets/js/html5shiv.min.js"
- "ACP3/Modules/ACP3/System/Resources/Assets/js/jquery.dataTables.js"
- "ACP3/Modules/ACP3/System/Resources/Assets/js/jquery.fancybox.pack.js"
- "ACP3/Modules/ACP3/System/Resources/Assets/js/jquery.fancybox.min.js"
- "ACP3/Modules/ACP3/System/Resources/Assets/js/jquery.min.js"
- "ACP3/Modules/ACP3/System/Resources/Assets/js/js.cookie.js"
- "ACP3/Modules/ACP3/System/Resources/Assets/js/moment.min.js"
- "ACP3/Modules/ACP3/WYSIWYGCKEditor/Resources/Assets/js/ckeditor/plugins/**/*"
- "ACP3/Modules/ACP3/Wysiwygckeditor/Resources/Assets/js/ckeditor/plugins/**/*"
- "vendor/**/*"
......@@ -14,7 +14,7 @@ interface BootstrapInterface extends HttpKernelInterface
/**
* Contains the current ACP3 version string
*/
const VERSION = '4.16.0';
const VERSION = '4.17.0';
/**
* Performs some startup checks
......
<?php
/**
* Copyright (c) by the ACP3 Developers.
* See the LICENCE file at the top-level module directory for licencing details.
*/
namespace ACP3\Core\Helpers\DataGrid\ColumnRenderer;
use ACP3\Core\I18n\Translator;
use ACP3\Core\Router\RouterInterface;
class RouteColumnRenderer extends AbstractColumnRenderer
{
/**
* @var RouterInterface
*/
private $router;
/**
* @var Translator
*/
private $translator;
/**
* RouteColumnRenderer constructor.
* @param RouterInterface $router
* @param Translator $translator
*/
public function __construct(RouterInterface $router, Translator $translator)
{
$this->router = $router;
$this->translator = $translator;
}
/**
* @inheritdoc
*/
protected function getValue(array $column, array $dbResultRow)
{
$value = parent::getValue($column, $dbResultRow);
if (!empty($column['custom']['path'])) {
$route = $this->router->route(sprintf($column['custom']['path'], $value));
$pattern = <<<HTML
<a href="%s" target="_blank" title="%s">%s <small><i class="glyphicon glyphicon-link"></i></small></a>
HTML;
$value = sprintf(
$pattern,
$route, $this->translator->t('system', 'open_in_new_window'),
$value
);
}
return $value;
}
}
......@@ -73,6 +73,15 @@ services:
- { name: core.helpers.data_grid.column_renderer }
public: false
core.helpers.data_grid.column_renderer.route_column_renderer:
class: ACP3\Core\Helpers\DataGrid\ColumnRenderer\RouteColumnRenderer
arguments:
- '@core.router'
- '@core.i18n.translator'
tags:
- { name: core.helpers.data_grid.column_renderer }
public: false
core.helpers.data_grid.column_renderer.sort_column_renderer:
class: ACP3\Core\Helpers\DataGrid\ColumnRenderer\SortColumnRenderer
arguments:
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"autoload": {
"psr-4": {
......
......@@ -7,13 +7,14 @@
namespace ACP3\Modules\ACP3\Articles\Controller\Admin\Index;
use ACP3\Core;
use ACP3\Core\Controller\AbstractFrontendAction;
use ACP3\Modules\ACP3\Articles;
/**
* Class Create
* @package ACP3\Modules\ACP3\Articles\Controller\Admin\Index
*/
class Create extends AbstractFormAction
class Create extends AbstractFrontendAction
{
/**
* @var \ACP3\Modules\ACP3\Articles\Validation\AdminFormValidation
......@@ -27,6 +28,10 @@ class Create extends AbstractFormAction
* @var Articles\Model\ArticlesModel
*/
protected $articlesModel;
/**
* @var Core\Helpers\Forms
*/
protected $formsHelper;
/**
* @param \ACP3\Core\Controller\Context\FrontendContext $context
......@@ -42,11 +47,12 @@ class Create extends AbstractFormAction
Articles\Validation\AdminFormValidation $adminFormValidation,
Core\Helpers\FormToken $formTokenHelper
) {
parent::__construct($context, $formsHelper);
parent::__construct($context);
$this->articlesModel = $articlesModel;
$this->adminFormValidation = $adminFormValidation;
$this->formTokenHelper = $formTokenHelper;
$this->formsHelper = $formsHelper;
}
/**
......@@ -80,11 +86,8 @@ class Create extends AbstractFormAction
$this->adminFormValidation->validate($formData);
$formData['user_id'] = $this->user->getUserId();
$articleId = $this->articlesModel->save($formData);
$this->createOrUpdateMenuItem($formData, $articleId);
return $articleId;
return $this->articlesModel->save($formData);
});
}
}
......@@ -7,13 +7,14 @@
namespace ACP3\Modules\ACP3\Articles\Controller\Admin\Index;
use ACP3\Core;
use ACP3\Core\Controller\AbstractFrontendAction;
use ACP3\Modules\ACP3\Articles;
/**
* Class Edit
* @package ACP3\Modules\ACP3\Articles\Controller\Admin\Index
*/
class Edit extends AbstractFormAction
class Edit extends AbstractFrontendAction
{
/**
* @var \ACP3\Modules\ACP3\Articles\Validation\AdminFormValidation
......@@ -27,6 +28,10 @@ class Edit extends AbstractFormAction
* @var Articles\Model\ArticlesModel
*/
protected $articlesModel;
/**
* @var Core\Helpers\Forms
*/
protected $formsHelper;
/**
* @param \ACP3\Core\Controller\Context\FrontendContext $context
......@@ -42,11 +47,12 @@ class Edit extends AbstractFormAction
Articles\Validation\AdminFormValidation $adminFormValidation,
Core\Helpers\FormToken $formTokenHelper
) {
parent::__construct($context, $formsHelper);
parent::__construct($context);
$this->adminFormValidation = $adminFormValidation;
$this->formTokenHelper = $formTokenHelper;
$this->articlesModel = $articlesModel;
$this->formsHelper = $formsHelper;
}
/**
......@@ -88,11 +94,8 @@ class Edit extends AbstractFormAction
->validate($formData);
$formData['user_id'] = $this->user->getUserId();
$result = $this->articlesModel->save($formData, $id);
$this->createOrUpdateMenuItem($formData, $id);
return $result;
return $this->articlesModel->save($formData, $id);
});
}
}
......@@ -8,6 +8,7 @@ namespace ACP3\Modules\ACP3\Articles\Controller\Admin\Index;
use ACP3\Core;
use ACP3\Modules\ACP3\Articles;
use ACP3\Modules\ACP3\Articles\Helpers;
use ACP3\Modules\ACP3\System\Installer\Schema;
/**
......@@ -86,9 +87,12 @@ class Index extends Core\Controller\AbstractFrontendAction
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'type' => Core\Helpers\DataGrid\ColumnRenderer\RouteColumnRenderer::class,
'fields' => ['id'],
'primary' => true
'primary' => true,
'custom' => [
'path' => Helpers::URL_KEY_PATTERN
]
], 10);
}
}
......@@ -16,7 +16,7 @@
<div id="tab-2" class="tab-pane fade">
{include file="asset:System/Partials/form_group.input_text.tpl" name="title" value=$form.title required=true maxlength=120 data_attributes=['seo-slug-base' => 'true'] label={lang t="articles|title"}}
{include file="asset:System/Partials/form_group.wysiwyg.tpl" name="text" value=$form.text required=true advanced=true label={lang t="articles|text"}}
{event name="menus.layout.render_manage_menu_item" path=$SEO_ROUTE_NAME}
{event name="menus.layout.render_manage_menu_item" uri_pattern=$SEO_URI_PATTERN path=$SEO_ROUTE_NAME}
</div>
{event name="seo.layout.render_form_fields" uri_pattern=$SEO_URI_PATTERN path=$SEO_ROUTE_NAME}
</div>
......
......@@ -7,8 +7,6 @@ services:
- '@articles.model'
- '@articles.validation.admin_form_validation'
- '@core.helpers.formToken'
calls:
- ['setManageMenuItemHelper', ['@?menus.helpers.managemenuitem']]
articles.controller.admin.index.delete:
class: ACP3\Modules\ACP3\Articles\Controller\Admin\Index\Delete
......@@ -30,8 +28,6 @@ services:
- '@articles.model'
- '@articles.validation.admin_form_validation'
- '@core.helpers.formToken'
calls:
- ['setManageMenuItemHelper', ['@?menus.helpers.managemenuitem']]
articles.controller.admin.index.index:
class: ACP3\Modules\ACP3\Articles\Controller\Admin\Index\Index
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0",
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0",
"google/recaptcha": "^1.1.0"
},
"autoload": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"suggest": {
"acp3/module-captcha": "Provides basic protection against spam bots."
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"suggest": {
"acp3/module-captcha": "Provides basic protection against spam bots."
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"autoload": {
"psr-4": {
......
......@@ -17,11 +17,11 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0",
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0",
"mibe/feedwriter": "^1.0"
},
"autoload": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"autoload": {
"psr-4": {
......
......@@ -8,6 +8,7 @@ namespace ACP3\Modules\ACP3\Files\Controller\Admin\Index;
use ACP3\Core;
use ACP3\Modules\ACP3\Files;
use ACP3\Modules\ACP3\Files\Helpers;
use ACP3\Modules\ACP3\System\Installer\Schema;
/**
......@@ -102,9 +103,12 @@ class Index extends Core\Controller\AbstractFrontendAction
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'type' => Core\Helpers\DataGrid\ColumnRenderer\RouteColumnRenderer::class,
'fields' => ['id'],
'primary' => true
'primary' => true,
'custom' => [
'path' => Helpers::URL_KEY_PATTERN
],
], 10);
if ($this->acl->hasPermission('admin/files/index/sort') && $settings['order_by'] === 'custom') {
......
......@@ -17,13 +17,13 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0",
"acp3/module-categories": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0",
"acp3/module-categories": "^4.17.0"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -8,6 +8,7 @@ namespace ACP3\Modules\ACP3\Gallery\Controller\Admin\Index;
use ACP3\Core;
use ACP3\Modules\ACP3\Gallery;
use ACP3\Modules\ACP3\Gallery\Helpers;
use ACP3\Modules\ACP3\System\Installer\Schema;
/**
......@@ -82,9 +83,12 @@ class Index extends Core\Controller\AbstractFrontendAction
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'type' => Core\Helpers\DataGrid\ColumnRenderer\RouteColumnRenderer::class,
'fields' => ['id'],
'primary' => true
'primary' => true,
'custom' => [
'path' => Helpers::URL_KEY_PATTERN_GALLERY
],
], 10);
}
}
......@@ -8,6 +8,7 @@ namespace ACP3\Modules\ACP3\Gallery\Controller\Admin\Pictures;
use ACP3\Core;
use ACP3\Modules\ACP3\Gallery;
use ACP3\Modules\ACP3\Gallery\Helpers;
use ACP3\Modules\ACP3\System\Installer\Schema;
use ACP3\Core\Controller\AbstractFrontendAction;
......@@ -98,9 +99,12 @@ class Index extends AbstractFrontendAction
], 30)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'type' => Core\Helpers\DataGrid\ColumnRenderer\RouteColumnRenderer::class,
'fields' => ['id'],
'primary' => true
'primary' => true,
'custom' => [
'path' => Helpers::URL_KEY_PATTERN_PICTURE
]
], 10);
if ($this->acl->hasPermission('admin/gallery/pictures/order')) {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.16.0",
"acp3/setup": "^4.16.0",
"acp3/module-errors": "^4.16.0",
"acp3/module-permissions": "^4.16.0",
"acp3/module-system": "^4.16.0",
"acp3/module-users": "^4.16.0"
"acp3/core": "^4.17.0",
"acp3/setup": "^4.17.0",
"acp3/module-errors": "^4.17.0",
"acp3/module-permissions": "^4.17.0",
"acp3/module-system": "^4.17.0",
"acp3/module-users": "^4.17.0"
},
"suggest": {
"acp3/module-captcha": "Provides basic protection against spam bots."
......
......@@ -4,61 +4,41 @@
* See the LICENCE file at the top-level module directory for licencing details.
*/
namespace ACP3\Modules\ACP3\Articles\Controller\Admin\Index;
namespace ACP3\Modules\ACP3\Menus\Event\Listener;
use ACP3\Core;
use ACP3\Core\Controller\AbstractFrontendAction;
use ACP3\Modules\ACP3\Articles;
use ACP3\Modules\ACP3\Menus;
/**
* Class AbstractFormAction
* @package ACP3\Modules\ACP3\Articles\Controller\Admin\Index
*/
abstract class AbstractFormAction extends AbstractFrontendAction
use ACP3\Core\ACL;
use ACP3\Core\Model\Event\ModelSaveEvent;
use ACP3\Modules\ACP3\Menus\Helpers\ManageMenuItem;
class ManageMenuItemOnModelSaveAfterListener
{
/**
* @var Core\Helpers\Forms
*/
protected $formsHelper;
/**
* @var \ACP3\Modules\ACP3\Menus\Helpers\ManageMenuItem
* @var ManageMenuItem
*/
protected $manageMenuItemHelper;
private $menuItemManager;
/**
* AbstractFormAction constructor.
* @param Core\Controller\Context\FrontendContext $context
* @param Core\Helpers\Forms $formsHelper
* @var ACL
*/
public function __construct(
Core\Controller\Context\FrontendContext $context,
Core\Helpers\Forms $formsHelper
) {
parent::__construct($context);
$this->formsHelper = $formsHelper;
}
private $acl;
/**
* @param \ACP3\Modules\ACP3\Menus\Helpers\ManageMenuItem $manageMenuItemHelper
*
* @return $this
* OnModelSaveAfterListener constructor.
* @param ACL $acl
* @param ManageMenuItem $menuItemManager
*/
public function setManageMenuItemHelper(Menus\Helpers\ManageMenuItem $manageMenuItemHelper)
public function __construct(ACL $acl, ManageMenuItem $menuItemManager)
{
$this->manageMenuItemHelper = $manageMenuItemHelper;
return $this;
$this->menuItemManager = $menuItemManager;
$this->acl = $acl;
}
/**
* @param array $formData
* @param int $articleId
*/
protected function createOrUpdateMenuItem(array $formData, $articleId)
public function createOrUpdateMenuItem(ModelSaveEvent $event)
{
if ($this->acl->hasPermission('admin/menus/items/create') === true) {
if ($this->acl->hasPermission('admin/menus/items/create') === true
&& $this->hasNecessaryMenuItemFormFields($event->getRawData())) {
$formData = $event->getRawData();
$data = [
'mode' => 4,
'block_id' => $formData['block_id'],
......@@ -68,11 +48,26 @@ abstract class AbstractFormAction extends AbstractFrontendAction
'target' => 1
];
$this->manageMenuItemHelper->manageMenuItem(
sprintf(Articles\Helpers::URL_KEY_PATTERN, $articleId),
isset($formData['create']) === true,
$this->menuItemManager->manageMenuItem(
sprintf($formData['menu_item_uri_pattern'], $event->getEntryId()),
isset($formData['create_menu_item']) === true,
$data
);
}
}
/**