further label/vfeed/feed behaviour unification
This commit is contained in:
parent
392d45635b
commit
8073cce71e
24
backend.php
24
backend.php
|
@ -21,7 +21,7 @@
|
||||||
function getLabelCounters($link) {
|
function getLabelCounters($link) {
|
||||||
|
|
||||||
$result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
|
$result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
|
||||||
WHERE marked = true");
|
WHERE marked = true AND unread = true");
|
||||||
|
|
||||||
$count = db_fetch_result($result, 0, "count");
|
$count = db_fetch_result($result, 0, "count");
|
||||||
|
|
||||||
|
@ -48,6 +48,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFeedCounter($link, $id) {
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT
|
||||||
|
count(id) as count FROM ttrss_entries
|
||||||
|
WHERE feed_id = '$id' AND unread = true");
|
||||||
|
|
||||||
|
$count = db_fetch_result($result, 0, "count");
|
||||||
|
|
||||||
|
print "<feed id=\"$id\" counter=\"$count\"/>";
|
||||||
|
}
|
||||||
|
|
||||||
function getFeedCounters($link) {
|
function getFeedCounters($link) {
|
||||||
|
|
||||||
$result = db_query($link, "SELECT id,
|
$result = db_query($link, "SELECT id,
|
||||||
|
@ -79,7 +90,7 @@
|
||||||
/* virtual feeds */
|
/* virtual feeds */
|
||||||
|
|
||||||
$result = db_query($link, "SELECT count(id) as num_starred
|
$result = db_query($link, "SELECT count(id) as num_starred
|
||||||
FROM ttrss_entries WHERE marked = true");
|
FROM ttrss_entries WHERE marked = true AND unread = true");
|
||||||
$num_starred = db_fetch_result($result, 0, "num_starred");
|
$num_starred = db_fetch_result($result, 0, "num_starred");
|
||||||
|
|
||||||
printFeedEntry(-1, "odd", "Starred articles", $num_starred, "images/mark_set.png");
|
printFeedEntry(-1, "odd", "Starred articles", $num_starred, "images/mark_set.png");
|
||||||
|
@ -172,8 +183,12 @@
|
||||||
$subop = $_GET["subop"];
|
$subop = $_GET["subop"];
|
||||||
|
|
||||||
if ($subop == "getLabelCounters") {
|
if ($subop == "getLabelCounters") {
|
||||||
|
$aid = $_GET["aid"];
|
||||||
print "<rpc-reply>";
|
print "<rpc-reply>";
|
||||||
getLabelCounters($link);
|
getLabelCounters($link);
|
||||||
|
if ($aid) {
|
||||||
|
getFeedCounter($link, $aid);
|
||||||
|
}
|
||||||
print "</rpc-reply>";
|
print "</rpc-reply>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +275,7 @@
|
||||||
if ($op == "view") {
|
if ($op == "view") {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = $_GET["id"];
|
||||||
|
$feed_id = $_GET["feed"];
|
||||||
|
|
||||||
$result = db_query($link, "UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'");
|
$result = db_query($link, "UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'");
|
||||||
|
|
||||||
|
@ -315,7 +331,7 @@
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
print "<script type=\"text/javascript\">
|
print "<script type=\"text/javascript\">
|
||||||
update_label_counters();
|
update_label_counters($feed_id);
|
||||||
</script>";
|
</script>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,7 +603,7 @@
|
||||||
feedctr.className = 'invisible';
|
feedctr.className = 'invisible';
|
||||||
}
|
}
|
||||||
|
|
||||||
update_label_counters();
|
update_label_counters($feed);
|
||||||
|
|
||||||
// p_notify(\"\");
|
// p_notify(\"\");
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ function label_counters_callback() {
|
||||||
|
|
||||||
if (ctr > 0) {
|
if (ctr > 0) {
|
||||||
feedctr.className = "odd";
|
feedctr.className = "odd";
|
||||||
if (!feedr.className.match("Unread") && id != -1) {
|
if (!feedr.className.match("Unread")) {
|
||||||
feedr.className = feedr.className + "Unread";
|
feedr.className = feedr.className + "Unread";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -329,9 +329,9 @@ function label_counters_callback() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_label_counters() {
|
function update_label_counters(feed) {
|
||||||
if (xmlhttp_ready(xmlhttp_rpc)) {
|
if (xmlhttp_ready(xmlhttp_rpc)) {
|
||||||
var query = "backend.php?op=rpc&subop=getLabelCounters";
|
var query = "backend.php?op=rpc&subop=getLabelCounters&aid=" + feed;
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
xmlhttp_rpc.open("GET", query, true);
|
||||||
xmlhttp_rpc.onreadystatechange=label_counters_callback;
|
xmlhttp_rpc.onreadystatechange=label_counters_callback;
|
||||||
xmlhttp_rpc.send(null);
|
xmlhttp_rpc.send(null);
|
||||||
|
|
|
@ -70,7 +70,7 @@ function refetch_callback() {
|
||||||
|
|
||||||
if (ctr > 0) {
|
if (ctr > 0) {
|
||||||
feedctr.className = "odd";
|
feedctr.className = "odd";
|
||||||
if (id != -1 && !feedr.className.match("Unread")) {
|
if (!feedr.className.match("Unread")) {
|
||||||
feedr.className = feedr.className + "Unread";
|
feedr.className = feedr.className + "Unread";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
2
view.js
2
view.js
|
@ -19,6 +19,7 @@ if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') {
|
||||||
xmlhttp_rpc = new XMLHttpRequest();
|
xmlhttp_rpc = new XMLHttpRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function label_counters_callback() {
|
function label_counters_callback() {
|
||||||
if (xmlhttp_rpc.readyState == 4) {
|
if (xmlhttp_rpc.readyState == 4) {
|
||||||
var reply = xmlhttp_rpc.responseXML.firstChild;
|
var reply = xmlhttp_rpc.responseXML.firstChild;
|
||||||
|
@ -51,3 +52,4 @@ function update_label_counters() {
|
||||||
xmlhttp_rpc.send(null);
|
xmlhttp_rpc.send(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
18
viewfeed.js
18
viewfeed.js
|
@ -34,7 +34,7 @@ function view(id, feed_id) {
|
||||||
|
|
||||||
var crow = h_document.getElementById("RROW-" + id);
|
var crow = h_document.getElementById("RROW-" + id);
|
||||||
|
|
||||||
if (crow.className.match("Unread")) {
|
/* if (crow.className.match("Unread")) {
|
||||||
var umark = f_document.getElementById("FEEDU-" + feed_id);
|
var umark = f_document.getElementById("FEEDU-" + feed_id);
|
||||||
|
|
||||||
umark.innerHTML = umark.innerHTML - 1;
|
umark.innerHTML = umark.innerHTML - 1;
|
||||||
|
@ -52,8 +52,9 @@ function view(id, feed_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
total_unread--;
|
total_unread--;
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
crow.className = crow.className.replace("Unread", "");
|
||||||
|
|
||||||
cleanSelected("headlinesList");
|
cleanSelected("headlinesList");
|
||||||
|
|
||||||
|
@ -63,23 +64,14 @@ function view(id, feed_id) {
|
||||||
upd_img_pic.src = "images/blank_icon.gif";
|
upd_img_pic.src = "images/blank_icon.gif";
|
||||||
}
|
}
|
||||||
|
|
||||||
var unread_rows = getVisibleUnreadHeadlines();
|
|
||||||
|
|
||||||
if (unread_rows.length == 0) {
|
|
||||||
var button = h_document.getElementById("btnCatchupPage");
|
|
||||||
if (button) {
|
|
||||||
button.className = "disabledButton";
|
|
||||||
button.href = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
active_post_id = id;
|
active_post_id = id;
|
||||||
setActiveFeedId(feed_id);
|
setActiveFeedId(feed_id);
|
||||||
|
|
||||||
var content = m_document.getElementById("content-frame");
|
var content = m_document.getElementById("content-frame");
|
||||||
|
|
||||||
if (content) {
|
if (content) {
|
||||||
content.src = "backend.php?op=view&addheader=true&id=" + param_escape(id);
|
content.src = "backend.php?op=view&addheader=true&id=" + param_escape(id) +
|
||||||
|
"&feed=" + param_escape(feed_id);
|
||||||
markHeadline(active_post_id);
|
markHeadline(active_post_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue