Added Feed Title to infos section

In Link Post types of feed sites the url of the post may refer to a
site different than the feed site.  This modification shows the site
name in the infos section for bookmarks, history, unread_items and
show_item in addition to the url for the post
This commit is contained in:
Chris Lemonier 2013-07-18 15:54:24 -07:00
parent fd24c5a421
commit 34ad994991
6 changed files with 14 additions and 5 deletions

View File

@ -87,11 +87,14 @@ Router\post_action('login', function() {
Router\get_action('show', function() { Router\get_action('show', function() {
$id = Model\decode_item_id(Request\param('id')); $id = Model\decode_item_id(Request\param('id'));
$item = Model\get_item($id);
$feed = Model\get_feed($item['feed_id']);
Model\set_item_read($id); Model\set_item_read($id);
Response\html(Template\layout('show_item', array( Response\html(Template\layout('show_item', array(
'item' => Model\get_item($id), 'item' => $item,
'feed' => $feed,
'menu' => 'show' 'menu' => 'show'
))); )));
}); });
@ -102,12 +105,14 @@ Router\get_action('read', function() {
$id = Model\decode_item_id(Request\param('id')); $id = Model\decode_item_id(Request\param('id'));
$item = Model\get_item($id); $item = Model\get_item($id);
$feed = Model\get_feed($item['feed_id']);
$nav = Model\get_nav_item($item); // must be placed before set_item_read() $nav = Model\get_nav_item($item); // must be placed before set_item_read()
Model\set_item_read($id); Model\set_item_read($id);
Response\html(Template\layout('show_item', array( Response\html(Template\layout('show_item', array(
'item' => $item, 'item' => $item,
'feed' => $feed,
'item_nav' => $nav, 'item_nav' => $nav,
'menu' => 'read' 'menu' => 'read'
))); )));

View File

@ -327,7 +327,7 @@ function get_unread_items($offset = null, $limit = null)
{ {
return \PicoTools\singleton('db') return \PicoTools\singleton('db')
->table('items') ->table('items')
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.content', 'items.bookmark', 'items.status', 'feeds.site_url') ->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.content', 'items.bookmark', 'items.status', 'feeds.site_url', 'feeds.title AS feed_title')
->join('feeds', 'id', 'feed_id') ->join('feeds', 'id', 'feed_id')
->eq('status', 'unread') ->eq('status', 'unread')
->desc('updated') ->desc('updated')
@ -350,7 +350,7 @@ function get_read_items($offset = null, $limit = null)
{ {
return \PicoTools\singleton('db') return \PicoTools\singleton('db')
->table('items') ->table('items')
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.bookmark', 'feeds.site_url') ->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.bookmark', 'feeds.site_url', 'feeds.title AS feed_title')
->join('feeds', 'id', 'feed_id') ->join('feeds', 'id', 'feed_id')
->eq('status', 'read') ->eq('status', 'read')
->desc('updated') ->desc('updated')
@ -374,7 +374,7 @@ function get_bookmarks($offset = null, $limit = null)
{ {
return \PicoTools\singleton('db') return \PicoTools\singleton('db')
->table('items') ->table('items')
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.status', 'feeds.site_url') ->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.status', 'feeds.site_url', 'feeds.title AS feed_title')
->join('feeds', 'id', 'feed_id') ->join('feeds', 'id', 'feed_id')
->in('status', array('read', 'unread')) ->in('status', array('read', 'unread'))
->eq('bookmark', 1) ->eq('bookmark', 1)
@ -412,7 +412,7 @@ function get_feed_items($feed_id, $offset = null, $limit = null)
function get_item($id) function get_item($id)
{ {
return \PicoTools\singleton('db') return \PicoTools\singleton('db')
->table('items') ->table('items')
->eq('id', $id) ->eq('id', $id)
->findOne(); ->findOne();

View File

@ -22,6 +22,7 @@
</a> </a>
</h2> </h2>
<p> <p>
<?= Helper\escape($item['feed_title']) ?> |
<?= Helper\get_host_from_url($item['url']) ?> | <?= Helper\get_host_from_url($item['url']) ?> |
<?= dt('%e %B %Y %k:%M', $item['updated']) ?> | <?= dt('%e %B %Y %k:%M', $item['updated']) ?> |
<a href="?action=bookmark&amp;value=0&amp;id=<?= $item_id ?>&amp;redirect=bookmarks&amp;offset=<?= $offset ?>"><?= t('remove bookmark') ?></a> | <a href="?action=bookmark&amp;value=0&amp;id=<?= $item_id ?>&amp;redirect=bookmarks&amp;offset=<?= $offset ?>"><?= t('remove bookmark') ?></a> |

View File

@ -24,6 +24,7 @@
</a> </a>
</h2> </h2>
<p> <p>
<?= Helper\escape($item['feed_title']) ?> |
<?= Helper\get_host_from_url($item['url']) ?> | <?= Helper\get_host_from_url($item['url']) ?> |
<?= dt('%e %B %Y %k:%M', $item['updated']) ?> | <?= dt('%e %B %Y %k:%M', $item['updated']) ?> |

View File

@ -12,6 +12,7 @@
</h1> </h1>
<p class="infos"> <p class="infos">
<?= Helper\escape($feed['title']) ?> |
<?= Helper\get_host_from_url($item['url']) ?> | <?= Helper\get_host_from_url($item['url']) ?> |
<?= dt('%A %e %B %Y %k:%M', $item['updated']) ?> | <?= dt('%A %e %B %Y %k:%M', $item['updated']) ?> |
<?php if ($item['bookmark']): ?> <?php if ($item['bookmark']): ?>

View File

@ -33,6 +33,7 @@
<?= Helper\escape(Helper\summary(strip_tags($item['content']), 50, 300)) ?> <?= Helper\escape(Helper\summary(strip_tags($item['content']), 50, 300)) ?>
</p> </p>
<p> <p>
<?= Helper\escape($item['feed_title']) ?> |
<?= Helper\get_host_from_url($item['url']) ?> | <?= Helper\get_host_from_url($item['url']) ?> |
<?= dt('%e %B %Y %k:%M', $item['updated']) ?> | <?= dt('%e %B %Y %k:%M', $item['updated']) ?> |