implement removing selected categories

This commit is contained in:
Andrew Dolgov 2012-09-03 16:06:24 +04:00
parent 6b218731af
commit fd26d5bfdf
2 changed files with 43 additions and 4 deletions

View 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>";
}

View 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:"));