]> git.wh0rd.org Git - tt-rss.git/commitdiff
support for feed-specific images (channel->url)
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 26 Aug 2005 03:11:37 +0000 (04:11 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 26 Aug 2005 03:11:37 +0000 (04:11 +0100)
TODO
backend.php
functions.php
tt-rss.css
ttrss_schema.sql

diff --git a/TODO b/TODO
index b7e7394e430c7b0be106ea6adab28c708b2f8918..13ed2585ba84bae3d5384fdf5416a3195c7c7f4b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -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
 
index 6dd80a41497eec798731bfb81d72af8264fa4e72..e34cde94459db24eeb65edb6d382b6839b2c0b46 100644 (file)
 
                $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 = "&nbsp;";
+                       }
 
-                       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>&nbsp;</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>&nbsp;</td> </tr>";
+                       print "<tr><td class=\"post\" colspan=\"2\">" . $line["content"] . "</td>                       
+                               <td valign=\"top\">$feed_icon</td>
+                       </tr>";
+                       print "</table>";        
+
                }
        }
 
index f3ff6a1f997b4d19d00e3b68a12cb35948c6a3fa..0de0e405600143320867606fbbc2dd4b56a12d8f 100644 (file)
@@ -83,6 +83,8 @@
                error_reporting (E_ERROR | E_WARNING | E_PARSE);
 
                pg_query("BEGIN");
+
+               $feed = pg_escape_string($feed);
        
                if ($rss) {
 
                                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"];
index 8b4e69ebb84335e998458748b9d7819c4b6ba925..74f328925c2744ce82d077f61d63a0b9e9c4d08e 100644 (file)
@@ -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;
+}
index cdc7abfb5aa526f88c7f64aa7583c266032e1837..0ee3a7558d1fb41af67f96e51a2b332bf054e5e3 100644 (file)
@@ -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');