forked from pagemachine/typo3-formlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f1d07e4
Showing
79 changed files
with
6,303 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
root = true | ||
charset = utf-8 | ||
|
||
trim_trailing_whitespace = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.less] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.php] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.ts] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.travis.yml export-ignore | ||
bower.json export-ignore | ||
Gruntfile.js export-ignore | ||
package.json export-ignore | ||
phpcs.xml export-ignore | ||
phpstan.neon export-ignore | ||
phpunit-functional.xml export-ignore | ||
phpunit.xml export-ignore | ||
|
||
.grunt/ export-ignore | ||
Tests/ export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/bin | ||
/bower_components | ||
/composer.lock | ||
/node_modules | ||
/vendor | ||
/web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
default: | ||
- clean:css | ||
- clean:js | ||
- bower | ||
- less | ||
- umd | ||
- uglify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
install: { | ||
options: { | ||
targetDir: '<%= paths.resources.public %>', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
css: '<%= paths.resources.public %>Css/**/*.css', | ||
js: '<%= paths.resources.public %>JavaScript/**/*.js', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
options: { | ||
compress: true, | ||
ieCompat: false, | ||
// Make LESS files from components accessible | ||
paths: 'bower_components', | ||
}, | ||
files: { | ||
cwd: '<%= paths.resources.private %>Less/', | ||
src: '*.less', | ||
dest: '<%= paths.resources.public %>Css/', | ||
ext: '.css', | ||
expand: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
js: { | ||
files: [{ | ||
expand: true, | ||
cwd: '<%= paths.resources.private %>JavaScript/', | ||
src: '**/*.js', | ||
dest: '<%= paths.resources.public %>JavaScript/', | ||
}], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
daterangepicker: { | ||
src: '<%= paths.resources.public %>/JavaScript/knockout-daterangepicker/daterangepicker.js', | ||
deps: { | ||
default: ['$', 'moment', 'ko'], | ||
amd: ['jquery', 'moment', 'TYPO3/CMS/Formlog/knockout/knockout'], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
dist: trusty | ||
sudo: false | ||
language: php | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
install: | ||
- composer require typo3/cms="$TYPO3_VERSION" | ||
|
||
script: | ||
- composer test | ||
|
||
jobs: | ||
include: | ||
- php: 7.0 | ||
env: TYPO3_VERSION=^8.7 | ||
- php: 7.1 | ||
env: TYPO3_VERSION=^8.7 | ||
|
||
- &lint | ||
php: 7.0 | ||
env: PHP lint | ||
install: | ||
- composer install | ||
script: | ||
- composer lint:php | ||
- <<: *lint | ||
php: 7.1 | ||
- <<: *lint | ||
php: 7.1 | ||
env: TypoScript lint | ||
script: | ||
- composer lint:typoscript | ||
- <<: *lint | ||
php: 7.1 | ||
env: XML lint | ||
script: | ||
- composer lint:xml | ||
- <<: *lint | ||
php: 7.1 | ||
env: Codestyle | ||
script: | ||
- composer lint:style | ||
- <<: *lint | ||
php: 7.1 | ||
env: Static analysis | ||
script: | ||
- composer analyze:php | ||
|
||
- stage: deploy | ||
if: tag IS present | ||
php: 7.1 | ||
before_install: skip | ||
install: skip | ||
before_script: skip | ||
script: | | ||
echo -e "Preparing upload of release ${TRAVIS_TAG} to TER\n" | ||
TAG_ANNOTATION="$(git tag -n -l $TRAVIS_TAG)" | ||
TAG_MESSAGE="${TAG_ANNOTATION#* }" | ||
git reset --hard | ||
git clean -xfd | ||
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) | ||
composer global require helhum/ter-client dev-master | ||
echo "Uploading release ${TRAVIS_TAG} to TER" | ||
ter-client upload $(composer config extra.typo3/cms.extension-key) . -u "$TYPO3_ORG_USERNAME" -p "$TYPO3_ORG_PASSWORD" -m "$TAG_MESSAGE" | ||
notifications: | ||
slack: | ||
secure: TPgLYBAyIa6V6RT3YqndCnpkiifnY01ehmPrhVHU3G3yC4e4PtnqftgCrg8D4IBbmlVTxncNbsDqNbFfBEaJ1dMv6tv0yMpYlllfN5Syl3nBcjh43rHN4DWEffgJ59dAhJJtWjHvPfYR1/80EdKzsmepQl1i1+CXH1ryxtS6jEU= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
namespace Pagemachine\Formlog\Controller\Backend; | ||
|
||
/* | ||
* This file is part of the Pagemachine TYPO3 Formlog project. | ||
*/ | ||
|
||
use Pagemachine\Formlog\Domain\FormLog\Filters; | ||
use Pagemachine\Formlog\Domain\Repository\FormLogEntryRepository; | ||
use Pagemachine\Formlog\Mvc\View\Export\CsvView; | ||
use Pagemachine\Formlog\Mvc\View\Export\XlsxView; | ||
use TYPO3\CMS\Backend\Routing\UriBuilder; | ||
use TYPO3\CMS\Backend\View\BackendTemplateView; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; | ||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; | ||
|
||
/** | ||
* Controller for form log management | ||
*/ | ||
class FormLogController extends ActionController | ||
{ | ||
/** | ||
* @var \TYPO3\CMS\Extbase\Mvc\View\ViewInterface|\Pagemachine\Formlog\Mvc\View\ConfigurableViewInterface | ||
*/ | ||
protected $view = null; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $viewFormatToObjectNameMap = [ | ||
'csv' => CsvView::class, | ||
'xlsx' => XlsxView::class, | ||
]; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $defaultViewObjectName = BackendTemplateView::class; | ||
|
||
/** | ||
* @var FormLogEntryRepository $formLogEntryRepository | ||
*/ | ||
protected $formLogEntryRepository; | ||
|
||
/** | ||
* @param FormLogEntryRepository $formLogEntryRepository | ||
*/ | ||
public function injectFormLogEntryRepository(FormLogEntryRepository $formLogEntryRepository) | ||
{ | ||
$this->formLogEntryRepository = $formLogEntryRepository; | ||
} | ||
|
||
/** | ||
* Initialize all actions | ||
* | ||
* @return void | ||
*/ | ||
public function initializeAction() | ||
{ | ||
if ($this->arguments->hasArgument('filters')) { | ||
$this->request->setArgument('filters', $this->request->hasArgument('filters') ? $this->request->getArgument('filters') : []); | ||
$filtersArgument = $this->arguments->getArgument('filters'); | ||
$filtersArgument->getPropertyMappingConfiguration() | ||
->allowAllProperties() | ||
->forProperty('*') | ||
->allowAllProperties(); | ||
} | ||
} | ||
|
||
/** | ||
* Main overview action | ||
* | ||
* @param Filters $filters | ||
* @param array $pagination | ||
* @return void | ||
*/ | ||
public function indexAction(Filters $filters, array $pagination = []) | ||
{ | ||
$this->view->assignMultiple([ | ||
'entries' => $this->formLogEntryRepository->findAllFiltered($filters), | ||
'filters' => $filters, | ||
'pagination' => $pagination, | ||
'dateFormat' => $this->settings['dateTimeFormat'] ?: \DateTime::W3C, | ||
'isoDateFormat' => \DateTime::W3C, | ||
'daterangepickerTranslations' => $this->prepareDaterangepickerTranslations(), | ||
'inlineSettings' => [ | ||
'formlog' => [ | ||
'suggestUri' => (string)GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute('ajax_formlog_suggest'), | ||
'language' => $GLOBALS['BE_USER']->uc['lang'], | ||
'timeZone' => date_default_timezone_get(), | ||
], | ||
], | ||
]); | ||
} | ||
|
||
/** | ||
* Export CSV of form log entries | ||
* | ||
* @param Filters $filters | ||
* @return void | ||
*/ | ||
public function exportAction(Filters $filters) | ||
{ | ||
$now = new \DateTime(); | ||
$fileBasename = sprintf('formlog-%s', $now->format('Y-m-d-H-i-s')); | ||
|
||
$this->view->setConfiguration([ | ||
'columns' => $this->settings['export']['columns'], | ||
'dateTimeFormat' => $this->settings['dateTimeFormat'], | ||
'fileBasename' => $fileBasename, | ||
]); | ||
$this->view->assign('items', $this->formLogEntryRepository->findAllFiltered($filters)); | ||
} | ||
|
||
/** | ||
* Prepare localized daterangepicker labels | ||
* | ||
* @return array | ||
*/ | ||
protected function prepareDaterangepickerTranslations(): array | ||
{ | ||
$translationIdentifiers = [ | ||
'labels' => [ | ||
'applyButtonTitle', | ||
'cancelButtonTitle', | ||
'startLabel', | ||
'endLabel', | ||
], | ||
'ranges' => [ | ||
'last30days', | ||
'lastYear', | ||
'other', | ||
], | ||
'periods' => [ | ||
'day', | ||
'week', | ||
'month', | ||
'quarter', | ||
'year', | ||
], | ||
]; | ||
$translations = []; | ||
|
||
foreach ($translationIdentifiers as $section => $identifiers) { | ||
foreach ($identifiers as $identifier) { | ||
$translations[$section][$identifier] = LocalizationUtility::translate('formlog.daterangepicker.' . $section . '.' . $identifier, 'Formlog'); | ||
} | ||
} | ||
|
||
return $translations; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
namespace Pagemachine\Formlog\Controller\Backend; | ||
|
||
/* | ||
* This file is part of the Pagemachine TYPO3 Formlog project. | ||
*/ | ||
|
||
use Pagemachine\Formlog\Domain\FormLog\Suggestions; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
/** | ||
* Controller for form log suggestions | ||
*/ | ||
class FormLogSuggestController | ||
{ | ||
/** | ||
* @var Suggestions | ||
*/ | ||
protected $suggestions; | ||
|
||
/** | ||
* @param Suggestions|null $suggestions | ||
*/ | ||
public function __construct(Suggestions $suggestions = null) | ||
{ | ||
$this->suggestions = $suggestions ?: GeneralUtility::makeInstance(Suggestions::class); | ||
} | ||
|
||
/** | ||
* @param ServerRequestInterface $request | ||
* @param ResponseInterface $response | ||
* @return ResponseInterface | ||
*/ | ||
public function searchAction(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface | ||
{ | ||
$body = $request->getParsedBody(); | ||
$suggestions = $this->suggestions->getForProperty($body['property']); | ||
$response->getBody()->write(json_encode($suggestions)); | ||
|
||
return $response; | ||
} | ||
} |
Oops, something went wrong.