var xmlhttp = false;
var active_feed = false;
+var active_feed_cat = false;
var active_filter = false;
var active_label = false;
var active_user = false;
}
+function addFeedCat() {
+
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
+ var cat = document.getElementById("fadd_cat");
+
+ if (cat.value.length == 0) {
+ notify("Missing feed category.");
+ } else {
+ notify("Adding feed category...");
+
+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
+ param_escape(cat.value), true);
+ xmlhttp.onreadystatechange=feedlist_callback;
+ xmlhttp.send(null);
+
+ link.value = "";
+
+ }
+
+}
function addUser() {
if (!xmlhttp_ready(xmlhttp)) {
}
-function getSelectedLabels() {
-
- var content = document.getElementById("prefLabelList");
-
- var sel_rows = new Array();
+function editFeedCat(cat) {
- for (i = 0; i < content.rows.length; i++) {
- if (content.rows[i].className.match("Selected")) {
- var row_id = content.rows[i].id.replace("LILRR-", "");
- sel_rows.push(row_id);
- }
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
}
- return sel_rows;
-}
-
-function getSelectedUsers() {
-
- var content = document.getElementById("prefUserList");
+ active_feed_cat = cat;
- var sel_rows = new Array();
-
- for (i = 0; i < content.rows.length; i++) {
- if (content.rows[i].className.match("Selected")) {
- var row_id = content.rows[i].id.replace("UMRR-", "");
- sel_rows.push(row_id);
- }
- }
+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
+ param_escape(cat), true);
+ xmlhttp.onreadystatechange=feedlist_callback;
+ xmlhttp.send(null);
- return sel_rows;
}
+function getSelectedLabels() {
+ return getSelectedTableRowIds("prefLabelList", "LILRR");
+}
-function getSelectedFilters() {
-
- var content = document.getElementById("prefFilterList");
-
- var sel_rows = new Array();
-
- for (i = 0; i < content.rows.length; i++) {
- if (content.rows[i].className.match("Selected")) {
- var row_id = content.rows[i].id.replace("FILRR-", "");
- sel_rows.push(row_id);
- }
- }
-
- return sel_rows;
+function getSelectedUsers() {
+ return getSelectedTableRowIds("prefUserList", "UMRR");
}
function getSelectedFeeds() {
+ return getSelectedTableRowIds("prefFeedList", "FEEDR");
+}
- var content = document.getElementById("prefFeedList");
-
- var sel_rows = new Array();
-
- for (i = 0; i < content.rows.length; i++) {
- if (content.rows[i].className.match("Selected")) {
- var row_id = content.rows[i].id.replace("FEEDR-", "");
- sel_rows.push(row_id);
- }
- }
+function getSelectedFilters() {
+ return getSelectedTableRowIds("prefFilterList", "FILRR");
+}
- return sel_rows;
+function getSelectedFeedCats() {
+ return getSelectedTableRowIds("prefFeedCatList", "FCATR");
}
+
function readSelectedFeeds() {
if (!xmlhttp_ready(xmlhttp)) {
}
+function removeSelectedFeedCats() {
+
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
+ var sel_rows = getSelectedFeedCats();
+
+ if (sel_rows.length > 0) {
+
+ notify("Removing selected categories...");
+
+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
+ param_escape(sel_rows.toString()), true);
+ xmlhttp.onreadystatechange=feedlist_callback;
+ xmlhttp.send(null);
+
+ } else {
+
+ notify("Please select some feeds first.");
+
+ }
+
+}
+
function feedEditCancel() {
if (!xmlhttp_ready(xmlhttp)) {
}
+function feedCatEditCancel() {
+
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
+ active_feed_cat = false;
+
+ notify("Operation cancelled.");
+
+ xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
+ xmlhttp.onreadystatechange=feedlist_callback;
+ xmlhttp.send(null);
+
+}
+
function feedEditSave() {
var feed = active_feed;
var title = document.getElementById("iedit_title").value;
var upd_intl = document.getElementById("iedit_updintl").value;
var purge_intl = document.getElementById("iedit_purgintl").value;
+ var fcat = document.getElementById("iedit_fcat");
+
+ var fcat_id = fcat[fcat.selectedIndex].id;
// notify("Saving feed.");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" +
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
- "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl), true);
+ "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
+ "&catid=" + param_escape(fcat_id), true);
xmlhttp.onreadystatechange=feedlist_callback;
xmlhttp.send(null);
}
+function editSelectedFeedCat() {
+ var rows = getSelectedFeedCats();
+
+ if (rows.length == 0) {
+ notify("No categories are selected.");
+ return;
+ }
+
+ if (rows.length > 1) {
+ notify("Please select one category.");
+ return;
+ }
+
+ notify("");
+
+ editFeedCat(rows[0]);
+
+}
+
function localPiggieFunction(enable) {
if (enable) {
piggie.style.display = "block";