From: Andrew Dolgov Date: Mon, 22 Aug 2005 11:43:07 +0000 (+0100) Subject: mark headlines page as read now works (via rpc) X-Git-Tag: 20050823-1~20 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=175847dee889442606adae97f844302cb027cebd;p=tt-rss.git mark headlines page as read now works (via rpc) --- diff --git a/backend.php b/backend.php index f862d540..c7b66929 100644 --- a/backend.php +++ b/backend.php @@ -12,7 +12,27 @@ $op = $_GET["op"]; $fetch = $_GET["fetch"]; + + if ($op == "rpc") { + + $subop = $_GET["subop"]; + if ($subop == "catchupPage") { + + $ids = split(",", $_GET["ids"]); + + foreach ($ids as $id) { + + pg_query("UPDATE ttrss_entries SET unread=false,last_read = NOW() + WHERE id = '$id'"); + + } + + print "Marked active page as read."; + } + + } + if ($op == "feeds") { $subop = $_GET["subop"]; @@ -150,7 +170,7 @@ } } - print ""; + print "
"; print ""; @@ -242,9 +262,11 @@ print " "; print "Update"; + print "  Mark as read: "; + print "This Page"; + href=\"javascript:catchupPage($feed);\">This Page"; print " "; print "All Posts"; diff --git a/prefs.js b/prefs.js index 192e194f..6263a6ec 100644 --- a/prefs.js +++ b/prefs.js @@ -39,6 +39,7 @@ function notify_callback() { } } + function updateFeedList() { document.getElementById("feeds").innerHTML = "Loading feeds, please wait..."; diff --git a/tt-rss.css b/tt-rss.css index 0da8b122..ba1d08a1 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -55,7 +55,7 @@ table.feeds td.footer { font-size : small; } -table.headlines td.search { +table.headlinesList td.search { font-size : small; /* border-width : 0px 0px 1px 0px; border-color : #d0d0d0; @@ -63,7 +63,7 @@ table.headlines td.search { padding-bottom : 3px; */ } -table.headlines td.title { +table.headlinesList td.title { font-weight : bold; font-size : large; border-width : 0px 0px 1px 0px; @@ -73,9 +73,8 @@ table.headlines td.title { padding-bottom : 3px; } -table.headlines td.headlineUpdated { +table.headlinesList td.headlineUpdated { width : 200px; - } input { diff --git a/tt-rss.js b/tt-rss.js index 7d0972a4..f5721639 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -26,6 +26,13 @@ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } +function notify_callback() { + var container = document.getElementById('notify'); + if (xmlhttp.readyState == 4) { + container.innerHTML=xmlhttp.responseText; + } +} + function feedlist_callback() { var container = document.getElementById('feeds'); if (xmlhttp.readyState == 4) { @@ -99,6 +106,42 @@ function updateFeedList(called_from_timer, fetch) { } +function catchupPage(feed) { + + var content = document.getElementById("headlinesList"); + + var rows = new Array(); + + for (i = 0; i < content.rows.length; i++) { + var row_id = content.rows[i].id.replace("RROW-", ""); + if (row_id.length > 0) { + rows.push(row_id); + content.rows[i].className = content.rows[i].className.replace("Unread", ""); + } + } + + var feedr = document.getElementById("FEEDR-" + feed); + var feedu = document.getElementById("FEEDU-" + feed); + + feedu.innerHTML = feedu.innerHTML - rows.length; + + if (feedu.innerHTML > 0 && !feedr.className.match("Unread")) { + feedr.className = feedr.className + "Unread"; + } else if (feedu.innerHTML <= 0) { + feedr.className = feedr.className.replace("Unread", ""); + } + + var query_str = "backend.php?op=rpc&subop=catchupPage&ids=" + + param_escape(rows.toString()); + + notify("Marking this page as read..."); + + xmlhttp.open("GET", query_str, true); + xmlhttp.onreadystatechange=notify_callback; + xmlhttp.send(null); + +} + function catchupAllFeeds() { var query_str = "backend.php?op=feeds&subop=catchupAll";
Search: