From 1d09413180502728d7dcfb1b1062fb2c75863d5e Mon Sep 17 00:00:00 2001 From: "developing@domjos.de" Date: Tue, 2 Apr 2019 18:06:38 +0200 Subject: [PATCH] solve localization bugs, add rte for description, add forecolor, improve designs --- Classes/Controller/TimelineController.php | 23 +++++--- .../Repository/TimelineEventRepository.php | 4 +- Configuration/FlexForms/flexform_timeline.xml | 28 +++++++++- ...tx_timeline_domain_model_timelineevent.php | 55 ++++++++++++++++++- Configuration/Typoscript/constants.ts | 4 +- Configuration/Typoscript/setup.ts | 9 ++- .../Private/Language/de.locallang_db.xlf | 4 ++ .../Private/Language/es.locallang_db.xlf | 4 ++ .../Private/Language/fr.locallang_db.xlf | 4 ++ Resources/Private/Language/locallang_db.xlf | 5 +- .../Private/Templates/Timeline/List.html | 8 +-- Resources/Public/Css/timeline.css | 31 +++++------ ext_tables.sql | 2 + 13 files changed, 143 insertions(+), 38 deletions(-) diff --git a/Classes/Controller/TimelineController.php b/Classes/Controller/TimelineController.php index 6617b10..9dbe4ee 100644 --- a/Classes/Controller/TimelineController.php +++ b/Classes/Controller/TimelineController.php @@ -11,7 +11,7 @@ class TimelineController extends ActionController { protected $configurationManager; private $layout; private $year; - private $color; + private $color, $foreColor; public function injectTimelineEventRepository(TimelineEventRepository $timelineEventRepository) { $this->timelineEventRepository = $timelineEventRepository; @@ -36,16 +36,26 @@ public function injectConfigurationManager(ConfigurationManagerInterface $config $this->year = $tmpYear; } - $tmpColor = $this->settings['color']; + $tmpColor = $this->settings['back_color']; if(empty($tmpColor)) { - $this->color = $tsSettings['color']; + $this->color = $tsSettings['back_color']; } else { $this->color = $tmpColor; } + + $tmpColor = $this->settings['fore_color']; + if(empty($tmpColor)) { + $this->foreColor = $tsSettings['fore_color']; + } else { + $this->foreColor = $tmpColor; + } } public function listAction() { - $uid = $this->configurationManager->getContentObject()->data['uid']; + $uid = $this->configurationManager->getContentObject()->data['_LOCALIZED_UID']; + if($uid==null) { + $uid = $this->configurationManager->getContentObject()->data['uid']; + } $timelineEvents = $this->timelineEventRepository->findAll(); if(!is_null($timelineEvents)) { @@ -59,16 +69,15 @@ public function listAction() { } $uniqueIDs = null; - $i = 0; - foreach($timelineEvents as $var) { + for($i = 0;$i<=count($timelineEvents)-1; $i++) { $uniqueIDs[$i] = uniqid(rand(), true); - $i++; } $this->view->assign('events', $timelineEvents); $this->view->assign('uid', $uid); $this->view->assign("layout", $this->layout); $this->view->assign("onlyYear", $this->year); $this->view->assign("color", $this->color); + $this->view->assign("fore_color", $this->foreColor); return $this->view->render(); } diff --git a/Classes/Domain/Repository/TimelineEventRepository.php b/Classes/Domain/Repository/TimelineEventRepository.php index db51173..a699564 100644 --- a/Classes/Domain/Repository/TimelineEventRepository.php +++ b/Classes/Domain/Repository/TimelineEventRepository.php @@ -12,7 +12,6 @@ class TimelineEventRepository extends Repository { * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface */ public function getContentElementEntries($uid) { - /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Query */ $query = $this->createQuery(); $query->getQuerySettings()->setRespectStoragePage(false); @@ -24,9 +23,8 @@ public function getContentElementEntries($uid) { 'start_date' => Query::ORDER_ASCENDING, ]); - /** @var \TYPO3\CMS\Extbase\Persistence\QueryResultInterface */ - $result = $query->execute(); + $result = $query->execute(); return $result; } } diff --git a/Configuration/FlexForms/flexform_timeline.xml b/Configuration/FlexForms/flexform_timeline.xml index 3c25611..a330a82 100644 --- a/Configuration/FlexForms/flexform_timeline.xml +++ b/Configuration/FlexForms/flexform_timeline.xml @@ -44,7 +44,7 @@ - + @@ -67,7 +67,31 @@ #555555 - + + + + + + input + 6 + + + colorbox + 212x18 + border:solid 1px black; + + + wizard_colorpicker + + + height=340,width=360,status=0,menubar=0,scrollbars=1 + + + + #555555 + + + diff --git a/Configuration/TCA/tx_timeline_domain_model_timelineevent.php b/Configuration/TCA/tx_timeline_domain_model_timelineevent.php index 6c6b307..9f3fa39 100644 --- a/Configuration/TCA/tx_timeline_domain_model_timelineevent.php +++ b/Configuration/TCA/tx_timeline_domain_model_timelineevent.php @@ -21,6 +21,52 @@ ) ], 'columns' => [ + 'sys_language_uid' => [ + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'foreign_table' => 'sys_language', + 'foreign_table_where' => 'ORDER BY sys_language.title', + 'items' => [ + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1], + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.php:LGL.default_value',0] + ], + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_timeline_domain_model_timelineevent', + 'foreign_table_where' => 'AND tx_timeline_domain_model_timelineevent.uid=###REC_FIELD_l10n_parent### AND tx_timeline_domain_model_timelineevent.sys_language_uid IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' =>'passthrough' + ], + ], + 't3ver_label' => array( + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => array( + 'type' => 'input', + 'size' => 30, + 'max' => 255 + ) + ), + 'hidden' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.hidden', + 'config' => array( + 'type' => 'check' + ) + ), 'title' => [ 'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent.item_title', 'config' => [ @@ -55,8 +101,11 @@ 'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent.item_description', 'config' => [ 'type' => 'text', - 'eval' => 'trim' - ] + 'eval' => 'trim', + 'cols' => 40, + 'rows' => 6 + ], + 'defaultExtras' => 'richtext[]' ], 'start_date' => [ 'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent.item_start', @@ -98,7 +147,7 @@ ], ], 'types' => [ - '0' => ['showitem' => 'title, event_link, description, start_date, end_date, format, side'] + '0' => ['showitem' => 'sys_language_uid, l10n_parent, hidden, title, event_link, description, start_date, end_date, format, side'] ] ]; diff --git a/Configuration/Typoscript/constants.ts b/Configuration/Typoscript/constants.ts index e9c639e..f5adf36 100644 --- a/Configuration/Typoscript/constants.ts +++ b/Configuration/Typoscript/constants.ts @@ -8,7 +8,9 @@ plugin.tx_timeline_pi1 { # cat=tx_timeline_pi1/style/b; type=boolean; label=Year: Show the year of the events only year = 0 # cat=tx_timeline_pi1/color/a; type=color; label=Background-Color:The Background-Color of the Timeline - color = #000 + back_color = #fff + # cat=tx_timeline_pi1/color/b; type=color; label=Background-Color:The Foreground-Color of the Timeline + fore_color = #000 # cat=tx_timeline_pi1/file/a; type=string; label=Custom css: Include custom Stylesheet for Timeline diff --git a/Configuration/Typoscript/setup.ts b/Configuration/Typoscript/setup.ts index da85776..730883d 100644 --- a/Configuration/Typoscript/setup.ts +++ b/Configuration/Typoscript/setup.ts @@ -9,7 +9,8 @@ plugin.tx_timeline_pi1 { jquery = {$plugin.tx_timeline_pi1.settings.jquery} layout = {$plugin.tx_timeline_pi1.settings.layout} year = {$plugin.tx_timeline_pi1.settings.year} - color = {$plugin.tx_timeline_pi1.settings.color} + back_color = {$plugin.tx_timeline_pi1.settings.back_color} + fore_color = {$plugin.tx_timeline_pi1.settings.fore_color} customCSS = {$plugin.tx_timeline_pi1.settings.customCSS} } } @@ -38,6 +39,12 @@ page.footerData.10.value ( $('ul.timeline2 li div.timeline-panel h4').css("color", $var); $('ul.timeline3').css("border-left", "4px solid " + $var); } + if($var.startsWith("foreCol")) { + $var = $var.replace("foreCol", ""); + $('ul.timeline1 li.work div.content').css("color", $var); + $('ul.timeline1 li.work div.relative').css("color", $var); + $('ul.timeline2 li div.timeline-panel h4').css("background-color", $var); + } }); }); diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 7a6ffdd..13943aa 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -69,6 +69,10 @@ Color Farbe + + Font-Color + Schrift-Farbe + From Typoscript Von Typoscript diff --git a/Resources/Private/Language/es.locallang_db.xlf b/Resources/Private/Language/es.locallang_db.xlf index e85748f..d0b2303 100644 --- a/Resources/Private/Language/es.locallang_db.xlf +++ b/Resources/Private/Language/es.locallang_db.xlf @@ -69,6 +69,10 @@ Color Color + + Font-Color + Font-Color + From Typoscript De Typoscript diff --git a/Resources/Private/Language/fr.locallang_db.xlf b/Resources/Private/Language/fr.locallang_db.xlf index 06a0842..65ac112 100644 --- a/Resources/Private/Language/fr.locallang_db.xlf +++ b/Resources/Private/Language/fr.locallang_db.xlf @@ -69,6 +69,10 @@ Color Couleur + + Font-Color + Font-Couleur + From Typoscript De Typoscript diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 22694aa..67569e0 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -51,8 +51,11 @@ Show the year only - Color + Back-Color + + Font-Color + From Typoscript diff --git a/Resources/Private/Templates/Timeline/List.html b/Resources/Private/Templates/Timeline/List.html index 45d2cc1..c05ebd5 100644 --- a/Resources/Private/Templates/Timeline/List.html +++ b/Resources/Private/Templates/Timeline/List.html @@ -1,5 +1,5 @@
-

- {event.description} + {event.description}
@@ -69,7 +69,7 @@

{event.title}

-

{event.description}

+

{event.description}


@@ -129,7 +129,7 @@

{event.title}

{event.title}

- {event.description} + {event.description}
diff --git a/Resources/Public/Css/timeline.css b/Resources/Public/Css/timeline.css index db624a5..ff31204 100644 --- a/Resources/Public/Css/timeline.css +++ b/Resources/Public/Css/timeline.css @@ -30,10 +30,7 @@ ul.timeline1 li.work div.content { } ul.timeline1 li.work div.relative { - border-top-left-radius: 0.5em; - border-top-right-radius: 0.5em; - border-bottom-left-radius: 0.5em; - border-bottom-right-radius: 0.5em; + border-radius: 0.5em; } ul.timeline1 li.work input.radio { @@ -52,13 +49,13 @@ ul.timeline1 li.work input.radio:checked ~ div.content { ul.timeline1 li.work input.radio:checked ~ div.relative { border-bottom: 0; - border-bottom-left-radius: 0em; - border-bottom-right-radius: 0em; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } ul.timeline1 span.circle { position: absolute; - left: 0.8em; + left: 1.8em; height: 1.4em; width: 1.4em; border-radius: 50%; @@ -99,7 +96,7 @@ ul.timeline2 { position: absolute; content:" "; width: 2px; - background: #ffffff; + background: #708090; left: 50%; margin-left: -1.5px; } @@ -157,7 +154,7 @@ ul.timeline2 { content:" "; } .timeline2 > li > .timeline-badge { - color: #ffffff; + color: #fff; width: 24px; height: 24px; line-height: 50px; @@ -198,8 +195,7 @@ ul.timeline2 { } .timeline2 .timeline-body > p, .timeline2 .timeline-body > ul { - margin: 0.5em; - margin-bottom: 0; + margin: 0.5em 0.5em 0; } .timeline2 .timeline-footer { padding: 5px 15px; @@ -228,7 +224,7 @@ ul.timeline2 { left: 40px; } ul.timeline2 > li { - margin-bottom: 0px; + margin-bottom: 0; position: relative; width:100%; float: left; @@ -280,8 +276,7 @@ ul.timeline2 { border-top-right-radius: 4px; background: rgba(255, 255, 255, 0.3); color: black; - margin: 50px auto; - letter-spacing: 0.5px; + letter-spacing: 1px; position: relative; line-height: 1.4em; font-size: 1.03em; @@ -289,11 +284,13 @@ ul.timeline2 { list-style: none; text-align: left; font-weight: 100; + margin: 50px auto 50px 8em!important; } + .timeline3 h1, .timeline3 h2, .timeline3 h3 { - letter-spacing: 1.5px; + letter-spacing: 2px; font-weight: 100; font-size: 1.4em; } @@ -318,10 +315,12 @@ ul.timeline2 { left: -217.5px; color: black; content: attr(data-date); - text-align: right; + text-align: left; font-weight: 100; font-size: 0.9em; min-width: 120px; + max-width: 7em; + } .timeline3 .event:after { box-shadow: 0 0 0 4px gray; diff --git a/ext_tables.sql b/ext_tables.sql index 061b27e..560ba51 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -33,6 +33,8 @@ CREATE TABLE tx_timeline_domain_model_timelineevent ( sys_language_uid int(11) DEFAULT '0' NOT NULL, l10n_parent int(11) DEFAULT '0' NOT NULL, l10n_diffsource mediumblob, + sorting int(11) DEFAULT '0' NOT NULL, + t3_origuid int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (uid), KEY parent (pid),