mirror of https://tt-rss.org/git/tt-rss.git
filterEditDlg: add regexp verification; js: code cleanup
This commit is contained in:
parent
59216e083c
commit
141fb6e3a6
43
functions.js
43
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®_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});
|
||||
|
|
116
prefs.js
116
prefs.js
|
@ -301,12 +301,39 @@ function editFilter(id, event) {
|
|||
style: "width: 600px",
|
||||
execute: function() {
|
||||
if (this.validate()) {
|
||||
this.hide();
|
||||
notify_progress("Savind data...", true);
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: dojo.objectToQuery(this.attr('value')),
|
||||
|
||||
var query = "?op=rpc&subop=verifyRegexp®_exp=" +
|
||||
param_escape(dialog.attr('value').reg_exp);
|
||||
|
||||
notify_progress("Verifying regular expression...");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
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();
|
||||
updateFilterList();
|
||||
}})
|
||||
}
|
||||
}
|
||||
}});
|
||||
}
|
||||
},
|
||||
|
@ -687,11 +714,6 @@ function userEditCancel() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function filterEditCancel() {
|
||||
closeInfoBox();
|
||||
return false;
|
||||
}
|
||||
|
||||
function userEditSave() {
|
||||
|
||||
try {
|
||||
|
@ -724,55 +746,6 @@ function userEditSave() {
|
|||
}
|
||||
|
||||
|
||||
function filterEditSave() {
|
||||
try {
|
||||
var reg_exp = document.forms["filter_edit_form"].reg_exp.value;
|
||||
|
||||
var query = "?op=rpc&subop=verifyRegexp®_exp=" + param_escape(reg_exp);
|
||||
|
||||
notify_progress("Verifying regular expression...");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
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 {
|
||||
|
||||
var query = "?" + Form.serialize("filter_edit_form");
|
||||
|
||||
notify_progress("Saving filter...");
|
||||
|
||||
Form.disable("filter_edit_form");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
closeInfoBox();
|
||||
filterlist_callback2(transport);
|
||||
} });
|
||||
}
|
||||
}
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("filterEditSave", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function editSelectedUser() {
|
||||
var rows = getSelectedUsers();
|
||||
|
||||
|
@ -2002,29 +1975,4 @@ function editLabel(id, event) {
|
|||
}
|
||||
}
|
||||
|
||||
function editLabelSave() {
|
||||
try {
|
||||
var form = document.forms['label_edit_form'];
|
||||
|
||||
var id = form.id.value;
|
||||
var caption = form.caption.value;
|
||||
var fg_color = form.fg_color.value;
|
||||
var bg_color = form.bg_color.value;
|
||||
|
||||
var query = Form.serialize('label_edit_form');
|
||||
|
||||
dijit.byId('labelTree').setNameById(id, caption);
|
||||
setLabelColor(id, fg_color, bg_color);
|
||||
|
||||
closeInfoBox();
|
||||
updateFilterList();
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editLabelSave", e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue