From 8780384b42d12966edd21fe4488d8628d6f0929d Mon Sep 17 00:00:00 2001 From: Kurt Gusbeth Date: Tue, 8 Dec 2020 15:34:49 +0100 Subject: [PATCH] version 1.4.7 path segment added --- Configuration/Routes/Default.yaml | 30 ++++++++++ .../TCA/tx_fpmasterquiz_domain_model_quiz.php | 25 +++++++- Documentation/Administrator/Index.rst | 6 +- Documentation/ChangeLog/Index.rst | 2 + Documentation/Configuration/Index.rst | 1 + Documentation/Configuration/Routing/Index.rst | 60 +++++++++++++++++++ README.md | 4 +- Resources/Private/Language/de.locallang.xlf | 3 + .../Private/Language/de.locallang_db.xlf | 3 + Resources/Private/Language/locallang.xlf | 3 + ..._csh_tx_fpmasterquiz_domain_model_quiz.xlf | 3 + Resources/Private/Language/locallang_db.xlf | 3 + ext_emconf.php | 4 +- ext_tables.sql | 2 + 14 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 Configuration/Routes/Default.yaml create mode 100644 Documentation/Configuration/Routing/Index.rst diff --git a/Configuration/Routes/Default.yaml b/Configuration/Routes/Default.yaml new file mode 100644 index 0000000..816389f --- /dev/null +++ b/Configuration/Routes/Default.yaml @@ -0,0 +1,30 @@ +# You can simply include this Route in your site configuration: +# imports: +# - { resource: "EXT:fp_masterquiz/Configuration/Routes/Default.yaml" } +routeEnhancers: + QuizPlugin: + type: Extbase + extension: FpMasterquiz + plugin: Pi1 + routes: + - { routePath: '/', _controller: 'FpMasterquiz::list' } + - { routePath: '/quiz', _controller: 'FpMasterquiz::show' } + - { routePath: '/result', _controller: 'FpMasterquiz::result' } + - routePath: '/quiz/{quiz_title}' + _controller: 'FpMasterquiz::show' + _arguments: + quiz_title: quiz + - routePath: '/result/{quiz_title}' + _controller: 'FpMasterquiz::result' + _arguments: + quiz_title: quiz + defaultController: 'FpMasterquiz::list' + requirements: + tag_title: '^[a-z0-9].*$' + aspects: + quiz_title: + type: PersistedAliasMapper + tableName: tx_fpmasterquiz_domain_model_quiz + routeFieldPattern: '^(?P.+)$' + routeFieldResult: '{path_segment}' + routeFieldName: path_segment \ No newline at end of file diff --git a/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php b/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php index 8c2bec9..733e6d9 100644 --- a/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php +++ b/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php @@ -21,10 +21,10 @@ 'iconfile' => 'EXT:fp_masterquiz/Resources/Public/Icons/tx_fpmasterquiz_domain_model_quiz.gif' ], 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, about, questions, evaluations', + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, path_segment, about, questions, evaluations', ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, about, questions, evaluations, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, path_segment, about, questions, evaluations, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -125,6 +125,27 @@ 'eval' => 'trim,required' ], ], + 'path_segment' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tx_fpmasterquiz_domain_model_quiz.path_segment', + 'config' => [ + 'type' => 'slug', + 'size' => 50, + 'generatorOptions' => [ + 'fields' => ['name'], + 'replacements' => [ + '/' => '-', + '[' => '', + ']' => '', + '(' => '', + ')' => '' + ], + ], + 'fallbackCharacter' => '-', + 'eval' => 'unique', + 'default' => '' + ] + ], 'about' => [ 'exclude' => true, 'label' => 'LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tx_fpmasterquiz_domain_model_quiz.about', diff --git a/Documentation/Administrator/Index.rst b/Documentation/Administrator/Index.rst index a76e31f..bc0926e 100644 --- a/Documentation/Administrator/Index.rst +++ b/Documentation/Administrator/Index.rst @@ -76,4 +76,8 @@ FAQ - How can I rename or hide some fields in the Backend? - See chapter “Configuration / Page TSConfig”. \ No newline at end of file + See chapter “Configuration / Page TSConfig”. + +- How can I use routing / speaking urls? + + See chapter “Configuration / Routing”. \ No newline at end of file diff --git a/Documentation/ChangeLog/Index.rst b/Documentation/ChangeLog/Index.rst index c57e6b6..65d7a22 100644 --- a/Documentation/ChangeLog/Index.rst +++ b/Documentation/ChangeLog/Index.rst @@ -60,6 +60,8 @@ ChangeLog Important bugfix for PHP 7.3 and other bugfixes points related. 1.5.0: Bodytext and image added to the evaluation. + Routing/slug/path segment added to a quiz. Categories added to a quiz. Layout of yes/no-questions changed. Another bugfix points related. + See issues #12 - #16. diff --git a/Documentation/Configuration/Index.rst b/Documentation/Configuration/Index.rst index 34324c6..89749be 100644 --- a/Documentation/Configuration/Index.rst +++ b/Documentation/Configuration/Index.rst @@ -264,3 +264,4 @@ FAQ :glob: PageTSconfig/Index + Routing/Index diff --git a/Documentation/Configuration/Routing/Index.rst b/Documentation/Configuration/Routing/Index.rst new file mode 100644 index 0000000..1a1f4d8 --- /dev/null +++ b/Documentation/Configuration/Routing/Index.rst @@ -0,0 +1,60 @@ +.. include:: ../../Includes.txt + +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. ================================================== +.. DEFINE SOME TEXTROLES +.. -------------------------------------------------- +.. role:: underline +.. role:: typoscript(code) +.. role:: ts(typoscript) + :class: typoscript +.. role:: php(code) + + +Frontend Routing Setup +^^^^^^^^^^^^^^^^^^^^^^ + +The extension provides a frontend route enhancer configuration that you can include +in your site configuration `config/sites/mysite/config.yaml`. + +.. code-block:: yaml + + imports: + - { resource: "EXT:fp_masterquiz/Configuration/Routes/Default.yaml" } + +Feel free to modify or enhance this configuration. + +Note: every quiz must have set the path segment before you can use this feature! + + +Example +~~~~~~~ + +You write your own frontend route configuration by adding the following to your site configuration:: + + routeEnhancers: + QuizPlugin: + type: Extbase + extension: FpMasterquiz + plugin: Pi1 + routes: + - { routePath: '/', _controller: 'FpMasterquiz::list' } + - { routePath: '/umfrage', _controller: 'FpMasterquiz::show' } + - routePath: '/umfrage/{quiz_title}' + _controller: 'FpMasterquiz::show' + _arguments: + quiz_title: quiz + defaultController: 'FpMasterquiz::list' + requirements: + tag_title: '^[a-z0-9].*$' + aspects: + quiz_title: + type: PersistedAliasMapper + tableName: tx_fpmasterquiz_domain_model_quiz + routeFieldPattern: '^(?P.+)$' + routeFieldResult: '{path_segment}' + routeFieldName: path_segment \ No newline at end of file diff --git a/README.md b/README.md index 8b25594..a01132a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # fp_masterquiz -version 1.4.6 +version 1.4.7 TYPO3 extension to create a quiz, poll or test. The participant result will be saved in the DB too and can be deleted automatically via Scheduler. @@ -10,4 +10,4 @@ Features: a quiz, poll or test can be played by submitting a form or by submitti You find the documentation at typo3.org: https://docs.typo3.org/p/fixpunkt/fp-masterquiz/master/en-us/ -Last feature: categories for a quiz. \ No newline at end of file +Last feature: routing added. \ No newline at end of file diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index ea05dce..003a2e2 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -12,6 +12,9 @@ Beschreibung + + Sprechendes Url Segment + Fragen diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 095769f..37e01d8 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -18,6 +18,9 @@ Beschreibung dieses Quiz/Test + + Sprechendes Url Segment + Fragen des Quiz diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 56bb177..556d24e 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -12,6 +12,9 @@ About + + Path segment + Questions diff --git a/Resources/Private/Language/locallang_csh_tx_fpmasterquiz_domain_model_quiz.xlf b/Resources/Private/Language/locallang_csh_tx_fpmasterquiz_domain_model_quiz.xlf index ce418a5..0f343a6 100644 --- a/Resources/Private/Language/locallang_csh_tx_fpmasterquiz_domain_model_quiz.xlf +++ b/Resources/Private/Language/locallang_csh_tx_fpmasterquiz_domain_model_quiz.xlf @@ -9,6 +9,9 @@ Text about this quiz + + Path segment + Questions diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 766f4bc..f1186d6 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -18,6 +18,9 @@ Text about this quiz + + Path segment + Questions diff --git a/ext_emconf.php b/ext_emconf.php index d22d9f5..5441356 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -12,7 +12,7 @@ $EM_CONF[$_EXTKEY] = [ 'title' => 'Master-Quiz', - 'description' => 'A modern extension that offers quiz, polls and tests. The result can be displayed as a chart. Supports 7 question modes.', + 'description' => 'A modern extension that offers quiz, polls and tests. The result can be displayed as a chart too. Supports 7 question modes.', 'category' => 'plugin', 'author' => 'Kurt Gusbeth', 'author_email' => 'info@quizpalme.de', @@ -20,7 +20,7 @@ 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '1.4.6', + 'version' => '1.4.7', 'constraints' => [ 'depends' => [ 'typo3' => '9.5.20-10.4.99', diff --git a/ext_tables.sql b/ext_tables.sql index 04aa999..9c688a5 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -10,6 +10,7 @@ CREATE TABLE tx_fpmasterquiz_domain_model_quiz ( about text, questions int(11) unsigned DEFAULT '0' NOT NULL, evaluations int(11) unsigned DEFAULT '0' NOT NULL, + path_segment varchar(2048), categories int(11) unsigned DEFAULT '0' NOT NULL, tstamp int(11) unsigned DEFAULT '0' NOT NULL, @@ -38,6 +39,7 @@ CREATE TABLE tx_fpmasterquiz_domain_model_quiz ( PRIMARY KEY (uid), KEY parent (pid), + KEY path_segment (path_segment(185),uid), KEY t3ver_oid (t3ver_oid,t3ver_wsid), KEY language (l10n_parent,sys_language_uid)