Skip to content

Commit

Permalink
Merge branch 'release/11.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianstein committed Nov 24, 2023
2 parents 8b0a175 + 4e11abe commit 38e0e66
Show file tree
Hide file tree
Showing 53 changed files with 897 additions and 650 deletions.
6 changes: 3 additions & 3 deletions .ddev/commands/host/initialize
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ mkdir -p config/sites/main
cp .project/config/typo3/config.yaml config/sites/main/
mkdir -p .build/public
cp .project/config/typo3/.htaccess .build/public/
mkdir -p .build/public/typo3conf
cp .project/config/typo3/LocalConfiguration.php .build/public/typo3conf
cp .project/config/typo3/AdditionalConfiguration.php .build/public/typo3conf
mkdir -p config/system
cp .project/config/typo3/settings.php config/system/
cp .project/config/typo3/additional.php config/system/

echo "Importing database"
ddev import-db --src=.project/data/db.sql.gz
Expand Down
2 changes: 1 addition & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: in2studyfinder
type: php
docroot: .build/public
php_version: "8.0"
php_version: "8.1"
webserver_type: apache-fpm
router_http_port: "80"
router_https_port: "443"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ var/
!.ddev/config.yaml
!.ddev/docker-compose.typo3.yaml

!.project/config
2 changes: 1 addition & 1 deletion .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<file>Classes</file>

<config name="testVersion" value="7.4-"/>
<config name="testVersion" value="8.1-"/>

<arg name="extensions" value="php" />
<arg name="basepath" value="."/>
Expand Down
2 changes: 1 addition & 1 deletion .phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="26" />
<property name="maximum" value="30" />
</properties>
</rule>
<rule ref="rulesets/unusedcode.xml" />
Expand Down
20 changes: 9 additions & 11 deletions .project/config/typo3/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
# *) Set $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] = 9 together with the TypoScript properties
# config.compressJs and config.compressCss for GZIP compression of Frontend JS and CSS files.

#<FilesMatch "\.js\.gzip$">
# AddType "text/javascript" .gzip
#<FilesMatch "\.js\.gz">
# AddType "text/javascript" .gz
#</FilesMatch>
#<FilesMatch "\.css\.gzip$">
# AddType "text/css" .gzip
#<FilesMatch "\.css\.gz">
# AddType "text/css" .gz
#</FilesMatch>
#AddEncoding gzip .gzip
#AddEncoding x-gzip .gz

<IfModule mod_deflate.c>
# Force compression for mangled `Accept-Encoding` request headers
Expand Down Expand Up @@ -111,7 +111,7 @@
# This affects Frontend and Backend and increases performance.
<IfModule mod_expires.c>

ExpiresActive on
ExpiresActive On
ExpiresDefault "access plus 1 month"

ExpiresByType text/css "access plus 1 year"
Expand Down Expand Up @@ -259,7 +259,7 @@ AddDefaultCharset utf-8
# Send the CORS header for images when browsers request it.
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
<FilesMatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$">
<FilesMatch "\.(avifs?|bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$">
SetEnvIf Origin ":" IS_CORS
Header set Access-Control-Allow-Origin "*" env=IS_CORS
</FilesMatch>
Expand All @@ -279,8 +279,6 @@ AddDefaultCharset utf-8

### Begin: Rewriting and Access ###

# You need rewriting, if you use a URL-Rewriting extension (RealURL, CoolUri).

<IfModule mod_rewrite.c>

# Enable URL rewriting
Expand All @@ -305,7 +303,7 @@ AddDefaultCharset utf-8
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ %{ENV:CWD}$1.$3 [L]
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gz)$ %{ENV:CWD}$1.$3 [L]

