implement filter titles
This commit is contained in:
parent
8e8c8934a9
commit
18ad09af01
|
@ -178,7 +178,7 @@ class Pref_Filters extends Handler_Protected {
|
||||||
$fg_color = db_fetch_result($label_result, 0, "fg_color");
|
$fg_color = db_fetch_result($label_result, 0, "fg_color");
|
||||||
$bg_color = db_fetch_result($label_result, 0, "bg_color");
|
$bg_color = db_fetch_result($label_result, 0, "bg_color");
|
||||||
|
|
||||||
$name[1] = "<span class=\"labelColorIndicator\" id=\"label-editor-indicator\" style='color : $fg_color; background-color : $bg_color; margin-right : 4px'>α</span>" . $name[1];
|
if ($name[1]) $name[1] = "<span class=\"labelColorIndicator\" id=\"label-editor-indicator\" style='color : $fg_color; background-color : $bg_color; margin-right : 4px'>α</span>" . $name[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ class Pref_Filters extends Handler_Protected {
|
||||||
$enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled"));
|
$enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled"));
|
||||||
$match_any_rule = sql_bool_to_bool(db_fetch_result($result, 0, "match_any_rule"));
|
$match_any_rule = sql_bool_to_bool(db_fetch_result($result, 0, "match_any_rule"));
|
||||||
$inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse"));
|
$inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse"));
|
||||||
|
$title = htmlspecialchars(db_fetch_result($result, 0, "title"));
|
||||||
|
|
||||||
print "<form id=\"filter_edit_form\" onsubmit='return false'>";
|
print "<form id=\"filter_edit_form\" onsubmit='return false'>";
|
||||||
|
|
||||||
|
@ -226,6 +227,12 @@ class Pref_Filters extends Handler_Protected {
|
||||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
|
||||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
|
||||||
|
|
||||||
|
print "<div class=\"dlgSec\">".__("Caption")."</div>";
|
||||||
|
|
||||||
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"width : 20em;\" name=\"title\" value=\"$title\">";
|
||||||
|
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
print "<div class=\"dlgSec\">".__("Match")."</div>";
|
print "<div class=\"dlgSec\">".__("Match")."</div>";
|
||||||
|
|
||||||
print "<div dojoType=\"dijit.Toolbar\">";
|
print "<div dojoType=\"dijit.Toolbar\">";
|
||||||
|
@ -422,10 +429,12 @@ class Pref_Filters extends Handler_Protected {
|
||||||
$enabled = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["enabled"]));
|
$enabled = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["enabled"]));
|
||||||
$match_any_rule = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["match_any_rule"]));
|
$match_any_rule = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["match_any_rule"]));
|
||||||
$inverse = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["inverse"]));
|
$inverse = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["inverse"]));
|
||||||
|
$title = db_escape_string($this->link, $_REQUEST["title"]);
|
||||||
|
|
||||||
$result = db_query($this->link, "UPDATE ttrss_filters2 SET enabled = $enabled,
|
$result = db_query($this->link, "UPDATE ttrss_filters2 SET enabled = $enabled,
|
||||||
match_any_rule = $match_any_rule,
|
match_any_rule = $match_any_rule,
|
||||||
inverse = $inverse
|
inverse = $inverse,
|
||||||
|
title = '$title'
|
||||||
WHERE id = '$filter_id'
|
WHERE id = '$filter_id'
|
||||||
AND owner_uid = ". $_SESSION["uid"]);
|
AND owner_uid = ". $_SESSION["uid"]);
|
||||||
|
|
||||||
|
@ -539,14 +548,15 @@ class Pref_Filters extends Handler_Protected {
|
||||||
|
|
||||||
$enabled = checkbox_to_sql_bool($_REQUEST["enabled"]);
|
$enabled = checkbox_to_sql_bool($_REQUEST["enabled"]);
|
||||||
$match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
|
$match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
|
||||||
|
$title = db_escape_string($this->link, $_REQUEST["title"]);
|
||||||
|
|
||||||
db_query($this->link, "BEGIN");
|
db_query($this->link, "BEGIN");
|
||||||
|
|
||||||
/* create base filter */
|
/* create base filter */
|
||||||
|
|
||||||
$result = db_query($this->link, "INSERT INTO ttrss_filters2
|
$result = db_query($this->link, "INSERT INTO ttrss_filters2
|
||||||
(owner_uid, match_any_rule, enabled) VALUES
|
(owner_uid, match_any_rule, enabled, title) VALUES
|
||||||
(".$_SESSION["uid"].",$match_any_rule,$enabled)");
|
(".$_SESSION["uid"].",$match_any_rule,$enabled, '$title')");
|
||||||
|
|
||||||
$result = db_query($this->link, "SELECT MAX(id) AS id FROM ttrss_filters2
|
$result = db_query($this->link, "SELECT MAX(id) AS id FROM ttrss_filters2
|
||||||
WHERE owner_uid = ".$_SESSION["uid"]);
|
WHERE owner_uid = ".$_SESSION["uid"]);
|
||||||
|
@ -668,6 +678,10 @@ class Pref_Filters extends Handler_Protected {
|
||||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
|
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']."\">";
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
|
||||||
|
|
||||||
|
print "<div class=\"dlgSec\">".__("Caption")."</div>";
|
||||||
|
|
||||||
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"width : 20em;\" name=\"title\" value=\"\">";
|
||||||
|
|
||||||
print "<div class=\"dlgSec\">".__("Match")."</div>";
|
print "<div class=\"dlgSec\">".__("Match")."</div>";
|
||||||
|
|
||||||
print "<div dojoType=\"dijit.Toolbar\">";
|
print "<div dojoType=\"dijit.Toolbar\">";
|
||||||
|
@ -894,6 +908,16 @@ class Pref_Filters extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFilterName($id) {
|
private function getFilterName($id) {
|
||||||
|
|
||||||
|
$result = db_query($this->link,
|
||||||
|
"SELECT title FROM ttrss_filters2 WHERE id = '$id'");
|
||||||
|
|
||||||
|
$title = db_fetch_result($result, 0, "title");
|
||||||
|
|
||||||
|
if ($title) {
|
||||||
|
return array($title);
|
||||||
|
} else {
|
||||||
|
|
||||||
$result = db_query($this->link,
|
$result = db_query($this->link,
|
||||||
"SELECT * FROM ttrss_filters2_rules WHERE filter_id = '$id' ORDER BY id
|
"SELECT * FROM ttrss_filters2_rules WHERE filter_id = '$id' ORDER BY id
|
||||||
LIMIT 3");
|
LIMIT 3");
|
||||||
|
@ -937,6 +961,8 @@ class Pref_Filters extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(join(", ", $titles), join(", ", $actions));
|
return array(join(", ", $titles), join(", ", $actions));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function join() {
|
function join() {
|
||||||
|
|
Loading…
Reference in New Issue