support for feed-specific images (channel->url)

This commit is contained in:
Andrew Dolgov 2005-08-26 04:11:37 +01:00
parent a14b6d21d9
commit b7f4bda298
5 changed files with 62 additions and 17 deletions

2
TODO
View File

@ -6,7 +6,7 @@
+ update detection based on content checksum + update detection based on content checksum
+ cleanup posts older then specified number of days + cleanup posts older then specified number of days
~ keyboard navigation ~ keyboard navigation
- support channel -> image -> url (like in LJ feeds) + support for channel -> image -> url (like in LJ feeds)
1.1 1.1

View File

@ -178,30 +178,36 @@
$result = pg_query("UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'"); $result = pg_query("UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'");
$result = pg_query("SELECT title,link,content FROM ttrss_entries $result = pg_query("SELECT title,link,content,feed_id,
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url
FROM ttrss_entries
WHERE id = '$id'"); WHERE id = '$id'");
if ($result) { if ($result) {
$line = pg_fetch_assoc($result); $line = pg_fetch_assoc($result);
/* print "<table class=\"feedOverview\">"; if ($line["icon_url"]) {
print "<tr><td><b>Title:</b></td><td>".$line["title"]."</td></tr>"; $feed_icon = "<img class=\"feedIcon\" src=\"" . $line["icon_url"] . "\">";
print "<tr><td><b>Link:</b></td><td><a href=\"".$line["link"]."\">".$line["link"]."</a></td></tr>"; } else {
print "</table>"; $feed_icon = "&nbsp;";
}
print $line["content"]; */ print "<table class=\"postTable\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"0\">";
print "<table class=\"postTable\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr class=\"titleTop\"><td align=\"right\"><b>Title:</b></td> print "<tr class=\"titleTop\"><td align=\"right\"><b>Title:</b></td>
<td width=\"100%\">".$line["title"]."</td></tr>"; <td width=\"100%\">".$line["title"]."</td>
<td>&nbsp;</td></tr>";
print "<tr class=\"titleBottom\"><td align=\"right\"><b>Link:</b></td> print "<tr class=\"titleBottom\"><td align=\"right\"><b>Link:</b></td>
<td><a href=\"".$line["link"]."\">".$line["link"]."</a></td></tr>"; <td><a href=\"".$line["link"]."\">".$line["link"]."</a></td>
<td>&nbsp;</td> </tr>";
print "<tr><td class=\"post\" colspan=\"2\">" . $line["content"] . "</td></tr>"; print "<tr><td class=\"post\" colspan=\"2\">" . $line["content"] . "</td>
<td valign=\"top\">$feed_icon</td>
</tr>";
print "</table>"; print "</table>";
} }
} }

View File

@ -84,21 +84,33 @@
pg_query("BEGIN"); pg_query("BEGIN");
$feed = pg_escape_string($feed);
if ($rss) { if ($rss) {
if (ENABLE_FEED_ICONS) { if (ENABLE_FEED_ICONS) {
check_feed_favicon($feed_url, $feed); check_feed_favicon($feed_url, $feed);
} }
$result = pg_query("SELECT title FROM ttrss_feeds WHERE id = '$feed'"); $result = pg_query("SELECT title,icon_url FROM ttrss_feeds WHERE id = '$feed'");
$registered_title = pg_fetch_result($result, 0, "title"); $registered_title = pg_fetch_result($result, 0, "title");
$orig_icon_url = pg_fetch_result($result, 0, "icon_url");
if (!$registered_title) { if (!$registered_title) {
$feed_title = $rss->channel["title"]; $feed_title = $rss->channel["title"];
pg_query("UPDATE ttrss_feeds SET title = '$feed_title' WHERE id = '$feed'"); pg_query("UPDATE ttrss_feeds SET title = '$feed_title' WHERE id = '$feed'");
} }
// print "I: " . $rss->channel["image"]["url"];
$icon_url = $rss->image["url"];
if ($icon_url && !$orig_icon_url) {
$icon_url = pg_escape_string($icon_url);
pg_query("UPDATE ttrss_feeds SET icon_url = '$icon_url' WHERE id = '$feed'");
}
foreach ($rss->items as $item) { foreach ($rss->items as $item) {
$entry_guid = $item["id"]; $entry_guid = $item["id"];

View File

@ -315,11 +315,16 @@ div.errorBox {
margin : 20px; margin : 20px;
background : #f0f0f0; background : #f0f0f0;
} }
table.postTable tr.titleTop, table.postTable tr.titleBottom { table.postTable tr.titleTop, table.postTable tr.titleBottom {
background : #f0f0f0; background : #f0f0f0;
} }
table.postTable td.titleIcon {
border-width : 0px 0px 1px 0px;
border-color : #d0d0d0;
border-style : solid;
}
table.postTable tr.titleTop td { table.postTable tr.titleTop td {
padding : 5px 10px 0px 10px; padding : 5px 10px 0px 10px;
} }
@ -332,6 +337,22 @@ table.postTable tr.titleBottom td {
} }
/*
table.postTable tr.titleTop td {
padding : 5px 10px 0px 10px;
}
table.postTable tr.titleBottom td {
padding : 3px 10px 5px 10px;
}
table.postTable tr.headerRow td.headers, table.postTable tr.headerRow td.iconBox {
background : #f0f0f0;
border-width : 0px 0px 1px 0px;
border-color : #d0d0d0;
border-style : solid;
}*/
table.postTable td.post { table.postTable td.post {
padding : 20px; padding : 20px;
@ -354,3 +375,8 @@ table.postTable td.post {
-moz-border-radius : 10px; -moz-border-radius : 10px;
opacity : 0.8; opacity : 0.8;
} }
img.feedIcon {
margin : 3px;
border : 1px solid #c0c0c0;
}

View File

@ -4,6 +4,7 @@ drop table ttrss_feeds;
create table ttrss_feeds (id serial not null primary key, create table ttrss_feeds (id serial not null primary key,
title varchar(200) not null unique, title varchar(200) not null unique,
feed_url varchar(250) unique not null, feed_url varchar(250) unique not null,
icon_url varchar(250) not null default '',
last_updated timestamp default null); last_updated timestamp default null);
insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed'); insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');