Display item content everywhere
This commit is contained in:
parent
405086e9b0
commit
bf0de86b8a
@ -5,7 +5,7 @@ require '../vendor/JsonRPC/Client.php';
|
||||
use JsonRPC\Client;
|
||||
|
||||
$client = new Client('http://webapps/miniflux/jsonrpc.php');
|
||||
$client->authentication('admin', 'Nwjt73kOhC0K2mF');
|
||||
$client->authentication('admin', 'd4i/Tanb55426mi');
|
||||
|
||||
$result = $client->execute('feed.create', array('url' => 'http://bbc.co.uk/news'));
|
||||
var_dump($result);
|
||||
@ -24,8 +24,8 @@ print_r($result);
|
||||
$result = $client->execute('feed.delete', array('feed_id' => $feed_id));
|
||||
var_dump($result);
|
||||
|
||||
//$result = $client->execute('item.list_unread');
|
||||
//print_r($result);
|
||||
$result = $client->execute('item.list_unread');
|
||||
print_r($result);
|
||||
|
||||
$result = $client->execute('item.list_unread', array('offset' => 5, 'limit' => 2));
|
||||
print_r($result);
|
||||
|
@ -232,7 +232,7 @@ Router\get_action('history', function() {
|
||||
$nb_items = Model\count_items('read');
|
||||
|
||||
Response\html(Template\layout('history', array(
|
||||
'items' => Model\get_read_items($offset, Model\get_config_value('items_per_page')),
|
||||
'items' => Model\get_items('read', $offset, Model\get_config_value('items_per_page')),
|
||||
'nb_items' => $nb_items,
|
||||
'offset' => $offset,
|
||||
'items_per_page' => Model\get_config_value('items_per_page'),
|
||||
@ -608,7 +608,7 @@ Router\notfound(function() {
|
||||
Model\autoflush();
|
||||
|
||||
$offset = Request\int_param('offset', 0);
|
||||
$items = Model\get_unread_items($offset, Model\get_config_value('items_per_page'));
|
||||
$items = Model\get_items('unread', $offset, Model\get_config_value('items_per_page'));
|
||||
$nb_items = Model\count_items('unread');;
|
||||
|
||||
if ($nb_items === 0) Response\redirect('?action=feeds¬hing_to_read=1');
|
||||
|
@ -94,7 +94,7 @@ $server->register('item.bookmark.delete', function ($item_id) {
|
||||
// Get all unread items
|
||||
$server->register('item.list_unread', function ($offset = null, $limit = null) {
|
||||
|
||||
return Model\get_unread_items($offset, $limit);
|
||||
return Model\get_items('unread', $offset, $limit);
|
||||
});
|
||||
|
||||
// Count all unread items
|
||||
@ -106,7 +106,7 @@ $server->register('item.count_unread', function () {
|
||||
// Get all read items
|
||||
$server->register('item.list_read', function ($offset = null, $limit = null) {
|
||||
|
||||
return Model\get_read_items($offset, $limit);
|
||||
return Model\get_items('read', $offset, $limit);
|
||||
});
|
||||
|
||||
// Count all read items
|
||||
|
55
model.php
55
model.php
@ -402,13 +402,24 @@ function disable_feed($feed_id)
|
||||
}
|
||||
|
||||
|
||||
function get_unread_items($offset = null, $limit = null)
|
||||
function get_items($status, $offset = null, $limit = null)
|
||||
{
|
||||
return \PicoTools\singleton('db')
|
||||
->table('items')
|
||||
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.content', 'items.bookmark', 'items.status', 'items.feed_id', 'feeds.site_url', 'feeds.title AS feed_title')
|
||||
->columns(
|
||||
'items.id',
|
||||
'items.title',
|
||||
'items.updated',
|
||||
'items.url',
|
||||
'items.bookmark',
|
||||
'items.feed_id',
|
||||
'items.status',
|
||||
'items.content',
|
||||
'feeds.site_url',
|
||||
'feeds.title AS feed_title'
|
||||
)
|
||||
->join('feeds', 'id', 'feed_id')
|
||||
->eq('status', 'unread')
|
||||
->eq('status', $status)
|
||||
->desc('updated')
|
||||
->offset($offset)
|
||||
->limit($limit)
|
||||
@ -425,20 +436,6 @@ function count_items($status)
|
||||
}
|
||||
|
||||
|
||||
function get_read_items($offset = null, $limit = null)
|
||||
{
|
||||
return \PicoTools\singleton('db')
|
||||
->table('items')
|
||||
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.bookmark', 'items.feed_id', 'feeds.site_url', 'feeds.title AS feed_title')
|
||||
->join('feeds', 'id', 'feed_id')
|
||||
->eq('status', 'read')
|
||||
->desc('updated')
|
||||
->offset($offset)
|
||||
->limit($limit)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
|
||||
function count_bookmarks()
|
||||
{
|
||||
return \PicoTools\singleton('db')
|
||||
@ -453,7 +450,17 @@ function get_bookmarks($offset = null, $limit = null)
|
||||
{
|
||||
return \PicoTools\singleton('db')
|
||||
->table('items')
|
||||
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.status', 'items.feed_id', 'feeds.site_url', 'feeds.title AS feed_title')
|
||||
->columns(
|
||||
'items.id',
|
||||
'items.title',
|
||||
'items.updated',
|
||||
'items.url',
|
||||
'items.status',
|
||||
'items.content',
|
||||
'items.feed_id',
|
||||
'feeds.site_url',
|
||||
'feeds.title AS feed_title'
|
||||
)
|
||||
->join('feeds', 'id', 'feed_id')
|
||||
->in('status', array('read', 'unread'))
|
||||
->eq('bookmark', 1)
|
||||
@ -478,7 +485,17 @@ function get_feed_items($feed_id, $offset = null, $limit = null)
|
||||
{
|
||||
return \PicoTools\singleton('db')
|
||||
->table('items')
|
||||
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.feed_id', 'items.status', 'items.bookmark', 'feeds.site_url')
|
||||
->columns(
|
||||
'items.id',
|
||||
'items.title',
|
||||
'items.updated',
|
||||
'items.url',
|
||||
'items.feed_id',
|
||||
'items.status',
|
||||
'items.content',
|
||||
'items.bookmark',
|
||||
'feeds.site_url'
|
||||
)
|
||||
->join('feeds', 'id', 'feed_id')
|
||||
->in('status', array('read', 'unread'))
|
||||
->eq('feed_id', $feed_id)
|
||||
|
@ -20,6 +20,9 @@
|
||||
<?= Helper\escape($item['title']) ?>
|
||||
</a>
|
||||
</h2>
|
||||
<p class="preview">
|
||||
<?= Helper\escape(Helper\summary(strip_tags($item['content']), 50, 300)) ?>
|
||||
</p>
|
||||
<p>
|
||||
<a href="?action=feed-items&feed_id=<?= $item['feed_id'] ?>"><?= Helper\escape($item['feed_title']) ?></a> |
|
||||
<?= dt('%e %B %Y %k:%M', $item['updated']) ?> |
|
||||
|
@ -21,6 +21,9 @@
|
||||
<?= Helper\escape($item['title']) ?>
|
||||
</a>
|
||||
</h2>
|
||||
<p class="preview">
|
||||
<?= Helper\escape(Helper\summary(strip_tags($item['content']), 50, 300)) ?>
|
||||
</p>
|
||||
<p>
|
||||
<?= Helper\get_host_from_url($item['url']) ?> |
|
||||
<?= dt('%e %B %Y %k:%M', $item['updated']) ?> |
|
||||
|
@ -22,6 +22,9 @@
|
||||
<?= Helper\escape($item['title']) ?>
|
||||
</a>
|
||||
</h2>
|
||||
<p class="preview">
|
||||
<?= Helper\escape(Helper\summary(strip_tags($item['content']), 50, 300)) ?>
|
||||
</p>
|
||||
<p>
|
||||
<a href="?action=feed-items&feed_id=<?= $item['feed_id'] ?>"><?= Helper\escape($item['feed_title']) ?></a> |
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user