]> git.wh0rd.org - tt-rss.git/commitdiff
rework feed update errors and inactive feeds dialogs
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 8 Apr 2011 11:37:50 +0000 (15:37 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 8 Apr 2011 11:37:50 +0000 (15:37 +0400)
functions.js
modules/popup-dialog.php
prefs.js
tt-rss.js

index e9a6d928c673a95fa8b1dca3212186e648072d0a..3b18b00725059f6037ce6ac6f9d05b864cd41f57 100644 (file)
@@ -1521,4 +1521,59 @@ function feedBrowser() {
        }
 }
 
+function showFeedsWithErrors() {
+       try {
+               var query = "backend.php?op=dlg&id=feedsWithErrors";
+
+               if (dijit.byId("errorFeedsDlg"))
+                       dijit.byId("errorFeedsDlg").destroyRecursive();
+
+               dialog = new dijit.Dialog({
+                       id: "errorFeedsDlg",
+                       title: __("Feeds with update errors"),
+                       style: "width: 600px",
+                       getSelectedFeeds: function() {
+                               return getSelectedTableRowIds("prefErrorFeedList");
+                       },
+                       removeSelected: function() {
+                               var sel_rows = this.getSelectedFeeds();
+
+                               console.log(sel_rows);
+
+                               if (sel_rows.length > 0) {
+                                       var ok = confirm(__("Remove selected feeds?"));
+
+                                       if (ok) {
+                                               notify_progress("Removing selected feeds...", true);
+
+                                               var query = "?op=pref-feeds&subop=remove&ids="+
+                                                       param_escape(sel_rows.toString());
+
+                                               new Ajax.Request("backend.php", {
+                                                       parameters: query,
+                                                       onComplete: function(transport) {
+                                                               notify('');
+                                                               dialog.hide();
+                                                               updateFeedList();
+                                                       } });
+                                       }
+
+                               } else {
+                                       alert(__("No feeds are selected."));
+                               }
+                       },
+                       execute: function() {
+                               if (this.validate()) {
+                               }
+                       },
+                       href: query});
+
+               dialog.show();
+
+       } catch (e) {
+               exception_error("showFeedsWithErrors", e);
+       }
+
+}
+
 
index 3192ac57a700029e5ea9e983a273f822eff58370..dbbd1fb32c3e97704e96844603e5566f896a8cc6 100644 (file)
                                        type=\"checkbox\"></td>";
                                print "<td>";
 
-                               print "<a target=\"_blank\" class=\"visibleLink\" href=\"".
-                                       htmlspecialchars($line["site_url"])."\">".
-                                       htmlspecialchars($line["title"])."</a> (".
-                                       "<a target=\"_blank\" class=\"visibleLink\"
-                                       href=\"".htmlspecialchars($line["feed_url"]).
-                                       "\">".__("feed")."</a>)";
+                               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($link, $line['last_article']);
+                               print make_local_datetime($link, $line['last_article'], false);
                                print "</td>";
                                print "</tr>";
 
 
                }
 
-               if ($id == "feedUpdateErrors") {
+               if ($id == "feedsWithErrors") {
 
-                       print "<title>".__('Feeds with update errors')."</title>";
-                       print "<content><![CDATA[";
+#                      print "<title>".__('Feeds with update errors')."</title>";
+#                      print "<content><![CDATA[";
 
                        print __("These feeds have not been updated because of errors:");
 
                        $result = db_query($link, "SELECT id,title,feed_url,last_error,site_url
                        FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
 
-                       print "<ul class='feedErrorsList'>";
+                       print "<div class=\"inactiveFeedHolder\">";
+
+                       print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
+
+                       $lnum = 1;
 
                        while ($line = db_fetch_assoc($result)) {
-                               print "<li><a target=\"_blank\" class=\"visibleLink\" href=\"".
-                                       htmlspecialchars($line["site_url"])."\">".
-                                       htmlspecialchars($line["title"])."</a> (".
-                                       "<a target=\"_blank\" class=\"visibleLink\"
-                                       href=\"".htmlspecialchars($line["feed_url"]).
-                                       "\">".__("feed")."</a>): ".
-                                       $line["last_error"]."</li>";
+
+                               $class = ($lnum % 2) ? "even" : "odd";
+                               $feed_id = $line["id"];
+                               $this_row_id = "id=\"FUPDD-$feed_id\"";
+
+                               print "<tr class=\"\" $this_row_id>";
+
+                               $edit_title = htmlspecialchars($line["title"]);
+
+                               print "<td width='5%' align='center'><input
+                                       onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
+                                       type=\"checkbox\"></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 "</ul>";
+                       print "</table>";
+                       print "</div>";
 
-                       print "<div align='center'>";
+                       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=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">".
                                __('Close this window')."</button>";
 
-                       print "]]></content>";
-
-                       //return;
+                       print "</div>";
                }
 
                if ($id == "editArticleTags") {
index 9bca57cd96d02ac3fa7b75c7125ddf8b36d53bcc..05052093d5b7e06029dae8eef382be6a2c072f66 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1159,10 +1159,6 @@ function editFeedCats() {
        }
 }
 
-function showFeedsWithErrors() {
-       displayDlg('feedUpdateErrors');
-}
-
 function showInactiveFeeds() {
        try {
                var query = "backend.php?op=dlg&id=inactiveFeeds";
index ac85b78211d1655f93e801b7de8fa393075ac8a8..cb3fa26f8dfa2b0b94c0574cfcd1a109f734ab46 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -995,10 +995,6 @@ function reverseHeadlineOrder() {
        }
 }
 
-function showFeedsWithErrors() {
-       displayDlg('feedUpdateErrors');
-}
-
 function scheduleFeedUpdate(id, is_cat) {
        try {
                if (!id) {