diff options
-rw-r--r-- | appinfo/database.xml | 6 | ||||
-rw-r--r-- | appinfo/info.xml | 2 | ||||
-rw-r--r-- | css/news.css | 2 | ||||
-rw-r--r-- | lib/feed.php | 10 | ||||
-rw-r--r-- | lib/feedmapper.php | 12 | ||||
-rw-r--r-- | lib/foldermapper.php | 2 | ||||
-rw-r--r-- | lib/utils.php | 8 | ||||
-rw-r--r-- | templates/part.feeds.php | 3 |
8 files changed, 37 insertions, 8 deletions
diff --git a/appinfo/database.xml b/appinfo/database.xml index 3f5f6c44a..dc3a2b606 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -76,6 +76,12 @@ <length>100</length> </field> <field> + <name>favicon_link</name> + <type>text</type> + <notnull>false</notnull> + <length>100</length> + </field> + <field> <name>added</name> <type>integer</type> <default></default> diff --git a/appinfo/info.xml b/appinfo/info.xml index 0ada6e75c..1e5215550 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -3,7 +3,7 @@ <id>news</id> <name>News</name> <description>An RSS/Atom feed reader</description> - <version>5.5</version> + <version>6.1</version> <licence>AGPL</licence> <author>Alessandro Cosentino</author> <require>4</require> diff --git a/css/news.css b/css/news.css index d85c8e48b..37b73334c 100644 --- a/css/news.css +++ b/css/news.css @@ -44,7 +44,7 @@ ul#feedfoldermenu { position:fixed; margin-left: 0; bottom: 2.8em; border-left:1 li { padding: 0px !important; } li.menuItem { margin-left:0.7em; margin-right:0.7em; float: none !important; text-align: left; } -li.feeds_list { margin-left: 20px !important; text-align: right; } +li.feeds_list { text-align: right; padding-left: 20px; } li.folder_list:hover { color: rgb(0, 0, 0) !important; background: none !important; } li.feeds_list:hover { background: none repeat scroll 0% 0% rgb(221, 221, 221) !important; } diff --git a/lib/feed.php b/lib/feed.php index bbed8d598..59db6f7cc 100644 --- a/lib/feed.php +++ b/lib/feed.php @@ -18,6 +18,7 @@ class OC_News_Feed extends OC_News_Collection { private $url; private $spfeed; //encapsulate a SimplePie_Core object private $items; //array that contains all the items of the feed + private $favicon; public function __construct($url, $title, $items, $id = null){ $this->url = $url; @@ -36,6 +37,14 @@ class OC_News_Feed extends OC_News_Collection { return $this->title; } + public function getFavicon(){ + return $this->favicon; + } + + public function setFavicon($favicon){ + $this->favicon = $favicon; + } + public function setItems($items){ $this->items = $items; } @@ -43,4 +52,5 @@ class OC_News_Feed extends OC_News_Collection { public function getItems(){ return $this->items; } + } diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 73afa0e86..c43ff47a5 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -46,6 +46,8 @@ class OC_News_FeedMapper { $title = $row['title']; $id = $row['id']; $feed = new OC_News_Feed($url, $title, null, $id); + $favicon = $row['favicon_link']; + $feed->setFavicon($favicon); $feeds[] = $feed; } return $feeds; @@ -64,7 +66,8 @@ class OC_News_FeedMapper { $url = $row['url']; $title = $row['title']; $feed = new OC_News_Feed($url, $title, null,$id); - + $favicon = $row['favicon_link']; + $feed->setFavicon($favicon); $itemMapper = new OC_News_ItemMapper(); $items = $itemMapper->findAll($id); $feed->setItems($items); @@ -118,16 +121,17 @@ class OC_News_FeedMapper { if ($feedid == null){ $query = OCP\DB::prepare(' INSERT INTO ' . self::tableName . - '(url, title, folder_id, added, lastmodified) - VALUES (?, ?, ?, ?, ?) + '(url, title, favicon_link, folder_id, added, lastmodified) + VALUES (?, ?, ?, ?, ?, ?) '); $params=array( $url, htmlspecialchars_decode($title), + $feed->getFavicon(), $folderid, $_ut, - $_ut + $_ut, ); $query->execute($params); diff --git a/lib/foldermapper.php b/lib/foldermapper.php index 45dc53c42..01dce13d7 100644 --- a/lib/foldermapper.php +++ b/lib/foldermapper.php @@ -40,7 +40,7 @@ class OC_News_FolderMapper { $result = $stmt->execute(array($this->userid, $id)); while( $row = $result->fetchRow()){ - $child = OC_News_FolderMapper::populate($row['name'], $row['id']); + $child = self::populate($row['name'], $row['id']); $root->addChild($child); } diff --git a/lib/utils.php b/lib/utils.php index 959a102ee..a9f1488b1 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -41,6 +41,14 @@ class OC_News_Utils { } $feed = new OC_News_Feed($url, $title, $items); + + $favicon = $spfeed->get_image_url(); + if ($favicon == null) { + $favicon = $url . "favicon.ico"; + //check if this file exists + } + $feed->setFavicon($favicon); + return $feed; } }
\ No newline at end of file diff --git a/templates/part.feeds.php b/templates/part.feeds.php index 5874f1bc1..d8e4a6b01 100644 --- a/templates/part.feeds.php +++ b/templates/part.feeds.php @@ -14,7 +14,8 @@ print_folder($child, $depth+1); } elseif ($child instanceOf OC_News_Feed) { //onhover $(element).attr('id', 'newID'); - echo '<li class="feeds_list" data-id="' . $child->getId() . '"><a href="' . OCP\Util::linkTo('news', 'index.php'). '?feedid=' . $child->getId() . '">' . $child->getTitle() .'</a>'; + $favicon = $child->getFavicon(); + echo '<li style="background: url(' . $favicon . ') left center no-repeat; background-size:16px 16px;" class="feeds_list" data-id="' . $child->getId() . '"><a href="' . OCP\Util::linkTo('news', 'index.php'). '?feedid=' . $child->getId() . '">' . $child->getTitle() .'</a>'; countUnreadItems($child->getId()); echo '<button class="svg action" id="feeds_delete" onClick="(News.Feed.delete(' . $child->getId(). '))" title="' . $l->t('Delete feed') . '"></button>'; echo '<button class="svg action" id="feeds_edit" title="' . $l->t('Edit feed') . '"></button>'; |