disable btnCatchupPage when there is nothing to catchup
This commit is contained in:
parent
961513a3bb
commit
e1123aee35
19
backend.php
19
backend.php
|
@ -294,18 +294,23 @@
|
||||||
|
|
||||||
$lnum = 0;
|
$lnum = 0;
|
||||||
|
|
||||||
|
$num_unread = 0;
|
||||||
|
|
||||||
while ($line = pg_fetch_assoc($result)) {
|
while ($line = pg_fetch_assoc($result)) {
|
||||||
|
|
||||||
$class = ($lnum % 2) ? "even" : "odd";
|
$class = ($lnum % 2) ? "even" : "odd";
|
||||||
|
|
||||||
if ($line["last_read_ts"] < $line["updated_ts"] && $line["unread"] == "f") {
|
if ($line["last_read_ts"] < $line["updated_ts"] && $line["unread"] == "f") {
|
||||||
$update_pic = "<img src=\"images/updated.png\" alt=\"Updated\">";
|
$update_pic = "<img src=\"images/updated.png\" alt=\"Updated\">";
|
||||||
|
++$num_unread;
|
||||||
} else {
|
} else {
|
||||||
$update_pic = " ";
|
$update_pic = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($line["unread"] == "t")
|
if ($line["unread"] == "t") {
|
||||||
$class .= "Unread";
|
$class .= "Unread";
|
||||||
|
++$num_unread;
|
||||||
|
}
|
||||||
|
|
||||||
$id = $line["id"];
|
$id = $line["id"];
|
||||||
$feed_id = $line["feed_id"];
|
$feed_id = $line["feed_id"];
|
||||||
|
@ -365,9 +370,15 @@
|
||||||
|
|
||||||
print " Mark as read: ";
|
print " Mark as read: ";
|
||||||
|
|
||||||
print "<a class=\"button\"
|
if ($num_unread > 0) {
|
||||||
href=\"javascript:catchupPage($feed);\">This Page</a>";
|
print "<a class=\"button\" id=\"btnCatchupPage\"
|
||||||
print " ";
|
href=\"javascript:catchupPage($feed);\">This Page</a>";
|
||||||
|
print " ";
|
||||||
|
} else {
|
||||||
|
print "<a class=\"disabledButton\">This Page</a>";
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
|
||||||
print "<a class=\"button\"
|
print "<a class=\"button\"
|
||||||
href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
|
href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,11 @@ function catchupPage(feed) {
|
||||||
|
|
||||||
notify("Marking this page as read...");
|
notify("Marking this page as read...");
|
||||||
|
|
||||||
|
var button = document.getElementById("btnCatchupPage");
|
||||||
|
|
||||||
|
button.className = "disabledButton";
|
||||||
|
button.href = "";
|
||||||
|
|
||||||
xmlhttp.open("GET", query_str, true);
|
xmlhttp.open("GET", query_str, true);
|
||||||
xmlhttp.onreadystatechange=notify_callback;
|
xmlhttp.onreadystatechange=notify_callback;
|
||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
|
|
Loading…
Reference in New Issue