feed update notification, catchup all feeds button
This commit is contained in:
parent
cac95b8d16
commit
476cac422f
33
backend.php
33
backend.php
|
@ -15,7 +15,14 @@
|
||||||
|
|
||||||
if ($op == "feeds") {
|
if ($op == "feeds") {
|
||||||
|
|
||||||
|
$subop = $_GET["subop"];
|
||||||
|
|
||||||
|
if ($subop == "catchupAll") {
|
||||||
|
pg_query("UPDATE ttrss_entries SET last_read = NOW(),unread = false");
|
||||||
|
}
|
||||||
|
|
||||||
if ($fetch) update_all_feeds($link, $fetch);
|
if ($fetch) update_all_feeds($link, $fetch);
|
||||||
|
|
||||||
|
|
||||||
$result = pg_query("SELECT *,
|
$result = pg_query("SELECT *,
|
||||||
(SELECT count(id) FROM ttrss_entries
|
(SELECT count(id) FROM ttrss_entries
|
||||||
|
@ -57,11 +64,21 @@
|
||||||
++$lnum;
|
++$lnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr><td class=\"footer\" colspan=\"3\">
|
// print "<tr><td class=\"footer\" colspan=\"3\">
|
||||||
<a href=\"javascript:update_feed_list(false,true)\">Update all feeds</a></td></tr>";
|
// <a href=\"javascript:update_feed_list(false,true)\">Update all feeds</a></td></tr>";
|
||||||
|
|
||||||
|
// print "<tr><td class=\"footer\" colspan=\"2\"> ";
|
||||||
|
// print "</td></tr>";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
print "<p align=\"center\">All feeds:
|
||||||
|
<a class=\"button\"
|
||||||
|
href=\"javascript:updateFeedList(false,true)\">Update</a>";
|
||||||
|
|
||||||
|
print " <a class=\"button\"
|
||||||
|
href=\"javascript:catchupAllFeeds()\">Mark as read</a></p>";
|
||||||
|
|
||||||
print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>";
|
print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,11 +112,11 @@
|
||||||
|
|
||||||
$feed = $_GET["feed"];
|
$feed = $_GET["feed"];
|
||||||
$skip = $_GET["skip"];
|
$skip = $_GET["skip"];
|
||||||
$ext = $_GET["ext"];
|
$subop = $_GET["subop"];
|
||||||
|
|
||||||
if (!$skip) $skip = 0;
|
if (!$skip) $skip = 0;
|
||||||
|
|
||||||
if ($ext == "undefined") $ext = "";
|
if ($subop == "undefined") $subop = "";
|
||||||
|
|
||||||
// FIXME: check for null value here
|
// FIXME: check for null value here
|
||||||
|
|
||||||
|
@ -111,20 +128,20 @@
|
||||||
|
|
||||||
$line = pg_fetch_assoc($result);
|
$line = pg_fetch_assoc($result);
|
||||||
|
|
||||||
if ($ext == "ForceUpdate" ||
|
if ($subop == "ForceUpdate" ||
|
||||||
(!$ext && $line["update_timeout"] > MIN_UPDATE_TIME)) {
|
(!$subop && $line["update_timeout"] > MIN_UPDATE_TIME)) {
|
||||||
|
|
||||||
update_rss_feed($link, $line["feed_url"], $feed);
|
update_rss_feed($link, $line["feed_url"], $feed);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ($ext == "MarkAllRead") {
|
if ($subop == "MarkAllRead") {
|
||||||
|
|
||||||
pg_query("UPDATE ttrss_entries SET unread = false,last_read = NOW()
|
pg_query("UPDATE ttrss_entries SET unread = false,last_read = NOW()
|
||||||
WHERE feed_id = '$feed'");
|
WHERE feed_id = '$feed'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ext == "MarkPageRead") {
|
if ($subop == "MarkPageRead") {
|
||||||
|
|
||||||
// pg_query("UPDATE ttrss_entries SET unread = false
|
// pg_query("UPDATE ttrss_entries SET unread = false
|
||||||
// WHERE feed_id = '$feed' ORDER BY updated OFFSET $skip LIMIT 1");
|
// WHERE feed_id = '$feed' ORDER BY updated OFFSET $skip LIMIT 1");
|
||||||
|
|
27
tt-rss.js
27
tt-rss.js
|
@ -37,6 +37,8 @@ function feedlist_callback() {
|
||||||
total_unread = feedtu.innerHTML;
|
total_unread = feedtu.innerHTML;
|
||||||
update_title();
|
update_title();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notify("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +79,11 @@ function view_callback() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_feed_list(called_from_timer, fetch) {
|
function updateFeedList(called_from_timer, fetch) {
|
||||||
|
|
||||||
if (called_from_timer != true) {
|
if (called_from_timer != true) {
|
||||||
document.getElementById("feeds").innerHTML = "Loading feeds, please wait...";
|
//document.getElementById("feeds").innerHTML = "Loading feeds, please wait...";
|
||||||
|
notify("Updating feeds...");
|
||||||
}
|
}
|
||||||
|
|
||||||
var query_str = "backend.php?op=feeds";
|
var query_str = "backend.php?op=feeds";
|
||||||
|
@ -91,18 +94,26 @@ function update_feed_list(called_from_timer, fetch) {
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
xmlhttp.onreadystatechange=feedlist_callback;
|
||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function catchupAllFeeds() {
|
||||||
|
var query_str = "backend.php?op=feeds&subop=catchupAll";
|
||||||
|
|
||||||
|
notify("Marking all feeds as read...");
|
||||||
|
|
||||||
|
xmlhttp.open("GET", query_str, true);
|
||||||
|
xmlhttp.onreadystatechange=feedlist_callback;
|
||||||
|
xmlhttp.send(null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewfeed(feed, skip, ext) {
|
function viewfeed(feed, skip, subop) {
|
||||||
|
|
||||||
// notify("view-feed: " + feed);
|
|
||||||
|
|
||||||
document.getElementById('headlines').innerHTML='Loading headlines, please wait...';
|
document.getElementById('headlines').innerHTML='Loading headlines, please wait...';
|
||||||
document.getElementById('content').innerHTML=' ';
|
document.getElementById('content').innerHTML=' ';
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed) +
|
xmlhttp.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed) +
|
||||||
"&skip=" + param_escape(skip) + "&ext=" + param_escape(ext) , true);
|
"&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) , true);
|
||||||
xmlhttp.onreadystatechange=viewfeed_callback;
|
xmlhttp.onreadystatechange=viewfeed_callback;
|
||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
|
|
||||||
|
@ -143,7 +154,7 @@ function view(id,feed_id) {
|
||||||
|
|
||||||
function timeout() {
|
function timeout() {
|
||||||
|
|
||||||
update_feed_list(true);
|
updateFeedList(true);
|
||||||
|
|
||||||
setTimeout("timeout()", 1800*1000);
|
setTimeout("timeout()", 1800*1000);
|
||||||
|
|
||||||
|
@ -168,6 +179,6 @@ function update_title() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
update_feed_list(false, false);
|
updateFeedList(false, false);
|
||||||
setTimeout("timeout()", 1800*1000);
|
setTimeout("timeout()", 1800*1000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue