]> git.wh0rd.org - tt-rss.git/commitdiff
implement a simple pseudo-dashboard feed; display feeds having update errors there...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 4 Nov 2010 16:11:54 +0000 (19:11 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 4 Nov 2010 16:11:54 +0000 (19:11 +0300)
backend.php
feedlist.js
functions.php
tt-rss.js
tt-rss.php

index 252548167e31aaafdd5e3166f1833e9cbca90c4a..0182b24361a20c7045e6bb062d0b2350010bb80a 100644 (file)
                        $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 "</reply>";
+                               return;
+                       }
+
                        /* Updating a label ccache means recalculating all of the caches
                         * so for performance reasons we don't do that here */
 
index 3d9acafd1667e8c4f2f70bae7ee00bb43f5fbacd..ddbcd6c0e11e1737e4e03db7fdd7a3461ac066cd 100644 (file)
@@ -429,6 +429,7 @@ function feedlist_init() {
                                notify_silent_next();
                                setTimeout("viewfeed(-3)", 100);
                        } else {
+                               setTimeout("viewfeed(-5)", 100);
                                remove_splash();
                        }
                }
index 259aaf556b4be82ba18eea6173b369489e89c289..c691039d80018d8f4397ef67b20eb3c2fb964734 100644 (file)
                        return $headlines;
        }
 
+       function generate_dashboard_feed($link) {
+               print "<headlines id=\"-5\" is_cat=\"\">";
+
+               print '<![CDATA[<div id="headlinesContainer">';
+
+               print "<div class='whiteBox'>".__('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 "<p><a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">".
+                               __('Some feeds have update errors (click for details)')."</a>";
+               }
+
+               print "</div>]]>";
+               print "</headlines>";
+
+               print "<headlines-count value=\"0\"/>";
+               print "<vgroup-last-feed value=\"0\"/>";
+               print "<headlines-unread value=\"0\"/>";
+               print "<disable-cache value=\"1\"/>";
+
+       }
 ?>
index e4469d8fe2de3074011db0decfb2b1a46fb4a621..8f5c2847439c0c2ed5f47cab922ef08a13133219 100644 (file)
--- 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 = "<div class='whiteBox'>" + __('No feed selected.') + "</div>";
-               }
+               setTimeout("viewfeed(-5)", 100);
        }
 
        setTimeout('updateFeedList(false, false)', 50);
@@ -1327,3 +1324,8 @@ function reverseHeadlineOrder() {
                exception_error("reverseHeadlineOrder", e);
        }
 }
+
+function showFeedsWithErrors() {
+       displayDlg('feedUpdateErrors');
+}
+
index b9b6cbe006d4c31f3e8dd69ae1f6466e4e528fd7..bf6855741acce1c6411fcef7c2e841a114840512 100644 (file)
 
 <?php if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { ?>
        <div id="headlines-frame" class="headlines_normal">
-               <div class="whiteBox"><?php echo __('No feed selected.') ?></div></div>
+               <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div></div>
        <div id="content-frame">
        <div id="resize-grabber"
                onmouseover="enable_resize(true)" onmouseout="enable_resize(false)"
        <!-- <div class="whiteBox">&nbsp;</div> --> </div>
 <?php } else { ?>
        <div id="headlines-frame" class="headlines_cdm">
-               <div class="whiteBox"><?php echo __('No feed selected.') ?></div></div>
+               <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div></div>
 <?php } ?>
 
 <div id="footer">