pg_query("UPDATE ttrss_entries SET unread = false
WHERE feed_id = '$feed'");
}
+
+ if ($ext == "MarkPageRead") {
+
+// pg_query("UPDATE ttrss_entries SET unread = false
+// WHERE feed_id = '$feed' ORDER BY updated OFFSET $skip LIMIT 1");
+ }
+
}
}
print "<table class=\"headlines\" width=\"100%\">";
-/* print "<tr><td class=\"search\">
- Search: <input onchange=\"javascript:search($feed,this);\"></td>";
- print "<td class=\"title\">" . $line["title"] . "</td></tr>"; */
print "<tr><td class=\"search\" colspan=\"2\">
- Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
- print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>";
+ Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
+ print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>";
if ($ext == "SEARCH") {
$search = $_GET["search"];
$next_skip = $skip + HEADLINES_PER_PAGE;
$prev_skip = $skip - HEADLINES_PER_PAGE;
-
+
+ print "Navigate: ";
print "<a class=\"button\"
href=\"javascript:viewfeed($feed, $prev_skip);\">Previous Page</a>";
print " ";
print "<a class=\"button\"
href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
- print " ";
-
+ print " ";
print "<a class=\"button\"
- href=\"javascript:viewfeed($feed, 0, '');\">Refresh</a>";
- print " ";
+ href=\"javascript:viewfeed($feed, $skip, '');\">Refresh</a>";
+ print " Mark as read: ";
+ print "<a class=\"button\"
+ href=\"javascript:viewfeed($feed, $skip, 'MarkPageRead');\">This Page</a>";
+ print " ";
print "<a class=\"button\"
- href=\"javascript:viewfeed($feed, 0, 'MarkAllRead');\">Mark all as read</a>";
+ href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
print "</td></tr>";
print "</table>";
print "<p>[Edit feed placeholder]</p>";
}
+ if ($subop == "unread") {
+ $ids = split(",", $_GET["ids"]);
+ foreach ($ids as $id) {
+ pg_query("UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'");
+ }
+ }
+
+ if ($subop == "read") {
+ $ids = split(",", $_GET["ids"]);
+ foreach ($ids as $id) {
+ pg_query("UPDATE ttrss_entries SET unread = false WHERE feed_id = '$id'");
+ }
+ }
+
if ($subop == "remove") {
$ids = split(",", $_GET["ids"]);
var link = document.getElementById("fadd_link");
- if (link.length == 0) {
- notify("Missing feed URL.");
+ if (link.value.length == 0) {
+ notify("Error: Missing feed URL.");
} else {
notify("Adding feed...");
}
-
-function removeSelectedFeeds() {
+function getSelectedFeeds() {
var content = document.getElementById("prefFeedList");
}
}
+ return sel_rows;
+}
+
+function readSelectedFeeds() {
+
+ var sel_rows = getSelectedFeeds();
+
+ if (sel_rows.length > 0) {
+
+ notify("Marking selected feeds as read...");
+
+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
+ param_escape(sel_rows.toString()), true);
+ xmlhttp.onreadystatechange=feedlist_callback;
+ xmlhttp.send(null);
+
+ } else {
+
+ notify("Error: Please select some feeds first.");
+
+ }
+}
+
+function unreadSelectedFeeds() {
+
+ var sel_rows = getSelectedFeeds();
+
+ if (sel_rows.length > 0) {
+
+ notify("Marking selected feeds as unread...");
+
+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
+ param_escape(sel_rows.toString()), true);
+ xmlhttp.onreadystatechange=feedlist_callback;
+ xmlhttp.send(null);
+
+ } else {
+
+ notify("Error: Please select some feeds first.");
+
+ }
+}
+
+function removeSelectedFeeds() {
+
+ var sel_rows = getSelectedFeeds();
+
if (sel_rows.length > 0) {
notify("Removing selected feeds...");
} else {
- notify("Please select some feeds first.");
+ notify("Error: Please select some feeds first.");
}