first commit

This commit is contained in:
2024-11-05 12:22:50 +01:00
commit e5682a3912
19641 changed files with 2948548 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<?php
/**
* 2007-2020 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2020 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
namespace PrestaShop\Module\Mbo\Controller\Admin;
use PrestaShopBundle\Controller\Admin\Improve\Modules\ModuleAbstractController;
use PrestaShopBundle\Security\Annotation\AdminSecurity;
use Symfony\Component\HttpFoundation\Response;
/**
* Responsible of "Improve > Modules > Modules Catalog" page display.
*/
class ModuleCatalogController extends ModuleAbstractController
{
/**
* Module Catalog page
*
* @AdminSecurity("is_granted(['read', 'create', 'update', 'delete'], 'ADMINMODULESSF_')")
*
* @return Response
*/
public function indexAction()
{
return $this->render(
'@PrestaShop/Admin/Module/catalog.html.twig',
[
'layoutHeaderToolbarBtn' => $this->getToolbarButtons(),
'layoutTitle' => $this->trans('Modules catalog', 'Admin.Navigation.Menu'),
'requireAddonsSearch' => true,
'requireBulkActions' => false,
'showContentHeader' => true,
'enableSidebar' => true,
'help_link' => $this->generateSidebarLink('AdminModules'),
'requireFilterStatus' => false,
'level' => $this->authorizationLevel(self::CONTROLLER_NAME),
'errorMessage' => $this->trans(
'You do not have permission to add this.',
'Admin.Notifications.Error'
),
]
);
}
}

View File

@@ -0,0 +1,95 @@
<?php
/**
* 2007-2020 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2020 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
namespace PrestaShop\Module\Mbo\Controller\Admin;
use PrestaShop\Module\Mbo\RecommendedModule\RecommendedModulePresenterInterface;
use PrestaShop\Module\Mbo\Tab\TabCollectionProviderInterface;
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
/**
* Responsible of render json data for ajax display of Recommended Modules.
*/
class ModuleRecommendedController extends FrameworkBundleAdminController
{
/**
* @var RequestStack
*/
private $requestStack;
/**
* @var TabCollectionProviderInterface
*/
private $tabCollectionProvider;
/**
* @var RecommendedModulePresenterInterface
*/
private $recommendedModulePresenter;
/**
* @param RequestStack $requestStack
* @param TabCollectionProviderInterface $tabCollectionProvider
* @param RecommendedModulePresenterInterface $recommendedModulePresenter
*/
public function __construct(
RequestStack $requestStack,
TabCollectionProviderInterface $tabCollectionProvider,
RecommendedModulePresenterInterface $recommendedModulePresenter
) {
parent::__construct();
$this->requestStack = $requestStack;
$this->tabCollectionProvider = $tabCollectionProvider;
$this->recommendedModulePresenter = $recommendedModulePresenter;
}
/**
* @return JsonResponse
*/
public function indexAction()
{
$response = new JsonResponse();
try {
$tabCollection = $this->tabCollectionProvider->getTabCollection();
$tabClassName = $this->requestStack->getCurrentRequest()->get('tabClassName');
$tab = $tabCollection->getTab($tabClassName);
$response->setData([
'content' => $this->renderView(
'@Modules/ps_mbo/views/templates/admin/controllers/module_catalog/recommended-modules.html.twig',
[
'recommendedModulesInstalled' => $this->recommendedModulePresenter->presentCollection($tab->getRecommendedModulesInstalled()),
'recommendedModulesNotInstalled' => $this->recommendedModulePresenter->presentCollection($tab->getRecommendedModulesNotInstalled()),
]
),
]);
} catch (ServiceUnavailableHttpException $exception) {
$response->setData([
'content' => $this->renderView('@Modules/ps_mbo/views/templates/admin/error.html.twig'),
]);
$response->setStatusCode($exception->getStatusCode());
$response->headers->add($exception->getHeaders());
}
return $response;
}
}

View File