# Access block for folders
RewriteRule _(?:recycler|temp)_/ - [F]
Expand Down Expand Up @@ -377,7 +375,7 @@ Options -MultiViews
<IfModule mod_headers.c>
# Force IE to render pages in the highest available mode
Header set X-UA-Compatible "IE=edge"
<FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff2?|xml|xpi)$">
<FilesMatch "\.(appcache|avifs?|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff2?|xml|xpi)$">
Header unset X-UA-Compatible
</FilesMatch>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
return [
'BE' => [
'debug' => false,
'debug' => true,
'explicitADmode' => 'explicitAllow',
'installToolPassword' => '$argon2i$v=19$m=65536,t=16,p=1$Y0Zkc2tFVUFzaWs3S1JUMA$VUYXEG49usrpbDP9cKfC0GrhRAtGICi5B7HGJ4LVYtg',
'passwordHashing' => [
Expand Down Expand Up @@ -53,7 +53,7 @@
],
],
'FE' => [
'debug' => false,
'debug' => true,
'disableNoCacheParameter' => true,
'passwordHashing' => [
'className' => 'TYPO3\\CMS\\Core\\Crypto\\PasswordHashing\\Argon2iPasswordHash',
Expand Down
47 changes: 31 additions & 16 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,41 @@
use In2code\In2studyfinder\Domain\Repository\StudyCourseRepository;
use In2code\In2studyfinder\Domain\Service\CourseService;
use In2code\In2studyfinder\Service\ExportService;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

/**
* @SuppressWarnings(PHPMD.LongVariable)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class BackendController extends AbstractController
{
protected CourseService $courseService;

/**
* @var StudyCourseRepository
*/
protected $studyCourseRepository;

public function __construct(StudyCourseRepository $studyCourseRepository, CourseService $courseService)
{
protected StudyCourseRepository $studyCourseRepository;
protected ModuleTemplateFactory $moduleTemplateFactory;
protected PageRenderer $pageRenderer;

public function __construct(
StudyCourseRepository $studyCourseRepository,
CourseService $courseService,
ModuleTemplateFactory $moduleTemplateFactory,
PageRenderer $pageRenderer
) {
$this->studyCourseRepository = $studyCourseRepository;
$this->courseService = $courseService;
$this->moduleTemplateFactory = $moduleTemplateFactory;
$this->pageRenderer = $pageRenderer;
}

/**
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
*/
public function listAction(): void
public function listAction(): ResponseInterface
{
$this->validateSettings();

Expand All @@ -57,7 +65,7 @@ public function listAction(): void
$this->addFlashMessage(
LocalizationUtility::translate('messages.noCourses.body', 'in2studyfinder'),
LocalizationUtility::translate('messages.noCourses.title', 'in2studyfinder'),
AbstractMessage::WARNING
ContextualFeedbackSeverity::WARNING
);
} else {
$propertyArray =
Expand All @@ -82,6 +90,13 @@ public function listAction(): void
'itemsPerPage' => $itemsPerPage
]
);

$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/In2studyfinder/Backend/Backend');
$this->pageRenderer->addCssFile('EXT:in2studyfinder/Resources/Public/Css/backend.css');
$moduleTemplate->setContent($this->view->render());

return $this->htmlResponse($moduleTemplate->renderContent());
}

/**
Expand All @@ -98,7 +113,7 @@ public function exportAction(
$this->addFlashMessage(
LocalizationUtility::translate('messages.notAllRequiredFieldsSet.body', 'in2studyfinder'),
LocalizationUtility::translate('messages.notAllRequiredFieldsSet.title', 'in2studyfinder'),
AbstractMessage::ERROR
ContextualFeedbackSeverity::ERROR
);

$this->forward('list');
Expand All @@ -124,7 +139,7 @@ protected function getSysLanguages(): array
->from('sys_language')
->where($queryBuilder->expr()->eq('hidden', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)))
->orderBy('sorting')
->execute()->fetchAll();
->executeQuery()->fetchAllAssociative();

foreach ($languageRecords as $languageRecord) {
$sysLanguages[(int)$languageRecord['uid']] =
Expand Down Expand Up @@ -153,7 +168,7 @@ protected function getPossibleExportDataProvider(): array
$this->addFlashMessage(
'export provider class "' . $providerClass . '" was not found',
'export provider class not found',
AbstractMessage::ERROR
ContextualFeedbackSeverity::ERROR
);
} else {
$possibleDataProvider[$providerName] = $providerClass;
Expand All @@ -170,15 +185,15 @@ protected function validateSettings(): void
$this->addFlashMessage(
LocalizationUtility::translate('messages.noStoragePid.body', 'in2studyfinder'),
LocalizationUtility::translate('messages.noStoragePid.title', 'in2studyfinder'),
AbstractMessage::ERROR
ContextualFeedbackSeverity::ERROR
);
}

if (!isset($this->settings['settingsPid']) || empty($this->settings['settingsPid'])) {
$this->addFlashMessage(
LocalizationUtility::translate('messages.noSettingsPid.body', 'in2studyfinder'),
LocalizationUtility::translate('messages.noSettingsPid.title', 'in2studyfinder'),
AbstractMessage::ERROR
ContextualFeedbackSeverity::ERROR
);
}
}
Expand Down
52 changes: 19 additions & 33 deletions Classes/Controller/StudyCourseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use In2code\In2studyfinder\Utility\FlexFormUtility;
use In2code\In2studyfinder\Utility\FrontendUtility;
use In2code\In2studyfinder\Utility\RecordUtility;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand All @@ -39,40 +40,12 @@ public function __construct(
}

/**
* Strip empty options from incoming (selected) filters
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
* @param array $pluginInformation contains additional plugin information from ajax / fetch requests
*/
public function initializeFilterAction(): void
public function filterAction(array $searchOptions = [], array $pluginInformation = []): ResponseInterface
{
$this->filterService->initialize();

if ($this->request->hasArgument('searchOptions')) {
$searchOptions = array_filter((array)$this->request->getArgument('searchOptions'));
$this->request->setArgument('searchOptions', $searchOptions);

if (ConfigurationUtility::isPersistentFilterEnabled()) {
FrontendUtility::getTyposcriptFrontendController()
->fe_user
->setAndSaveSessionData('tx_in2studycourse_filter', $searchOptions);
}
} else {
if (ConfigurationUtility::isPersistentFilterEnabled()) {
$this->request->setArgument(
'searchOptions',
FrontendUtility::getTyposcriptFrontendController()
->fe_user
->getSessionData('tx_in2studycourse_filter')
);
}
}
}

/**
* @param array $pluginInformation contains additional plugin information from ajax / fetch requests
*/
public function filterAction(array $searchOptions = [], array $pluginInformation = []): void
{
if (!empty($pluginInformation)) {
// if the current call is an ajax / fetch request
$currentPluginRecord =
Expand All @@ -90,8 +63,15 @@ public function filterAction(array $searchOptions = [], array $pluginInformation
$currentPluginRecord = $this->configurationManager->getContentObject()->data;
}

$this->filterService->setSettings($this->settings);
$searchOptions = $this->filterService->sanitizeSearch($searchOptions);

if (ConfigurationUtility::isPersistentFilterEnabled()) {
$searchOptions = $this->filterService->loadOrSetPersistedFilter($searchOptions);
}

$studyCourses = $this->courseService->findBySearchOptions(
$this->filterService->setSettings($this->settings)->prepareSearchOptions($searchOptions),
$this->filterService->resolveFilterPropertyPath($searchOptions),
$currentPluginRecord
);

Expand All @@ -106,12 +86,14 @@ public function filterAction(array $searchOptions = [], array $pluginInformation
'data' => $currentPluginRecord
]
);

return $this->htmlResponse();
}

/**
* fastSearchAction
*/
public function fastSearchAction(): void
public function fastSearchAction(): ResponseInterface
{
$currentPluginRecord = $this->configurationManager->getContentObject()->data;
$studyCourses =
Expand All @@ -126,6 +108,8 @@ public function fastSearchAction(): void
'data' => $currentPluginRecord
]
);

return $this->htmlResponse();
}

