support for comments attribute (schema updated)

This commit is contained in:
Andrew Dolgov 2005-08-26 06:11:41 +01:00
parent b10e155060
commit a1ea1e12a8
4 changed files with 24 additions and 38 deletions

View File

@ -178,7 +178,7 @@
$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,feed_id, $result = pg_query("SELECT title,link,content,feed_id,comments,
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url (SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url
FROM ttrss_entries FROM ttrss_entries
WHERE id = '$id'"); WHERE id = '$id'");
@ -200,8 +200,16 @@
<td width=\"100%\">".$line["title"]."</td> <td width=\"100%\">".$line["title"]."</td>
<td>&nbsp;</td></tr>"; <td>&nbsp;</td></tr>";
if ($line["comments"] && $line["comments"] != $line["link"]) {
// print "<tr class=\"titleInner\"><td align=\"right\"><b>Comments:</b></td>
// <td><a href=\"".$line["comments"]."\">".$line["comments"]."</a></td>
// <td>&nbsp;</td> </tr>";
$comments_prompt = "(<a href=\"".$line["comments"]."\">Comments</a>)";
}
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> <td><a href=\"".$line["link"]."\">".$line["link"]."</a> $comments_prompt</td>
<td>&nbsp;</td></tr>"; <td>&nbsp;</td></tr>";
print "<tr><td valign=\"top\" class=\"post\" print "<tr><td valign=\"top\" class=\"post\"
colspan=\"2\">" . $line["content"] . "</td> colspan=\"2\">" . $line["content"] . "</td>

View File

@ -153,6 +153,8 @@
$content_hash = "SHA1:" . sha1(strip_tags($entry_content)); $content_hash = "SHA1:" . sha1(strip_tags($entry_content));
$entry_comments = $item["comments"];
$result = pg_query($link, " $result = pg_query($link, "
SELECT SELECT
id,last_read,no_orig_date,title,feed_id,content_hash, id,last_read,no_orig_date,title,feed_id,content_hash,
@ -164,9 +166,11 @@
if (pg_num_rows($result) == 0) { if (pg_num_rows($result) == 0) {
$entry_guid = pg_escape_string($entry_guid);
$entry_content = pg_escape_string($entry_content); $entry_content = pg_escape_string($entry_content);
$entry_title = pg_escape_string($entry_title); $entry_title = pg_escape_string($entry_title);
$entry_link = pg_escape_string($entry_link); $entry_link = pg_escape_string($entry_link);
$entry_comments = pg_escape_string($entry_comments);
$query = "INSERT $query = "INSERT
INTO ttrss_entries INTO ttrss_entries
@ -177,6 +181,7 @@
content, content,
content_hash, content_hash,
feed_id, feed_id,
comments,
no_orig_date) no_orig_date)
VALUES VALUES
('$entry_title', ('$entry_title',
@ -186,6 +191,7 @@
'$entry_content', '$entry_content',
'$content_hash', '$content_hash',
'$feed', '$feed',
'$entry_comments',
$no_orig_date)"; $no_orig_date)";
$result = pg_query($link, $query); $result = pg_query($link, $query);
@ -217,10 +223,11 @@
$last_read_qpart = 'last_read = null,'; $last_read_qpart = 'last_read = null,';
} }
// if ($orig_timestamp < $entry_timestamp) { // if (!$no_orig_date && $orig_timestamp < $entry_timestamp) {
// $last_read_qpart = 'last_read = null,'; // $last_read_qpart = 'last_read = null,';
// } // }
$entry_comments = pg_escape_string($entry_comments);
$entry_content = pg_escape_string($entry_content); $entry_content = pg_escape_string($entry_content);
$entry_title = pg_escape_string($entry_title); $entry_title = pg_escape_string($entry_title);
$entry_link = pg_escape_string($entry_link); $entry_link = pg_escape_string($entry_link);
@ -232,6 +239,7 @@
link = '$entry_link', link = '$entry_link',
updated = '$entry_timestamp_fmt', updated = '$entry_timestamp_fmt',
content = '$entry_content', content = '$entry_content',
comments = '$entry_comments',
content_hash = '$content_hash' content_hash = '$content_hash'
WHERE WHERE
id = '$orig_entry_id'"; id = '$orig_entry_id'";

View File

@ -98,9 +98,6 @@ input {
table.main td.toolbar { table.main td.toolbar {
height : 40px; height : 40px;
background-color : #f0f0f0; background-color : #f0f0f0;
/* background-image : url("shadow_top.png");
background-position : bottom left;
background-repeat : repeat-x; */
padding-right : 10px; padding-right : 10px;
padding-left : 10px; padding-left : 10px;
font-size : small; font-size : small;
@ -200,17 +197,6 @@ table.main td.notify {
font-weight : bold; font-weight : bold;
} }
li {
list-style-type : none;
}
ul {
margin : 0px;
padding : 0px;
border : 1px solid #f0f0f0;
}
.invisible { .invisible {
display : none; display : none;
} }
@ -251,7 +237,6 @@ table.prefFeedList tr.title td {
font-weight : bold; font-weight : bold;
} }
.evenSelected { .evenSelected {
background-color : #e0e0ff; background-color : #e0e0ff;
} }
@ -344,22 +329,6 @@ 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;

View File

@ -38,5 +38,6 @@ create table ttrss_entries (id serial not null primary key,
last_read timestamp, last_read timestamp,
date_entered timestamp not null default NOW(), date_entered timestamp not null default NOW(),
no_orig_date boolean not null default false, no_orig_date boolean not null default false,
comments varchar(250) not null default '',
unread boolean not null default true); unread boolean not null default true);