summaryrefslogtreecommitdiff
path: root/prefs.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-11-23 08:07:04 +0100
committerAndrew Dolgov <[email protected]>2005-11-23 08:07:04 +0100
commit91ff844a863a374a00e1604348943f1815e7e4e0 (patch)
tree454a70fb61b1c19bcc593bb14fd5c1f48a245acc /prefs.js
parent10dc37acce64a972a623cfbe6f800d8dbc567742 (diff)
feed categories
Diffstat (limited to 'prefs.js')
-rw-r--r--prefs.js165
1 files changed, 114 insertions, 51 deletions
diff --git a/prefs.js b/prefs.js
index aa1e6aeee..846f6825f 100644
--- a/prefs.js
+++ b/prefs.js
@@ -6,6 +6,7 @@
var xmlhttp = false;
var active_feed = false;
+var active_feed_cat = false;
var active_filter = false;
var active_label = false;
var active_user = false;
@@ -295,6 +296,30 @@ function addFeed() {
}
+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)) {
@@ -386,71 +411,43 @@ function editFeed(feed) {
}
-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)) {
@@ -597,6 +594,32 @@ function removeSelectedFeeds() {
}
+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)) {
@@ -614,6 +637,23 @@ function feedEditCancel() {
}
+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;
@@ -627,6 +667,9 @@ function feedEditSave() {
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.");
@@ -656,7 +699,8 @@ function feedEditSave() {
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);
@@ -982,6 +1026,25 @@ function editSelectedFeed() {
}
+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";