1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-02-10 16:01:33 +00:00

refactor category editor

This commit is contained in:
Andrew Dolgov
2010-11-20 21:29:19 +03:00
parent e43399b79b
commit da1f74c9c4
2 changed files with 71 additions and 62 deletions
+62 -41
View File
@@ -356,10 +356,9 @@ function getSelectedFilters() {
}
function getSelectedFeedCats() {
/* function getSelectedFeedCats() {
return getSelectedTableRowIds("prefFeedCatList");
}
} */
function removeSelectedLabels() {
@@ -583,37 +582,6 @@ function removeSelectedPrefProfiles() {
return false;
}
function removeSelectedFeedCats() {
var sel_rows = getSelectedFeedCats();
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected categories?"));
if (ok) {
notify_progress("Removing selected categories...");
var query = "?op=pref-feeds&subop=editCats&action=remove&ids="+
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
infobox_callback2(transport);
} });
}
} else {
alert(__("No categories are selected."));
}
return false;
}
function userEditCancel() {
closeInfoBox();
return false;
@@ -1245,15 +1213,68 @@ function pref_hotkey_handler(e) {
function editFeedCats() {
try {
var query = "?op=pref-feeds&subop=editCats";
var query = "backend.php?op=pref-feeds&subop=editCats";
notify_progress("Loading, please wait...");
if (dijit.byId("feedCatEditDlg"))
dijit.byId("feedCatEditDlg").destroyRecursive();
dialog = new dijit.Dialog({
id: "feedCatEditDlg",
title: __("Feed Categories"),
style: "width: 600px",
getSelectedCategories: function() {
return getSelectedTableRowIds("prefFeedCatList");
},
removeSelected: function() {
var sel_rows = this.getSelectedCategories();
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected categories?"));
if (ok) {
notify_progress("Removing selected categories...", true);
var query = "?op=pref-feeds&subop=editCats&action=remove&ids="+
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
notify('');
dialog.attr('content', transport.responseText);
updateFeedList();
} });
}
} else {
alert(__("No categories are selected."));
}
},
addCategory: function() {
if (this.validate()) {
notify_progress("Creating category...");
var query = "?op=pref-feeds&subop=editCats&action=add&cat=" +
param_escape(this.attr('value').newcat);
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
notify('');
dialog.attr('content', transport.responseText);
updateFeedList();
} });
}
},
execute: function() {
if (this.validate()) {
}
},
href: query});
dialog.show();
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
infobox_callback2(transport);
} });
} catch (e) {
exception_error("editFeedCats", e);
}