Skip to content

Commit

Permalink
solve localization bugs,
Browse files Browse the repository at this point in the history
add rte for description,
add forecolor,
improve designs
  • Loading branch information
domjos1994 committed Apr 2, 2019
1 parent 5c37ea7 commit 1d09413
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 38 deletions.
23 changes: 16 additions & 7 deletions Classes/Controller/TimelineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)) {
Expand All @@ -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();
}

Expand Down
4 changes: 1 addition & 3 deletions Classes/Domain/Repository/TimelineEventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
}
28 changes: 26 additions & 2 deletions Configuration/FlexForms/flexform_timeline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</config>
</TCEforms>
</settings.year>
<settings.color>
<settings.back_color>
<TCEforms>
<label>LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.item_color</label>
<config>
Expand All @@ -67,7 +67,31 @@
<eval>#555555</eval>
</config>
</TCEforms>
</settings.color>
</settings.back_color>
<settings.fore_color>
<TCEforms>
<label>LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.item_fore_color</label>
<config>
<type>input</type>
<size>6</size>
<wizards>
<color>
<type>colorbox</type>
<dim>212x18</dim>
<tableStyle>border:solid 1px black;</tableStyle>
<script>wizard_colorpicker.php</script>
<module type="array">
<name>wizard_colorpicker</name>
<urlParameters type="array"/>
</module>
<JSopenParams>height=340,width=360,status=0,menubar=0,scrollbars=1</JSopenParams>
</color>
</wizards>
<default></default>
<eval>#555555</eval>
</config>
</TCEforms>
</settings.fore_color>
</el>
</ROOT>
</sDEF>
Expand Down
55 changes: 52 additions & 3 deletions Configuration/TCA/tx_timeline_domain_model_timelineevent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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']
]
];

4 changes: 3 additions & 1 deletion Configuration/Typoscript/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion Configuration/Typoscript/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
}
Expand Down Expand Up @@ -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);
}
});
});
</script>
Expand Down
4 changes: 4 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<source>Color</source>
<target>Farbe</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.item_fore_color">
<source>Font-Color</source>
<target>Schrift-Farbe</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.ts">
<source>From Typoscript</source>
<target>Von Typoscript</target>
Expand Down
4 changes: 4 additions & 0 deletions Resources/Private/Language/es.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<source>Color</source>
<target>Color</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.item_fore_color">
<source>Font-Color</source>
<target>Font-Color</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.ts">
<source>From Typoscript</source>
<target>De Typoscript</target>
Expand Down
4 changes: 4 additions & 0 deletions Resources/Private/Language/fr.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<source>Color</source>
<target>Couleur</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.item_fore_color">
<source>Font-Color</source>
<target>Font-Couleur</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.ts">
<source>From Typoscript</source>
<target>De Typoscript</target>
Expand Down
5 changes: 4 additions & 1 deletion Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
<source>Show the year only</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.item_color">
<source>Color</source>
<source>Back-Color</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.item_fore_color">
<source>Font-Color</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.ts">
<source>From Typoscript</source>
</trans-unit>
Expand Down
8 changes: 4 additions & 4 deletions Resources/Private/Templates/Timeline/List.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="tx_timeline">
<ul class='timeline timeline{layout} col{color}'>
<ul class='timeline timeline{layout} col{color} foreCol{fore_color}'>
<f:for each="{events}" as="event" iteration="objIterator">
<f:switch expression="{layout}">
<f:case value="1">
Expand Down Expand Up @@ -41,7 +41,7 @@
</div>
<div class='content'>
<p>
{event.description}
<f:format.html>{event.description}</f:format.html>
<f:if condition="{event.eventLink}">
<f:then>
<br/>
Expand Down Expand Up @@ -69,7 +69,7 @@
<h4>{event.title}</h4>
</div>
<div class="timeline-body">
<p>{event.description}</p>
<p><f:format.html>{event.description}</f:format.html></p>
<f:if condition="{event.eventLink}">
<f:then>
<br/>
Expand Down Expand Up @@ -129,7 +129,7 @@ <h4>{event.title}</h4>
</f:if>
<h3>{event.title}</h3>
<p>
{event.description}
<f:format.html>{event.description}</f:format.html>
<f:if condition="{event.eventLink}">
<f:then>
<br/>
Expand Down
Loading

0 comments on commit 1d09413

Please sign in to comment.