cute icon for updated posts
This commit is contained in:
parent
4fa3573e1a
commit
b197f11776
43
backend.php
43
backend.php
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = $_GET["id"];
|
||||||
|
|
||||||
$result = pg_query("UPDATE ttrss_entries SET unread = false 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 FROM ttrss_entries
|
||||||
WHERE id = '$id'");
|
WHERE id = '$id'");
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
|
|
||||||
if ($ext == "MarkAllRead") {
|
if ($ext == "MarkAllRead") {
|
||||||
|
|
||||||
pg_query("UPDATE ttrss_entries SET unread = false
|
pg_query("UPDATE ttrss_entries SET unread = false,last_read = NOW()
|
||||||
WHERE feed_id = '$feed'");
|
WHERE feed_id = '$feed'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
|
|
||||||
print "<tr><td class=\"search\" colspan=\"2\">
|
print "<tr><td class=\"search\" colspan=\"2\">
|
||||||
Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
|
Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
|
||||||
print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>";
|
print "<tr><td colspan=\"3\" class=\"title\">" . $line["title"] . "</td></tr>";
|
||||||
|
|
||||||
if ($ext == "SEARCH") {
|
if ($ext == "SEARCH") {
|
||||||
$search = $_GET["search"];
|
$search = $_GET["search"];
|
||||||
|
@ -145,8 +145,13 @@
|
||||||
OR content LIKE '%$search%') AND";
|
OR content LIKE '%$search%') AND";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = pg_query("SELECT id,title,updated,unread,feed_id FROM
|
$result = pg_query("SELECT
|
||||||
ttrss_entries WHERE
|
id,title,updated,unread,feed_id,
|
||||||
|
EXTRACT(EPOCH FROM last_read) AS last_read_ts,
|
||||||
|
EXTRACT(EPOCH FROM updated) AS updated_ts
|
||||||
|
FROM
|
||||||
|
ttrss_entries
|
||||||
|
WHERE
|
||||||
$search_query_part
|
$search_query_part
|
||||||
feed_id = '$feed' ORDER BY updated DESC LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip");
|
feed_id = '$feed' ORDER BY updated DESC LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip");
|
||||||
|
|
||||||
|
@ -156,12 +161,25 @@
|
||||||
|
|
||||||
$class = ($lnum % 2) ? "even" : "odd";
|
$class = ($lnum % 2) ? "even" : "odd";
|
||||||
|
|
||||||
|
if ($line["last_read_ts"] < $line["updated_ts"] && $line["unread"] == "f") {
|
||||||
|
$update_pic = "<img src=\"updated.png\" alt=\"Updated\">";
|
||||||
|
} else {
|
||||||
|
$update_pic = " ";
|
||||||
|
}
|
||||||
|
|
||||||
if ($line["unread"] == "t")
|
if ($line["unread"] == "t")
|
||||||
$class .= "Unread";
|
$class .= "Unread";
|
||||||
|
|
||||||
$content_link = "<a href=\"javascript:view(".$line["id"].",".$line["feed_id"].");\">".$line["title"]."</a>";
|
$id = $line["id"];
|
||||||
|
$feed_id = $line["feed_id"];
|
||||||
|
|
||||||
|
$content_link = "<a href=\"javascript:view($id,$feed_id);\">" .
|
||||||
|
$line["title"] . "</a>";
|
||||||
|
|
||||||
|
print "<tr class='$class' id='RROW-$id'>";
|
||||||
|
|
||||||
|
print "<td id='FUPDPIC-$id' valign='center' class='headlineUpdateMark'>$update_pic</td>";
|
||||||
|
|
||||||
print "<tr class='$class' id='RROW-".$line["id"]."'>";
|
|
||||||
print "<td class='headlineUpdated'>".$line["updated"]."</td>";
|
print "<td class='headlineUpdated'>".$line["updated"]."</td>";
|
||||||
print "<td class='headlineTitle'>$content_link</td>";
|
print "<td class='headlineTitle'>$content_link</td>";
|
||||||
|
|
||||||
|
@ -175,7 +193,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr><td colspan=\"2\" class=\"headlineToolbar\">";
|
print "<tr><td colspan=\"3\" class=\"headlineToolbar\">";
|
||||||
|
|
||||||
$next_skip = $skip + HEADLINES_PER_PAGE;
|
$next_skip = $skip + HEADLINES_PER_PAGE;
|
||||||
$prev_skip = $skip - HEADLINES_PER_PAGE;
|
$prev_skip = $skip - HEADLINES_PER_PAGE;
|
||||||
|
@ -187,9 +205,9 @@
|
||||||
print "<a class=\"button\"
|
print "<a class=\"button\"
|
||||||
href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
|
href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
|
||||||
print " ";
|
print " ";
|
||||||
// print "<a class=\"button\"
|
print "<a class=\"button\"
|
||||||
// href=\"javascript:viewfeed($feed, $skip, '');\">Refresh</a>";
|
href=\"javascript:viewfeed($feed, $skip, '');\">Refresh Page</a>";
|
||||||
// print " ";
|
print " ";
|
||||||
print "<a class=\"button\"
|
print "<a class=\"button\"
|
||||||
href=\"javascript:viewfeed($feed, 0, 'ForceUpdate');\">Update</a>";
|
href=\"javascript:viewfeed($feed, 0, 'ForceUpdate');\">Update</a>";
|
||||||
print " Mark as read: ";
|
print " Mark as read: ";
|
||||||
|
@ -233,7 +251,8 @@
|
||||||
if ($subop == "read") {
|
if ($subop == "read") {
|
||||||
$ids = split(",", $_GET["ids"]);
|
$ids = split(",", $_GET["ids"]);
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
pg_query("UPDATE ttrss_entries SET unread = false WHERE feed_id = '$id'");
|
pg_query("UPDATE ttrss_entries
|
||||||
|
SET unread = false,last_read = NOW() WHERE feed_id = '$id'");
|
||||||
}
|
}
|
||||||
|
|
||||||
print "Marked selected feeds as unread.";
|
print "Marked selected feeds as unread.";
|
||||||
|
|
|
@ -57,7 +57,9 @@
|
||||||
if ($atom_date != "") $entry_timestamp = parse_w3cdtf($atom_date);
|
if ($atom_date != "") $entry_timestamp = parse_w3cdtf($atom_date);
|
||||||
if ($rss_1_date != "") $entry_timestamp = parse_w3cdtf($rss_1_date);
|
if ($rss_1_date != "") $entry_timestamp = parse_w3cdtf($rss_1_date);
|
||||||
if ($rss_2_date != "") $entry_timestamp = strtotime($rss_2_date);
|
if ($rss_2_date != "") $entry_timestamp = strtotime($rss_2_date);
|
||||||
if ($entry_timestamp == "") $entry_timestamp = time();
|
if ($entry_timestamp == "") $entry_timestamp = 0;
|
||||||
|
|
||||||
|
if (!$entry_timestamp) continue;
|
||||||
|
|
||||||
$entry_title = $item["title"];
|
$entry_title = $item["title"];
|
||||||
$entry_link = $item["link"];
|
$entry_link = $item["link"];
|
||||||
|
@ -75,7 +77,8 @@
|
||||||
|
|
||||||
$result = pg_query($link, "
|
$result = pg_query($link, "
|
||||||
SELECT
|
SELECT
|
||||||
id,unread,md5_hash
|
id,unread,md5_hash,
|
||||||
|
EXTRACT(EPOCH FROM updated) as updated_timestamp
|
||||||
FROM
|
FROM
|
||||||
ttrss_entries
|
ttrss_entries
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -99,7 +102,8 @@
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$entry_id = pg_fetch_result($result, 0, "id");
|
$entry_id = pg_fetch_result($result, 0, "id");
|
||||||
$entry_timestamp = strftime("%Y/%m/%d %H:%M:%S", $entry_timestamp);
|
$updated_timestamp = pg_fetch_result($result, 0, "updated_timestamp");
|
||||||
|
$entry_timestamp_fmt = strftime("%Y/%m/%d %H:%M:%S", $entry_timestamp);
|
||||||
|
|
||||||
$unread = pg_fetch_result($result, 0, "unread");
|
$unread = pg_fetch_result($result, 0, "unread");
|
||||||
$md5_hash = pg_fetch_result($result, 0, "md5_hash");
|
$md5_hash = pg_fetch_result($result, 0, "md5_hash");
|
||||||
|
@ -107,15 +111,20 @@
|
||||||
if ($md5_hash != $content_md5 && CONTENT_CHECK_MD5)
|
if ($md5_hash != $content_md5 && CONTENT_CHECK_MD5)
|
||||||
$unread = "true";
|
$unread = "true";
|
||||||
|
|
||||||
if ($unread || !CONTENT_CHECK_MD5) {
|
// if ($unread || !CONTENT_CHECK_MD5) {
|
||||||
$updated_query_part = "updated = '$entry_timestamp',";
|
// $updated_query_part = "updated = '$entry_timestamp',";
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// if ($updated_timestamp > $entry_timestamp) {
|
||||||
|
// $unread = "true";
|
||||||
|
// print "$updated_timestamp : $entry_timestamp<br>";
|
||||||
|
// }
|
||||||
|
|
||||||
$query = "UPDATE ttrss_entries
|
$query = "UPDATE ttrss_entries
|
||||||
SET
|
SET
|
||||||
title ='$entry_title',
|
title ='$entry_title',
|
||||||
link = '$entry_link',
|
link = '$entry_link',
|
||||||
$updated_query_part
|
updated = '$entry_timestamp_fmt',
|
||||||
content = '$entry_content',
|
content = '$entry_content',
|
||||||
md5_hash = '$content_md5',
|
md5_hash = '$content_md5',
|
||||||
unread = '$unread'
|
unread = '$unread'
|
||||||
|
|
|
@ -263,3 +263,8 @@ a.buttonWarn:hover {
|
||||||
text-decoration : none;
|
text-decoration : none;
|
||||||
color : black;
|
color : black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td.headlineUpdateMark {
|
||||||
|
width : 25px;
|
||||||
|
text-align : center;
|
||||||
|
}
|
||||||
|
|
|
@ -127,6 +127,12 @@ function view(id,feed_id) {
|
||||||
update_title();
|
update_title();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var upd_img_pic = document.getElementById("FUPDPIC-" + id);
|
||||||
|
|
||||||
|
if (upd_img_pic) {
|
||||||
|
upd_img_pic.innerHTML = "";
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('content').innerHTML='Loading, please wait...';
|
document.getElementById('content').innerHTML='Loading, please wait...';
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=view&id=" + param_escape(id), true);
|
xmlhttp.open("GET", "backend.php?op=view&id=" + param_escape(id), true);
|
||||||
|
|
|
@ -33,5 +33,6 @@ create table ttrss_entries (id serial not null primary key,
|
||||||
link varchar(300) not null unique,
|
link varchar(300) not null unique,
|
||||||
md5_hash varchar(200) not null unique,
|
md5_hash varchar(200) not null unique,
|
||||||
content text not null,
|
content text not null,
|
||||||
|
last_read timestamp,
|
||||||
unread boolean default true);
|
unread boolean default true);
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 244 B |
Loading…
Reference in New Issue