summaryrefslogtreecommitdiff
path: root/js/functions.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-02-21 12:36:29 +0400
committerAndrew Dolgov <[email protected]>2012-02-21 12:36:29 +0400
commit56fbb82cb004fb6f8689ee7f50be05d6a927f9f1 (patch)
tree6a0c3a21ece080f36cde838ef2910f291fa7765d /js/functions.js
parent7b8ff151ed3d36214156906805e7e6327f59793c (diff)
properly handle invalid regular expressions supplied when testing filters, add some additional regexp checks (closes #427)
Diffstat (limited to 'js/functions.js')
-rw-r--r--js/functions.js42
1 files changed, 31 insertions, 11 deletions
diff --git a/js/functions.js b/js/functions.js
index bd0d5fb73..4a4602f9e 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -982,19 +982,39 @@ function quickAddFilter() {
test: function() {
if (this.validate()) {
- if (dijit.byId("filterTestDlg"))
- dijit.byId("filterTestDlg").destroyRecursive();
+ var query = "?op=rpc&method=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) {
+ var reply = JSON.parse(transport.responseText);
+
+ if (reply) {
+ notify('');
+
+ if (!reply['status']) {
+ alert("Invalid regular expression.");
+ return;
+ } else {
- tdialog = new dijit.Dialog({
- id: "filterTestDlg",
- title: __("Filter Test Results"),
- style: "width: 600px",
- href: "backend.php?savemode=test&" +
- dojo.objectToQuery(dialog.attr('value')),
- });
+ if (dijit.byId("filterTestDlg"))
+ dijit.byId("filterTestDlg").destroyRecursive();
- tdialog.show();
+ tdialog = new dijit.Dialog({
+ id: "filterTestDlg",
+ title: __("Filter Test Results"),
+ style: "width: 600px",
+ href: "backend.php?savemode=test&" +
+ dojo.objectToQuery(dialog.attr('value')),
+ });
+ tdialog.show();
+ }
+ }
+ }});
}
},
execute: function() {
@@ -1014,7 +1034,7 @@ function quickAddFilter() {
notify('');
if (!reply['status']) {
- alert("Match regular expression seems to be invalid.");
+ alert("Invalid regular expression.");
return;
} else {
notify_progress("Saving data...", true);