1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 17:05:56 +00:00

pref-feeds: load error button via xhr

This commit is contained in:
Andrew Dolgov
2021-02-13 23:12:49 +03:00
parent 43d8a1f2ff
commit d4c925819b
8 changed files with 18 additions and 22 deletions

View File

@@ -1198,22 +1198,10 @@ class Pref_Feeds extends Handler_Protected {
} }
private function index_feeds() { private function index_feeds() {
$sth = $this->pdo->prepare("SELECT COUNT(id) AS num_errors $error_button = "<button dojoType='dijit.form.Button'
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ?"); id='pref_feeds_errors_btn' style='display : none'
$sth->execute([$_SESSION['uid']]); onclick='CommonDialogs.showFeedsWithErrors()'>".
__("Feeds with errors")."</button>";
if ($row = $sth->fetch()) {
$num_errors = $row["num_errors"];
} else {
$num_errors = 0;
}
if ($num_errors > 0) {
$error_button = "<button dojoType='dijit.form.Button' onclick='CommonDialogs.showFeedsWithErrors()' id='errorButton'>".
__("Feeds with errors")."</button>";
} else {
$error_button = "";
}
$inactive_button = "<button dojoType='dijit.form.Button' $inactive_button = "<button dojoType='dijit.form.Button'
id='pref_feeds_inactive_btn' id='pref_feeds_inactive_btn'
@@ -1311,6 +1299,7 @@ class Pref_Feeds extends Handler_Protected {
</script> </script>
<script type="dojo/method" event="onLoad" args="item"> <script type="dojo/method" event="onLoad" args="item">
dijit.byId('feedTree').checkInactiveFeeds(); dijit.byId('feedTree').checkInactiveFeeds();
dijit.byId('feedTree').checkErrorFeeds();
</script> </script>
</div> </div>
</div> </div>

View File

@@ -209,6 +209,13 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
return false; return false;
}, },
checkErrorFeeds: function() {
xhrJson("backend.php", {op: "pref-feeds", method: "feedsWithErrors"}, (reply) => {
if (reply.length > 0) {
Element.show(dijit.byId("pref_feeds_errors_btn").domNode);
}
});
},
checkInactiveFeeds: function() { checkInactiveFeeds: function() {
xhrJson("backend.php", {op: "pref-feeds", method: "inactivefeeds"}, (reply) => { xhrJson("backend.php", {op: "pref-feeds", method: "inactivefeeds"}, (reply) => {
if (reply.length > 0) { if (reply.length > 0) {

View File

@@ -1456,7 +1456,7 @@ body.ttrss_prefs #feedsTab {
body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode { body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode {
padding: 0px; padding: 0px;
} }
body.ttrss_prefs #errorButton { body.ttrss_prefs #pref_feeds_errors_btn {
color: red; color: red;
} }
body.ttrss_prefs .user-css-editor { body.ttrss_prefs .user-css-editor {

View File

@@ -1456,7 +1456,7 @@ body.ttrss_prefs #feedsTab {
body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode { body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode {
padding: 0px; padding: 0px;
} }
body.ttrss_prefs #errorButton { body.ttrss_prefs #pref_feeds_errors_btn {
color: red; color: red;
} }
body.ttrss_prefs .user-css-editor { body.ttrss_prefs .user-css-editor {

View File

@@ -1456,7 +1456,7 @@ body.ttrss_prefs #feedsTab {
body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode { body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode {
padding: 0px; padding: 0px;
} }
body.ttrss_prefs #errorButton { body.ttrss_prefs #pref_feeds_errors_btn {
color: red; color: red;
} }
body.ttrss_prefs .user-css-editor { body.ttrss_prefs .user-css-editor {

View File

@@ -65,7 +65,7 @@ body.ttrss_prefs {
padding : 0px; padding : 0px;
} }
#errorButton { #pref_feeds_errors_btn {
color : red; color : red;
} }

View File

@@ -1457,7 +1457,7 @@ body.ttrss_prefs #feedsTab {
body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode { body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode {
padding: 0px; padding: 0px;
} }
body.ttrss_prefs #errorButton { body.ttrss_prefs #pref_feeds_errors_btn {
color: red; color: red;
} }
body.ttrss_prefs .user-css-editor { body.ttrss_prefs .user-css-editor {

View File

@@ -1457,7 +1457,7 @@ body.ttrss_prefs #feedsTab {
body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode { body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode {
padding: 0px; padding: 0px;
} }
body.ttrss_prefs #errorButton { body.ttrss_prefs #pref_feeds_errors_btn {
color: red; color: red;
} }
body.ttrss_prefs .user-css-editor { body.ttrss_prefs .user-css-editor {