]> git.wh0rd.org - tt-rss.git/commitdiff
mark headlines page as read now works (via rpc)
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 22 Aug 2005 11:43:07 +0000 (12:43 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 22 Aug 2005 11:43:07 +0000 (12:43 +0100)
backend.php
prefs.js
tt-rss.css
tt-rss.js

index f862d540d685a6b2ba85512da914e12977ee0ab6..c7b66929e475608874af7f34caccadb42170d894 100644 (file)
 
        $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"];
                        }
                }
 
-               print "<table class=\"headlines\" width=\"100%\">";
+               print "<table class=\"headlinesList\" id=\"headlinesList\" width=\"100%\">";
 
                print "<tr><td class=\"search\" colspan=\"3\">
                        Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>"; 
                print "&nbsp;";
                print "<a class=\"button\" 
                        href=\"javascript:viewfeed($feed, 0, 'ForceUpdate');\">Update</a>";
+               
                print "&nbsp;&nbsp;Mark as read: ";
+               
                print "<a class=\"button\" 
-                       href=\"javascript:viewfeed($feed, $skip, 'MarkPageRead');\">This Page</a>";
+                       href=\"javascript:catchupPage($feed);\">This Page</a>";
                print "&nbsp;";
                print "<a class=\"button\" 
                        href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
index 192e194fe2ab05f649b508c18bb4237caaf64e75..6263a6ec093a6b1205eeae2e3e8386abfe9c6b65 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -39,6 +39,7 @@ function notify_callback() {
        }
 }
 
+
 function updateFeedList() {
 
        document.getElementById("feeds").innerHTML = "Loading feeds, please wait...";
index 0da8b12294e08bc0c20b6a044e07ff0e9181dd43..ba1d08a1237bc57dc3294a71055a45ee69558088 100644 (file)
@@ -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 {
index 7d0972a45c8cbb95e7591fec692e22a23261bed5..f5721639deb38b42ae7514c3e49fcac352ffd672 100644 (file)
--- 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";