diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/part.items.header.php | 7 | ||||
-rw-r--r-- | templates/part.items.php | 14 | ||||
-rw-r--r-- | templates/part.listfeed.php | 19 |
3 files changed, 25 insertions, 15 deletions
diff --git a/templates/part.items.header.php b/templates/part.items.header.php index 5fdec1d46..68e0d9234 100644 --- a/templates/part.items.header.php +++ b/templates/part.items.header.php @@ -8,6 +8,9 @@ if(isset($_['feedid'])){ $feedTitle = ''; } +// FIXME: get this setting from the database +$showOnlyUnread = true; + ?> <div class="feed_controls"> @@ -18,8 +21,8 @@ if(isset($_['feedid'])){ <div class="controls"> <input type="button" value="<?php echo $l->t('Mark all as read'); ?>" id="mark_all_as_read" /> <select id="feed_filter"> - <option value="all"><?php echo $l->t('Show read/unread articles'); ?></option> - <option value="newest"><?php echo $l->t('Show only unread articles'); ?></option> + <option value="unread" <?php if($showOnlyUnread){ echo 'selected="selected"'; }; ?>><?php echo $l->t('Show only unread articles'); ?></option> + <option value="all" <?php if(!$showOnlyUnread){ echo 'selected="selected"'; }; ?>><?php echo $l->t('Show read/unread articles'); ?></option> </select> </div> </div>
\ No newline at end of file diff --git a/templates/part.items.php b/templates/part.items.php index 49423236c..486741f19 100644 --- a/templates/part.items.php +++ b/templates/part.items.php @@ -1,9 +1,15 @@ <?php -$feedid = isset($_['feedid']) ? $_['feedid'] : ''; +$feedId = isset($_['feedid']) ? $_['feedid'] : ''; -$itemmapper = new OCA\News\ItemMapper(); -$items = $itemmapper->findAll($feedid); +$itemMapper = new OCA\News\ItemMapper(); + +$showOnlyUnread = true; // FIXME: get this from the settings db +if($showOnlyUnread){ + $items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::Unread); +} else { + $items = $itemMapper->findAll($feedId); +} echo '<ul>'; foreach($items as $item) { @@ -22,7 +28,7 @@ foreach($items as $item) { $startTitle = $l->t('Mark as important'); } - echo '<li class="feed_item ' . $newsItemClass .'" data-id="' . $item->getId() . '" data-feedid="' . $feedid . '">'; + echo '<li class="feed_item ' . $newsItemClass .'" data-id="' . $item->getId() . '" data-feedid="' . $feedId . '" data-processing="false">'; echo '<div class="utils">'; echo '<ul class="primary_item_utils">'; diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php index 0fba399ec..7d5c91afd 100644 --- a/templates/part.listfeed.php +++ b/templates/part.listfeed.php @@ -4,20 +4,21 @@ $l = new OC_l10n('news'); $feed = isset($_['feed']) ? $_['feed'] : null; $unreadItems = isset($_['unreadItems']) ? $_['unreadItems'] : null; + $favicon = $feed->getFavicon(); if ($favicon == null) { - $favicon = OCP\Util::imagePath('news', 'rss.svg'); + $favicon = OCP\Util::imagePath('news', 'rss.svg'); } -echo '<li class="feed" data-id="' . $feed->getId() . '">'; -echo '<a href="#" style="background: url(' . $favicon . ') left center no-repeat; background-size:16px 16px;" class="' . - (($unreadItems > 0) ? 'nonzero' : 'zero') . '">' . $feed->getTitle() .'</a>'; -if ($unreadItems > 0) { - echo '<span class="unreaditemcounter nonzero">' . $unreadItems . '</span>'; -} -else { - echo '<span class="unreaditemcounter zero"></span>'; +if($unreadItems == 0){ + $allReadClass = 'all_read'; +} else { + $allReadClass = ''; } + +echo '<li class="feed" data-id="' . $feed->getId() . '">'; +echo '<a href="#" style="background: url(' . $favicon . ') left center no-repeat; background-size:16px 16px;" class="' . $allReadClass . '">' . $feed->getTitle() .'</a>'; + echo '<span class="unreaditemcounter ' . $allReadClass . '">' . $unreadItems . '</span>'; echo '<button class="svg action feeds_edit" title="' . $l->t('Edit feed') . '"></button>'; echo '<button class="svg action feeds_delete" onClick="(News.Feed.delete(' . $feed->getId(). '))" title="' . $l->t('Delete feed') . '"></button>'; echo '</li>'; |