summaryrefslogtreecommitdiff
path: root/prefs.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-08-17 05:54:57 +0100
committerAndrew Dolgov <[email protected]>2006-08-17 05:54:57 +0100
commitf156fd00ee99338d1824d20f65f0fe30d03c4f9e (patch)
treea7508b5bd911540c5755ff6284a79412ecbcf298 /prefs.js
parent60a2080f9a886a26ac2e119031f807c8986de595 (diff)
create label now uses dialog, code cleanups
Diffstat (limited to 'prefs.js')
-rw-r--r--prefs.js61
1 files changed, 18 insertions, 43 deletions
diff --git a/prefs.js b/prefs.js
index 28e54ee4f..2ac772fc1 100644
--- a/prefs.js
+++ b/prefs.js
@@ -63,8 +63,8 @@ function filterlist_callback() {
function labellist_callback() {
var container = document.getElementById('prefContent');
if (xmlhttp.readyState == 4) {
+ closeInfoBox();
container.innerHTML=xmlhttp.responseText;
-
if (active_label) {
var row = document.getElementById("LILRR-" + active_label);
if (row) {
@@ -181,55 +181,26 @@ function addLabel() {
return
}
- var sqlexp = document.getElementById("ladd_expr");
-
- if (sqlexp.value.length == 0) {
- alert("Can't add label: missing SQL expression.");
- } else {
- notify("Adding label...");
+ var form = document.forms['label_edit_form'];
- xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
- param_escape(sqlexp.value), true);
-
- xmlhttp.onreadystatechange=labellist_callback;
- xmlhttp.send(null);
+ var sql_exp = form.sql_exp.value;
+ var description = form.description.value;
- sqlexp.value = "";
+ if (sql_exp == "") {
+ alert("Can't create label: missing SQL expression.");
+ return false;
}
-}
-
-function addFilter() {
-
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
+ if (description == "") {
+ alert("Can't create label: missing caption.");
+ return false;
}
- var regexp = document.getElementById("fadd_regexp");
- var match = document.getElementById("fadd_match");
- var feed = document.getElementById("fadd_feed");
- var action = document.getElementById("fadd_action");
-
- if (regexp.value.length == 0) {
- alert("Can't add filter: missing filter expression.");
- } else {
- notify("Adding filter...");
-
- var v_match = match[match.selectedIndex].text;
- var feed_id = feed[feed.selectedIndex].id;
- var action_id = action[action.selectedIndex].id;
-
- xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add&regexp=" +
- param_escape(regexp.value) + "&match=" + v_match +
- "&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true);
-
- xmlhttp.onreadystatechange=filterlist_callback;
- xmlhttp.send(null);
-
- regexp.value = "";
- }
+ var query = Form.serialize("label_edit_form");
+ xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&" + query, true);
+ xmlhttp.onreadystatechange=infobox_submit_callback;
+ xmlhttp.send(null);
}
function addFeed() {
@@ -315,6 +286,8 @@ function editLabel(id) {
return
}
+ document.getElementById("label_create_btn").disabled = true;
+
active_label = id;
selectTableRowsByIdPrefix('prefLabelList', 'LILRR-', 'LICHK-', false);
@@ -709,6 +682,8 @@ function labelEditCancel() {
return
}
+ document.getElementById("label_create_btn").disabled = false;
+
active_label = false;
selectPrefRows('label', false); // cleanup feed selection