From 7f45e5cdf715722a106c34df2e3d2041559de820 Mon Sep 17 00:00:00 2001 From: Andreas Pfeiffer Date: Fri, 28 Jan 2022 14:05:25 +0100 Subject: [PATCH 01/11] [TASK] Initialize extension --- .editorconfig | 56 ++++++ Classes/Controller/MessageController.php | 35 ++++ Configuration/Icons.php | 22 +++ Configuration/Services.yaml | 8 + Configuration/TCA/Overrides/pages.php | 18 ++ Configuration/TCA/Overrides/sys_template.php | 10 + Configuration/TCA/Overrides/tt_content.php | 65 ++++++ ...ubprofilemessages_domain_model_message.php | 187 ++++++++++++++++++ Configuration/TsConfig/Page.tsconfig | 18 ++ Configuration/TypoScript/constants.typoscript | 3 + Configuration/TypoScript/setup.typoscript | 9 + README.md | 28 +++ .../Private/Language/de.locallang_backend.xlf | 26 +++ .../Private/Language/de.locallang_db.xlf | 25 +++ .../Private/Language/locallang_backend.xlf | 23 +++ Resources/Private/Language/locallang_db.xlf | 22 +++ Resources/Public/Icons/Extension.svg | 1 + Resources/Public/Icons/Model/message.svg | 5 + Resources/Public/Icons/Overlay/extension.svg | 6 + .../Public/Icons/PageTree/message-folder.svg | 4 + .../Public/Icons/Wizard/message-list.svg | 10 + composer.json | 29 +++ ext_emconf.php | 28 +++ ext_localconf.php | 25 +++ ext_tables.sql | 22 +++ 25 files changed, 685 insertions(+) create mode 100644 .editorconfig create mode 100644 Classes/Controller/MessageController.php create mode 100644 Configuration/Icons.php create mode 100644 Configuration/Services.yaml create mode 100644 Configuration/TCA/Overrides/pages.php create mode 100644 Configuration/TCA/Overrides/sys_template.php create mode 100644 Configuration/TCA/Overrides/tt_content.php create mode 100644 Configuration/TCA/tx_slubprofilemessages_domain_model_message.php create mode 100644 Configuration/TsConfig/Page.tsconfig create mode 100644 Configuration/TypoScript/constants.typoscript create mode 100644 Configuration/TypoScript/setup.typoscript create mode 100644 Resources/Private/Language/de.locallang_backend.xlf create mode 100644 Resources/Private/Language/de.locallang_db.xlf create mode 100644 Resources/Private/Language/locallang_backend.xlf create mode 100644 Resources/Private/Language/locallang_db.xlf create mode 100644 Resources/Public/Icons/Extension.svg create mode 100644 Resources/Public/Icons/Model/message.svg create mode 100644 Resources/Public/Icons/Overlay/extension.svg create mode 100644 Resources/Public/Icons/PageTree/message-folder.svg create mode 100644 Resources/Public/Icons/Wizard/message-list.svg create mode 100644 composer.json create mode 100644 ext_emconf.php create mode 100644 ext_localconf.php create mode 100644 ext_tables.sql diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b0b42d7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,56 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +# TS/JS-Files +[*.{ts,js}] +indent_size = 2 + +# JSON-Files +[*.json] +indent_style = tab + +# ReST-Files +[*.rst] +indent_size = 4 +max_line_length = 80 + +# YAML-Files +[*.{yaml,yml}] +indent_size = 2 + +# NEON-Files +[*.neon] +indent_size = 2 +indent_style = tab + +# package.json +[package.json] +indent_size = 2 + +# TypoScript +[*.{typoscript,tsconfig}] +indent_size = 2 + +# XLF-Files +[*.xlf] +indent_style = tab + +# SQL-Files +[*.sql] +indent_style = tab +indent_size = 2 + +# .htaccess +[{_.htaccess,.htaccess}] +indent_style = tab \ No newline at end of file diff --git a/Classes/Controller/MessageController.php b/Classes/Controller/MessageController.php new file mode 100644 index 0000000..783a1d9 --- /dev/null +++ b/Classes/Controller/MessageController.php @@ -0,0 +1,35 @@ +view->setVariablesToRender(['messageList']); + $this->view->assign('messageList', $messages); + + return $this->jsonResponse(); + } +} diff --git a/Configuration/Icons.php b/Configuration/Icons.php new file mode 100644 index 0000000..f9cf9aa --- /dev/null +++ b/Configuration/Icons.php @@ -0,0 +1,22 @@ + [ + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + 'source' => 'EXT:slub_profile_messages/Resources/Public/Icons/Overlay/extension.svg' + ], + 'slubprofilemessages-model-message' => [ + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + 'source' => 'EXT:slub_profile_messages/Resources/Public/Icons/Model/message.svg' + ], + 'slubprofilemessages-pagetree-messagefolder' => [ + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + 'source' => 'EXT:slub_profile_messages/Resources/Public/Icons/PageTree/message-folder.svg' + ], + 'slubprofilemessages-wizard-messagelist' => [ + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + 'source' => 'EXT:slub_profile_messages/Resources/Public/Icons/Wizard/message-list.svg' + ], +]; diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..67a0fa9 --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,8 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + Slub\SlubProfileMessages\: + resource: '../Classes/*' diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php new file mode 100644 index 0000000..5afa39d --- /dev/null +++ b/Configuration/TCA/Overrides/pages.php @@ -0,0 +1,18 @@ + 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_backend.xlf', + 'core' => 'LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf', + 'frontend' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf', + ]; + + // Add new group to ctype selector + TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItemGroup( + 'tt_content', + 'CType', + $extensionName, + $ll['backend'] . ':plugin.title', + 'after:default' // Should be the same like "common" in page tsconfig + ); + + foreach ($pluginNames as $pluginName) { + // Merge content element definition + TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['tt_content'], [ + 'ctrl' => [ + 'typeicon_classes' => [ + $extensionName . '_' . $pluginName => $extensionName . '-wizard-' . $pluginName, + ], + ], + 'types' => [ + $extensionName . '_' . $pluginName => [ + 'showitem' => ' + --div--;' . $ll['core'] . ':general, + --palette--;;general, + --palette--;;headers, + --div--;' . $ll['core'] . ':language, + --palette--;;language, + --div--;' . $ll['core'] . ':access, + --palette--;;hidden, + --palette--;;access, + --div--;' . $ll['core'] . ':notes, + rowDescription, + --div--;' . $ll['core'] . ':extended', + ], + ], + ]); + + // Add item to select field list (ctype) + TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( + 'tt_content', + 'CType', + [ + $ll['backend'] . ':plugin.' . $pluginName . '.title', // Title + $extensionName . '_' . $pluginName, // CType + $extensionName . '-wizard-' . $pluginName, // Icon identifier + $extensionName // Item group id + ] + ); + } +})( + 'slub_profile_messages', + [ + 'messagelist' + ] +); diff --git a/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php b/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php new file mode 100644 index 0000000..34e78bd --- /dev/null +++ b/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php @@ -0,0 +1,187 @@ + [ + 'general' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf', + 'tabs' => 'LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf', + 'tca' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf' + ], + 'frontend' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf', + 'slubProfileMessages' => 'LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_db.xlf' +]; + +return [ + 'ctrl' => [ + 'title' => $ll['slubProfileMessages'] . ':tx_slubprofilemessages_domain_model_message', + 'label' => 'title', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'editlock' => 'editlock', + 'delete' => 'deleted', + 'sortby' => 'sorting', + 'enablecolumns' => [ + 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime', + 'fe_group' => 'fe_group' + ], + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', + 'transOrigDiffSourceField' => 'l18n_diffsource', + 'descriptionColumn' => 'description', + 'translationSource' => 'l10n_source', + 'origUid' => 't3_origuid', + 'versioningWS' => true, + 'searchFields' => 'title, content', + 'typeicon_classes' => [ + 'default' => 'slubprofilemessages-model-message' + ], + ], + 'types' => [ + '0' => [ + 'showitem' => ' + --div--;' . $ll['core']['tabs'] . ':general, + title, content, + --div--;' . $ll['core']['tabs'] . ':language, + --palette--;;language, + --div--;' . $ll['core']['tabs'] . ':access, + --palette--;;hidden, + --palette--;;access, + --div--;' . $ll['core']['tabs'] . ':extended' + ] + ], + 'palettes' => [ + 'access' => [ + 'label' => $ll['frontend'] . ':palette.access', + 'showitem' => ' + starttime;' . $ll['frontend'] . ':starttime_formlabel, + endtime;' . $ll['frontend'] . ':endtime_formlabel, + --linebreak--, + editlock + ', + ], + 'hidden' => [ + 'showitem' => ' + hidden;' . $ll['frontend'] . ':field.default.hidden + ', + ], + 'language' => [ + 'showitem' => ' + sys_language_uid;' . $ll['frontend'] . ':sys_language_uid_formlabel, + l18n_parent + ', + ], + ], + 'columns' => [ + 'editlock' => [ + 'exclude' => true, + 'displayCond' => 'HIDE_FOR_NON_ADMINS', + 'label' => $ll['core']['tca'] . ':editlock', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + ], + ], + 'sys_language_uid' => [ + 'exclude' => true, + 'label' => $ll['core']['general'] . ':LGL.language', + 'config' => [ + 'type' => 'language' + ] + ], + 'l18n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'label' => $ll['core']['general'] . ':LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'items' => [ + ['', 0] + ], + 'foreign_table' => 'tx_slubprofilemessages_domain_model_message', + 'foreign_table_where' => 'AND tx_slubprofilemessages_domain_model_message.pid=###CURRENT_PID### AND tx_slubprofilemessages_domain_model_message.sys_language_uid IN (-1,0)', + 'default' => 0 + ] + ], + 'l18n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + 'default' => '' + ] + ], + 'hidden' => [ + 'exclude' => true, + 'label' => $ll['core']['general'] . ':LGL.hidden', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + 'invertStateDisplay' => true + ] + ] + ] + ], + 'starttime' => [ + 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'label' => $ll['frontend'] . ':starttime_formlabel', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime', + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ] + ] + ], + 'endtime' => [ + 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'label' => $ll['frontend'] . ':endtime_formlabel', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime', + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ] + ] + ], + 'title' => [ + 'exclude' => true, + 'l10n_mode' => 'prefixLangTitle', + 'label' => $ll['slubProfileMessages'] . ':tx_slubprofilemessages_domain_model_message.title', + 'config' => [ + 'type' => 'input', + 'eval' => 'trim,required', + ] + ], + 'content' => [ + 'exclude' => true, + 'l10n_mode' => 'prefixLangTitle', + 'label' => $ll['slubProfileMessages'] . ':tx_slubprofilemessages_domain_model_message.content', + 'config' => [ + 'type' => 'text', + 'rows' => 5, + 'cols' => 30, + 'eval' => 'trim', + ] + ], + ] +]; diff --git a/Configuration/TsConfig/Page.tsconfig b/Configuration/TsConfig/Page.tsconfig new file mode 100644 index 0000000..549acce --- /dev/null +++ b/Configuration/TsConfig/Page.tsconfig @@ -0,0 +1,18 @@ +mod { + wizards.newContentElement.wizardItems.slubprofilemessages { + after = common + header = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.title + + elements { + slubprofilemessages_messagelist { + iconIdentifier = slubprofilemessages-wizard-messagelist + iconOverlay = slubprofilemessages-overlay-extension + title = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.messagelist.title + description = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.messagelist.description + tt_content_defValues.CType = slubprofilemessages_messagelist + } + } + + show := addToList(slubprofilemessages_messagelist) + } +} diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript new file mode 100644 index 0000000..c9b1268 --- /dev/null +++ b/Configuration/TypoScript/constants.typoscript @@ -0,0 +1,3 @@ +plugin.tx_slubprofilemessages { + persistence.storagePid = 18 +} diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript new file mode 100644 index 0000000..8fd3f46 --- /dev/null +++ b/Configuration/TypoScript/setup.typoscript @@ -0,0 +1,9 @@ +plugin.tx_slubprofilemessages { + mvc { + callDefaultActionIfActionCantBeResolved = 1 + throwPageNotFoundExceptionIfActionCantBeResolved = 1 + } + + features.skipDefaultArguments = 1 + persistence.storagePid = {$plugin.tx_slubprofilemessages.persistence.storagePid} +} diff --git a/README.md b/README.md index 2f78e8c..d1ebff8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,30 @@ # slub-profile-messages SLUB profile service messages extension for TYPO3. + + +# TYPO3 Extension `slub_profile_messages` + +[![TYPO3](https://img.shields.io/badge/TYPO3-11-orange.svg)](https://typo3.org/) + +SLUB profile service messages extension for TYPO3. + +## 1 Usage + +### 1.1 Installation using Composer + +The recommended way to install the extension is using [Composer][1]. + +Run the following command within your Composer based TYPO3 project: + +``` +composer require slub/slub-profile-messages +``` + +## 2 Administration corner + +### 2.1 Release Management + +News uses [semantic versioning][2], which means, that +* **bugfix updates** (e.g. 1.0.0 => 1.0.1) just includes small bugfixes or security relevant stuff without breaking changes, +* **minor updates** (e.g. 1.0.0 => 1.1.0) includes new features and smaller tasks without breaking changes, +* **major updates** (e.g. 1.0.0 => 2.0.0) breaking changes which can be refactorings, features or bugfixes. diff --git a/Resources/Private/Language/de.locallang_backend.xlf b/Resources/Private/Language/de.locallang_backend.xlf new file mode 100644 index 0000000..7d76dfc --- /dev/null +++ b/Resources/Private/Language/de.locallang_backend.xlf @@ -0,0 +1,26 @@ + + + +
+ + + + + + Messages + Meldung + + + + Message list + Liste mit Meldungen + + + List of messages depends at user category. + Liste mit Meldungen in Abhängigkeit der Benutzerkategorie + + + + diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf new file mode 100644 index 0000000..2fcaa30 --- /dev/null +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -0,0 +1,25 @@ + + + +
+ + + + + + Message + Meldung + + + Title + Titel + + + Content + Content + + + + diff --git a/Resources/Private/Language/locallang_backend.xlf b/Resources/Private/Language/locallang_backend.xlf new file mode 100644 index 0000000..642eac6 --- /dev/null +++ b/Resources/Private/Language/locallang_backend.xlf @@ -0,0 +1,23 @@ + + + +
+ + + + + + Messages + + + + Message list + + + List of messages depends at user category. + + + + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf new file mode 100644 index 0000000..c64298c --- /dev/null +++ b/Resources/Private/Language/locallang_db.xlf @@ -0,0 +1,22 @@ + + + +
+ + + + + + Message + + + Title + + + Content + + + + diff --git a/Resources/Public/Icons/Extension.svg b/Resources/Public/Icons/Extension.svg new file mode 100644 index 0000000..881918c --- /dev/null +++ b/Resources/Public/Icons/Extension.svg @@ -0,0 +1 @@ + diff --git a/Resources/Public/Icons/Model/message.svg b/Resources/Public/Icons/Model/message.svg new file mode 100644 index 0000000..4d0d6dd --- /dev/null +++ b/Resources/Public/Icons/Model/message.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/Resources/Public/Icons/Overlay/extension.svg b/Resources/Public/Icons/Overlay/extension.svg new file mode 100644 index 0000000..24db569 --- /dev/null +++ b/Resources/Public/Icons/Overlay/extension.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Resources/Public/Icons/PageTree/message-folder.svg b/Resources/Public/Icons/PageTree/message-folder.svg new file mode 100644 index 0000000..c711bef --- /dev/null +++ b/Resources/Public/Icons/PageTree/message-folder.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Resources/Public/Icons/Wizard/message-list.svg b/Resources/Public/Icons/Wizard/message-list.svg new file mode 100644 index 0000000..1161e96 --- /dev/null +++ b/Resources/Public/Icons/Wizard/message-list.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4149f61 --- /dev/null +++ b/composer.json @@ -0,0 +1,29 @@ +{ + "name": "slub/slub-profile-messages", + "type": "typo3-cms-extension", + "description": "SLUB profile service messages extension for TYPO3", + "authors": [ + { + "name": "Andreas Pfeiffer", + "role": "Developer" + } + ], + "version": "0.1.0", + "license": "GPL-2.0-or-later", + "require": { + "typo3/cms-core": "^11" + }, + "replace": { + "typo3-ter/slub-profile-messages": "self.version" + }, + "autoload": { + "psr-4": { + "Slub\\SlubProfileMessages\\": "Classes/" + } + }, + "extra": { + "typo3/cms": { + "extension-key": "slub_profile_messages" + } + } +} diff --git a/ext_emconf.php b/ext_emconf.php new file mode 100644 index 0000000..7285682 --- /dev/null +++ b/ext_emconf.php @@ -0,0 +1,28 @@ + 'SLUB profile messages', + 'description' => 'SLUB profile messages account extension for TYPO3', + 'category' => 'fe', + 'author' => 'Andreas Pfeiffer', + 'author_email' => 'andreas.pfeiffer@e-pixler.com', + 'author_company' => 'e-pixler', + 'shy' => '', + 'priority' => '', + 'module' => '', + 'state' => 'stable', + 'internal' => '', + 'uploadfolder' => 1, + 'createDirs' => '', + 'modify_tables' => '', + 'clearCacheOnLoad' => 1, + 'lockType' => '', + 'version' => '0.1.0', + 'constraints' => [ + 'depends' => [ + 'typo3' => '11.0.0-11.5.99' + ], + 'conflicts' => [], + 'suggests' => [], + ], +]; diff --git a/ext_localconf.php b/ext_localconf.php new file mode 100644 index 0000000..c6868b4 --- /dev/null +++ b/ext_localconf.php @@ -0,0 +1,25 @@ + 'list' + ], + [ + MessageController::class => 'list' + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT +); diff --git a/ext_tables.sql b/ext_tables.sql new file mode 100644 index 0000000..a53b408 --- /dev/null +++ b/ext_tables.sql @@ -0,0 +1,22 @@ +# +# Table structure for table 'tx_slubprofilemessages_domain_model_message' +# +CREATE TABLE tx_slubprofilemessages_domain_model_message ( + uid int(11) unsigned DEFAULT 0 NOT NULL auto_increment, + pid int(11) DEFAULT 0 NOT NULL, + + title varchar(255) NOT NULL, + message text, + + tstamp int(11) unsigned DEFAULT 0 NOT NULL, + crdate int(11) unsigned DEFAULT 0 NOT NULL, + deleted tinyint(4) unsigned DEFAULT 0 NOT NULL, + hidden tinyint(4) unsigned DEFAULT 0 NOT NULL, + sys_language_uid int(11) DEFAULT 0 NOT NULL, + l18n_parent int(11) DEFAULT 0 NOT NULL, + l18n_diffsource mediumblob NOT NULL, + fe_group int(11) DEFAULT 0 NOT NULL, + + PRIMARY KEY (uid), + KEY parent (pid), +); From 3fbf81db046281886742b6b5b821bae8dab3ccf8 Mon Sep 17 00:00:00 2001 From: Andreas Pfeiffer Date: Fri, 28 Jan 2022 15:09:41 +0100 Subject: [PATCH 02/11] [TASK] Refactor icons and database --- Classes/Utility/ConstantsUtility.php | 18 ++++++++++++++++++ Configuration/TCA/Overrides/pages.php | 2 +- Resources/Public/Icons/Extension.svg | 2 +- Resources/Public/Icons/Model/message.svg | 4 ++-- Resources/Public/Icons/Overlay/extension.svg | 2 +- .../Public/Icons/PageTree/message-folder.svg | 2 +- Resources/Public/Icons/Wizard/message-list.svg | 6 +++--- ext_tables.sql | 2 +- 8 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 Classes/Utility/ConstantsUtility.php diff --git a/Classes/Utility/ConstantsUtility.php b/Classes/Utility/ConstantsUtility.php new file mode 100644 index 0000000..570cc56 --- /dev/null +++ b/Classes/Utility/ConstantsUtility.php @@ -0,0 +1,18 @@ + + diff --git a/Resources/Public/Icons/Model/message.svg b/Resources/Public/Icons/Model/message.svg index 4d0d6dd..55af9dd 100644 --- a/Resources/Public/Icons/Model/message.svg +++ b/Resources/Public/Icons/Model/message.svg @@ -1,5 +1,5 @@ - - + + diff --git a/Resources/Public/Icons/Overlay/extension.svg b/Resources/Public/Icons/Overlay/extension.svg index 24db569..99ac47b 100644 --- a/Resources/Public/Icons/Overlay/extension.svg +++ b/Resources/Public/Icons/Overlay/extension.svg @@ -1,5 +1,5 @@ - + diff --git a/Resources/Public/Icons/PageTree/message-folder.svg b/Resources/Public/Icons/PageTree/message-folder.svg index c711bef..1f5cc56 100644 --- a/Resources/Public/Icons/PageTree/message-folder.svg +++ b/Resources/Public/Icons/PageTree/message-folder.svg @@ -1,4 +1,4 @@ - + diff --git a/Resources/Public/Icons/Wizard/message-list.svg b/Resources/Public/Icons/Wizard/message-list.svg index 1161e96..eea4d11 100644 --- a/Resources/Public/Icons/Wizard/message-list.svg +++ b/Resources/Public/Icons/Wizard/message-list.svg @@ -1,10 +1,10 @@ - + - + - + diff --git a/ext_tables.sql b/ext_tables.sql index a53b408..8fd634d 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -6,7 +6,7 @@ CREATE TABLE tx_slubprofilemessages_domain_model_message ( pid int(11) DEFAULT 0 NOT NULL, title varchar(255) NOT NULL, - message text, + content text, tstamp int(11) unsigned DEFAULT 0 NOT NULL, crdate int(11) unsigned DEFAULT 0 NOT NULL, From daa9bd408d893883516f4facba3ca85b98e79db4 Mon Sep 17 00:00:00 2001 From: Andreas Pfeiffer Date: Mon, 31 Jan 2022 17:22:54 +0100 Subject: [PATCH 03/11] [TASK] Extend data structure --- Configuration/RTE/Message.yaml | 25 +++++++++++++++++ Configuration/TCA/Overrides/sys_category.php | 28 +++++++++++++++++++ ...ubprofilemessages_domain_model_message.php | 18 +++++++++--- Configuration/TsConfig/Page.tsconfig | 19 +------------ Configuration/TsConfig/Page/RTE.tsconfig | 4 +++ Configuration/TsConfig/Page/TCEFORM.tsconfig | 15 ++++++++++ Configuration/TsConfig/Page/mod.tsconfig | 20 +++++++++++++ .../Private/Language/de.locallang_db.xlf | 9 ++++++ Resources/Private/Language/locallang_db.xlf | 8 ++++++ ext_localconf.php | 4 +++ ext_tables.sql | 9 ++++++ 11 files changed, 137 insertions(+), 22 deletions(-) create mode 100644 Configuration/RTE/Message.yaml create mode 100644 Configuration/TCA/Overrides/sys_category.php create mode 100644 Configuration/TsConfig/Page/RTE.tsconfig create mode 100644 Configuration/TsConfig/Page/TCEFORM.tsconfig create mode 100644 Configuration/TsConfig/Page/mod.tsconfig diff --git a/Configuration/RTE/Message.yaml b/Configuration/RTE/Message.yaml new file mode 100644 index 0000000..3a85cf4 --- /dev/null +++ b/Configuration/RTE/Message.yaml @@ -0,0 +1,25 @@ +imports: + - { resource: 'EXT:rte_ckeditor/Configuration/RTE/Processing.yaml' } + - { resource: 'EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml' } + - { resource: 'EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml' } + +editor: + config: + toolbarGroups: + - { name: basicstyles, groups: [ basicstyles ] } + - { name: paragraph, groups: [ list, indent ] } + - { name: links, groups: [ links ] } + - { name: clipboard, groups: [ clipboard, undo ] } + - { name: editing, groups: [ spellchecker ] } + - { name: insert, groups: [ insert ] } + - { name: tools, groups: [ specialchar ] } + - { name: document, groups: [ mode ] } + + removePlugins: + - image + - horizontalrule + + removeButtons: + - Anchor + - Strike + - Table diff --git a/Configuration/TCA/Overrides/sys_category.php b/Configuration/TCA/Overrides/sys_category.php new file mode 100644 index 0000000..0502c99 --- /dev/null +++ b/Configuration/TCA/Overrides/sys_category.php @@ -0,0 +1,28 @@ + [ + 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'label' => 'LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_db.xlf:sys_category.tx_slubprofilemessages_code', + 'config' => [ + 'type' => 'input', + 'eval' => 'trim' + ], + ] + ] +); + +// Add types +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'sys_category', + 'tx_slubprofilemessages_code', + '', + 'after:title' +); diff --git a/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php b/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php index 34e78bd..d820197 100644 --- a/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php +++ b/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php @@ -12,6 +12,11 @@ 'slubProfileMessages' => 'LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_db.xlf' ]; +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'tx_slubprofilemessages_domain_model_message', + 'categories' +); + return [ 'ctrl' => [ 'title' => $ll['slubProfileMessages'] . ':tx_slubprofilemessages_domain_model_message', @@ -35,7 +40,7 @@ 'translationSource' => 'l10n_source', 'origUid' => 't3_origuid', 'versioningWS' => true, - 'searchFields' => 'title, content', + 'searchFields' => 'title, content, categories', 'typeicon_classes' => [ 'default' => 'slubprofilemessages-model-message' ], @@ -45,6 +50,8 @@ 'showitem' => ' --div--;' . $ll['core']['tabs'] . ':general, title, content, + --div--;' . $ll['core']['tabs'] . ':categories, + categories, --div--;' . $ll['core']['tabs'] . ':language, --palette--;;language, --div--;' . $ll['core']['tabs'] . ':access, @@ -178,9 +185,12 @@ 'label' => $ll['slubProfileMessages'] . ':tx_slubprofilemessages_domain_model_message.content', 'config' => [ 'type' => 'text', - 'rows' => 5, - 'cols' => 30, - 'eval' => 'trim', + 'enableRichtext' => true + ] + ], + 'categories' => [ + 'config' => [ + 'type' => 'category' ] ], ] diff --git a/Configuration/TsConfig/Page.tsconfig b/Configuration/TsConfig/Page.tsconfig index 549acce..6a73488 100644 --- a/Configuration/TsConfig/Page.tsconfig +++ b/Configuration/TsConfig/Page.tsconfig @@ -1,18 +1 @@ -mod { - wizards.newContentElement.wizardItems.slubprofilemessages { - after = common - header = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.title - - elements { - slubprofilemessages_messagelist { - iconIdentifier = slubprofilemessages-wizard-messagelist - iconOverlay = slubprofilemessages-overlay-extension - title = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.messagelist.title - description = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.messagelist.description - tt_content_defValues.CType = slubprofilemessages_messagelist - } - } - - show := addToList(slubprofilemessages_messagelist) - } -} +@import 'EXT:slub_profile_messages/Configuration/TsConfig/Page/*.tsconfig' diff --git a/Configuration/TsConfig/Page/RTE.tsconfig b/Configuration/TsConfig/Page/RTE.tsconfig new file mode 100644 index 0000000..ee890f0 --- /dev/null +++ b/Configuration/TsConfig/Page/RTE.tsconfig @@ -0,0 +1,4 @@ +RTE.config.tx_slubprofilemessages_domain_model_message.content { + preset = slubProfileMessage + buttons.link.options.removeItems = page,file,spec,folder +} diff --git a/Configuration/TsConfig/Page/TCEFORM.tsconfig b/Configuration/TsConfig/Page/TCEFORM.tsconfig new file mode 100644 index 0000000..662fa9d --- /dev/null +++ b/Configuration/TsConfig/Page/TCEFORM.tsconfig @@ -0,0 +1,15 @@ +TCEFORM { + sys_category { + tx_slubprofilemessages_code.disabled = 1 + } +} + +# Folder with messages +[page["uid"] == 18] + TCEFORM { + sys_category { + tx_slubprofilemessages_code.disabled = 0 + parent.config.treeConfig.rootUid = 2 + } + } +[END] diff --git a/Configuration/TsConfig/Page/mod.tsconfig b/Configuration/TsConfig/Page/mod.tsconfig new file mode 100644 index 0000000..c574ded --- /dev/null +++ b/Configuration/TsConfig/Page/mod.tsconfig @@ -0,0 +1,20 @@ +mod { + wizards.newContentElement.wizardItems.slubprofilemessages { + after = common + header = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.title + + elements { + slubprofilemessages_messagelist { + iconIdentifier = slubprofilemessages-wizard-messagelist + iconOverlay = slubprofilemessages-overlay-extension + title = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.messagelist.title + description = LLL:EXT:slub_profile_messages/Resources/Private/Language/locallang_backend.xlf:plugin.messagelist.description + tt_content_defValues.CType = slubprofilemessages_messagelist + } + } + + show := addToList(slubprofilemessages_messagelist) + } + + web_list.tableDisplayOrder.tx_slubprofilemessages_domain_model_message.before = sys_category +} diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 2fcaa30..edf1862 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -20,6 +20,15 @@ Content Content + + + + + Code + Code + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index c64298c..5c4cefc 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -17,6 +17,14 @@ Content + + + + + Code + diff --git a/ext_localconf.php b/ext_localconf.php index c6868b4..9f4aab2 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -23,3 +23,7 @@ ], ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); + +// Register own RTE preset +$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['slubProfileMessage'] = + 'EXT:slub_profile_messages/Configuration/RTE/Message.yaml'; diff --git a/ext_tables.sql b/ext_tables.sql index 8fd634d..36138c4 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -7,6 +7,7 @@ CREATE TABLE tx_slubprofilemessages_domain_model_message ( title varchar(255) NOT NULL, content text, + categories int(11) unsigned DEFAULT 0 NOT NULL, tstamp int(11) unsigned DEFAULT 0 NOT NULL, crdate int(11) unsigned DEFAULT 0 NOT NULL, @@ -20,3 +21,11 @@ CREATE TABLE tx_slubprofilemessages_domain_model_message ( PRIMARY KEY (uid), KEY parent (pid), ); + +# +# Table structure for table 'sys_category' +# +CREATE TABLE sys_category ( + tx_slubprofilemessages_code varchar(255) DEFAULT '' NOT NULL, +); + From 13a7780bc9d05d20a000835abd9cb97971a94554 Mon Sep 17 00:00:00 2001 From: Andreas Pfeiffer Date: Tue, 1 Feb 2022 13:55:26 +0100 Subject: [PATCH 04/11] [TASK] Add date field --- ...ubprofilemessages_domain_model_message.php | 22 +++++++++++++++++-- .../Private/Language/de.locallang_db.xlf | 4 ++++ Resources/Private/Language/locallang_db.xlf | 3 +++ ext_tables.sql | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php b/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php index d820197..c87dc74 100644 --- a/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php +++ b/Configuration/TCA/tx_slubprofilemessages_domain_model_message.php @@ -40,7 +40,7 @@ 'translationSource' => 'l10n_source', 'origUid' => 't3_origuid', 'versioningWS' => true, - 'searchFields' => 'title, content, categories', + 'searchFields' => 'title, content, categories, datetime', 'typeicon_classes' => [ 'default' => 'slubprofilemessages-model-message' ], @@ -49,7 +49,7 @@ '0' => [ 'showitem' => ' --div--;' . $ll['core']['tabs'] . ':general, - title, content, + datetime, title, content, --div--;' . $ll['core']['tabs'] . ':categories, categories, --div--;' . $ll['core']['tabs'] . ':language, @@ -193,5 +193,23 @@ 'type' => 'category' ] ], + 'datetime' => [ + 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'label' => $ll['slubProfileMessages'] . ':tx_slubprofilemessages_domain_model_message.datetime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'required,datetime', + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ] + ] + ], ] ]; diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index edf1862..cc82beb 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -20,6 +20,10 @@ Content Content + + Date + Datum +