]> git.wh0rd.org - tt-rss.git/commitdiff
add quick unsubscribe button to prefs/feedlist
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 25 Jul 2008 07:48:15 +0000 (08:48 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 25 Jul 2008 07:48:15 +0000 (08:48 +0100)
modules/pref-feeds.php
prefs.js
tt-rss.css

index 8041b8cc1a84b4c9539aef356a5923edcebef3ce..f1c9bfd6f00f6b1f8fa98531e124a5f859c32f74 100644 (file)
                                $cat_id = $line["cat_id"];
 
                                $edit_title = htmlspecialchars($line["title"]);
+                               $feed_title = $edit_title;
                                $edit_cat = htmlspecialchars($line["category"]);
 
                                $hidden = sql_bool_to_bool($line["hidden"]);
                                                $parent_title)</span>";
                                }
 
+                               $ops = "<span class=\"feedOps\">
+                                       (<a title=\"".__('Unsubscribe')."\"
+                                       href='javascript:removeFeed($feed_id, \"$feed_title\")'>x</a>)
+                                       </span>";
+
                                print "<td $onclick>" . "$edit_title $parent_title" . "</td>";
 
                                if ($show_last_article_info) {
                                                "$last_article</td>";
                                }
 
-                               print "<td $onclick align='right'>$last_updated</td>";
+                               print "<td align='right'>$ops $last_updated</td>";
 
                                print "</tr>";
        
index c405a4f196a0a0d65854db837eee0429d2e2cef0..dd80aee4d6a5a1b8a2e77d023e91827c0049d204 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -508,6 +508,7 @@ function editFeed(feed) {
        xmlhttp.onreadystatechange=infobox_callback;
        xmlhttp.send(null);
 
+       return false;
 }
 
 function editFeedCat(cat) {
@@ -691,6 +692,33 @@ function removeSelectedFeeds() {
        return false;
 }
 
+function removeFeed(id, title) {
+
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
+       if (id) {
+
+               var msg = __("Unsubscribe from %s?").replace("%s", title);
+
+               var ok = confirm(msg);
+
+               if (ok) {
+
+                       notify_progress("Unsubscribing...");
+       
+                       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
+                               param_escape(id), true);
+                       xmlhttp.onreadystatechange=feedlist_callback;
+                       xmlhttp.send(null);
+               }
+       }
+       
+       return false;
+}
+
 function clearSelectedFeeds() {
 
        if (!xmlhttp_ready(xmlhttp)) {
index 43a76229b85ac572271ca5e4c24c33f3b0f7419b..a7e8ff849a55e00b17c5aaddfde6554f295614a3 100644 (file)
@@ -442,6 +442,15 @@ div.feedEditSearch {
        float : right;
 }
 
+table.prefFeedList span.feedOps {
+       display : none;
+       margin-right : 1em;     
+}
+
+table.prefFeedList tr:hover span.feedOps {
+       display : inline;
+}
+
 table.prefFeedList td.feedEditCat {
        font-weight : bold;
        border-width : 0px 0px 1px 0px;