@@ -0,0 +1,100 @@
<?php
/**
* 2007-2020 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2020 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
namespace PrestaShop\Module\Mbo\Controller\Admin;
use PrestaShop\Module\Mbo\AddonsSelectionLinkProvider;
use PrestaShop\Module\Mbo\ExternalContentProvider\ExternalContentProviderInterface;
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
use PrestaShopBundle\Security\Annotation\AdminSecurity;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
/**
* Responsible of "Improve > Modules > Modules Catalog > Modules Selection" page display.
*/
class ModuleSelectionController extends FrameworkBundleAdminController
{
/**
* @var RequestStack
*/
private $requestStack;
/**
* @var ExternalContentProviderInterface
*/
private $externalContentProvider;
/**
* @var AddonsSelectionLinkProvider
*/
private $addonsSelectionLinkProvider;
/**
* @param RequestStack $requestStack
* @param ExternalContentProviderInterface $externalContentCollectionProvider
* @param AddonsSelectionLinkProvider $addonsSelectionLinkProvider
*/
public function __construct(
RequestStack $requestStack,
ExternalContentProviderInterface $externalContentCollectionProvider,
AddonsSelectionLinkProvider $addonsSelectionLinkProvider
) {
parent::__construct();
$this->requestStack = $requestStack;
$this->externalContentProvider = $externalContentCollectionProvider;
$this->addonsSelectionLinkProvider = $addonsSelectionLinkProvider;
}
/**
* @AdminSecurity("is_granted('read', request.get('_legacy_controller'))")
*
* @return Response
*/
public function indexAction()
{
$response = new Response();
try {
$response->setContent($this->renderView(
'@Modules/ps_mbo/views/templates/admin/controllers/module_catalog/addons_store.html.twig',
[
'pageContent' => $this->externalContentProvider->getContent($this->addonsSelectionLinkProvider->getLinkUrl()),
'layoutHeaderToolbarBtn' => [],
'layoutTitle' => $this->trans('Module selection', 'Admin.Navigation.Menu'),
'requireAddonsSearch' => true,
'requireBulkActions' => false,
'showContentHeader' => true,
'enableSidebar' => true,
'help_link' => $this->generateSidebarLink($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
'requireFilterStatus' => false,
'level' => $this->authorizationLevel($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
]
));
} catch (ServiceUnavailableHttpException $exception) {
$response->setContent($this->renderView('@Modules/ps_mbo/views/templates/admin/error.html.twig'));
$response->setStatusCode($exception->getStatusCode());
$response->headers->add($exception->getHeaders());
}
return $response;
}
}

View File

@@ -0,0 +1,100 @@
<?php
/**
* 2007-2020 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2020 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
namespace PrestaShop\Module\Mbo\Controller\Admin;
use PrestaShop\Module\Mbo\AddonsSelectionLinkProvider;
use PrestaShop\Module\Mbo\ExternalContentProvider\ExternalContentProviderInterface;
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
use PrestaShopBundle\Security\Annotation\AdminSecurity;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
/**
* Responsible of "Improve > Design > Themes Catalog" page display.
*/
class ThemeCatalogController extends FrameworkBundleAdminController
{
/**
* @var RequestStack
*/
private $requestStack;
/**
* @var ExternalContentProviderInterface
*/
private $externalContentProvider;
/**
* @var AddonsSelectionLinkProvider
*/
private $addonsSelectionLinkProvider;
/**
* @param RequestStack $requestStack
* @param ExternalContentProviderInterface $externalContentCollectionProvider
* @param AddonsSelectionLinkProvider $addonsSelectionLinkProvider
*/
public function __construct(
RequestStack $requestStack,
ExternalContentProviderInterface $externalContentCollectionProvider,
AddonsSelectionLinkProvider $addonsSelectionLinkProvider
) {
parent::__construct();
$this->requestStack = $requestStack;
$this->externalContentProvider = $externalContentCollectionProvider;
$this->addonsSelectionLinkProvider = $addonsSelectionLinkProvider;
}
/**
* @AdminSecurity("is_granted('read', request.get('_legacy_controller'))")
*
* @return Response
*/
public function indexAction()
{
$response = new Response();
try {
$response->setContent($this->renderView(
'@Modules/ps_mbo/views/templates/admin/controllers/theme_catalog/addons_store.html.twig',
[
'pageContent' => $this->externalContentProvider->getContent($this->addonsSelectionLinkProvider->getLinkUrl()),
'layoutHeaderToolbarBtn' => [],
'layoutTitle' => $this->trans('Themes Catalog', 'Admin.Navigation.Menu'),
'requireAddonsSearch' => true,
'requireBulkActions' => false,
'showContentHeader' => true,
'enableSidebar' => true,
'help_link' => $this->generateSidebarLink($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
'requireFilterStatus' => false,
'level' => $this->authorizationLevel($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
]
));
} catch (ServiceUnavailableHttpException $exception) {
$response->setContent($this->renderView('@Modules/ps_mbo/views/templates/admin/error.html.twig'));
$response->setStatusCode($exception->getStatusCode());
$response->headers->add($exception->getHeaders());
}
return $response;
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* 2007-2020 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2020 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,28 @@
<?php
/**
* 2007-2020 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2020 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;