refactor category editor
This commit is contained in:
@@ -1021,11 +1021,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Content-Type: text/xml");
|
|
||||||
print "<dlg id=\"$subop\">";
|
|
||||||
print "<title>".__('Category editor')."</title>";
|
|
||||||
print "<content><![CDATA[";
|
|
||||||
|
|
||||||
if ($action == "add") {
|
if ($action == "add") {
|
||||||
|
|
||||||
$feed_cat = db_escape_string(trim($_REQUEST["cat"]));
|
$feed_cat = db_escape_string(trim($_REQUEST["cat"]));
|
||||||
@@ -1045,11 +1040,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "<div dojoType=\"dijit.Toolbar\">
|
print "<div dojoType=\"dijit.Toolbar\">
|
||||||
<input id=\"fadd_cat\"
|
<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"newcat\">
|
||||||
onkeypress=\"return filterCR(event, addFeedCat)\"
|
<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedCatEditDlg').addCategory()\">".
|
||||||
size=\"40\">
|
__('Create category')."</button></div>";
|
||||||
<button onclick=\"addFeedCat()\">".
|
|
||||||
__('Create category')."</button></div>";
|
|
||||||
|
|
||||||
$result = db_query($link, "SELECT title,id FROM ttrss_feed_categories
|
$result = db_query($link, "SELECT title,id FROM ttrss_feed_categories
|
||||||
WHERE owner_uid = ".$_SESSION["uid"]."
|
WHERE owner_uid = ".$_SESSION["uid"]."
|
||||||
@@ -1059,13 +1052,9 @@
|
|||||||
|
|
||||||
if (db_num_rows($result) != 0) {
|
if (db_num_rows($result) != 0) {
|
||||||
|
|
||||||
# print __('Select:')."
|
|
||||||
# <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'all')\">".__('All')."</a>,
|
|
||||||
# <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'none')\">".__('None')."</a>";
|
|
||||||
#
|
|
||||||
print "<div class=\"prefFeedCatHolder\">";
|
print "<div class=\"prefFeedCatHolder\">";
|
||||||
|
|
||||||
print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">";
|
# print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">";
|
||||||
|
|
||||||
print "<table width=\"100%\" class=\"prefFeedCatList\"
|
print "<table width=\"100%\" class=\"prefFeedCatList\"
|
||||||
cellspacing=\"0\" id=\"prefFeedCatList\">";
|
cellspacing=\"0\" id=\"prefFeedCatList\">";
|
||||||
@@ -1105,6 +1094,7 @@
|
|||||||
cid: this.srcNodeRef.getAttribute('cat-id')},
|
cid: this.srcNodeRef.getAttribute('cat-id')},
|
||||||
load: function(response) {
|
load: function(response) {
|
||||||
elem.attr('value', response);
|
elem.attr('value', response);
|
||||||
|
updateFeedList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -1117,7 +1107,7 @@
|
|||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print "</form>";
|
# print "</form>";
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
@@ -1127,15 +1117,13 @@
|
|||||||
|
|
||||||
print "<div class='dlgButtons'>
|
print "<div class='dlgButtons'>
|
||||||
<div style='float : left'>
|
<div style='float : left'>
|
||||||
<button onclick=\"return removeSelectedFeedCats()\">".
|
<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedCatEditDlg').removeSelected()\">".
|
||||||
__('Remove')."</button>
|
__('Remove selected categories')."</button>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
print "<button onclick=\"selectTab('feedConfig')\">".
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedCatEditDlg').hide()\">".
|
||||||
__('Close this window')."</button></div>";
|
__('Close this window')."</button></div>";
|
||||||
|
|
||||||
print "]]></content></dlg>";
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
103
prefs.js
103
prefs.js
@@ -356,10 +356,9 @@ function getSelectedFilters() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectedFeedCats() {
|
/* function getSelectedFeedCats() {
|
||||||
return getSelectedTableRowIds("prefFeedCatList");
|
return getSelectedTableRowIds("prefFeedCatList");
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
function removeSelectedLabels() {
|
function removeSelectedLabels() {
|
||||||
|
|
||||||
@@ -583,37 +582,6 @@ function removeSelectedPrefProfiles() {
|
|||||||
return false;
|
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() {
|
function userEditCancel() {
|
||||||
closeInfoBox();
|
closeInfoBox();
|
||||||
return false;
|
return false;
|
||||||
@@ -1245,15 +1213,68 @@ function pref_hotkey_handler(e) {
|
|||||||
|
|
||||||
function editFeedCats() {
|
function editFeedCats() {
|
||||||
try {
|
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) {
|
} catch (e) {
|
||||||
exception_error("editFeedCats", e);
|
exception_error("editFeedCats", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user