diff --git a/backend.php b/backend.php index f51e9c1a7..4645759ea 100644 --- a/backend.php +++ b/backend.php @@ -2108,11 +2108,11 @@ if ($subop == "editSave") { - $regexp = db_escape_string(trim($_GET["r"])); - $match = db_escape_string(trim($_GET["m"])); + $reg_exp = db_escape_string(trim($_GET["reg_exp"])); + $filter_type = db_escape_string(trim($_GET["filter_type"])); $filter_id = db_escape_string($_GET["id"]); - $feed_id = db_escape_string($_GET["fid"]); - $action_id = db_escape_string($_GET["aid"]); + $feed_id = db_escape_string($_GET["feed_id"]); + $action_id = db_escape_string($_GET["action_id"]); if (!$feed_id) { $feed_id = 'NULL'; @@ -2121,11 +2121,10 @@ } $result = db_query($link, "UPDATE ttrss_filters SET - reg_exp = '$regexp', - feed_id = $feed_id, - action_id = '$action_id', - filter_type = (SELECT id FROM ttrss_filter_types WHERE - description = '$match') + reg_exp = '$reg_exp', + feed_id = $feed_id, + action_id = '$action_id', + filter_type = '$filter_type' WHERE id = '$filter_id'"); } @@ -2171,13 +2170,14 @@ print "
| "; @@ -2272,21 +2274,28 @@ } else { - print " | "; + print " | "; + + print ""; + print ""; + print ""; + + print " | "; - print ""; print " | "; - print_feed_select($link, "iedit_feed", $line["feed_id"]); + print_feed_select($link, "feed_id", $line["feed_id"], "class=\"iedit\""); print " | "; print ""; - print_select("iedit_match", $line["filter_type_descr"], $filter_types); + print_select_hash("filter_type", $line["filter_type"], $filter_types, + "class=\"iedit\""); print " | "; print ""; - print " |
"; @@ -2334,7 +2345,7 @@ onclick=\"javascript:editSelectedFilter()\" value=\"Edit\"> "; - } + } } else { diff --git a/prefs.js b/prefs.js index 50809d870..7b1e4f0bb 100644 --- a/prefs.js +++ b/prefs.js @@ -684,8 +684,6 @@ function feedCatEditCancel() { function feedEditSave() { try { - - var feed = active_feed; if (!xmlhttp_ready(xmlhttp)) { printLockingError(); @@ -887,39 +885,22 @@ function userEditSave() { function filterEditSave() { - var filter = active_filter; - if (!xmlhttp_ready(xmlhttp)) { printLockingError(); return } - var regexp = document.getElementById("iedit_regexp").value; - var match = document.getElementById("iedit_match"); - - var v_match = match[match.selectedIndex].text; - - var feed = document.getElementById("iedit_feed"); - var feed_id = feed[feed.selectedIndex].id; - - var action = document.getElementById("iedit_filter_action"); - var action_id = action[action.selectedIndex].id; - - if (regexp.length == 0) { - alert("Can't save filter: match expression is blank."); - return; - } - - active_filter = false; - - xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" + - filter + "&r=" + param_escape(regexp) + "&m=" + param_escape(v_match) + - "&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true); + // FIXME: input validation notify("Saving filter..."); + active_filter = false; + + var query = Form.serialize("filter_edit_form"); + + xmlhttp.open("GET", "backend.php?" + query, true); xmlhttp.onreadystatechange=filterlist_callback; - xmlhttp.send(null); + xmlhttp.send(null); } diff --git a/tt-rss.css b/tt-rss.css index 56edc7e93..f9e109df6 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -287,7 +287,7 @@ a:hover { background-color : #f0fff0; } -input.iedit { +.iedit { width : 100%; padding-left : 2px; }