Skip to content

Commit e96947d

Browse files
committed
Update
1 parent cd9912e commit e96947d

File tree

9 files changed

+106
-133
lines changed

9 files changed

+106
-133
lines changed

administrator/language/en-GB.com_timeline.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ COM_TIMELINE_SAVE_SUCCESS="Item successfully saved"
2222
COM_TIMELINE_ITEM_ID_SELECT_LABEL="Select the item ID"
2323
COM_TIMELINE_ITEM_ID_SELECT_LABEL_FORM="Select the Item ID to Edit (Set up as 0 if you want to set up as add form)"
2424
COM_TIMELINE_FIELDSET_ITEM_ID_SELECT_LABEL="Required Settings"
25-
COM_TIMELINE_FILTER_SELECT_LABEL=" - Select %s - "
25+
COM_TIMELINE_FILTER_SELECT_LABEL=" - Select %s"
2626
COM_TIMELINE_TEST_LABEL="Test label"
2727
COM_TIMELINE_FIELDSET_RULES="Permissions"
2828

administrator/models/forms/timeline.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@
4646

4747
<field name="hash_bookmark" type="list"
4848
label="COM_TIMELINE_FORM_LBL_TIMELINE_HASH_BOOKMARK"
49-
description="COM_TIMELINE_FORM_DESC_TIMELINE_HASH_BOOKMARK" >
50-
<option value="">No</option>
49+
description="COM_TIMELINE_FORM_DESC_TIMELINE_HASH_BOOKMARK"
50+
default="false"
51+
>
52+
<option value="false">No</option>
5153
<option value="true">Yes</option>
5254
</field>
5355

@@ -159,6 +161,8 @@
159161
<field name="text" type="editor"
160162
label="COM_TIMELINE_FORM_LBL_TIMELINE_TEXT"
161163
description="COM_TIMELINE_FORM_DESC_TIMELINE_TEXT"
164+
rows="5"
165+
height="200px"
162166
filter="safehtml" />
163167

164168
<field name="media" type="text"

administrator/models/items.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected function populateState($ordering = null, $direction = null) {
8181
$this->setState('params', $params);
8282

8383
// List state information.
84-
parent::populateState('a.headline', 'asc');
84+
parent::populateState('a.startdate', 'asc');
8585
}
8686

