diff options
author | Andrew Dolgov <[email protected]> | 2005-08-26 04:11:37 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2005-08-26 04:11:37 +0100 |
commit | b7f4bda2987193da0399aed302df0c5624e0f9ce (patch) | |
tree | 9d84e618b3fa1ae777e3f164aef5951141fc5f9c | |
parent | a14b6d21d977058359acda6719ff528fde583209 (diff) |
support for feed-specific images (channel->url)
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | backend.php | 34 | ||||
-rw-r--r-- | functions.php | 14 | ||||
-rw-r--r-- | tt-rss.css | 28 | ||||
-rw-r--r-- | ttrss_schema.sql | 1 |
5 files changed, 62 insertions, 17 deletions
@@ -6,7 +6,7 @@ + update detection based on content checksum + cleanup posts older then specified number of days ~ keyboard navigation -- support channel -> image -> url (like in LJ feeds) ++ support for channel -> image -> url (like in LJ feeds) 1.1 diff --git a/backend.php b/backend.php index 6dd80a414..e34cde944 100644 --- a/backend.php +++ b/backend.php @@ -178,30 +178,36 @@ $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'"); if ($result) { $line = pg_fetch_assoc($result); -/* print "<table class=\"feedOverview\">"; - print "<tr><td><b>Title:</b></td><td>".$line["title"]."</td></tr>"; - print "<tr><td><b>Link:</b></td><td><a href=\"".$line["link"]."\">".$line["link"]."</a></td></tr>"; - print "</table>"; - - print $line["content"]; */ - + if ($line["icon_url"]) { + $feed_icon = "<img class=\"feedIcon\" src=\"" . $line["icon_url"] . "\">"; + } else { + $feed_icon = " "; + } - 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> - <td width=\"100%\">".$line["title"]."</td></tr>"; + <td width=\"100%\">".$line["title"]."</td> + <td> </td></tr>"; print "<tr class=\"titleBottom\"><td align=\"right\"><b>Link:</b></td> - <td><a href=\"".$line["link"]."\">".$line["link"]."</a></td></tr>"; - - print "<tr><td class=\"post\" colspan=\"2\">" . $line["content"] . "</td></tr>"; - print "</table>"; + <td><a href=\"".$line["link"]."\">".$line["link"]."</a></td> + <td> </td> </tr>"; + print "<tr><td class=\"post\" colspan=\"2\">" . $line["content"] . "</td> + <td valign=\"top\">$feed_icon</td> + </tr>"; + print "</table>"; + } } diff --git a/functions.php b/functions.php index f3ff6a1f9..0de0e4056 100644 --- a/functions.php +++ b/functions.php @@ -83,6 +83,8 @@ error_reporting (E_ERROR | E_WARNING | E_PARSE); pg_query("BEGIN"); + + $feed = pg_escape_string($feed); if ($rss) { @@ -90,15 +92,25 @@ 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"); + $orig_icon_url = pg_fetch_result($result, 0, "icon_url"); if (!$registered_title) { $feed_title = $rss->channel["title"]; 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) { $entry_guid = $item["id"]; diff --git a/tt-rss.css b/tt-rss.css index 8b4e69ebb..74f328925 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -315,11 +315,16 @@ div.errorBox { margin : 20px; background : #f0f0f0; } - table.postTable tr.titleTop, table.postTable tr.titleBottom { background : #f0f0f0; } +table.postTable td.titleIcon { + border-width : 0px 0px 1px 0px; + border-color : #d0d0d0; + border-style : solid; +} + table.postTable tr.titleTop td { 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 { padding : 20px; @@ -354,3 +375,8 @@ table.postTable td.post { -moz-border-radius : 10px; opacity : 0.8; } + +img.feedIcon { + margin : 3px; + border : 1px solid #c0c0c0; +} diff --git a/ttrss_schema.sql b/ttrss_schema.sql index cdc7abfb5..0ee3a7558 100644 --- a/ttrss_schema.sql +++ b/ttrss_schema.sql @@ -4,6 +4,7 @@ drop table ttrss_feeds; create table ttrss_feeds (id serial not null primary key, title varchar(200) not null unique, feed_url varchar(250) unique not null, + icon_url varchar(250) not null default '', last_updated timestamp default null); insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed'); |