]> git.wh0rd.org Git - tt-rss.git/commitdiff
implement removing selected categories
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 3 Sep 2012 12:06:24 +0000 (16:06 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 3 Sep 2012 12:06:24 +0000 (16:06 +0400)
classes/pref/feeds.php
js/prefs.js

index b81f8265fdeb13e302049ecf21f62038d7ac1770..74ad973875483e7c9a8fd80cc14c23f3dde01805 100644 (file)
@@ -1406,6 +1406,8 @@ class Pref_Feeds extends Handler_Protected {
                                dojoType=\"dijit.MenuItem\">".__('(Un)hide empty categories')."</div>";
                        print "<div onclick=\"resetCatOrder()\"
                                dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
+                       print "<div onclick=\"removeSelectedCategories()\"
+                               dojoType=\"dijit.MenuItem\">".__('Remove selected')."</div>";
                        print "</div></div>";
 
                }
index d23d4a68b0788af34696ba7df0ae6a1bef7360f7..91d1e2783862cdf118c90eb5f7bab8f231b1bc3a 100644 (file)
@@ -264,6 +264,19 @@ function getSelectedFeeds() {
        return rv;
 }
 
+function getSelectedCategories() {
+       var tree = dijit.byId("feedTree");
+       var items = tree.model.getCheckedItems();
+       var rv = [];
+
+       items.each(function(item) {
+               if (item.id[0].match("CAT:"))
+                       rv.push(tree.model.store.getValue(item, 'bare_id'));
+       });
+
+       return rv;
+}
+
 function getSelectedFilters() {
        var tree = dijit.byId("filterTree");
        var items = tree.model.getCheckedItems();
@@ -277,10 +290,6 @@ function getSelectedFilters() {
 
 }
 
-/* function getSelectedFeedCats() {
-       return getSelectedTableRowIds("prefFeedCatList");
-} */
-
 function removeSelectedLabels() {
 
        var sel_rows = getSelectedLabels();
@@ -1233,6 +1242,34 @@ function removeCategory(id, item) {
        }
 }
 
+function removeSelectedCategories() {
+
+       var sel_rows = getSelectedCategories();
+
+       if (sel_rows.length > 0) {
+
+               var ok = confirm(__("Remove selected categories?"));
+
+               if (ok) {
+                       notify_progress("Removing selected categories...");
+
+                       var query = "?op=pref-feeds&method=removeCat&ids="+
+                               param_escape(sel_rows.toString());
+
+                       new Ajax.Request("backend.php", {
+                               parameters: query,
+                               onComplete: function(transport) {
+                                               updateFeedList();
+                                       } });
+
+               }
+       } else {
+               alert(__("No categories are selected."));
+       }
+
+       return false;
+}
+
 function createCategory() {
        try {
                var title = prompt(__("Category title:"));