8787
/**
@@ -216,7 +216,7 @@ public function getItems() {
216216
}
217217
}
218218

219-
$oneItem->timeline = !empty($textValue) ? implode(', ', $textValue) : $oneItem->timeline;
219+
$oneItem->timeline = !empty($textValue) ? implode(', ', $textValue) : $oneItem->timeline;
220220

221221
}
222222

administrator/sql/install.mysql.utf8.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ CREATE TABLE IF NOT EXISTS `#__timeline_timelines` (
2020
`media` VARCHAR(255) NOT NULL ,
2121
`credit` TEXT NOT NULL ,
2222
`caption` TEXT NOT NULL ,
23+
`lang` TEXT NOT NULL ,
2324
PRIMARY KEY (`id`)
2425
) DEFAULT COLLATE=utf8_general_ci;
2526

2627
CREATE TABLE IF NOT EXISTS `#__timeline_items` (
2728
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
28-
2929
`timeline` INT NOT NULL ,
3030
`state` TINYINT(1) NOT NULL ,
3131
`checked_out` INT(11) NOT NULL ,

administrator/views/items/tmpl/default.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,9 @@
116116
<th class='left'>
117117
<?php echo JHtml::_('grid.sort', 'COM_TIMELINE_ITEMS_STARTDATE', 'a.startdate', $listDirn, $listOrder); ?>
118118
</th>
119-
<th class='left'>
120-
<?php echo JHtml::_('grid.sort', 'COM_TIMELINE_ITEMS_ENDDATE', 'a.enddate', $listDirn, $listOrder); ?>
121-
</th>
122-
<th class='left'>
119+
<th class='nowrap hidden-phone'>
123120
<?php echo JHtml::_('grid.sort', 'COM_TIMELINE_ITEMS_CREATED_BY', 'a.created_by', $listDirn, $listOrder); ?>
124121
</th>
125-
<th class='left'>
126-
<?php echo JHtml::_('grid.sort', 'COM_TIMELINE_ITEMS_TAG', 'a.tag', $listDirn, $listOrder); ?>
127-
</th>
128122

129123

130124
<?php if (isset($this->items[0]->id)): ?>
@@ -202,19 +196,12 @@
202196
<td>
203197

204198
<?php echo $item->startdate; ?>
199+
<?php if($item->enddate>0) echo ' - '.$item->enddate; ?>
205200
</td>
206-
<td>
207-
208-
<?php echo $item->enddate; ?>
209-
</td>
210-
<td>
201+
<td class="small hidden-phone">
211202

212203
<?php echo $item->created_by; ?>
213204
</td>
214-
<td>
215-
216-
<?php echo $item->tag; ?>
217-
</td>
218205

219206

220207
<?php if (isset($this->items[0]->id)): ?>

site/models/forms/timelineform.xml

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,60 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<form>
33
<fieldset>
4-
5-
<field name="id" type="text" default="0" label="COM_TIMELINE_FORM_LBL_TIMELINE_ID"
4+
<field name="id" type="text" default="0" label="COM_TIMELINE_FORM_LBL_TIMELINE_ID"
65
readonly="true" class="readonly"
76
description="JGLOBAL_FIELD_ID_DESC" />
8-
9-
<field name="title" type="text"
10-
7+
8+
<field name="title" type="text"
119
label="COM_TIMELINE_FORM_LBL_TIMELINE_TITLE"
1210
description="COM_TIMELINE_FORM_DESC_TIMELINE_TITLE"
13-
14-
15-
required="true"
11+
required="true"
1612
filter="string" />
17-
18-
<field name="created_by" type="createdby" default=""
13+
14+
<field name="created_by" type="createdby" default=""
1915
label="COM_TIMELINE_FORM_LBL_TIMELINE_CREATED_BY"
2016
description="COM_TIMELINE_FORM_DESC_TIMELINE_CREATED_BY" />
21-
22-
17+
2318
<field name="filter_created_by" type="user" onchange="this.form.submit();" />
24-
25-
<field name="width" type="text"
26-
19+
20+
<field name="width" type="text"
2721
label="COM_TIMELINE_FORM_LBL_TIMELINE_WIDTH"
2822
description="COM_TIMELINE_FORM_DESC_TIMELINE_WIDTH"
29-
default="100%"
30-
31-
required="true"
23+
default="100%"
24+
required="true"
3225
filter="string" />
3326

3427
<field name="height" type="text"
35-
3628
label="COM_TIMELINE_FORM_LBL_TIMELINE_HEIGHT"
3729
description="COM_TIMELINE_FORM_DESC_TIMELINE_HEIGHT"
38-
default="600"
39-
40-
required="true" />
41-
42-
<field name="start_at_slide" type="foreignkey" class="inputbox"
30+
default="600"
31+
required="true" />
32+
33+
<field name="start_at_slide" type="foreignkey" class="inputbox"
4334
label="COM_TIMELINE_FORM_LBL_TIMELINE_START_AT_SLIDE"
4435
description="COM_TIMELINE_FORM_DESC_TIMELINE_START_AT_SLIDE" input_type="list" table="#__timeline_items" key_field="id" value_field="headline" />
45-
46-
<field name="start_zoom_adjust" type="integer"
47-
36+
37+
<field name="start_zoom_adjust" type="integer"
4838
label="COM_TIMELINE_FORM_LBL_TIMELINE_START_ZOOM_ADJUST"
4939
description="COM_TIMELINE_FORM_DESC_TIMELINE_START_ZOOM_ADJUST"
50-
default="0"
51-
52-
53-
first="-10"
40+
default="0"
41+
first="-10"
5442
last="10"
5543
step="1" />
56-
57-
<field name="hash_bookmark" type="list"
58-
44+
45+
<field name="hash_bookmark" type="list"
5946
label="COM_TIMELINE_FORM_LBL_TIMELINE_HASH_BOOKMARK"
6047
description="COM_TIMELINE_FORM_DESC_TIMELINE_HASH_BOOKMARK"
61-
62-
63-
>
48+
>
6449
<option value="">No</option>
6550
<option value="true">Yes</option>
6651
</field>
67-
68-
<field name="maptype" type="list"
69-
52+
53+
<field name="maptype" type="list"
7054
label="COM_TIMELINE_FORM_LBL_TIMELINE_MAPTYPE"
7155
description="COM_TIMELINE_FORM_DESC_TIMELINE_MAPTYPE"
72-
default="toner"
73-
74-
>
56+
default="toner"
57+
>
7558
<option value="">Stamen Maps</option>
7659
<option value="toner">Toner</option>
7760
<option value="toner-lines">Toner-lines</option>
@@ -89,7 +72,7 @@
8972

9073
label="COM_TIMELINE_FORM_LBL_TIMELINE_FONT"
9174
description="COM_TIMELINE_FORM_DESC_TIMELINE_FONT"
92-
default="Arvo-PTSans"
75+
default="Arvo-PTSans"
9376

9477
>
9578
<option value="AbrilFatface-Average">Abril Fatface &amp; Average</option>

site/models/timeline.php

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -88,66 +88,68 @@ public function &getData($id = null) {
8888

8989
$this->_item->start_at_end = ($this->_item->start_at_slide >= 0 ? 'false' : 'true');
9090

91-
if (isset($this->_item->start_at_slide) && $this->_item->start_at_slide != '') {
92-
if(is_object($this->_item->start_at_slide)){
93-
$this->_item->start_at_slide = JArrayHelper::fromObject($this->_item->start_at_slide);
94-
}
95-
$values = (is_array($this->_item->start_at_slide)) ? $this->_item->start_at_slide : explode(',',$this->_item->start_at_slide);
96-
97-
$textValue = array();
98-
foreach ($values as $value){
99-
$db = JFactory::getDbo();
100-
$query = $db->getQuery(true);
101-
$query
102-
->select('headline')
103-
->from('`#__timeline_items`')
104-
->where('id = ' .$value);
105-
$db->setQuery($query);
106-
$results = $db->loadObject();
107-
if ($results) {
108-
$textValue[] = $results->headline;
109-
}
91+
if (isset($this->_item->start_at_slide) && $this->_item->start_at_slide != '') {
92+
if(is_object($this->_item->start_at_slide)){
93+
$this->_item->start_at_slide = JArrayHelper::fromObject($this->_item->start_at_slide);
94+
}
95+
$values = (is_array($this->_item->start_at_slide)) ? $this->_item->start_at_slide : explode(',',$this->_item->start_at_slide);
96+
97+
$textValue = array();
98+
foreach ($values as $value){
99+
$db = JFactory::getDbo();
100+
$query = $db->getQuery(true);
101+
$query
102+
->select('headline')
103+
->from('`#__timeline_items`')
104+
->where('id = ' .$value);
105+
$db->setQuery($query);
106+
$results = $db->loadObject();
107+
if ($results) {
108+
$textValue[] = $results->headline;
110109
}
111-
112-
$this->_item->start_at_slide = !empty($textValue) ? implode(', ', $textValue) : $this->_item->start_at_slide;
113-
114110
}
111+
$this->_item->start_at_slide = !empty($textValue) ? implode(', ', $textValue) : $this->_item->start_at_slide;
112+
113+
}
115114

116-
$this->_item->timeline = new stdClass;
117-
$this->_item->timeline->headline = $this->_item->title;
118-
$this->_item->timeline->type = $this->_item->type;
119-
$this->_item->timeline->text = $this->_item->text;
120-
$this->_item->timeline->asset = new stdClass;
121-
$this->_item->timeline->asset->media = $this->_item->media;
122-
$this->_item->timeline->asset->thumbnail = $this->_item->thumbnail;
123-
$this->_item->timeline->asset->credit = $this->_item->credit;
124-
$this->_item->timeline->asset->caption = $this->_item->caption;
125-
unset($this->_item->type, $this->_item->text, $this->_item->media, $this->_item->thumbnail, $this->_item->credit, $this->_item->caption);
126-
127-
// add the dates to the timeline
128-
$db = JFactory::getDbo();
129-
$query = $db->getQuery(true);
130-
$query
131-
->select('headline, startdate AS startDate, enddate AS endDate, text, tag, media, thumbnail, credit, caption, classname')
132-
->from('`#__timeline_items`')
133-
->where('state = 1')
134-
->where('timeline = ' .$id);
135-
$db->setQuery($query);
136-
$results = $db->loadObjectList();
137-
foreach($results as &$result) {
138-
$result->startDate = JHtml::date($result->startDate, 'Y,m,d');
139-
$result->endDate = ($result->endDate>0 ? JHtml::date($result->endDate, 'Y,m,d') : $result->startDate);
140-
$result->asset = new stdClass;
141-
$result->asset->media = $result->media;
142-
$result->asset->thumbnail = $result->thumbnail;
143-
$result->asset->credit = $result->credit;
144-
$result->asset->caption = $result->caption;
145-
unset($result->media, $result->thumbnail, $result->credit, $result->caption);
146-
}
147-
if ($results) {
148-
$this->_item->timeline->date = $results;
149-
}
150-
return json_decode(json_encode($this->filter_object($this->_item)));
115+
$this->_item->timeline = new stdClass;
116+
$this->_item->timeline->headline = $this->_item->title;
117+
$this->_item->timeline->type = $this->_item->type;
118+
if($this->_item->text) $this->_item->timeline->text = $this->_item->text;
119+
$this->_item->timeline->asset = new stdClass;
120+
if($this->_item->media) $this->_item->timeline->asset->media = $this->_item->media;
121+
if(isset($this->_item->thumbnail) && $this->_item->thumbnail) $this->_item->timeline->asset->thumbnail = $this->_item->thumbnail;
122+
if($this->_item->credit) $this->_item->timeline->asset->credit = $this->_item->credit;
123+
if($this->_item->caption) $this->_item->timeline->asset->caption = $this->_item->caption;
124+
unset($this->_item->type, $this->_item->text, $this->_item->media, $this->_item->thumbnail, $this->_item->credit, $this->_item->caption);
125+
126+
// add the dates to the timeline
127+
$db = JFactory::getDbo();
128+
$query = $db->getQuery(true);
129+
$query
130+
->select('headline, startdate AS startDate, enddate AS endDate, text, tag, media, thumbnail, credit, caption, classname')
131+
->from('`#__timeline_items`')
132+
->where('state = 1')
133+
->where('timeline = ' .$id);
134+
$db->setQuery($query);
135+
$results = $db->loadObjectList();
136+
foreach($results as &$result) {
137+
$result->startDate = JHtml::date($result->startDate, 'Y,m,d');
138+
$result->endDate = ($result->endDate>0 ? JHtml::date($result->endDate, 'Y,m,d') : $result->startDate);
139+
$result->asset = new stdClass;
140+
$result->asset->media = $result->media;
141+
$result->asset->thumbnail = $result->thumbnail;
142+
$result->asset->credit = $result->credit;
143+
$result->asset->caption = $result->caption;
144+
unset($result->media, $result->thumbnail, $result->credit, $result->caption);
145+
}
146+
if ($results) {
147+
$this->_item->timeline->date = $this->filter_object($results);
148+
}
149+
150+
$this->_item = json_decode(json_encode($this->_item));
151+
152+
return $this->_item;
151153
}
152154

153155
public function getTable($type = 'Timeline', $prefix = 'TimelineTable', $config = array()) {
@@ -249,5 +251,6 @@ function filter_object($input)
249251
}
250252
return array_filter($input);
251253
}
254+
252255

253256
}

site/views/timeline/tmpl/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
start_at_end: '.$this->item->start_at_end.',
3131
start_at_slide: "'.$this->item->start_at_slide.'",
3232
start_zoom_adjust: "'.$this->item->start_zoom_adjust.'",
33-
hash_bookmark: '.($this->item->hash_bookmark ? 'true' : 'false').',
33+
hash_bookmark: '.$this->item->hash_bookmark.',
3434
font: "'.$this->item->font.'",
3535
debug: false,
3636
lang: "'.$this->item->lang.'",

0 commit comments

Comments
 (0)