diff options
-rw-r--r-- | css/news.css | 11 | ||||
-rw-r--r-- | js/news.js | 2 | ||||
-rw-r--r-- | lib/feedmapper.php | 2 | ||||
-rw-r--r-- | lib/itemmapper.php | 6 | ||||
-rw-r--r-- | lib/utils.php | 6 | ||||
-rw-r--r-- | templates/part.items.php | 39 | ||||
-rw-r--r-- | templates/part.listfeed.php | 2 |
7 files changed, 38 insertions, 30 deletions
diff --git a/css/news.css b/css/news.css index 659633862..b0e66cbae 100644 --- a/css/news.css +++ b/css/news.css @@ -561,7 +561,16 @@ div.add_parentfolder { } /** - * Author of the feed + * Title of the feed to which the item belongs + */ + .feed_item h2.item_feed_title { + color: #aaa; + font-size: 1.1em; + margin-left: 3em; + } + + /** + * Author of the item */ .feed_item h2.item_author { color: #aaa; diff --git a/js/news.js b/js/news.js index fb6efe9b0..696f1b9a2 100644 --- a/js/news.js +++ b/js/news.js @@ -689,7 +689,7 @@ $(document).ready(function(){ setupFeedList(); News.Feed.updateAll(); - var updateInterval = 20000; //how often the feeds should update (in msec) + var updateInterval = 200000; //how often the feeds should update (in msec) setInterval('News.Feed.updateAll()', updateInterval); bindItemEventListeners(); diff --git a/lib/feedmapper.php b/lib/feedmapper.php index e3d8fa67f..82fff36ec 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -34,7 +34,7 @@ class FeedMapper { */ public function fromRow($row){ $url = $row['url']; - $title = htmlspecialchars_decode($row['title']); + $title = $row['title']; $id = $row['id']; $feed = new Feed($url, $title, null, $id); $favicon = $row['favicon_link']; diff --git a/lib/itemmapper.php b/lib/itemmapper.php index 661e3cf7a..4a8b569e1 100644 --- a/lib/itemmapper.php +++ b/lib/itemmapper.php @@ -186,11 +186,12 @@ class ItemMapper { if ($itemid == null){ $title = $item->getTitle(); $body = $item->getBody(); + $author = $item->getAuthor(); $stmt = \OCP\DB::prepare(' INSERT INTO ' . self::tableName . - '(url, title, body, guid, guid_hash, pub_date, feed_id, status) - VALUES (?, ?, ?, ?, ?, ?, ?, ?) + '(url, title, body, author, guid, guid_hash, pub_date, feed_id, status) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) '); if(empty($title)) { @@ -209,6 +210,7 @@ class ItemMapper { $item->getUrl(), $title, $body, + $author, $guid, $guid_hash, $pub_date, diff --git a/lib/utils.php b/lib/utils.php index b3ff3db0c..1632849b6 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -66,9 +66,9 @@ class Utils { $itemBody = $spitem->get_content(); $item = new Item($itemUrl, $itemTitle, $itemGUID, $itemBody); - $itemAuthor = $spitem->get_author(); - if ($itemAuthor !== null) { - $item->setAuthor($itemAuthor->get_name()); + $spAuthor = $spitem->get_author(); + if ($spAuthor !== null) { + $item->setAuthor($spAuthor->get_name()); } //date in Item is stored in UNIX timestamp format diff --git a/templates/part.items.php b/templates/part.items.php index 1023ab452..d40730e27 100644 --- a/templates/part.items.php +++ b/templates/part.items.php @@ -4,26 +4,21 @@ $feedId = isset($_['feedid']) ? $_['feedid'] : ''; $itemMapper = new OCA\News\ItemMapper(); -$showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll'); +$showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll'); -// select items by feed id and by preference -switch ($feedId) { - case -1: - $feedMapper = new OCA\News\FeedMapper(); - $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::IMPORTANT); - break; +$specialfeed = false; - case -2: - $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::UNREAD); - break; - - default: - if($showAll){ - $items = $itemMapper->findAll($feedId); +if ($feedId == -1 || $feedId == -2) { //TODO: change this values, too obscure + $specialfeed = true; + $status = ($feedId == -1) ? OCA\News\StatusFlag::IMPORTANT : OCA\News\StatusFlag::UNREAD; + $items = $itemMapper->findEveryItemByStatus($status); +} +else { + if($showAll){ + $items = $itemMapper->findAll($feedId); } else { $items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD); } - break; } echo '<ul>'; @@ -55,14 +50,16 @@ foreach($items as $item) { echo '</div>'; echo '<h1 class="item_title"><a target="_blank" href="' . $item->getUrl() . '">' . $item->getTitle() . '</a></h1>'; - - if(trim($item->getAuthor()) == ''){ + + if ($specialfeed) { $from = $l->t('from') . ' ' . parse_url($item->getUrl(), PHP_URL_HOST); - } else { - $from = $l->t('from') . ' ' . $item->getAuthor(); + echo '<h2 class="item_feed_title">' . $from .'</h2>'; } - echo '<h2 class="item_author">' . $from . '</h2>'; - + + if(($item->getAuthor() !== null) && (trim($item->getAuthor()) != '')){ + echo '<h2 class="item_author">'. $l->t('by') . ' ' . $item->getAuthor() . '</h2>'; + } + echo '<div class="body">' . $item->getBody() . '</div>'; echo '<div class="bottom_utils">'; diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php index f0205776b..0d343d3a9 100644 --- a/templates/part.listfeed.php +++ b/templates/part.listfeed.php @@ -7,7 +7,7 @@ $unreadItemsCount = isset($_['unreadItemsCount']) ? $_['unreadItemsCount'] : nul $favicon = $feed->getFavicon(); if ($favicon == null) { - $favicon = OCP\Util::imagePath('news', 'rss.svg'); + $favicon = OCP\Util::imagePath('core', 'actions/public.svg'); } if($unreadItemsCount == 0){ |