From fe1087fbb72959a2da5c71ef405e96c84c94381e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 4 Nov 2010 19:11:54 +0300 Subject: [PATCH] implement a simple pseudo-dashboard feed; display feeds having update errors there instead of client-based 'no feed selected' whiteBox plug (closes #189) --- backend.php | 9 +++++++++ feedlist.js | 1 + functions.php | 27 +++++++++++++++++++++++++++ tt-rss.js | 10 ++++++---- tt-rss.php | 4 ++-- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/backend.php b/backend.php index 252548167..0182b2436 100644 --- a/backend.php +++ b/backend.php @@ -289,6 +289,15 @@ $csync = $_REQUEST["csync"]; $order_by = db_escape_string($_REQUEST["order_by"]); + /* Feed -5 is a special case: it is used to display auxiliary information + * when there's nothing to load - e.g. no stuff in fresh feed */ + + if ($feed == -5) { + generate_dashboard_feed($link); + print ""; + return; + } + /* Updating a label ccache means recalculating all of the caches * so for performance reasons we don't do that here */ diff --git a/feedlist.js b/feedlist.js index 3d9acafd1..ddbcd6c0e 100644 --- a/feedlist.js +++ b/feedlist.js @@ -429,6 +429,7 @@ function feedlist_init() { notify_silent_next(); setTimeout("viewfeed(-3)", 100); } else { + setTimeout("viewfeed(-5)", 100); remove_splash(); } } diff --git a/functions.php b/functions.php index 259aaf556..c691039d8 100644 --- a/functions.php +++ b/functions.php @@ -6828,4 +6828,31 @@ return $headlines; } + function generate_dashboard_feed($link) { + print ""; + + print ''; + + print "
".__('No feed selected.'); + + $result = db_query($link, "SELECT COUNT(id) AS num_errors + FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); + + $num_errors = db_fetch_result($result, 0, "num_errors"); + + if ($num_errors > 0) { + + print "

". + __('Some feeds have update errors (click for details)').""; + } + + print "

]]>"; + print "
"; + + print ""; + print ""; + print ""; + print ""; + + } ?> diff --git a/tt-rss.js b/tt-rss.js index e4469d8fe..8f5c28474 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -87,10 +87,7 @@ function toggleTags(show_all) { function dlg_frefresh_callback(transport, deleted_feed) { if (getActiveFeedId() == deleted_feed) { - var h = $("headlines-frame"); - if (h) { - h.innerHTML = "
" + __('No feed selected.') + "
"; - } + setTimeout("viewfeed(-5)", 100); } setTimeout('updateFeedList(false, false)', 50); @@ -1327,3 +1324,8 @@ function reverseHeadlineOrder() { exception_error("reverseHeadlineOrder", e); } } + +function showFeedsWithErrors() { + displayDlg('feedUpdateErrors'); +} + diff --git a/tt-rss.php b/tt-rss.php index b9b6cbe00..bf6855741 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -242,7 +242,7 @@
-
+
 
-->
-
+