/**
Expand Down Expand Up @@ -156,7 +140,7 @@ public function initializeDetailAction(): void
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/
public function detailAction(StudyCourse $studyCourse = null): void
public function detailAction(StudyCourse $studyCourse = null): ResponseInterface
{
if ($studyCourse) {
$this->courseService->setPageTitleAndMetadata($studyCourse);
Expand All @@ -166,5 +150,7 @@ public function detailAction(StudyCourse $studyCourse = null): void
} else {
$this->redirect('filterAction', null, null, null, $this->settings['flexform']['studyCourseListPage']);
}

return $this->htmlResponse();
}
}
18 changes: 7 additions & 11 deletions Classes/Domain/Repository/StudyCourseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,22 @@ public function findAllFilteredByOptions($options): QueryResultInterface
foreach ($options as $name => $array) {
if ($array[0] === 'true') {
$constraints[] = $query->logicalOr(
[
$query->logicalNot($query->equals($name, '')),
$query->greaterThan($name, 0),
]
$query->logicalNot($query->equals($name, '')),
$query->greaterThan($name, 0),
);
} elseif ($array[0] === 'false') {
$constraints[] = $query->logicalOr(
[
$query->equals($name, 0),
$query->equals($name, ''),
$query->equals($name, null),
]
$query->equals($name, 0),
$query->equals($name, ''),
$query->equals($name, null),
);
} else {
$constraints[] = $query->in($name . '.uid', $array);
}
}

if (!empty($constraints)) {
$query->matching($query->logicalAnd($constraints));
$query->matching($query->logicalAnd(...$constraints));
}

return $query->execute();
Expand Down Expand Up @@ -116,7 +112,7 @@ public function findByUidsAndLanguage(array $uids, int $sysLanguageUid): QueryRe
$constraints[] = $query->equals('sysLanguageUid', $sysLanguageUid);
}

$query->matching($query->logicalAnd($constraints));
$query->matching($query->logicalAnd(...$constraints));

return $query->execute();
}
Expand Down
Loading

0 comments on commit 38e0e66

Please sign in to comment.