Add feed fallback icon and set a relative width on the feed list items.

This commit is contained in:
Gregor Tätzner 2012-07-21 16:45:37 +02:00
Родитель 67ba166c82
Коммит 912374165b
2 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -16,7 +16,7 @@
#addfolder { background: url('%webroot%/core/img/places/folder.svg') no-repeat left center; padding-left: 20px !important; }
#addfeed { background: url('%appswebroot%/apps/news/img/rss.svg') no-repeat left center; padding-left: 20px !important; }
#unreaditemcounter { position: relative; background: #5E5E5E; border-radius: 5px; padding: 0 5px; color: white; text-align: center; margin-right: 0.3em; }
#unreaditemcounter { position: relative; background: #5E5E5E; border-radius: 5px; padding: 0 5px; color: white; text-align: center; margin: 0 0.3em 0 0.3em;}
ul.controls li { float: left; }
@ -55,7 +55,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: 16px !important; text-align: right; border-radius: 5px; padding-left: 5px !important; }
li.feeds_list a { padding: 0 0 0 20px !important; overflow: hidden; text-overflow: ellipsis; text-align: left; width: 13em; }
li.feeds_list a { padding: 0 0 0 20px !important; overflow: hidden; text-overflow: ellipsis; text-align: left; width: 70%; }
div.collapsable_container { padding-left: 5px !important; border-radius: 5px; }
ul.folders { margin-left: 16px !important; }

Просмотреть файл

@ -4,10 +4,10 @@
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*
*/
// load SimplePie library
@ -18,8 +18,8 @@ class OC_News_Utils {
/**
* @brief Fetch a feed from remote
* @param url remote url of the feed
* @returns
* @param url remote url of the feed
* @returns
*/
public static function fetch($url){
//TODO: handle the case where fetching of the feed fails
@ -29,7 +29,7 @@ class OC_News_Utils {
$spfeed->init();
$spfeed->handle_content_type();
$title = $spfeed->get_title();
$spitems = $spfeed->get_items();
$items = array();
foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
@ -37,18 +37,19 @@ class OC_News_Utils {
$itemTitle = $spitem->get_title();
$itemGUID = $spitem->get_id();
$itemBody = $spitem->get_content();
$items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
$items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
}
$feed = new OC_News_Feed($url, $title, $items);
$favicon = $spfeed->get_image_url();
if ($favicon == null) {
$favicon = $url . "favicon.ico";
// fallback icon
$favicon = OCP\Util::imagePath('news', 'rss.svg');
//check if this file exists
}
$feed->setFavicon($favicon);
return $feed;
}
}