From c8d5dcfe2b640d0a0d8d9d6904fcc0f0ce9d1b1c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 6 Aug 2008 09:18:02 +0100 Subject: [PATCH] feed editor: add button to unsubscribe feed --- modules/pref-feeds.php | 8 +++++++- prefs.js | 28 ++++++++++++++++++++++++++++ tt-rss.js | 18 +++++++++++------- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index bb3670c2..cdd48405 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -364,7 +364,13 @@ "; + onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"> +
+ + + +
"; print ""; diff --git a/prefs.js b/prefs.js index a5fc6c54..d1cfae7b 100644 --- a/prefs.js +++ b/prefs.js @@ -2182,3 +2182,31 @@ function removeFilter(id, title) { return false; } +function unsubscribeFeed(id, title) { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return + } + + var msg = __("Unsubscribe from %s?").replace("%s", title); + + var ok = confirm(msg); + + if (ok) { + closeInfoBox(); + + notify_progress("Removing feed..."); + + xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ + param_escape(id), true); + xmlhttp.onreadystatechange=filterlist_callback; + xmlhttp.send(null); + } + + return false; + + return false; + +} + diff --git a/tt-rss.js b/tt-rss.js index 71ebf13b..879fff23 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -604,17 +604,21 @@ function quickMenuGo(opid) { } } -function unsubscribeFeed(feed_id) { +function unsubscribeFeed(feed_id, title) { - notify_progress("Removing feed..."); - var query = "backend.php?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id; + var msg = __("Unsubscribe from %s?").replace("%s", title); - new Ajax.Request(query, { - onComplete: function(transport) { - dlg_frefresh_callback(transport, feed_id); - } }); + if (title == undefined || confirm(msg)) { + notify_progress("Removing feed..."); + + var query = "backend.php?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id; + new Ajax.Request(query, { + onComplete: function(transport) { + dlg_frefresh_callback(transport, feed_id); + } }); + } return false; } -- 2.39.2