summaryrefslogtreecommitdiff
path: root/functions.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-11-20 15:02:20 +0300
committerAndrew Dolgov <[email protected]>2010-11-20 15:02:52 +0300
commit141fb6e3a664319c62e7fd1ffe2a2324b5f556d6 (patch)
treef8c172a96ecdd33eff576d99906a13ecc11fb46e /functions.js
parent59216e083ceae53c0f7862dcca4af20738b5d2cb (diff)
filterEditDlg: add regexp verification; js: code cleanup
Diffstat (limited to 'functions.js')
-rw-r--r--functions.js43
1 files changed, 34 insertions, 9 deletions
diff --git a/functions.js b/functions.js
index e9a1f70b6..946e29a9a 100644
--- a/functions.js
+++ b/functions.js
@@ -1184,18 +1184,43 @@ function quickAddFilter() {
style: "width: 600px",
execute: function() {
if (this.validate()) {
- console.log(dojo.objectToQuery(this.attr('value')));
- new Ajax.Request("backend.php", {
- parameters: dojo.objectToQuery(this.attr('value')),
+
+ var query = "?op=rpc&subop=verifyRegexp&reg_exp=" +
+ param_escape(dialog.attr('value').reg_exp);
+
+ notify_progress("Verifying regular expression...");
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
onComplete: function(transport) {
- this.hide();
- notify_progress("Savind data...", true);
- notify_info(transport.responseText);
- if (inPreferences()) {
- updateFilterList();
+ handle_rpc_reply(transport);
+ var response = transport.responseXML;
+
+ if (response) {
+ var s = response.getElementsByTagName("status")[0].firstChild.nodeValue;
+
+ notify('');
+
+ if (s == "INVALID") {
+ alert("Match regular expression seems to be invalid.");
+ return;
+ } else {
+ notify_progress("Saving data...", true);
+
+ console.log(dojo.objectToQuery(dialog.attr('value')));
+
+ new Ajax.Request("backend.php", {
+ parameters: dojo.objectToQuery(dialog.attr('value')),
+ onComplete: function(transport) {
+ dialog.hide();
+ notify_info(transport.responseText);
+ if (inPreferences()) {
+ updateFilterList();
+ }
+ }})
+ }
}
}});
-
}
},
href: query});