diff --git a/backend.php b/backend.php
index 5fe962c35..d7e2b157f 100644
--- a/backend.php
+++ b/backend.php
@@ -70,7 +70,7 @@
$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
WHERE id = '$id'");
@@ -120,7 +120,7 @@
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'");
}
@@ -137,7 +137,7 @@
print "
";
$next_skip = $skip + HEADLINES_PER_PAGE;
$prev_skip = $skip - HEADLINES_PER_PAGE;
@@ -187,9 +205,9 @@
print "Next Page";
print " ";
-// print "Refresh";
-// print " ";
+ print "Refresh Page";
+ print " ";
print "Update";
print " Mark as read: ";
@@ -233,7 +251,8 @@
if ($subop == "read") {
$ids = split(",", $_GET["ids"]);
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.";
diff --git a/functions.php b/functions.php
index 0d28016fa..d89e6bc83 100644
--- a/functions.php
+++ b/functions.php
@@ -53,11 +53,13 @@
$rss_2_date = $item['pubdate'];
$rss_1_date = $item['dc']['date'];
$atom_date = $item['issued'];
-
+
if ($atom_date != "") $entry_timestamp = parse_w3cdtf($atom_date);
if ($rss_1_date != "") $entry_timestamp = parse_w3cdtf($rss_1_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_link = $item["link"];
@@ -75,7 +77,8 @@
$result = pg_query($link, "
SELECT
- id,unread,md5_hash
+ id,unread,md5_hash,
+ EXTRACT(EPOCH FROM updated) as updated_timestamp
FROM
ttrss_entries
WHERE
@@ -99,7 +102,8 @@
} else {
$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");
$md5_hash = pg_fetch_result($result, 0, "md5_hash");
@@ -107,15 +111,20 @@
if ($md5_hash != $content_md5 && CONTENT_CHECK_MD5)
$unread = "true";
- if ($unread || !CONTENT_CHECK_MD5) {
- $updated_query_part = "updated = '$entry_timestamp',";
- }
-
+// if ($unread || !CONTENT_CHECK_MD5) {
+// $updated_query_part = "updated = '$entry_timestamp',";
+// }
+
+// if ($updated_timestamp > $entry_timestamp) {
+// $unread = "true";
+// print "$updated_timestamp : $entry_timestamp ";
+// }
+
$query = "UPDATE ttrss_entries
SET
title ='$entry_title',
link = '$entry_link',
- $updated_query_part
+ updated = '$entry_timestamp_fmt',
content = '$entry_content',
md5_hash = '$content_md5',
unread = '$unread'
diff --git a/tt-rss.css b/tt-rss.css
index 63a2fc26c..a225056bd 100644
--- a/tt-rss.css
+++ b/tt-rss.css
@@ -263,3 +263,8 @@ a.buttonWarn:hover {
text-decoration : none;
color : black;
}
+
+td.headlineUpdateMark {
+ width : 25px;
+ text-align : center;
+}
diff --git a/tt-rss.js b/tt-rss.js
index 285d667e2..24c5a88c6 100644
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -121,12 +121,18 @@ function view(id,feed_id) {
var feedr = document.getElementById("FEEDR-" + feed_id);
feedr.className = feedr.className.replace("Unread", "");
}
-
+
total_unread--;
- 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...';
xmlhttp.open("GET", "backend.php?op=view&id=" + param_escape(id), true);
diff --git a/ttrss_schema.sql b/ttrss_schema.sql
index d9cc38b9e..20237ce7e 100644
--- a/ttrss_schema.sql
+++ b/ttrss_schema.sql
@@ -33,5 +33,6 @@ create table ttrss_entries (id serial not null primary key,
link varchar(300) not null unique,
md5_hash varchar(200) not null unique,
content text not null,
+ last_read timestamp,
unread boolean default true);
diff --git a/updated.png b/updated.png
new file mode 100644
index 000000000..1cff4c659
Binary files /dev/null and b/updated.png differ
|