Skip to content

Commit

Permalink
Added latest article version note icon to the articles list. If the c…
Browse files Browse the repository at this point in the history
…hanges will be working, I will add this to modules. #4668
  • Loading branch information
kirapwn committed Oct 17, 2014
1 parent 94608a4 commit 3714221
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
15 changes: 13 additions & 2 deletions administrator/components/com_content/models/articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public function __construct($config = array())
'author_id',
'category_id',
'level',
'tag'
'tag',
'version', 'a.version', 'ch.version_id', 'version_id', 'ch.ucm_type_id', 'version_type'
);

if (JLanguageAssociations::isEnabled())
Expand Down Expand Up @@ -167,7 +168,7 @@ protected function getListQuery()
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid' .
', a.state, a.access, a.created, a.created_by, a.created_by_alias, a.ordering, a.featured, a.language, a.hits' .
', a.state, a.access, a.created, a.created_by, a.created_by_alias, a.ordering, a.featured, a.language, a.hits, a.version' .
', a.publish_up, a.publish_down'
)
);
Expand All @@ -193,6 +194,16 @@ protected function getListQuery()
$query->select('ua.name AS author_name')
->join('LEFT', '#__users AS ua ON ua.id = a.created_by');

// Join over the content history of the article.
$latest_version = $db->getQuery(true);
$latest_version->select('version_id')
->from('#__ucm_history')
->where('ucm_item_id = ch.ucm_item_id')
->order('version_id DESC LIMIT 1');
$query->select('ch.version_note AS version_note, ch.ucm_type_id AS version_type, ch.version_id, ch.save_date as version_date')
->join('LEFT', '#__ucm_history AS ch ON ch.ucm_item_id = a.id AND ch.version_id = (' . $latest_version . ')')
->group('a.id');

// Join over the associations.
if (JLanguageAssociations::isEnabled())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$archived = $this->state->get('filter.published') == 2 ? true : false;
$trashed = $this->state->get('filter.published') == -2 ? true : false;
$saveOrder = $listOrder == 'a.ordering';
$params = JComponentHelper::getParams('com_content');

if ($saveOrder)
{
Expand Down Expand Up @@ -107,6 +108,9 @@
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_NOTE', 'a.version', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -219,6 +223,15 @@
<td class="center hidden-phone">
<?php echo (int) $item->id; ?>
</td>
<td class="center hidden-phone">
<?php if($params->get('save_history', null) && $item->version_note): ?>
<a class="modal_jform_contenthistory" rel="{handler: 'iframe', size: {x: 800, y: 500}}" href="<?php echo 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id=' . $item->version_id . '&type_id=' . $item->version_type . '&type_alias=com_content.article&' . JSession::getFormToken() . '=1' ?>">
<span class="hasTooltip" title="<strong><?php echo JText::_('JGRID_HEADING_NOTE_VERSION'); ?></strong><br/><?php echo $item->version_note . ' - ' . $item->version_date ?>">
<i class="icon-file-2"></i>
</span>
</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
2 changes: 2 additions & 0 deletions administrator/language/en-GB/en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ JGRID_HEADING_ACCESS="Access"
JGRID_HEADING_ACCESS_ASC="Access ascending"
JGRID_HEADING_ACCESS_DESC="Access descending"
JGRID_HEADING_CREATED_BY="Created by"
JGRID_HEADING_NOTE="Note"
JGRID_HEADING_NOTE_VERSION="Version Note"
JGRID_HEADING_ID="ID"
JGRID_HEADING_ID_ASC="ID ascending"
JGRID_HEADING_ID_DESC="ID descending"
Expand Down

0 comments on commit 3714221

Please sign in to comment.