Commit 0043bd00 authored by Tino Goratsch's avatar Tino Goratsch

Merge branch 'release/v4.16.0'

parents b70780ab 9accaf48
......@@ -14,7 +14,7 @@ interface BootstrapInterface extends HttpKernelInterface
/**
* Contains the current ACP3 version string
*/
const VERSION = '4.15.0';
const VERSION = '4.16.0';
/**
* Performs some startup checks
......
......@@ -40,6 +40,10 @@ class Title
* @var string
*/
protected $pageTitleSeparator = '-';
/**
* @var string
*/
protected $siteTitleSeparator = '|';
/**
* @var string
*/
......@@ -179,6 +183,26 @@ class Title
return $this;
}
/**
* @return string
*/
public function getSiteTitleSeparator()
{
return ' ' . $this->siteTitleSeparator . ' ';
}
/**
* @param string $value
*
* @return $this
*/
public function setSiteTitleSeparator($value)
{
$this->siteTitleSeparator = $value;
return $this;
}
/**
* Returns the title of the current page + the site title
*
......@@ -193,18 +217,17 @@ class Title
$title = $this->getPageTitle();
$separator = $this->getPageTitleSeparator();
if (!empty($this->pageTitlePrefix)) {
$title = $this->pageTitlePrefix . $separator . $title;
$title = $this->pageTitlePrefix . $this->getPageTitleSeparator() . $title;
}
if (!empty($this->getPageTitlePostfix())) {
$title .= $separator . $this->getPageTitlePostfix();
$title .= $this->getPageTitleSeparator() . $this->getPageTitlePostfix();
}
if (!empty($this->getSiteTitle())) {
$title .= ' | ' . $this->getSiteTitle();
$title .= $this->getSiteTitleSeparator() . $this->getSiteTitle();
}
if (!empty($this->getSiteSubtitle())) {
$title .= $separator . $this->getSiteSubtitle();
$title .= $this->getPageTitleSeparator() . $this->getSiteSubtitle();
}
return $title;
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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",
"google/recaptcha": "^1.1.0"
},
"autoload": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"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.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"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.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"autoload": {
"psr-4": {
......
......@@ -17,11 +17,11 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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",
"mibe/feedwriter": "^1.0"
},
"autoload": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.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"
},
"autoload": {
"psr-4": {
......
......@@ -17,13 +17,13 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.15.0",
"acp3/setup": "^4.15.0",
"acp3/module-errors": "^4.15.0",
"acp3/module-permissions": "^4.15.0",
"acp3/module-system": "^4.15.0",
"acp3/module-users": "^4.15.0",
"acp3/module-categories": "^4.15.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"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -8,7 +8,6 @@ namespace ACP3\Modules\ACP3\Gallery\Controller\Admin\Index;
use ACP3\Core;
use ACP3\Modules\ACP3\Gallery;
use ACP3\Modules\ACP3\System\Installer\Schema;
/**
* Class Edit
......@@ -24,10 +23,6 @@ class Edit extends Core\Controller\AbstractFrontendAction
* @var \ACP3\Modules\ACP3\Gallery\Validation\GalleryFormValidation
*/
protected $galleryFormValidation;
/**
* @var \ACP3\Modules\ACP3\Gallery\Model\Repository\PictureRepository
*/
protected $pictureRepository;
/**
* @var Gallery\Model\GalleryModel
*/
......@@ -38,21 +33,18 @@ class Edit extends Core\Controller\AbstractFrontendAction
*
* @param \ACP3\Core\Controller\Context\FrontendContext $context
* @param \ACP3\Core\Helpers\FormToken $formTokenHelper
* @param \ACP3\Modules\ACP3\Gallery\Model\Repository\PictureRepository $pictureRepository
* @param Gallery\Model\GalleryModel $galleryModel
* @param \ACP3\Modules\ACP3\Gallery\Validation\GalleryFormValidation $galleryFormValidation
*/
public function __construct(
Core\Controller\Context\FrontendContext $context,
Core\Helpers\FormToken $formTokenHelper,
Gallery\Model\Repository\PictureRepository $pictureRepository,
Gallery\Model\GalleryModel $galleryModel,
Gallery\Validation\GalleryFormValidation $galleryFormValidation
) {
parent::__construct($context);
$this->formTokenHelper = $formTokenHelper;
$this->pictureRepository = $pictureRepository;
$this->galleryModel = $galleryModel;
$this->galleryFormValidation = $galleryFormValidation;
}
......@@ -70,24 +62,19 @@ class Edit extends Core\Controller\AbstractFrontendAction
if (!empty($gallery)) {
$this->title->setPageTitlePrefix($gallery['title']);
return array_merge(
[
'gallery_id' => $id,
'form' => array_merge($gallery, $this->request->getPost()->all()),
'form_token' => $this->formTokenHelper->renderFormToken(),
'SEO_URI_PATTERN' => Gallery\Helpers::URL_KEY_PATTERN_GALLERY,
'SEO_ROUTE_NAME' => sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $id)
],
$this->executeListPictures($id)
);
return [
'form' => array_merge($gallery, $this->request->getPost()->all()),
'form_token' => $this->formTokenHelper->renderFormToken(),
'SEO_URI_PATTERN' => Gallery\Helpers::URL_KEY_PATTERN_GALLERY,
'SEO_ROUTE_NAME' => sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $id)
];
}
throw new Core\Controller\Exception\ResultNotExistsException();
}
/**
* @param int $id
* @param int $id
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
......@@ -105,72 +92,4 @@ class Edit extends Core\Controller\AbstractFrontendAction
return $this->galleryModel->save($formData, $id);
});
}
/**
* @param int $id
*
* @return array
*/
protected function executeListPictures($id)
{
$pictures = $this->pictureRepository->getPicturesByGalleryId($id);
/** @var Core\Helpers\DataGrid $dataGrid */
$dataGrid = $this->get('core.helpers.data_grid');
$dataGrid
->setResults($pictures)
->setRecordsPerPage($this->resultsPerPage->getResultsPerPage(Schema::MODULE_NAME))
->setIdentifier('#gallery-edit-data-grid')
->setResourcePathDelete('admin/gallery/pictures/delete/id_' . $id)
->setResourcePathEdit('admin/gallery/pictures/edit');
$this->addDataGridColumns($dataGrid);
return [
'grid' => $dataGrid->render(),
'show_mass_delete_button' => $dataGrid->countDbResults() > 0
];
}
/**
* @param Core\Helpers\DataGrid $dataGrid
*/
protected function addDataGridColumns(Core\Helpers\DataGrid$dataGrid)
{
$dataGrid
->addColumn([
'label' => $this->translator->t('gallery', 'picture'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\PictureColumnRenderer::class,
'fields' => ['id'],
'custom' => [
'pattern' => 'gallery/index/image/id_%s/action_thumb',
'isRoute' => true
]
], 40)
->addColumn([
'label' => $this->translator->t('system', 'description'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['description'],
], 30)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
if ($this->acl->hasPermission('admin/gallery/pictures/order')) {
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'order'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\SortColumnRenderer::class,
'fields' => ['pic'],
'default_sort' => true,
'custom' => [
'route_sort_down' => 'acp/gallery/pictures/order/id_%d/action_down',
'route_sort_up' => 'acp/gallery/pictures/order/id_%d/action_up',
]
], 20);
}
}
}
......@@ -9,6 +9,7 @@ namespace ACP3\Modules\ACP3\Gallery\Controller\Admin\Pictures;
use ACP3\Core\Controller\AbstractFrontendAction;
use ACP3\Core\Controller\Context\FrontendContext;
use ACP3\Core\Helpers\Forms;
use ACP3\Modules\ACP3\Gallery;
/**
* Class AbstractFormAction
......@@ -47,4 +48,12 @@ class AbstractFormAction extends AbstractFrontendAction
return $this->formsHelper->checkboxGenerator('comments', $comments, $currentValue);
}
protected function canUseComments()
{
$settings = $this->config->getSettings(Gallery\Installer\Schema::MODULE_NAME);
return $settings['overlay'] == 0 && $settings['comments'] == 1 && $this->modules->isActive('comments');
}
}
......@@ -66,12 +66,10 @@ class Create extends AbstractFormAction
$gallery = $this->galleryRepository->getGalleryTitle($id);
$this->breadcrumb
->append($gallery, 'acp/gallery/index/edit/id_' . $id)
->append($gallery, 'acp/gallery/pictures/index/id_' . $id)
->append($this->translator->t('gallery', 'admin_pictures_create'));
$settings = $this->config->getSettings(Gallery\Installer\Schema::MODULE_NAME);
if ($settings['overlay'] == 0 && $settings['comments'] == 1 && $this->modules->isActive('comments') === true) {
if ($this->canUseComments() === true) {
$this->view->assign('options', $this->getOptions('0'));
}
......@@ -111,7 +109,7 @@ class Create extends AbstractFormAction
$formData['gallery_id'] = $id;
return $this->pictureModel->save($formData);
},
'acp/gallery/index/edit/id_' . $id
'acp/gallery/pictures/index/id_' . $id
);
}
}
......@@ -98,7 +98,7 @@ class Delete extends Core\Controller\AbstractFrontendAction
return $bool;
},
'acp/gallery/pictures/delete/id_' . $id,
'acp/gallery/index/edit/id_' . $id
'acp/gallery/pictures/index/id_' . $id
);
}
}
......@@ -71,7 +71,7 @@ class Edit extends AbstractFormAction
if (!empty($picture)) {
$this->breadcrumb
->append($picture['title'], 'acp/gallery/index/edit/id_' . $picture['gallery_id'])
->append($picture['title'], 'acp/gallery/pictures/index/id_' . $picture['gallery_id'])
->append($this->translator->t('gallery', 'admin_pictures_edit'));
$this->title
......@@ -81,9 +81,7 @@ class Edit extends AbstractFormAction
. $this->translator->t('gallery', 'picture_x', ['%picture%' => $picture['pic']])
);
$settings = $this->config->getSettings(Gallery\Installer\Schema::MODULE_NAME);
if ($settings['overlay'] == 0 && $settings['comments'] == 1 && $this->modules->isActive('comments') === true) {
if ($this->canUseComments() === true) {
$this->view->assign('options', $this->getOptions($picture['comments']));
}
......@@ -129,7 +127,7 @@ class Edit extends AbstractFormAction
$formData['gallery_id'] = $picture['gallery_id'];
return $this->pictureModel->save($formData, $id);
},
'acp/gallery/index/edit/id_' . $picture['gallery_id']
'acp/gallery/pictures/index/id_' . $picture['gallery_id']
);
}
}
<?php
/**
* Copyright (c) by the ACP3 Developers.
* See the LICENCE file at the top-level module directory for licencing details.
*/
namespace ACP3\Modules\ACP3\Gallery\Controller\Admin\Pictures;
use ACP3\Core;
use ACP3\Modules\ACP3\Gallery;
use ACP3\Modules\ACP3\System\Installer\Schema;
use ACP3\Core\Controller\AbstractFrontendAction;
class Index extends AbstractFrontendAction
{
/**
* @var \ACP3\Modules\ACP3\Gallery\Model\Repository\PictureRepository
*/
protected $pictureRepository;
/**
* @var Gallery\Model\GalleryModel
*/
protected $galleryModel;
/**
* Edit constructor.
*
* @param \ACP3\Core\Controller\Context\FrontendContext $context
* @param \ACP3\Modules\ACP3\Gallery\Model\Repository\PictureRepository $pictureRepository
* @param Gallery\Model\GalleryModel $galleryModel
*/
public function __construct(
Core\Controller\Context\FrontendContext $context,
Gallery\Model\Repository\PictureRepository $pictureRepository,
Gallery\Model\GalleryModel $galleryModel
) {
parent::__construct($context);
$this->pictureRepository = $pictureRepository;
$this->galleryModel = $galleryModel;
}
/**
* @param int $id
* @return array
* @throws Core\Controller\Exception\ResultNotExistsException
*/
public function execute($id)
{
$gallery = $this->galleryModel->getOneById($id);
if (!empty($gallery)) {
$this->breadcrumb->append($gallery['title'], 'acp/gallery/pictures/index/id_' . $id);
$this->title->setPageTitlePrefix($this->translator->t('gallery', 'admin_pictures_index'));
$pictures = $this->pictureRepository->getPicturesByGalleryId($id);
/** @var Core\Helpers\DataGrid $dataGrid */
$dataGrid = $this->get('core.helpers.data_grid');
$dataGrid
->setResults($pictures)
->setRecordsPerPage($this->resultsPerPage->getResultsPerPage(Schema::MODULE_NAME))
->setIdentifier('#gallery-pictures-data-grid')
->setResourcePathDelete('admin/gallery/pictures/delete/id_' . $id)
->setResourcePathEdit('admin/gallery/pictures/edit');
$this->addDataGridColumns($dataGrid);
return [
'gallery_id' => $id,
'grid' => $dataGrid->render(),
'show_mass_delete_button' => $dataGrid->countDbResults() > 0
];
}
throw new Core\Controller\Exception\ResultNotExistsException();
}
/**
* @param Core\Helpers\DataGrid $dataGrid
*/
protected function addDataGridColumns(Core\Helpers\DataGrid $dataGrid)
{
$dataGrid
->addColumn([
'label' => $this->translator->t('gallery', 'picture'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\PictureColumnRenderer::class,
'fields' => ['id'],
'custom' => [
'pattern' => 'gallery/index/image/id_%s/action_thumb',
'isRoute' => true
]
], 40)
->addColumn([
'label' => $this->translator->t('system', 'description'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class,
'fields' => ['description'],
], 30)
->addColumn([
'label' => $this->translator->t('system', 'id'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['id'],
'primary' => true
], 10);
if ($this->acl->hasPermission('admin/gallery/pictures/order')) {
$dataGrid
->addColumn([
'label' => $this->translator->t('system', 'order'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\SortColumnRenderer::class,
'fields' => ['pic'],
'default_sort' => true,
'custom' => [
'route_sort_down' => 'acp/gallery/pictures/order/id_%d/action_down',
'route_sort_up' => 'acp/gallery/pictures/order/id_%d/action_up',
]
], 20);
}
}
}
......@@ -71,7 +71,7 @@ class Order extends Core\Controller\AbstractFrontendAction
Core\Cache\Purge::doPurge($this->appPath->getCacheDir() . 'http');
return $this->redirect()->temporary('acp/gallery/index/edit/id_' . $galleryId);
return $this->redirect()->temporary('acp/gallery/pictures/index/id_' . $galleryId);
}
throw new Core\Controller\Exception\ResultNotExistsException();
......
<?php
/**
* Copyright (c) by the ACP3 Developers.
* See the LICENCE file at the top-level module directory for licencing details.
*/
namespace ACP3\Modules\ACP3\Gallery\Event\Listener;
use ACP3\Core\ACL;
use ACP3\Core\Helpers\DataGrid\ColumnRenderer\Event\CustomOptionEvent;
use ACP3\Core\I18n\Translator;
/**
* Class OnDataGridCustomOptionBeforeListener
* @package ACP3\Modules\ACP3\Newsletter\Event\Listener
*/
class OnDataGridCustomOptionBeforeListener
{
/**
* @var \ACP3\Core\ACL
*/
protected $acl;
/**
* @var \ACP3\Core\I18n\Translator
*/
protected $translator;
/**
* OnDataGridCustomOptionBeforeListener constructor.
*