From: Andrew Dolgov Date: Mon, 3 Sep 2012 12:06:24 +0000 (+0400) Subject: implement removing selected categories X-Git-Tag: 1.6.0~77 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=fd26d5bfdf1c79c340e81b52cf6b45814bdf2884;p=tt-rss.git implement removing selected categories --- diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index b81f8265..74ad9738 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1406,6 +1406,8 @@ class Pref_Feeds extends Handler_Protected { dojoType=\"dijit.MenuItem\">".__('(Un)hide empty categories').""; print "
".__('Reset sort order')."
"; + print "
".__('Remove selected')."
"; print ""; } diff --git a/js/prefs.js b/js/prefs.js index d23d4a68..91d1e278 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -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:"));