mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2026-01-08 23:59:16 +00:00
implement multiple rule/action filters
This commit is contained in:
126
classes/dlg.php
126
classes/dlg.php
@@ -444,132 +444,6 @@ class Dlg extends Handler_Protected {
|
||||
</div>";
|
||||
}
|
||||
|
||||
function quickAddFilter() {
|
||||
$active_feed_id = (int) db_escape_string($_REQUEST["feed"]);
|
||||
$cat_filter = db_escape_string($_REQUEST["is_cat"]) == "true";
|
||||
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"quiet\" value=\"1\">";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
|
||||
|
||||
$result = db_query($this->link, "SELECT id,description
|
||||
FROM ttrss_filter_types ORDER BY description");
|
||||
|
||||
$filter_types = array();
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
//array_push($filter_types, $line["description"]);
|
||||
$filter_types[$line["id"]] = __($line["description"]);
|
||||
}
|
||||
|
||||
print "<div class=\"dlgSec\">".__("Match")."</div>";
|
||||
|
||||
print "<div class=\"dlgSecCont\">";
|
||||
|
||||
print "<span id=\"filterDlg_dateModBox\" style=\"display : none\">";
|
||||
|
||||
$filter_params = array(
|
||||
"before" => __("before"),
|
||||
"after" => __("after"));
|
||||
|
||||
print_select_hash("filter_date_modifier", "before",
|
||||
$filter_params, 'dojoType="dijit.form.Select"');
|
||||
|
||||
print " </span>";
|
||||
|
||||
print "<input dojoType=\"dijit.form.ValidationTextBox\"
|
||||
required=\"true\" id=\"filterDlg_regExp\"
|
||||
style=\"font-size : 16px\"
|
||||
name=\"reg_exp\" value=\"$reg_exp\"/>";
|
||||
|
||||
print "<span id=\"filterDlg_dateChkBox\" style=\"display : none\">";
|
||||
print " <button dojoType=\"dijit.form.Button\"
|
||||
onclick=\"return filterDlgCheckDate()\">".
|
||||
__('Check it')."</button>";
|
||||
print "</span>";
|
||||
|
||||
print "<hr/>" . __("on field") . " ";
|
||||
print_select_hash("filter_type", 1, $filter_types,
|
||||
'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"');
|
||||
|
||||
print "<hr/>";
|
||||
|
||||
print __("in") . " ";
|
||||
|
||||
print "<span id='filterDlg_feeds'>";
|
||||
print_feed_select($this->link, "feed_id",
|
||||
$cat_filter ? "CAT:$active_feed_id" : $active_feed_id,
|
||||
'dojoType="dijit.form.FilteringSelect"');
|
||||
print "</span>";
|
||||
|
||||
print "<span id='filterDlg_cats' style='display : none'>";
|
||||
print_feed_cat_select($this->link, "cat_id", $active_cat_id,
|
||||
'dojoType="dijit.form.FilteringSelect"');
|
||||
print "</span>";
|
||||
|
||||
print "</div>";
|
||||
|
||||
print "<div class=\"dlgSec\">".__("Perform Action")."</div>";
|
||||
|
||||
print "<div class=\"dlgSecCont\">";
|
||||
|
||||
print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"
|
||||
onchange=\"filterDlgCheckAction(this)\">";
|
||||
|
||||
$result = db_query($this->link, "SELECT id,description FROM ttrss_filter_actions
|
||||
ORDER BY name");
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
|
||||
}
|
||||
|
||||
print "</select>";
|
||||
|
||||
print "<span id=\"filterDlg_paramBox\" style=\"display : none\">";
|
||||
print " " . __("with parameters:") . " ";
|
||||
print "<input dojoType=\"dijit.form.TextBox\"
|
||||
id=\"filterDlg_actionParam\"
|
||||
name=\"action_param\">";
|
||||
|
||||
print_label_select($this->link, "action_param_label", $action_param,
|
||||
'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"');
|
||||
|
||||
print "</span>";
|
||||
|
||||
print " "; // tiny layout hack
|
||||
|
||||
print "</div>";
|
||||
|
||||
print "<div class=\"dlgSec\">".__("Options")."</div>";
|
||||
print "<div class=\"dlgSecCont\">";
|
||||
|
||||
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">
|
||||
<label for=\"enabled\">".__('Enabled')."</label><hr/>";
|
||||
|
||||
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">
|
||||
<label for=\"inverse\">".__('Inverse match')."</label><hr/>";
|
||||
|
||||
# print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"cat_filter\" id=\"cat_filter\" onchange=\"filterDlgCheckCat(this)\">
|
||||
# <label for=\"cat_filter\">".__('Apply to category')."</label><hr/>";
|
||||
|
||||
|
||||
print "</div>";
|
||||
|
||||
print "<div class=\"dlgButtons\">";
|
||||
|
||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">".
|
||||
__('Test')."</button> ";
|
||||
|
||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">".
|
||||
__('Create')."</button> ";
|
||||
|
||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">".
|
||||
__('Cancel')."</button>";
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
function inactiveFeeds() {
|
||||
|
||||
if (DB_TYPE == "pgsql") {
|
||||
|
||||
@@ -159,7 +159,7 @@ class Opml extends Handler_Protected {
|
||||
|
||||
$out .= "</outline>";
|
||||
|
||||
$out .= "<outline title=\"tt-rss-filters\" schema-version=\"".SCHEMA_VERSION."\">";
|
||||
/* $out .= "<outline title=\"tt-rss-filters\" schema-version=\"".SCHEMA_VERSION."\">";
|
||||
|
||||
$result = db_query($this->link, "SELECT filter_type,
|
||||
reg_exp,
|
||||
@@ -191,7 +191,7 @@ class Opml extends Handler_Protected {
|
||||
}
|
||||
|
||||
|
||||
$out .= "</outline>";
|
||||
$out .= "</outline>"; */
|
||||
}
|
||||
|
||||
$out .= "</body></opml>";
|
||||
@@ -287,7 +287,7 @@ class Opml extends Handler_Protected {
|
||||
}
|
||||
}
|
||||
|
||||
private function opml_import_filter($doc, $node, $owner_uid) {
|
||||
/* private function opml_import_filter($doc, $node, $owner_uid) {
|
||||
$attrs = $node->attributes;
|
||||
|
||||
$filter_name = db_escape_string($attrs->getNamedItem('filter-name')->nodeValue);
|
||||
@@ -355,7 +355,7 @@ class Opml extends Handler_Protected {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
private function opml_import_category($doc, $root_node, $owner_uid, $parent_id) {
|
||||
$body = $doc->getElementsByTagName('body');
|
||||
@@ -413,7 +413,7 @@ class Opml extends Handler_Protected {
|
||||
$this->opml_import_label($doc, $node, $owner_uid);
|
||||
break;
|
||||
case "tt-rss-filters":
|
||||
$this->opml_import_filter($doc, $node, $owner_uid);
|
||||
//$this->opml_import_filter($doc, $node, $owner_uid);
|
||||
break;
|
||||
default:
|
||||
$this->opml_import_feed($doc, $node, $dst_cat_id, $owner_uid);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -192,10 +192,10 @@ class Pref_Labels extends Handler_Protected {
|
||||
|
||||
$old_caption = db_escape_string($old_caption);
|
||||
|
||||
db_query($this->link, "UPDATE ttrss_filters SET
|
||||
db_query($this->link, "UPDATE ttrss_filters2_actions SET
|
||||
action_param = '$caption' WHERE action_param = '$old_caption'
|
||||
AND action_id = 7
|
||||
AND owner_uid = " . $_SESSION["uid"]);
|
||||
AND filter_id IN (SELECT id FROM ttrss_filters2 WHERE owner_uid = ".$_SESSION["uid"].")");
|
||||
|
||||
print $_REQUEST["value"];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user