From 987936f57ab33fbe14bb625426b007061dfa5f1d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 10:26:12 +0300 Subject: pref_filters - refactor _get_name to use ORM, show cumulative score in tree filter description --- classes/Pref_Filters.php | 76 ++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 35 deletions(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 46cf6c30c..065303130 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -464,9 +464,9 @@ class Pref_Filters extends Handler_Protected { } /** - * @param array|null $action + * @param array|ArrayAccess|null $action */ - private function _get_action_name(?array $action = null): string { + private function _get_action_name(array|ArrayAccess|null $action = null): string { if (!$action) { return ""; } @@ -723,45 +723,51 @@ class Pref_Filters extends Handler_Protected { */ private function _get_name(int $id): array { - $sth = $this->pdo->prepare( - "SELECT title,match_any_rule,f.inverse AS inverse,COUNT(DISTINCT r.id) AS num_rules,COUNT(DISTINCT a.id) AS num_actions - FROM ttrss_filters2 AS f LEFT JOIN ttrss_filters2_rules AS r - ON (r.filter_id = f.id) - LEFT JOIN ttrss_filters2_actions AS a - ON (a.filter_id = f.id) WHERE f.id = ? GROUP BY f.title, f.match_any_rule, f.inverse"); - $sth->execute([$id]); - - if ($row = $sth->fetch()) { - - $title = $row["title"]; - $num_rules = $row["num_rules"]; - $num_actions = $row["num_actions"]; - $match_any_rule = $row["match_any_rule"]; - $inverse = $row["inverse"]; - - if (!$title) $title = __("[No caption]"); + $filter = ORM::for_table("ttrss_filters2") + ->table_alias('f') + ->select('f.title') + ->select('f.match_any_rule') + ->select('f.inverse') + ->select_expr('COUNT(DISTINCT r.id)', 'num_rules') + ->select_expr('COUNT(DISTINCT a.id)', 'num_actions') + ->join('ttrss_filters2_rules', ['r.filter_id', '=', 'f.id'], 'r') + ->join('ttrss_filters2_actions', ['a.filter_id', '=', 'f.id'], 'a') + ->where('f.id', $id) + ->group_by_expr('f.title, f.match_any_rule, f.inverse') + ->find_one(); + + if ($filter) { + $title_summary = [ + sprintf( + _ngettext("%s (%d rule)", "%s (%d rules)", (int) $filter->num_rules), + ($filter->title ? $filter->title : __("[No caption]")), + $filter->num_rules)]; + + if ($filter->match_any_rule) array_push($title_summary, __("matches any rule")); + if ($filter->inverse) array_push($title_summary, __("inverse")); + + $actions = ORM::for_table("ttrss_filters2_actions") + ->where("filter_id", $id) + ->order_by_asc('id') + ->find_many(); + + $actions_summary = ""; + $cumulative_score = 0; - $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules); - - $sth = $this->pdo->prepare("SELECT * FROM ttrss_filters2_actions - WHERE filter_id = ? ORDER BY id LIMIT 1"); - $sth->execute([$id]); - - $actions = ""; - - if ($line = $sth->fetch()) { - $actions = $this->_get_action_name($line); + foreach ($actions as $action) { + if ($action->action_id == self::ACTION_SCORE) + $cumulative_score += (int) $action->action_param; - $num_actions -= 1; + if ($actions_summary == "") + $actions_summary = self::_get_action_name($action); } - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; - if ($inverse) $title .= " (" . __("inverse") . ")"; + if ($cumulative_score) array_push($title_summary, T_sprintf("sets score: %d", $cumulative_score)); - if ($num_actions > 0) - $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); + if (count($actions) > 1) + $actions_summary .= " " . sprintf(_ngettext("(+%d action)", "(+%d actions)", count($actions) - 1), count($actions) - 1); - return [$title, $actions]; + return [implode(", ", $title_summary), $actions_summary]; } return []; -- cgit v1.2.3-54-g00ecf From 31ca090c631fe16e76235d37c822957f291c4463 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 11:07:50 +0300 Subject: get filter action descriptions on pref_filters class init instead of doing it all the time, use ORM in _get_action_name --- classes/Pref_Filters.php | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 065303130..2d8003629 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -10,6 +10,19 @@ class Pref_Filters extends Handler_Protected { const PARAM_ACTIONS = [self::ACTION_TAG, self::ACTION_SCORE, self::ACTION_LABEL, self::ACTION_PLUGIN, self::ACTION_REMOVE_TAG]; + private $action_descriptions = []; + + function before(string $method) : bool { + + $descriptions = ORM::for_table("ttrss_filter_actions")->find_array(); + + foreach ($descriptions as $desc) { + $this->action_descriptions[$desc['id']] = $desc; + } + + return parent::before($method); + } + function csrf_ignore(string $method): bool { $csrf_ignored = array("index", "getfiltertree", "savefilterorder"); @@ -471,32 +484,24 @@ class Pref_Filters extends Handler_Protected { return ""; } - $sth = $this->pdo->prepare("SELECT description FROM - ttrss_filter_actions WHERE id = ?"); - $sth->execute([(int)$action["action_id"]]); - - $title = ""; + $title = $this->action_descriptions[$action['action_id']]['description'] ?? + T_sprintf('Unknown action: %d', $action['action_id']); - if ($row = $sth->fetch()) { - - $title = __($row["description"]); + if ($action["action_id"] == self::ACTION_PLUGIN) { + list ($pfclass, $pfaction) = explode(":", $action["action_param"]); - if ($action["action_id"] == self::ACTION_PLUGIN) { - list ($pfclass, $pfaction) = explode(":", $action["action_param"]); - - $filter_actions = PluginHost::getInstance()->get_filter_actions(); + $filter_actions = PluginHost::getInstance()->get_filter_actions(); - foreach ($filter_actions as $fclass => $factions) { - foreach ($factions as $faction) { - if ($pfaction == $faction["action"] && $pfclass == $fclass) { - $title .= ": " . $fclass . ": " . $faction["description"]; - break; - } + foreach ($filter_actions as $fclass => $factions) { + foreach ($factions as $faction) { + if ($pfaction == $faction["action"] && $pfclass == $fclass) { + $title .= ": " . $fclass . ": " . $faction["description"]; + break; } } - } else if (in_array($action["action_id"], self::PARAM_ACTIONS)) { - $title .= ": " . $action["action_param"]; } + } else if (in_array($action["action_id"], self::PARAM_ACTIONS)) { + $title .= ": " . $action["action_param"]; } return $title; -- cgit v1.2.3-54-g00ecf From bbc28e626a04c826a561261eba6ec6348c9b009d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 11:11:19 +0300 Subject: fix _get_name failing on filters without any rules because of wrong type of JOIN --- classes/Pref_Filters.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 2d8003629..32ed2d187 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -735,8 +735,8 @@ class Pref_Filters extends Handler_Protected { ->select('f.inverse') ->select_expr('COUNT(DISTINCT r.id)', 'num_rules') ->select_expr('COUNT(DISTINCT a.id)', 'num_actions') - ->join('ttrss_filters2_rules', ['r.filter_id', '=', 'f.id'], 'r') - ->join('ttrss_filters2_actions', ['a.filter_id', '=', 'f.id'], 'a') + ->left_outer_join('ttrss_filters2_rules', ['r.filter_id', '=', 'f.id'], 'r') + ->left_outer_join('ttrss_filters2_actions', ['a.filter_id', '=', 'f.id'], 'a') ->where('f.id', $id) ->group_by_expr('f.title, f.match_any_rule, f.inverse') ->find_one(); -- cgit v1.2.3-54-g00ecf From ce5a96cb30bf47de85ee0394a8c61ef378962c9b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 11:14:39 +0300 Subject: set type hint for $action_descriptions --- classes/Pref_Filters.php | 1 + 1 file changed, 1 insertion(+) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 32ed2d187..104847098 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -10,6 +10,7 @@ class Pref_Filters extends Handler_Protected { const PARAM_ACTIONS = [self::ACTION_TAG, self::ACTION_SCORE, self::ACTION_LABEL, self::ACTION_PLUGIN, self::ACTION_REMOVE_TAG]; + /** @var array> $action_descriptions */ private $action_descriptions = []; function before(string $method) : bool { -- cgit v1.2.3-54-g00ecf From c23b76eb72b4830b101bba6d2a2a77eb529dbdbd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 11:21:18 +0300 Subject: pass resulting action description through gettext --- classes/Pref_Filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 104847098..60998683a 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -485,7 +485,7 @@ class Pref_Filters extends Handler_Protected { return ""; } - $title = $this->action_descriptions[$action['action_id']]['description'] ?? + $title = __($this->action_descriptions[$action['action_id']]['description']) ?? T_sprintf('Unknown action: %d', $action['action_id']); if ($action["action_id"] == self::ACTION_PLUGIN) { -- cgit v1.2.3-54-g00ecf From 64d9a77fde98b47c67dbaef0d4949ec6b0928e01 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 11:54:24 +0300 Subject: switch filters _get_rules_list() to ORM --- classes/Pref_Filters.php | 77 +++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 44 deletions(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 60998683a..53953b1e5 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -188,60 +188,49 @@ class Pref_Filters extends Handler_Protected { } private function _get_rules_list(int $filter_id): string { - $sth = $this->pdo->prepare("SELECT reg_exp, - inverse, - match_on, - feed_id, - cat_id, - cat_filter, - ttrss_filter_types.description AS field - FROM - ttrss_filters2_rules, ttrss_filter_types - WHERE - filter_id = ? AND filter_type = ttrss_filter_types.id - ORDER BY reg_exp"); - $sth->execute([$filter_id]); + $rules = ORM::for_table('ttrss_filters2_rules') + ->table_alias('r') + ->join('ttrss_filter_types', ['r.filter_type', '=', 't.id'], 't') + ->where('filter_id', $filter_id) + ->select_many_expr('r.*, t.description AS field') + ->find_many(); $rv = ""; - while ($line = $sth->fetch()) { - - if ($line["match_on"]) { - $feeds = json_decode($line["match_on"], true); - $feeds_fmt = []; - - foreach ($feeds as $feed_id) { - - if (strpos($feed_id, "CAT:") === 0) { - $feed_id = (int)substr($feed_id, 4); - array_push($feeds_fmt, Feeds::_get_cat_title($feed_id)); - } else { - if ($feed_id) - array_push($feeds_fmt, Feeds::_get_title((int)$feed_id)); - else - array_push($feeds_fmt, __("All feeds")); - } - } + foreach ($rules as $rule) { + if ($rule->match_on) { + $feeds = json_decode($rule->match_on, true); + $feeds_fmt = []; - $where = implode(", ", $feeds_fmt); + foreach ($feeds as $feed_id) { - } else { + if (strpos($feed_id, "CAT:") === 0) { + $feed_id = (int)substr($feed_id, 4); + array_push($feeds_fmt, Feeds::_get_cat_title($feed_id)); + } else { + if ($feed_id) + array_push($feeds_fmt, Feeds::_get_title((int)$feed_id)); + else + array_push($feeds_fmt, __("All feeds")); + } + } - $where = $line["cat_filter"] ? - Feeds::_get_cat_title($line["cat_id"] ?? 0) : - ($line["feed_id"] ? - Feeds::_get_title($line["feed_id"]) : __("All feeds")); - } + $where = implode(", ", $feeds_fmt); -# $where = $line["cat_id"] . "/" . $line["feed_id"]; + } else { + $where = $rule->cat_filter ? + Feeds::_get_cat_title($rule->cat_id ?? 0) : + ($rule->feed_id ? + Feeds::_get_title($rule->feed_id) : __("All feeds")); + } - $inverse = $line["inverse"] ? "inverse" : ""; + $inverse_class = $rule->inverse ? "inverse" : ""; - $rv .= "
  • " . T_sprintf("%s on %s in %s %s", - htmlspecialchars($line["reg_exp"]), - $line["field"], + $rv .= "
  • " . T_sprintf("%s on %s in %s %s", + htmlspecialchars($rule->reg_exp), + $rule->field, $where, - $line["inverse"] ? __("(inverse)") : "") . "
  • "; + $rule->inverse ? __("(inverse)") : "") . ""; } return $rv; -- cgit v1.2.3-54-g00ecf From 1fc19d6e50ac1dda8de4e9dde47e9d73b413c600 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 11:54:44 +0300 Subject: adjust indent --- classes/Pref_Filters.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 53953b1e5..8d131bf88 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -209,9 +209,9 @@ class Pref_Filters extends Handler_Protected { array_push($feeds_fmt, Feeds::_get_cat_title($feed_id)); } else { if ($feed_id) - array_push($feeds_fmt, Feeds::_get_title((int)$feed_id)); + array_push($feeds_fmt, Feeds::_get_title((int)$feed_id)); else - array_push($feeds_fmt, __("All feeds")); + array_push($feeds_fmt, __("All feeds")); } } -- cgit v1.2.3-54-g00ecf From 7be6484fee9c262a30d329851e5c9f530a409aa8 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 15:49:50 +0300 Subject: use select_many() without _expr --- classes/Pref_Filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 8d131bf88..76d5d686e 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -192,7 +192,7 @@ class Pref_Filters extends Handler_Protected { ->table_alias('r') ->join('ttrss_filter_types', ['r.filter_type', '=', 't.id'], 't') ->where('filter_id', $filter_id) - ->select_many_expr('r.*, t.description AS field') + ->select_many(['r.*', 'field' => 't.description']) ->find_many(); $rv = ""; -- cgit v1.2.3-54-g00ecf From 648024eb2e760b787bfabc5c8e51fcf7e68c7eb1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 15:54:40 +0300 Subject: bump minimum required php version to 8.0 & remove some deprecated code --- classes/Config.php | 4 ++-- classes/OPML.php | 8 -------- include/errorhandler.php | 8 ++------ include/functions.php | 4 ---- 4 files changed, 4 insertions(+), 20 deletions(-) (limited to 'classes') diff --git a/classes/Config.php b/classes/Config.php index 9235e2c45..ba6689214 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -534,8 +534,8 @@ class Config { array_push($errors, "Please don't run this script as root."); } - if (version_compare(PHP_VERSION, '7.4.0', '<')) { - array_push($errors, "PHP version 7.4.0 or newer required. You're using " . PHP_VERSION . "."); + if (version_compare(PHP_VERSION, '8.0.0', '<')) { + array_push($errors, "PHP version 8.0.0 or newer required. You're using " . PHP_VERSION . "."); } if (!class_exists("UConverter")) { diff --git a/classes/OPML.php b/classes/OPML.php index fce614a17..722312be6 100644 --- a/classes/OPML.php +++ b/classes/OPML.php @@ -647,16 +647,8 @@ class OPML extends Handler_Protected { $doc = new DOMDocument(); - if (version_compare(PHP_VERSION, '8.0.0', '<')) { - libxml_disable_entity_loader(false); - } - $loaded = $doc->load($tmp_file); - if (version_compare(PHP_VERSION, '8.0.0', '<')) { - libxml_disable_entity_loader(true); - } - // only remove temporary i.e. HTTP uploaded files if (!$filename) unlink($tmp_file); diff --git a/include/errorhandler.php b/include/errorhandler.php index 4f773bc19..c155c9989 100644 --- a/include/errorhandler.php +++ b/include/errorhandler.php @@ -41,12 +41,8 @@ function format_backtrace(array $trace): string { } function ttrss_error_handler(int $errno, string $errstr, string $file, int $line): bool { - // return true in order to avoid default error handling by PHP - if (version_compare(PHP_VERSION, '8.0.0', '<')) { - if (error_reporting() == 0 || !$errno) return true; - } else { - if (!(error_reporting() & $errno)) return true; - } + // return true in order to avoid default error handling by PHP + if (!(error_reporting() & $errno)) return true; $file = substr(str_replace(dirname(__DIR__), "", $file), 1); diff --git a/include/functions.php b/include/functions.php index c77b68828..dcb37cb86 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5,10 +5,6 @@ /** @deprecated by Config::SCHEMA_VERSION */ define('SCHEMA_VERSION', Config::SCHEMA_VERSION); - if (version_compare(PHP_VERSION, '8.0.0', '<')) { - libxml_disable_entity_loader(true); - } - libxml_use_internal_errors(true); // separate test because this is included before sanity checks -- cgit v1.2.3-54-g00ecf From 417065b8f56e5d273c80a866a67f9555073c6592 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 16:54:22 +0300 Subject: show cumulative score adjustment (if any) and up to 3 actions total in filter tree --- classes/Pref_Filters.php | 30 ++++++++++++++++++++++-------- themes/compact.css | 1 + themes/compact_night.css | 1 + themes/light-high-contrast.css | 1 + themes/light.css | 1 + themes/light/dijit_basic.less | 1 + themes/night.css | 1 + themes/night_blue.css | 1 + 8 files changed, 29 insertions(+), 8 deletions(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 76d5d686e..9b11284b4 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -10,6 +10,8 @@ class Pref_Filters extends Handler_Protected { const PARAM_ACTIONS = [self::ACTION_TAG, self::ACTION_SCORE, self::ACTION_LABEL, self::ACTION_PLUGIN, self::ACTION_REMOVE_TAG]; + const MAX_ACTIONS_TO_DISPLAY = 3; + /** @var array> $action_descriptions */ private $action_descriptions = []; @@ -746,23 +748,35 @@ class Pref_Filters extends Handler_Protected { ->order_by_asc('id') ->find_many(); - $actions_summary = ""; + /** @var array $actions_summary */ + $actions_summary = []; $cumulative_score = 0; + // we're going to show a summary adjustment so we skip individual score action descriptions here foreach ($actions as $action) { - if ($action->action_id == self::ACTION_SCORE) + if ($action->action_id == self::ACTION_SCORE) { $cumulative_score += (int) $action->action_param; + continue; + } - if ($actions_summary == "") - $actions_summary = self::_get_action_name($action); + array_push($actions_summary, self::_get_action_name($action)); } - if ($cumulative_score) array_push($title_summary, T_sprintf("sets score: %d", $cumulative_score)); + // inject a fake action description using cumulative filter score + if ($cumulative_score != 0) { + array_unshift($actions_summary, + self::_get_action_name(["action_id" => self::ACTION_SCORE, "action_param" => $cumulative_score])); + } - if (count($actions) > 1) - $actions_summary .= " " . sprintf(_ngettext("(+%d action)", "(+%d actions)", count($actions) - 1), count($actions) - 1); + if (count($actions_summary) > self::MAX_ACTIONS_TO_DISPLAY) { + $actions_not_shown = count($actions_summary) - self::MAX_ACTIONS_TO_DISPLAY; + $actions_summary = array_slice($actions_summary, 0, self::MAX_ACTIONS_TO_DISPLAY); + + array_push($actions_summary, + sprintf(_ngettext("(+%d action)", "(+%d actions)", $actions_not_shown), $actions_not_shown)); + } - return [implode(", ", $title_summary), $actions_summary]; + return [implode(", ", $title_summary), implode("
    ", $actions_summary)]; } return []; diff --git a/themes/compact.css b/themes/compact.css index b0330b885..c62595962 100644 --- a/themes/compact.css +++ b/themes/compact.css @@ -1964,6 +1964,7 @@ body.ttrss_utility.share_popup .content { .flat .dijitTree .labelParam { float: right; margin-right: 16px; + text-align: right; } .flat .dijitTree .dijitTreeRow.filterDisabled { opacity: 0.5; diff --git a/themes/compact_night.css b/themes/compact_night.css index 12b94dc85..8c48a6c27 100644 --- a/themes/compact_night.css +++ b/themes/compact_night.css @@ -1866,6 +1866,7 @@ body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules { .flat .dijitTree .labelParam { float: right; margin-right: 16px; + text-align: right; } .flat .dijitTree .dijitTreeRow.filterDisabled { opacity: 0.5; diff --git a/themes/light-high-contrast.css b/themes/light-high-contrast.css index 217d10eac..19387f96e 100644 --- a/themes/light-high-contrast.css +++ b/themes/light-high-contrast.css @@ -1964,6 +1964,7 @@ body.ttrss_utility.share_popup .content { .flat .dijitTree .labelParam { float: right; margin-right: 16px; + text-align: right; } .flat .dijitTree .dijitTreeRow.filterDisabled { opacity: 0.5; diff --git a/themes/light.css b/themes/light.css index e7aa0c11e..6934312ed 100644 --- a/themes/light.css +++ b/themes/light.css @@ -1964,6 +1964,7 @@ body.ttrss_utility.share_popup .content { .flat .dijitTree .labelParam { float: right; margin-right: 16px; + text-align: right; } .flat .dijitTree .dijitTreeRow.filterDisabled { opacity: 0.5; diff --git a/themes/light/dijit_basic.less b/themes/light/dijit_basic.less index f29461530..fcdde88eb 100644 --- a/themes/light/dijit_basic.less +++ b/themes/light/dijit_basic.less @@ -151,6 +151,7 @@ .labelParam { float: right; margin-right: 16px; + text-align: right; } .dijitTreeRow.filterDisabled { diff --git a/themes/night.css b/themes/night.css index 33a239af0..39f850e48 100644 --- a/themes/night.css +++ b/themes/night.css @@ -1867,6 +1867,7 @@ body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules { .flat .dijitTree .labelParam { float: right; margin-right: 16px; + text-align: right; } .flat .dijitTree .dijitTreeRow.filterDisabled { opacity: 0.5; diff --git a/themes/night_blue.css b/themes/night_blue.css index 6676426ef..d430e2834 100644 --- a/themes/night_blue.css +++ b/themes/night_blue.css @@ -1867,6 +1867,7 @@ body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules { .flat .dijitTree .labelParam { float: right; margin-right: 16px; + text-align: right; } .flat .dijitTree .dijitTreeRow.filterDisabled { opacity: 0.5; -- cgit v1.2.3-54-g00ecf From 4dc0e8cd29503a0a8a8979484c8b7a36f886b840 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Nov 2024 17:08:33 +0300 Subject: fix text-muted being set to default text foreground color in light mode, adjust styling of filter actions list --- classes/Pref_Filters.php | 2 +- themes/compact.css | 5 ++++- themes/compact_night.css | 5 ++++- themes/light-high-contrast.css | 5 ++++- themes/light.css | 5 ++++- themes/light/defines.less | 2 ++ themes/light/prefs.less | 4 ++++ themes/light/tt-rss.less | 2 +- themes/night.css | 5 ++++- themes/night_blue.css | 5 ++++- 10 files changed, 32 insertions(+), 8 deletions(-) (limited to 'classes') diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 9b11284b4..3a51a011b 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -773,7 +773,7 @@ class Pref_Filters extends Handler_Protected { $actions_summary = array_slice($actions_summary, 0, self::MAX_ACTIONS_TO_DISPLAY); array_push($actions_summary, - sprintf(_ngettext("(+%d action)", "(+%d actions)", $actions_not_shown), $actions_not_shown)); + "" . sprintf(_ngettext("(+%d action)", "(+%d actions)", $actions_not_shown), $actions_not_shown)) . ""; } return [implode(", ", $title_summary), implode("
    ", $actions_summary)]; diff --git a/themes/compact.css b/themes/compact.css index c62595962..3ee5a4a90 100644 --- a/themes/compact.css +++ b/themes/compact.css @@ -1151,7 +1151,7 @@ body.ttrss_utility .text-warning { } body.ttrss_main .text-muted, body.ttrss_utility .text-muted { - color: #555; + color: #888888; } body.ttrss_main .text-small, body.ttrss_utility .text-small, @@ -1510,6 +1510,9 @@ body.ttrss_prefs h4 { font-weight: 600; color: #555; } +body.ttrss_prefs .text-muted { + color: #888888; +} body.ttrss_prefs .dijitContentPane > h1:first-of-type, body.ttrss_prefs .dijitContentPane > h2:first-of-type, body.ttrss_prefs .dijitContentPane > h3:first-of-type { diff --git a/themes/compact_night.css b/themes/compact_night.css index 8c48a6c27..c62554e29 100644 --- a/themes/compact_night.css +++ b/themes/compact_night.css @@ -1151,7 +1151,7 @@ body.ttrss_utility .text-warning { } body.ttrss_main .text-muted, body.ttrss_utility .text-muted { - color: #ccc; + color: #999999; } body.ttrss_main .text-small, body.ttrss_utility .text-small, @@ -1510,6 +1510,9 @@ body.ttrss_prefs h4 { font-weight: 600; color: #ccc; } +body.ttrss_prefs .text-muted { + color: #999999; +} body.ttrss_prefs .dijitContentPane > h1:first-of-type, body.ttrss_prefs .dijitContentPane > h2:first-of-type, body.ttrss_prefs .dijitContentPane > h3:first-of-type { diff --git a/themes/light-high-contrast.css b/themes/light-high-contrast.css index 19387f96e..830b57f72 100644 --- a/themes/light-high-contrast.css +++ b/themes/light-high-contrast.css @@ -1151,7 +1151,7 @@ body.ttrss_utility .text-warning { } body.ttrss_main .text-muted, body.ttrss_utility .text-muted { - color: black; + color: #333333; } body.ttrss_main .text-small, body.ttrss_utility .text-small, @@ -1510,6 +1510,9 @@ body.ttrss_prefs h4 { font-weight: 600; color: black; } +body.ttrss_prefs .text-muted { + color: #333333; +} body.ttrss_prefs .dijitContentPane > h1:first-of-type, body.ttrss_prefs .dijitContentPane > h2:first-of-type, body.ttrss_prefs .dijitContentPane > h3:first-of-type { diff --git a/themes/light.css b/themes/light.css index 6934312ed..33d137423 100644 --- a/themes/light.css +++ b/themes/light.css @@ -1151,7 +1151,7 @@ body.ttrss_utility .text-warning { } body.ttrss_main .text-muted, body.ttrss_utility .text-muted { - color: #555; + color: #888888; } body.ttrss_main .text-small, body.ttrss_utility .text-small, @@ -1510,6 +1510,9 @@ body.ttrss_prefs h4 { font-weight: 600; color: #555; } +body.ttrss_prefs .text-muted { + color: #888888; +} body.ttrss_prefs .dijitContentPane > h1:first-of-type, body.ttrss_prefs .dijitContentPane > h2:first-of-type, body.ttrss_prefs .dijitContentPane > h3:first-of-type { diff --git a/themes/light/defines.less b/themes/light/defines.less index 08896b4f1..37d1beadf 100644 --- a/themes/light/defines.less +++ b/themes/light/defines.less @@ -28,6 +28,8 @@ @breakpoint-lg: 992px; @breakpoint-xl: 1200px; +@fg-text-muted: lighten(@default-text, 20%); + @embed-responsive-padding: 56.25%; // Use 56.25% for 16:9 aspect ratio, 75% for 4:3. body.ttrss_main, diff --git a/themes/light/prefs.less b/themes/light/prefs.less index e13358956..849855796 100644 --- a/themes/light/prefs.less +++ b/themes/light/prefs.less @@ -9,6 +9,10 @@ body.ttrss_prefs { color : @default-text; } + .text-muted { + color : @fg-text-muted; + } + .dijitContentPane { > h1:first-of-type, > h2:first-of-type, diff --git a/themes/light/tt-rss.less b/themes/light/tt-rss.less index 3896665c8..bb6ef9ef8 100644 --- a/themes/light/tt-rss.less +++ b/themes/light/tt-rss.less @@ -1348,7 +1348,7 @@ body.ttrss_main, body.ttrss_utility { } .text-muted { - color : @default-text; + color : @fg-text-muted; } .text-small, .small { diff --git a/themes/night.css b/themes/night.css index 39f850e48..81a1b444b 100644 --- a/themes/night.css +++ b/themes/night.css @@ -1152,7 +1152,7 @@ body.ttrss_utility .text-warning { } body.ttrss_main .text-muted, body.ttrss_utility .text-muted { - color: #ccc; + color: #999999; } body.ttrss_main .text-small, body.ttrss_utility .text-small, @@ -1511,6 +1511,9 @@ body.ttrss_prefs h4 { font-weight: 600; color: #ccc; } +body.ttrss_prefs .text-muted { + color: #999999; +} body.ttrss_prefs .dijitContentPane > h1:first-of-type, body.ttrss_prefs .dijitContentPane > h2:first-of-type, body.ttrss_prefs .dijitContentPane > h3:first-of-type { diff --git a/themes/night_blue.css b/themes/night_blue.css index d430e2834..16de963a3 100644 --- a/themes/night_blue.css +++ b/themes/night_blue.css @@ -1152,7 +1152,7 @@ body.ttrss_utility .text-warning { } body.ttrss_main .text-muted, body.ttrss_utility .text-muted { - color: #ccc; + color: #999999; } body.ttrss_main .text-small, body.ttrss_utility .text-small, @@ -1511,6 +1511,9 @@ body.ttrss_prefs h4 { font-weight: 600; color: #ccc; } +body.ttrss_prefs .text-muted { + color: #999999; +} body.ttrss_prefs .dijitContentPane > h1:first-of-type, body.ttrss_prefs .dijitContentPane > h2:first-of-type, body.ttrss_prefs .dijitContentPane > h3:first-of-type { -- cgit v1.2.3-54-g00ecf