From 449fee7a2cc9453da4aac03f833ccb28205d7d3a Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 26 Feb 2021 17:31:01 -0500 Subject: "Show all" option on labels (#3472) It uses the favorite option to keep a similar experience through out the application and also to limit the number of options. See #3263 --- app/Models/Context.php | 3 ++- app/Models/TagDAO.php | 13 ++++++++++--- app/i18n/cz/conf.php | 1 + app/i18n/de/conf.php | 1 + app/i18n/en-us/conf.php | 1 + app/i18n/en/conf.php | 1 + app/i18n/es/conf.php | 1 + app/i18n/fr/conf.php | 1 + app/i18n/he/conf.php | 1 + app/i18n/it/conf.php | 1 + app/i18n/kr/conf.php | 1 + app/i18n/nl/conf.php | 1 + app/i18n/oc/conf.php | 1 + app/i18n/pl/conf.php | 1 + app/i18n/pt-br/conf.php | 1 + app/i18n/ru/conf.php | 1 + app/i18n/sk/conf.php | 1 + app/i18n/tr/conf.php | 1 + app/i18n/zh-cn/conf.php | 1 + app/layout/aside_feed.phtml | 14 +++++--------- app/views/configure/reading.phtml | 1 + cli/i18n/ignore/en-us.php | 1 + 22 files changed, 36 insertions(+), 13 deletions(-) diff --git a/app/Models/Context.php b/app/Models/Context.php index 1ca99a26d..4f18165c0 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -292,9 +292,10 @@ class FreshRSS_Context { self::$get_unread = $tag->nbUnread(); break; case 'T': + $tagDAO = FreshRSS_Factory::createTagDao(); self::$current_get['tags'] = true; self::$name = _t('index.menu.tags'); - self::$get_unread = 0; + self::$get_unread = $tagDAO->countNotRead(); break; default: throw new FreshRSS_Context_Exception('Invalid getter: ' . $get); diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index 854dc07f2..a9aad519d 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -259,12 +259,19 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $res[0]['count']; } - public function countNotRead($id) { + public function countNotRead($id = null) { $sql = 'SELECT COUNT(*) AS count FROM `_entrytag` et ' . 'INNER JOIN `_entry` e ON et.id_entry=e.id ' - . 'WHERE et.id_tag=? AND e.is_read=0'; + . 'WHERE e.is_read=0'; + $values = null; + + if (null !== $id) { + $sql .= ' AND et.id_tag=?'; + $values = [$id]; + } + $stm = $this->pdo->prepare($sql); - $values = array($id); + $stm->execute($values); $res = $stm->fetchAll(PDO::FETCH_ASSOC); return $res[0]['count']; diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php index 9b1770336..b537cf158 100644 --- a/app/i18n/cz/conf.php +++ b/app/i18n/cz/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Zobrazit jen nepřečtené', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation 'sort' => array( '_' => 'Řazení', diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index 15a019ea3..c34bcdb55 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Geöffnete Kategorien merken', 'unread' => 'Nur ungelesene zeigen', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Klick außerhalb des Artikel-Textes schließt den Artikel', 'sort' => array( '_' => 'Sortierreihenfolge', diff --git a/app/i18n/en-us/conf.php b/app/i18n/en-us/conf.php index 090457aad..da9ce753a 100644 --- a/app/i18n/en-us/conf.php +++ b/app/i18n/en-us/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', 'unread' => 'Show only unread', ), + 'show_fav_unread_help' => 'Applies also on labels', 'sides_close_article' => 'Clicking outside of article text area closes the article', 'sort' => array( '_' => 'Sort order', diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php index 45d9fd280..1d8544810 100644 --- a/app/i18n/en/conf.php +++ b/app/i18n/en/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', 'unread' => 'Show only unread', ), + 'show_fav_unread_help' => 'Applies also on labels', 'sides_close_article' => 'Clicking outside of article text area closes the article', 'sort' => array( '_' => 'Sort order', diff --git a/app/i18n/es/conf.php b/app/i18n/es/conf.php index 5a03f0f8e..9149ed09b 100755 --- a/app/i18n/es/conf.php +++ b/app/i18n/es/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Mostrar solo pendientes', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Pinchar fuera del área de texto del artículo lo cerrará', 'sort' => array( '_' => 'Orden', diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php index 93848b28e..3a2d299ec 100644 --- a/app/i18n/fr/conf.php +++ b/app/i18n/fr/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Se souvenir des catégories dépliées', 'unread' => 'Afficher les non lus', ), + 'show_fav_unread_help' => 'S’applique aussi aux étiquettes', 'sides_close_article' => 'Cliquer hors de la zone de texte ferme l’article', 'sort' => array( '_' => 'Ordre de tri', diff --git a/app/i18n/he/conf.php b/app/i18n/he/conf.php index 439c07974..bafd4391b 100644 --- a/app/i18n/he/conf.php +++ b/app/i18n/he/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'הצגת מאמרים שלא נקראו בלבד', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation 'sort' => array( '_' => 'סדר המיון', diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.php index 803f80b40..d6bf69ae6 100644 --- a/app/i18n/it/conf.php +++ b/app/i18n/it/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Mostra solo non letti', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation 'sort' => array( '_' => 'Ordinamento', diff --git a/app/i18n/kr/conf.php b/app/i18n/kr/conf.php index 3d2eb9233..7072126b7 100644 --- a/app/i18n/kr/conf.php +++ b/app/i18n/kr/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => '읽지 않은 글만 표시', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => '글 영역 바깥을 클릭하면 글 접기', 'sort' => array( '_' => '정렬 순서', diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php index c79c2f989..8c25349c2 100644 --- a/app/i18n/nl/conf.php +++ b/app/i18n/nl/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Open categorieën herinneren', 'unread' => 'Bekijk alleen ongelezen', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Sluit het artikel door buiten de artikeltekst te klikken', 'sort' => array( '_' => 'Sorteer volgorde', diff --git a/app/i18n/oc/conf.php b/app/i18n/oc/conf.php index 374ec28de..5a51138bd 100644 --- a/app/i18n/oc/conf.php +++ b/app/i18n/oc/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Se remembrar de las categorias dobèrtas', 'unread' => 'Mostrar pas que los pas legits', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Clicar fòra de la zòna de tèxte tampa l’article', 'sort' => array( '_' => 'Òrdre de tria', diff --git a/app/i18n/pl/conf.php b/app/i18n/pl/conf.php index 5036fa439..45b41341e 100644 --- a/app/i18n/pl/conf.php +++ b/app/i18n/pl/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Tylko nieprzeczytane', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Kliknięcie poza zawartością wiadomości zamyka widok wiadomości', 'sort' => array( '_' => 'Porządek sortowania', diff --git a/app/i18n/pt-br/conf.php b/app/i18n/pt-br/conf.php index 5b48759f6..876fb1afe 100644 --- a/app/i18n/pt-br/conf.php +++ b/app/i18n/pt-br/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Exibir apenas não lido', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Clicando fora da área do texto do artigo fecha o mesmo', 'sort' => array( '_' => 'Ordem de visualização', diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.php index 446cd1f45..1e63347a1 100644 --- a/app/i18n/ru/conf.php +++ b/app/i18n/ru/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Show only unread', // TODO - Translation ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation 'sort' => array( '_' => 'Sort order', // TODO - Translation diff --git a/app/i18n/sk/conf.php b/app/i18n/sk/conf.php index 324d2f676..e7aa4cc9c 100644 --- a/app/i18n/sk/conf.php +++ b/app/i18n/sk/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Zobraziť iba neprečítané', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Po kliknutí mimo textu článku sa článok zatvorí', 'sort' => array( '_' => 'Poradie', diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.php index 6d447b099..27c766b83 100644 --- a/app/i18n/tr/conf.php +++ b/app/i18n/tr/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => 'Remember open categories', // TODO - Translation 'unread' => 'Sadece okunmamış makaleleri göster', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation 'sort' => array( '_' => 'Sıralama', diff --git a/app/i18n/zh-cn/conf.php b/app/i18n/zh-cn/conf.php index c121a57cf..7c9a21102 100644 --- a/app/i18n/zh-cn/conf.php +++ b/app/i18n/zh-cn/conf.php @@ -138,6 +138,7 @@ return array( 'remember_categories' => '记住打开的分类', 'unread' => '只显示未读', ), + 'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation 'sides_close_article' => '点击文章区域外以关闭', 'sort' => array( '_' => '排列顺序', diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 1b413ac86..98daf633c 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -6,6 +6,8 @@ !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) { $class = ' state_unread'; } + + $state_filter = FreshRSS_Context::$user_conf->show_fav_unread ? '&state=3' : ''; ?>
@@ -31,14 +33,8 @@
  • - show_fav_unread) { - $url_starred = $url_starred . '&state=3'; - } - ?> - +
    @@ -51,7 +47,7 @@
  • - +
  • - name() ?> + name() ?> diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index f828556b2..68fbc5bf2 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -73,6 +73,7 @@ diff --git a/cli/i18n/ignore/en-us.php b/cli/i18n/ignore/en-us.php index fad9a4aaa..e81a79e81 100644 --- a/cli/i18n/ignore/en-us.php +++ b/cli/i18n/ignore/en-us.php @@ -244,6 +244,7 @@ return array( 'conf.reading.show.no_category', 'conf.reading.show.remember_categories', 'conf.reading.show.unread', + 'conf.reading.show_fav_unread_help', 'conf.reading.sides_close_article', 'conf.reading.sort._', 'conf.reading.sort.newer_first', -- cgit v1.2.3