add interface/schema for inverse matching filters
This commit is contained in:
parent
8011ac363a
commit
3f2ff803b3
9 changed files with 54 additions and 9 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
$op = $_REQUEST["op"];
|
||||
|
||||
define('SCHEMA_VERSION', 12);
|
||||
define('SCHEMA_VERSION', 13);
|
||||
|
||||
require_once "sanity_check.php";
|
||||
require_once "config.php";
|
||||
|
|
|
@ -262,6 +262,11 @@
|
|||
|
||||
print "<td><input disabled class='iedit' name='action_param'></td></tr>";
|
||||
|
||||
print "<tr><td valign='top'>Options:</td><td>";
|
||||
|
||||
print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
|
||||
<label for=\"inverse\">Inverse match</label></td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
$action_param = db_fetch_result($result, 0, "action_param");
|
||||
|
||||
$enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled"));
|
||||
$inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse"));
|
||||
|
||||
print "<div id=\"infoBoxTitle\">Filter editor</div>";
|
||||
print "<div class=\"infoBoxContents\">";
|
||||
|
@ -87,9 +88,18 @@
|
|||
$checked = "";
|
||||
}
|
||||
|
||||
print "<tr><td>Options:</td><td>
|
||||
print "<tr><td valign='top'>Options:</td><td>
|
||||
<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" $checked>
|
||||
<label for=\"enabled\">Enabled</label>";
|
||||
<label for=\"enabled\">Enabled</label><br/>";
|
||||
|
||||
if ($inverse) {
|
||||
$checked = "checked";
|
||||
} else {
|
||||
$checked = "";
|
||||
}
|
||||
|
||||
print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\" $checked>
|
||||
<label for=\"inverse\">Inverse match</label>";
|
||||
|
||||
print "</td></tr></table>";
|
||||
|
||||
|
@ -121,6 +131,7 @@
|
|||
$action_id = db_escape_string($_GET["action_id"]);
|
||||
$action_param = db_escape_string($_GET["action_param"]);
|
||||
$enabled = checkbox_to_sql_bool(db_escape_string($_GET["enabled"]));
|
||||
$inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"]));
|
||||
|
||||
if (!$feed_id) {
|
||||
$feed_id = 'NULL';
|
||||
|
@ -134,6 +145,7 @@
|
|||
action_id = '$action_id',
|
||||
filter_type = '$filter_type',
|
||||
enabled = $enabled,
|
||||
inverse = $inverse,
|
||||
action_param = '$action_param'
|
||||
WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
|
@ -161,6 +173,8 @@
|
|||
$action_id = db_escape_string($_GET["action_id"]);
|
||||
$action_param = db_escape_string($_GET["action_param"]);
|
||||
|
||||
$inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"]));
|
||||
|
||||
if (!$regexp) return;
|
||||
|
||||
if (!$feed_id) {
|
||||
|
@ -171,10 +185,10 @@
|
|||
|
||||
$result = db_query($link,
|
||||
"INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,
|
||||
action_id, action_param)
|
||||
action_id, action_param, inverse)
|
||||
VALUES
|
||||
('$regexp', '$filter_type','".$_SESSION["uid"]."',
|
||||
$feed_id, '$action_id', '$action_param')");
|
||||
$feed_id, '$action_id', '$action_param', $inverse)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,6 +223,7 @@
|
|||
ttrss_filter_types.name AS filter_type_name,
|
||||
ttrss_filter_types.description AS filter_type_descr,
|
||||
enabled,
|
||||
inverse,
|
||||
feed_id,
|
||||
ttrss_filter_actions.description AS action_description,
|
||||
ttrss_feeds.title AS feed_title
|
||||
|
@ -251,7 +266,8 @@
|
|||
$edit_filter_id = $_GET["id"];
|
||||
|
||||
$enabled = sql_bool_to_bool($line["enabled"]);
|
||||
|
||||
$inverse = sql_bool_to_bool($line["inverse"]);
|
||||
|
||||
if ($subop == "edit" && $filter_id != $edit_filter_id) {
|
||||
$class .= "Grayed";
|
||||
$this_row_id = "";
|
||||
|
@ -286,9 +302,15 @@
|
|||
|
||||
print "<td><a href=\"javascript:editFilter($filter_id);\">" .
|
||||
$line["feed_title"] . "</td>";
|
||||
|
||||
$inverse_label = "";
|
||||
|
||||
if ($inverse) {
|
||||
$inverse_label = " <span class='insensitive'>(Inverse)</span>";
|
||||
}
|
||||
|
||||
print "<td><a href=\"javascript:editFilter($filter_id);\">" .
|
||||
$line["filter_type_descr"] . "</td>";
|
||||
$line["filter_type_descr"] . "$inverse_label</td>";
|
||||
|
||||
print "<td><a href=\"javascript:editFilter($filter_id);\">" .
|
||||
$line["action_description"] . "</td>";
|
||||
|
|
|
@ -154,6 +154,7 @@ create table ttrss_filters (id integer not null primary key auto_increment,
|
|||
feed_id integer default null,
|
||||
filter_type integer not null,
|
||||
reg_exp varchar(250) not null,
|
||||
inverse bool not null default false,
|
||||
enabled bool not null default true,
|
||||
action_id integer not null default 1,
|
||||
action_param varchar(200) not null default '',
|
||||
|
@ -190,7 +191,7 @@ create table ttrss_tags (id integer primary key auto_increment,
|
|||
|
||||
create table ttrss_version (schema_version int not null) TYPE=InnoDB;
|
||||
|
||||
insert into ttrss_version values (12);
|
||||
insert into ttrss_version values (13);
|
||||
|
||||
create table ttrss_prefs_types (id integer not null primary key,
|
||||
type_name varchar(100) not null) TYPE=InnoDB;
|
||||
|
|
|
@ -149,6 +149,7 @@ create table ttrss_filters (id serial not null primary key,
|
|||
filter_type integer not null references ttrss_filter_types(id),
|
||||
reg_exp varchar(250) not null,
|
||||
enabled boolean not null default true,
|
||||
inverse boolean not null default false,
|
||||
action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade,
|
||||
action_param varchar(200) not null default '');
|
||||
|
||||
|
@ -174,7 +175,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
|
|||
|
||||
create table ttrss_version (schema_version int not null);
|
||||
|
||||
insert into ttrss_version values (12);
|
||||
insert into ttrss_version values (13);
|
||||
|
||||
create table ttrss_prefs_types (id integer not null primary key,
|
||||
type_name varchar(100) not null);
|
||||
|
|
6
schema/upgrade-1.2.6-1.2.8-mysql.sql
Normal file
6
schema/upgrade-1.2.6-1.2.8-mysql.sql
Normal file
|
@ -0,0 +1,6 @@
|
|||
alter table ttrss_filters add column inverse bool;
|
||||
update ttrss_filters set inverse = false;
|
||||
alter table ttrss_filters change inverse inverse bool not null;
|
||||
alter table ttrss_filters alter column inverse set default false;
|
||||
|
||||
update ttrss_version set schema_version = 13;
|
10
schema/upgrade-1.2.6-1.2.8-pgsql.sql
Normal file
10
schema/upgrade-1.2.6-1.2.8-pgsql.sql
Normal file
|
@ -0,0 +1,10 @@
|
|||
begin;
|
||||
|
||||
alter table ttrss_filters add column inverse boolean;
|
||||
update ttrss_filters set inverse = false;
|
||||
alter table ttrss_filters alter column inverse set not null;
|
||||
alter table ttrss_filters alter column inverse set default false;
|
||||
|
||||
update ttrss_version set schema_version = 13;
|
||||
|
||||
commit;
|
Loading…
Reference in a new issue