From a44db887de77a0d2284a375c8af6d765f8fc4eb9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 6 Aug 2008 09:08:26 +0100 Subject: [PATCH] filter edit dialog: add remove button --- modules/pref-filters.php | 76 +++++----------------------------------- prefs.js | 26 ++++++++++++++ 2 files changed, 34 insertions(+), 68 deletions(-) diff --git a/modules/pref-filters.php b/modules/pref-filters.php index 927cddcd7..3946be5f3 100644 --- a/modules/pref-filters.php +++ b/modules/pref-filters.php @@ -38,74 +38,6 @@ $filter_types[$line["id"]] = __($line["description"]); } -/* print ""; - - print " - "; - print ""; - - print ""; - - print ""; - - print ""; - - $param_disabled = ($action_id == 4 || $action_id == 6) ? "" : "disabled"; - - print ""; - - if ($enabled) { - $checked = "checked"; - } else { - $checked = ""; - } - - print "
".__('Match:').""; - - print "
".__('On field:').""; - - print_select_hash("filter_type", $filter_type, $filter_types, "class=\"_iedit\""); - - print "
".__('Feed:').""; - - print_feed_select($link, "feed_id", $feed_id); - - print "
".__('Action:').""; - - print "
".__('Params:')."
Options: - -
"; - - if ($inverse) { - $checked = "checked"; - } else { - $checked = ""; - } - - print " - "; - - print "
"; - - print ""; - - print "
"; */ - print "
".__("Match")."
"; print "
"; @@ -188,6 +120,14 @@ type=\"submit\" onclick=\"return filterEditCancel()\" value=\"".__('Cancel')."\">"; + $reg_exp = htmlspecialchars($reg_exp); // second escaping seems to be needed for javascript + + print "
"; + print " "; + print "
"; + print "
"; return; diff --git a/prefs.js b/prefs.js index c405a4f19..a5fc6c544 100644 --- a/prefs.js +++ b/prefs.js @@ -2156,3 +2156,29 @@ function rescore_all_feeds() { xmlhttp.send(null); } } + +function removeFilter(id, title) { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return + } + + var msg = __("Remove filter %s?").replace("%s", title); + + var ok = confirm(msg); + + if (ok) { + closeInfoBox(); + + notify_progress("Removing filter..."); + + xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ + param_escape(id), true); + xmlhttp.onreadystatechange=filterlist_callback; + xmlhttp.send(null); + } + + return false; +} +