show last update time/status in feed tooltip (#55)
This commit is contained in:
parent
3b0f23de40
commit
fb1fb4ab1f
15
backend.php
15
backend.php
|
@ -238,6 +238,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = db_query($link, "SELECT ttrss_feeds.*,
|
$result = db_query($link, "SELECT ttrss_feeds.*,
|
||||||
|
SUBSTRING(last_updated,1,19) AS last_updated_noms,
|
||||||
(SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
|
(SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
|
||||||
WHERE feed_id = ttrss_feeds.id AND
|
WHERE feed_id = ttrss_feeds.id AND
|
||||||
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
||||||
|
@ -265,6 +266,8 @@
|
||||||
|
|
||||||
$category = "";
|
$category = "";
|
||||||
|
|
||||||
|
$short_date = get_pref($link, 'SHORT_DATE_FORMAT');
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
|
||||||
$feed = db_unescape_string($line["title"]);
|
$feed = db_unescape_string($line["title"]);
|
||||||
|
@ -275,6 +278,12 @@
|
||||||
$total = $line["total"];
|
$total = $line["total"];
|
||||||
$unread = $line["unread"];
|
$unread = $line["unread"];
|
||||||
|
|
||||||
|
if (get_pref($link, 'HEADLINES_SMART_DATE')) {
|
||||||
|
$last_updated = smart_date_time(strtotime($line["last_updated_noms"]));
|
||||||
|
} else {
|
||||||
|
$last_updated = date($short_date, strtotime($line["last_updated_noms"]));
|
||||||
|
}
|
||||||
|
|
||||||
$rtl_content = sql_bool_to_bool($line["rtl_content"]);
|
$rtl_content = sql_bool_to_bool($line["rtl_content"]);
|
||||||
|
|
||||||
if ($rtl_content) {
|
if ($rtl_content) {
|
||||||
|
@ -365,7 +374,8 @@
|
||||||
<a href=\"javascript:toggleCollapseCat($cat_id)\">$tmp_category</a>
|
<a href=\"javascript:toggleCollapseCat($cat_id)\">$tmp_category</a>
|
||||||
<a href=\"javascript:viewCategory($cat_id)\" id=\"FCAP-$cat_id\">
|
<a href=\"javascript:viewCategory($cat_id)\" id=\"FCAP-$cat_id\">
|
||||||
<span id=\"FCATCTR-$cat_id\"
|
<span id=\"FCATCTR-$cat_id\"
|
||||||
class=\"$catctr_class\">($cat_unread unread)$ellipsis</span></a></li>";
|
class=\"$catctr_class\">($cat_unread unread)$ellipsis</span>
|
||||||
|
</a></li>";
|
||||||
|
|
||||||
// !!! NO SPACE before <ul...feedCatList - breaks firstChild DOM function
|
// !!! NO SPACE before <ul...feedCatList - breaks firstChild DOM function
|
||||||
// -> keyboard navigation, etc.
|
// -> keyboard navigation, etc.
|
||||||
|
@ -373,7 +383,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
printFeedEntry($feed_id, $class, $feed, $unread,
|
printFeedEntry($feed_id, $class, $feed, $unread,
|
||||||
"icons/$feed_id.ico", $link, $rtl_content);
|
"icons/$feed_id.ico", $link, $rtl_content,
|
||||||
|
$last_updated, $line["last_error"]);
|
||||||
|
|
||||||
++$lnum;
|
++$lnum;
|
||||||
}
|
}
|
||||||
|
|
10
functions.js
10
functions.js
|
@ -399,6 +399,7 @@ function parse_counters(reply, f_document, title_obj, scheduled_call) {
|
||||||
var ctr = reply.childNodes[l].getAttribute("counter");
|
var ctr = reply.childNodes[l].getAttribute("counter");
|
||||||
var error = reply.childNodes[l].getAttribute("error");
|
var error = reply.childNodes[l].getAttribute("error");
|
||||||
var has_img = reply.childNodes[l].getAttribute("hi");
|
var has_img = reply.childNodes[l].getAttribute("hi");
|
||||||
|
var updated = reply.childNodes[l].getAttribute("updated");
|
||||||
|
|
||||||
if (id == "global-unread") {
|
if (id == "global-unread") {
|
||||||
title_obj.global_unread = ctr;
|
title_obj.global_unread = ctr;
|
||||||
|
@ -418,6 +419,15 @@ function parse_counters(reply, f_document, title_obj, scheduled_call) {
|
||||||
var feedu = f_document.getElementById("FEEDU-" + id);
|
var feedu = f_document.getElementById("FEEDU-" + id);
|
||||||
var feedr = f_document.getElementById("FEEDR-" + id);
|
var feedr = f_document.getElementById("FEEDR-" + id);
|
||||||
var feed_img = f_document.getElementById("FIMG-" + id);
|
var feed_img = f_document.getElementById("FIMG-" + id);
|
||||||
|
var feedlink = f_document.getElementById("FEEDL-" + id);
|
||||||
|
|
||||||
|
if (updated && feedlink) {
|
||||||
|
if (error) {
|
||||||
|
feedlink.title = "Error: " + error + " (" + updated + ")";
|
||||||
|
} else {
|
||||||
|
feedlink.title = "Updated: " + updated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (feedctr && feedu && feedr) {
|
if (feedctr && feedu && feedr) {
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link,
|
function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link,
|
||||||
$rtl_content = false) {
|
$rtl_content = false, $last_updated = false, $last_error = false) {
|
||||||
|
|
||||||
if (file_exists($icon_file) && filesize($icon_file) > 0) {
|
if (file_exists($icon_file) && filesize($icon_file) > 0) {
|
||||||
$feed_icon = "<img id=\"FIMG-$feed_id\" src=\"$icon_file\">";
|
$feed_icon = "<img id=\"FIMG-$feed_id\" src=\"$icon_file\">";
|
||||||
|
@ -700,7 +700,13 @@
|
||||||
$rtl_tag = "dir=\"ltr\"";
|
$rtl_tag = "dir=\"ltr\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed = "<a href=\"javascript:viewfeed('$feed_id', 0);\">$feed_title</a>";
|
if ($last_error) {
|
||||||
|
$link_title = "Error: $last_error ($last_updated)";
|
||||||
|
} else {
|
||||||
|
$link_title = "Updated: $last_updated";
|
||||||
|
}
|
||||||
|
|
||||||
|
$feed = "<a title=\"$link_title\" id=\"FEEDL-$feed_id\" href=\"javascript:viewfeed('$feed_id', 0);\">$feed_title</a>";
|
||||||
|
|
||||||
print "<li id=\"FEEDR-$feed_id\" class=\"$class\">";
|
print "<li id=\"FEEDR-$feed_id\" class=\"$class\">";
|
||||||
if (get_pref($link, 'ENABLE_FEED_ICONS')) {
|
if (get_pref($link, 'ENABLE_FEED_ICONS')) {
|
||||||
|
@ -1399,6 +1405,7 @@
|
||||||
$old_counters = $_SESSION["fctr_last_value"];
|
$old_counters = $_SESSION["fctr_last_value"];
|
||||||
|
|
||||||
$result = db_query($link, "SELECT id,last_error,parent_feed,
|
$result = db_query($link, "SELECT id,last_error,parent_feed,
|
||||||
|
SUBSTRING(last_updated,1,19) AS last_updated,
|
||||||
(SELECT count(id)
|
(SELECT count(id)
|
||||||
FROM ttrss_entries,ttrss_user_entries
|
FROM ttrss_entries,ttrss_user_entries
|
||||||
WHERE feed_id = ttrss_feeds.id AND
|
WHERE feed_id = ttrss_feeds.id AND
|
||||||
|
@ -1409,12 +1416,20 @@
|
||||||
|
|
||||||
$fctrs_modified = false;
|
$fctrs_modified = false;
|
||||||
|
|
||||||
|
$short_date = get_pref($link, 'SHORT_DATE_FORMAT');
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
|
||||||
$id = $line["id"];
|
$id = $line["id"];
|
||||||
$count = $line["count"];
|
$count = $line["count"];
|
||||||
$last_error = htmlspecialchars($line["last_error"]);
|
$last_error = htmlspecialchars($line["last_error"]);
|
||||||
|
|
||||||
|
if (get_pref($link, 'HEADLINES_SMART_DATE')) {
|
||||||
|
$last_updated = smart_date_time(strtotime($line["last_updated"]));
|
||||||
|
} else {
|
||||||
|
$last_updated = date($short_date, strtotime($line["last_updated"]));
|
||||||
|
}
|
||||||
|
|
||||||
$has_img = is_file(ICONS_DIR . "/$id.ico");
|
$has_img = is_file(ICONS_DIR . "/$id.ico");
|
||||||
|
|
||||||
$tmp_result = db_query($link,
|
$tmp_result = db_query($link,
|
||||||
|
@ -1445,7 +1460,7 @@
|
||||||
$has_img_part = "";
|
$has_img_part = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" $has_img_part $error_part/>";
|
print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" $has_img_part $error_part updated=\"$last_updated\"/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue