]> git.wh0rd.org - tt-rss.git/commitdiff
move inactiveFeeds and feedsWithErrors to pref-feeds; fix element id collisions
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 14 Sep 2012 08:30:04 +0000 (12:30 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 14 Sep 2012 08:30:04 +0000 (12:30 +0400)
classes/dlg.php
classes/pref/feeds.php
js/functions.js
js/prefs.js

index 0a30dd8e32fdc058e0f17d8ecf4849f26e3cc8b0..d6a3a0fbeb0816c464eb8d7322a78f03b4472123 100644 (file)
@@ -444,161 +444,6 @@ class Dlg extends Handler_Protected {
                </div>";
        }
 
-       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 "<div class=\"dialogNotice\">" . __("These feeds have not been updated with new content for 3 months (oldest first):") . "</div>";
-
-               print "<div dojoType=\"dijit.Toolbar\">";
-               print "<div dojoType=\"dijit.form.DropDownButton\">".
-                               "<span>" . __('Select')."</span>";
-               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
-               print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'all')\"
-                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
-               print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'none')\"
-                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
-               print "</div></div>";
-               print "</div>"; #toolbar
-
-               print "<div class=\"inactiveFeedHolder\">";
-
-               print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">";
-
-               $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 "<tr class=\"placeholder\" $this_row_id>";
-
-                       $edit_title = htmlspecialchars($line["title"]);
-
-                       # id needed for selectTableRows()
-                       print "<td width='5%' align='center'><input
-                               onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
-                               type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
-                       print "<td>";
-
-                       print "<a class=\"visibleLink\" href=\"#\" ".
-                               "title=\"".__("Click to edit feed")."\" ".
-                               "onclick=\"editFeed(".$line["id"].")\">".
-                               htmlspecialchars($line["title"])."</a>";
-
-                       print "</td><td class=\"insensitive\" align='right'>";
-                       print make_local_datetime($this->link, $line['last_article'], false);
-                       print "</td>";
-                       print "</tr>";
-
-                       ++$lnum;
-               }
-
-               print "</table>";
-               print "</div>";
-
-               print "<div class='dlgButtons'>";
-               print "<div style='float : left'>";
-               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">"
-                       .__('Unsubscribe from selected feeds')."</button> ";
-               print "</div>";
-
-               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">".
-                       __('Close this window')."</button>";
-
-               print "</div>";
-
-       }
-
-       function feedsWithErrors() {
-               print "<div class=\"dialogNotice\">" . __("These feeds have not been updated because of errors:") . "</div>";
-
-               $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 "<div dojoType=\"dijit.Toolbar\">";
-               print "<div dojoType=\"dijit.form.DropDownButton\">".
-                               "<span>" . __('Select')."</span>";
-               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
-               print "<div onclick=\"selectTableRows('prefErrorFeedList', 'all')\"
-                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
-               print "<div onclick=\"selectTableRows('prefErrorFeedList', 'none')\"
-                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
-               print "</div></div>";
-               print "</div>"; #toolbar
-
-               print "<div class=\"inactiveFeedHolder\">";
-
-               print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
-
-               $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 "<tr class=\"placeholder\" $this_row_id>";
-
-                       $edit_title = htmlspecialchars($line["title"]);
-
-                       # id needed for selectTableRows()
-                       print "<td width='5%' align='center'><input
-                               onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
-                               type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
-                       print "<td>";
-
-                       print "<a class=\"visibleLink\" href=\"#\" ".
-                               "title=\"".__("Click to edit feed")."\" ".
-                               "onclick=\"editFeed(".$line["id"].")\">".
-                               htmlspecialchars($line["title"])."</a>: ";
-
-                       print "<span class=\"insensitive\">";
-                       print htmlspecialchars($line["last_error"]);
-                       print "</span>";
-
-                       print "</td>";
-                       print "</tr>";
-
-                       ++$lnum;
-               }
-
-               print "</table>";
-               print "</div>";
-
-               print "<div class='dlgButtons'>";
-               print "<div style='float : left'>";
-               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">"
-                       .__('Unsubscribe from selected feeds')."</button> ";
-               print "</div>";
-
-               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">".
-                       __('Close this window')."</button>";
-
-               print "</div>";
-       }
-
        function editArticleTags() {
 
                print __("Tags for this article (separated by commas):")."<br>";
index 9dc2f7e6a33c9f20c22fbe4236cbdaed93b188cc..3a7da72d3c3ed858010d427d910b823af6d9c9e8 100644 (file)
@@ -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 "<div class=\"dialogNotice\">" . __("These feeds have not been updated with new content for 3 months (oldest first):") . "</div>";
+
+               print "<div dojoType=\"dijit.Toolbar\">";
+               print "<div dojoType=\"dijit.form.DropDownButton\">".
+                               "<span>" . __('Select')."</span>";
+               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+               print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'all')\"
+                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+               print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'none')\"
+                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+               print "</div></div>";
+               print "</div>"; #toolbar
+
+               print "<div class=\"inactiveFeedHolder\">";
+
+               print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">";
+
+               $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 "<tr class=\"placeholder\" $this_row_id>";
+
+                       $edit_title = htmlspecialchars($line["title"]);
+
+                       # id needed for selectTableRows()
+                       print "<td width='5%' align='center'><input
+                               onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
+                               type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
+                       print "<td>";
+
+                       print "<a class=\"visibleLink\" href=\"#\" ".
+                               "title=\"".__("Click to edit feed")."\" ".
+                               "onclick=\"editFeed(".$line["id"].")\">".
+                               htmlspecialchars($line["title"])."</a>";
+
+                       print "</td><td class=\"insensitive\" align='right'>";
+                       print make_local_datetime($this->link, $line['last_article'], false);
+                       print "</td>";
+                       print "</tr>";
+
+                       ++$lnum;
+               }
+
+               print "</table>";
+               print "</div>";
+
+               print "<div class='dlgButtons'>";
+               print "<div style='float : left'>";
+               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">"
+                       .__('Unsubscribe from selected feeds')."</button> ";
+               print "</div>";
+
+               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">".
+                       __('Close this window')."</button>";
+
+               print "</div>";
+
+       }
+
+       function feedsWithErrors() {
+               print "<div class=\"dialogNotice\">" . __("These feeds have not been updated because of errors:") . "</div>";
+
+               $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 "<div dojoType=\"dijit.Toolbar\">";
+               print "<div dojoType=\"dijit.form.DropDownButton\">".
+                               "<span>" . __('Select')."</span>";
+               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+               print "<div onclick=\"selectTableRows('prefErrorFeedList', 'all')\"
+                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+               print "<div onclick=\"selectTableRows('prefErrorFeedList', 'none')\"
+                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+               print "</div></div>";
+               print "</div>"; #toolbar
+
+               print "<div class=\"inactiveFeedHolder\">";
+
+               print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
+
+               $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 "<tr class=\"placeholder\" $this_row_id>";
+
+                       $edit_title = htmlspecialchars($line["title"]);
+
+                       # id needed for selectTableRows()
+                       print "<td width='5%' align='center'><input
+                               onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
+                               type=\"checkbox\" id=\"FERDC-$feed_id\"></td>";
+                       print "<td>";
+
+                       print "<a class=\"visibleLink\" href=\"#\" ".
+                               "title=\"".__("Click to edit feed")."\" ".
+                               "onclick=\"editFeed(".$line["id"].")\">".
+                               htmlspecialchars($line["title"])."</a>: ";
+
+                       print "<span class=\"insensitive\">";
+                       print htmlspecialchars($line["last_error"]);
+                       print "</span>";
+
+                       print "</td>";
+                       print "</tr>";
+
+                       ++$lnum;
+               }
+
+               print "</table>";
+               print "</div>";
+
+               print "<div class='dlgButtons'>";
+               print "<div style='float : left'>";
+               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">"
+                       .__('Unsubscribe from selected feeds')."</button> ";
+               print "</div>";
+
+               print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">".
+                       __('Close this window')."</button>";
+
+               print "</div>";
+       }
+
 }
 ?>
index 02aeb454fd14a31f24153044614feb83b13b4165..97df318e530f8249305acfa06448585a4dbdfd8e 100644 (file)
@@ -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();
index 91d1e2783862cdf118c90eb5f7bab8f231b1bc3a..ded6c345906c13c49bd248c7e1d532b552781f88 100644 (file)
@@ -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();