]> git.wh0rd.org Git - tt-rss.git/commitdiff
feed editor: add button to unsubscribe feed
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 6 Aug 2008 08:18:02 +0000 (09:18 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 6 Aug 2008 08:18:02 +0000 (09:18 +0100)
modules/pref-feeds.php
prefs.js
tt-rss.js

index bb3670c25ae63a2e35f28c5e100b93a07a73ecb6..cdd484057b042a7817f54bdd3335b8bb3a86d3cf 100644 (file)
                                <input type=\"submit\" class=\"button\" 
                                onclick=\"return feedEditSave()\" value=\"".__('Save')."\">
                                <input type='submit' class='button'                     
-                               onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"></div>";
+                               onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\">
+                               <div style=\"float : left\">
+
+                               <input type='submit' class='button'                     
+                                       onclick='return unsubscribeFeed($feed_id, \"$title\")' value=\"".__('Unsubscribe')."\">
+                                                       
+                               </div>";
 
                        print "</div>";
 
index a5fc6c54492d69aa33b254d2c0969b85af70c993..d1cfae7b045052f8dc92bb166dd14df9bd6077ac 100644 (file)
--- 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;
+
+}
+
index 71ebf13bc72d7efee2538d109c6b5e336499c72c..879fff23c13c04b75bf0e47fd594558d0412a306 100644 (file)
--- 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;
 }