diff --git a/backend.php b/backend.php
index 0d59e7902..763c04c68 100644
--- a/backend.php
+++ b/backend.php
@@ -1903,6 +1903,7 @@
$match = db_escape_string($_GET["m"]);
$filter_id = db_escape_string($_GET["id"]);
$feed_id = db_escape_string($_GET["fid"]);
+ $action_id = db_escape_string($_GET["aid"]);
if (!$feed_id) {
$feed_id = 'NULL';
@@ -1914,6 +1915,7 @@
reg_exp = '$regexp',
description = '$descr',
feed_id = $feed_id,
+ action_id = '$action_id',
filter_type = (SELECT id FROM ttrss_filter_types WHERE
description = '$match')
WHERE id = '$filter_id'");
@@ -1939,6 +1941,7 @@
$regexp = db_escape_string(trim($_GET["regexp"]));
$match = db_escape_string(trim($_GET["match"]));
$feed_id = db_escape_string($_GET["fid"]);
+ $action_id = db_escape_string($_GET["aid"]);
if (!$feed_id) {
$feed_id = 'NULL';
@@ -1947,9 +1950,12 @@
}
$result = db_query($link,
- "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id) VALUES
+ "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,
+ action_id)
+ VALUES
('$regexp', (SELECT id FROM ttrss_filter_types WHERE
- description = '$match'),'".$_SESSION["uid"]."', $feed_id)");
+ description = '$match'),'".$_SESSION["uid"]."',
+ $feed_id, '$action_id')");
}
}
@@ -1983,22 +1989,39 @@
}
print " ";
-
+
+ print " Action: ";
+
+ print " ";
+
print "";
+ print "";
+
$result = db_query($link, "SELECT
ttrss_filters.id AS id,reg_exp,
ttrss_filters.description AS description,
ttrss_filter_types.name AS filter_type_name,
ttrss_filter_types.description AS filter_type_descr,
feed_id,
+ ttrss_filter_actions.description AS action_description,
(SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title
FROM
- ttrss_filters,ttrss_filter_types
+ ttrss_filters,ttrss_filter_types,ttrss_filter_actions
WHERE
filter_type = ttrss_filter_types.id AND
+ ttrss_filter_actions.id = action_id AND
ttrss_filters.owner_uid = ".$_SESSION["uid"]."
ORDER by reg_exp");
@@ -2016,8 +2039,11 @@
";
print "
- Select | Filter expression |
- Feed | Match |
+ Select |
+ Filter expression |
+ Feed |
+ Match |
+ Action |
Description |
";
$lnum = 0;
@@ -2058,7 +2084,10 @@
print "" .
$line["filter_type_descr"] . " | ";
-
+
+ print "" .
+ $line["action_description"] . " | ";
+
print "" .
$line["description"] . " | ";
@@ -2072,8 +2101,9 @@
print "".$line["reg_exp"]." | ";
print "".$line["feed_title"]." | ";
print "".$line["filter_type_descr"]." | ";
+ print "".$line["action_description"]." | ";
print "".$line["description"]." | ";
-
+
} else {
print " | ";
@@ -2082,18 +2112,16 @@
"\">";
print "";
-
print "";
}
- function is_filtered($title, $content, $link, $filters) {
+ function get_filter_name($title, $content, $link, $filters) {
if ($filters["title"]) {
- foreach ($filters["title"] as $title_filter) {
- if (preg_match("/$title_filter/i", $title))
- return true;
+ foreach ($filters["title"] as $filter) {
+ $reg_exp = $filter["reg_exp"];
+ if (preg_match("/$reg_exp/i", $title)) {
+ return $filter["action"];
+ }
}
}
if ($filters["content"]) {
- foreach ($filters["content"] as $content_filter) {
- if (preg_match("/$content_filter/i", $content))
- return true;
+ foreach ($filters["content"] as $filter) {
+ $reg_exp = $filter["reg_exp"];
+ if (preg_match("/$reg_exp/i", $content)) {
+ return $filter["action"];
+ }
}
}
if ($filters["both"]) {
foreach ($filters["both"] as $filter) {
- if (preg_match("/$filter/i", $title) || preg_match("/$filter/i", $content))
- return true;
+ $reg_exp = $filter["reg_exp"];
+ if (preg_match("/$reg_exp/i", $title) ||
+ preg_match("/$reg_exp/i", $content)) {
+ return $filter["action"];
+ }
}
}
if ($filters["link"]) {
- foreach ($filters["link"] as $link_filter) {
- if (preg_match("/$link_filter/i", $link))
- return true;
+ $reg_exp = $filter["reg_exp"];
+ foreach ($filters["link"] as $filter) {
+ $reg_exp = $filter["reg_exp"];
+ if (preg_match("/$reg_exp/i", $link)) {
+ return $filter["action"];
+ }
}
}
diff --git a/prefs.js b/prefs.js
index 421b06a63..1064cb914 100644
--- a/prefs.js
+++ b/prefs.js
@@ -235,6 +235,7 @@ function addFilter() {
var regexp = document.getElementById("fadd_regexp");
var match = document.getElementById("fadd_match");
var feed = document.getElementById("fadd_feed");
+ var action = document.getElementById("fadd_action");
if (regexp.value.length == 0) {
notify("Missing filter expression.");
@@ -242,12 +243,12 @@ function addFilter() {
notify("Adding filter...");
var v_match = match[match.selectedIndex].text;
-
var feed_id = feed[feed.selectedIndex].id;
+ var action_id = action[action.selectedIndex].id;
xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
param_escape(regexp.value) + "&match=" + v_match +
- "&fid=" + param_escape(feed_id), true);
+ "&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true);
xmlhttp.onreadystatechange=filterlist_callback;
xmlhttp.send(null);
@@ -832,12 +833,15 @@ function filterEditSave() {
var regexp = document.getElementById("iedit_regexp").value;
var descr = document.getElementById("iedit_descr").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;
+
// notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
if (regexp.length == 0) {
@@ -849,7 +853,8 @@ function filterEditSave() {
xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
filter + "&r=" + param_escape(regexp) + "&d=" + param_escape(descr) +
- "&m=" + param_escape(v_match) + "&fid=" + param_escape(feed_id), true);
+ "&m=" + param_escape(v_match) + "&fid=" + param_escape(feed_id) +
+ "&aid=" + param_escape(action_id), true);
notify("");
diff --git a/tt-rss.css b/tt-rss.css
index 15f87ff29..25ea0c394 100644
--- a/tt-rss.css
+++ b/tt-rss.css
@@ -295,7 +295,7 @@ a:hover {
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl,
#iedit_purgintl, #iedit_ulogin, #iedit_ulevel, #iedit_match, #iedit_feed,
-#iedit_fcat {
+#iedit_fcat, #iedit_filter_action {
width : 100%;
padding-left : 2px;
}
@@ -651,6 +651,11 @@ span.insensitive {
.prefGenericAddBox {
margin : 5px;
+ font-size : small;
+}
+
+.prefGenericAddBox td {
+ font-size : small;
}
body.logoutBody {
|