From bc6fa2364b35ed33b058cfc99026789fcbc5135d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 14 Sep 2012 12:30:04 +0400 Subject: [PATCH] move inactiveFeeds and feedsWithErrors to pref-feeds; fix element id collisions --- classes/dlg.php | 155 ---------------------------------------- classes/pref/feeds.php | 157 ++++++++++++++++++++++++++++++++++++++++- js/functions.js | 2 +- js/prefs.js | 2 +- 4 files changed, 158 insertions(+), 158 deletions(-) diff --git a/classes/dlg.php b/classes/dlg.php index 0a30dd8e..d6a3a0fb 100644 --- a/classes/dlg.php +++ b/classes/dlg.php @@ -444,161 +444,6 @@ class Dlg extends Handler_Protected { "; } - function inactiveFeeds() { - - if (DB_TYPE == "pgsql") { - $interval_qpart = "NOW() - INTERVAL '3 months'"; - } else { - $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)"; - } - - $result = db_query($this->link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url, - ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article - FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE - (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE - ttrss_entries.id = ref_id AND - ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart - AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]." AND - ttrss_user_entries.feed_id = ttrss_feeds.id AND - ttrss_entries.id = ref_id - GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url - ORDER BY last_article"); - - print "
" . __("These feeds have not been updated with new content for 3 months (oldest first):") . "
"; - - print "
"; - print "
". - "" . __('Select').""; - print "
"; - print "
".__('All')."
"; - print "
".__('None')."
"; - print "
"; - print "
"; #toolbar - - print "
"; - - print ""; - - $lnum = 1; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - $feed_id = $line["id"]; - $this_row_id = "id=\"FUPDD-$feed_id\""; - - # class needed for selectTableRows() - print ""; - - $edit_title = htmlspecialchars($line["title"]); - - # id needed for selectTableRows() - print ""; - print ""; - print ""; - - ++$lnum; - } - - print "
"; - - print "". - htmlspecialchars($line["title"]).""; - - print ""; - print make_local_datetime($this->link, $line['last_article'], false); - print "
"; - print "
"; - - print "
"; - print "
"; - print " "; - print "
"; - - print ""; - - print "
"; - - } - - function feedsWithErrors() { - print "
" . __("These feeds have not been updated because of errors:") . "
"; - - $result = db_query($this->link, "SELECT id,title,feed_url,last_error,site_url - FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); - - print "
"; - print "
". - "" . __('Select').""; - print "
"; - print "
".__('All')."
"; - print "
".__('None')."
"; - print "
"; - print "
"; #toolbar - - print "
"; - - print ""; - - $lnum = 1; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - $feed_id = $line["id"]; - $this_row_id = "id=\"FUPDD-$feed_id\""; - - # class needed for selectTableRows() - print ""; - - $edit_title = htmlspecialchars($line["title"]); - - # id needed for selectTableRows() - print ""; - print ""; - print ""; - - ++$lnum; - } - - print "
"; - - print "". - htmlspecialchars($line["title"]).": "; - - print ""; - print htmlspecialchars($line["last_error"]); - print ""; - - print "
"; - print "
"; - - print "
"; - print "
"; - print " "; - print "
"; - - print ""; - - print "
"; - } - function editArticleTags() { print __("Tags for this article (separated by commas):")."
"; diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 9dc2f7e6..3a7da72d 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -3,7 +3,7 @@ class Pref_Feeds extends Handler_Protected { function csrf_ignore($method) { $csrf_ignored = array("index", "getfeedtree", "add", "editcats", "editfeed", - "savefeedorder", "uploadicon"); + "savefeedorder", "uploadicon", "feedswitherrors", "inactivefeeds"); return array_search($method, $csrf_ignored) !== false; } @@ -1547,5 +1547,160 @@ class Pref_Feeds extends Handler_Protected { return $obj; } + function inactiveFeeds() { + + if (DB_TYPE == "pgsql") { + $interval_qpart = "NOW() - INTERVAL '3 months'"; + } else { + $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)"; + } + + $result = db_query($this->link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url, + ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article + FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE + (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE + ttrss_entries.id = ref_id AND + ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart + AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]." AND + ttrss_user_entries.feed_id = ttrss_feeds.id AND + ttrss_entries.id = ref_id + GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url + ORDER BY last_article"); + + print "
" . __("These feeds have not been updated with new content for 3 months (oldest first):") . "
"; + + print "
"; + print "
". + "" . __('Select').""; + print "
"; + print "
".__('All')."
"; + print "
".__('None')."
"; + print "
"; + print "
"; #toolbar + + print "
"; + + print ""; + + $lnum = 1; + + while ($line = db_fetch_assoc($result)) { + + $class = ($lnum % 2) ? "even" : "odd"; + $feed_id = $line["id"]; + $this_row_id = "id=\"FUPDD-$feed_id\""; + + # class needed for selectTableRows() + print ""; + + $edit_title = htmlspecialchars($line["title"]); + + # id needed for selectTableRows() + print ""; + print ""; + print ""; + + ++$lnum; + } + + print "
"; + + print "". + htmlspecialchars($line["title"]).""; + + print ""; + print make_local_datetime($this->link, $line['last_article'], false); + print "
"; + print "
"; + + print "
"; + print "
"; + print " "; + print "
"; + + print ""; + + print "
"; + + } + + function feedsWithErrors() { + print "
" . __("These feeds have not been updated because of errors:") . "
"; + + $result = db_query($this->link, "SELECT id,title,feed_url,last_error,site_url + FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); + + print "
"; + print "
". + "" . __('Select').""; + print "
"; + print "
".__('All')."
"; + print "
".__('None')."
"; + print "
"; + print "
"; #toolbar + + print "
"; + + print ""; + + $lnum = 1; + + while ($line = db_fetch_assoc($result)) { + + $class = ($lnum % 2) ? "even" : "odd"; + $feed_id = $line["id"]; + $this_row_id = "id=\"FERDD-$feed_id\""; + + # class needed for selectTableRows() + print ""; + + $edit_title = htmlspecialchars($line["title"]); + + # id needed for selectTableRows() + print ""; + print ""; + print ""; + + ++$lnum; + } + + print "
"; + + print "". + htmlspecialchars($line["title"]).": "; + + print ""; + print htmlspecialchars($line["last_error"]); + print ""; + + print "
"; + print "
"; + + print "
"; + print "
"; + print " "; + print "
"; + + print ""; + + print "
"; + } + } ?> diff --git a/js/functions.js b/js/functions.js index 02aeb454..97df318e 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1751,7 +1751,7 @@ function feedBrowser() { function showFeedsWithErrors() { try { - var query = "backend.php?op=dlg&method=feedsWithErrors"; + var query = "backend.php?op=pref-feeds&method=feedsWithErrors"; if (dijit.byId("errorFeedsDlg")) dijit.byId("errorFeedsDlg").destroyRecursive(); diff --git a/js/prefs.js b/js/prefs.js index 91d1e278..ded6c345 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -1296,7 +1296,7 @@ function createCategory() { function showInactiveFeeds() { try { - var query = "backend.php?op=dlg&method=inactiveFeeds"; + var query = "backend.php?op=pref-feeds&method=inactiveFeeds"; if (dijit.byId("inactiveFeedsDlg")) dijit.byId("inactiveFeedsDlg").destroyRecursive();