diff options
| -rwxr-xr-x | app/Controllers/indexController.php | 7 | ||||
| -rw-r--r-- | app/Models/Configuration.php | 9 | ||||
| -rw-r--r-- | app/Models/EntryDAO.php | 32 | ||||
| -rw-r--r-- | app/i18n/en.php | 4 | ||||
| -rw-r--r-- | app/i18n/fr.php | 2 | ||||
| -rw-r--r-- | app/layout/aside_flux.phtml | 9 | ||||
| -rw-r--r-- | app/layout/nav_menu.phtml | 102 | ||||
| -rw-r--r-- | app/views/configure/reading.phtml | 2 | ||||
| -rw-r--r-- | p/themes/Dark/freshrss.css | 5 | ||||
| -rw-r--r-- | p/themes/Dark/global.css | 6 | ||||
| -rw-r--r-- | p/themes/Flat/freshrss.css | 5 | ||||
| -rw-r--r-- | p/themes/Flat/global.css | 6 | ||||
| -rw-r--r-- | p/themes/Origine/freshrss.css | 5 | ||||
| -rw-r--r-- | p/themes/Origine/global.css | 6 |
14 files changed, 111 insertions, 89 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 9da1e5022..243d887ac 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -91,14 +91,11 @@ class FreshRSS_index_Controller extends Minz_ActionController { $nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page); $first = Minz_Request::param ('next', ''); - if ($state === 'not_read') { //Any unread article in this category at all? + if ($state === FreshRSS_Configuration::STATE_NOT_READ) { //Any unread article in this category at all? switch ($getType) { case 'a': $hasUnread = $this->view->nb_not_read > 0; break; - case 's': - $hasUnread = $this->view->nb_favorites['unread'] > 0; - break; case 'c': $hasUnread = (!isset($this->view->cat_aside[$getId])) || ($this->view->cat_aside[$getId]->nbNotRead() > 0); break; @@ -128,7 +125,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { // Si on a récupéré aucun article "non lus" // on essaye de récupérer tous les articles - if ($state === 'not_read' && empty($entries) && ($state_param === null)) { + if ($state === FreshRSS_Configuration::STATE_NOT_READ && empty($entries) && ($state_param === null)) { Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); $this->view->state = 'all'; $entries = $entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, true, $keepHistoryDefault); diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 80031369e..f9ea47be6 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -1,6 +1,11 @@ <?php class FreshRSS_Configuration { + const STATE_READ = 1; + const STATE_NOT_READ = 2; + const STATE_FAVORITE = 4; + const STATE_NOT_FAVORITE = 8; + private $filename; private $data = array( @@ -13,7 +18,7 @@ class FreshRSS_Configuration { 'apiPasswordHash' => '', //CRYPT_BLOWFISH 'posts_per_page' => 20, 'view_mode' => 'normal', - 'default_view' => 'not_read', + 'default_view' => self::STATE_NOT_READ, 'auto_load_more' => true, 'display_posts' => false, 'onread_jump_next' => true, @@ -131,7 +136,7 @@ class FreshRSS_Configuration { } } public function _default_view ($value) { - $this->data['default_view'] = $value === 'all' ? 'all' : 'not_read'; + $this->data['default_view'] = $value === 'all' ? 'all' : self::STATE_NOT_READ; } public function _display_posts ($value) { $this->data['display_posts'] = ((bool)$value) && $value !== 'no'; diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 6d00967fc..2f5a9e1f6 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -415,9 +415,6 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'f.priority > 0 '; $joinFeed = true; break; - case 's': - $where .= 'e1.is_favorite = 1 '; - break; case 'c': $where .= 'f.category = ? '; $values[] = intval($id); @@ -433,21 +430,28 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { default: throw new FreshRSS_EntriesGetter_Exception ('Bad type in Entry->listByType: [' . $type . ']!'); } - switch ($state) { - case 'all': - break; - case 'not_read': + + if ($state & FreshRSS_Configuration::STATE_NOT_READ) { + if (!($state & FreshRSS_Configuration::STATE_READ)) { $where .= 'AND e1.is_read = 0 '; - break; - case 'read': + } + } + if ($state & FreshRSS_Configuration::STATE_READ) { + if (!($state & FreshRSS_Configuration::STATE_NOT_READ)) { $where .= 'AND e1.is_read = 1 '; - break; - case 'favorite': + } + } + if ($state & FreshRSS_Configuration::STATE_NOT_FAVORITE) { + if (!($state & FreshRSS_Configuration::STATE_FAVORITE)) { + $where .= 'AND e1.is_favorite = 0 '; + } + } + if ($state & FreshRSS_Configuration::STATE_FAVORITE) { + if (!($state & FreshRSS_Configuration::STATE_NOT_FAVORITE)) { $where .= 'AND e1.is_favorite = 1 '; - break; - default: - throw new FreshRSS_EntriesGetter_Exception ('Bad state in Entry->listByType: [' . $state . ']!'); + } } + switch ($order) { case 'DESC': case 'ASC': diff --git a/app/i18n/en.php b/app/i18n/en.php index d6096bbe8..01f31eca7 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -27,7 +27,6 @@ return array ( 'subscription_management' => 'Subscriptions management', 'main_stream' => 'Main stream', 'all_feeds' => 'All feeds', - 'favorite_feeds' => 'Favourites (%d)', 'not_read' => '%d unread', 'not_reads' => '%d unread', @@ -51,7 +50,8 @@ return array ( 'show_all_articles' => 'Show all articles', 'show_not_reads' => 'Show only unread', 'show_read' => 'Show only read', - 'show_favorite' => 'Show favorites', + 'show_favorite' => 'Show only favorites', + 'show_not_favorite' => 'Show all but favorites', 'older_first' => 'Oldest first', 'newer_first' => 'Newer first', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index d89cbb098..299d4d242 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -27,7 +27,6 @@ return array ( 'subscription_management' => 'Gestion des abonnements', 'main_stream' => 'Flux principal', 'all_feeds' => 'Tous les flux', - 'favorite_feeds' => 'Favoris (%d)', 'not_read' => '%d non lu', 'not_reads' => '%d non lus', @@ -52,6 +51,7 @@ return array ( 'show_not_reads' => 'Afficher les non lus', 'show_read' => 'Afficher les lus', 'show_favorite' => 'Afficher les favoris', + 'show_not_favorite' => 'Afficher tout sauf les favoris', 'older_first' => 'Plus anciens en premier', 'newer_first' => 'Plus récents en premier', diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 817dae676..0542e6b66 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -28,15 +28,6 @@ </div> </li> - <li> - <div class="category favorites<?php echo $this->get_c == 's' ? ' active' : ''; ?>"> - <a data-unread="<?php echo formatNumber($this->nb_favorites['unread']); ?>" class="btn<?php echo $this->get_c == 's' ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 's'; echo Minz_Url::display($arUrl); ?>"> - <?php echo FreshRSS_Themes::icon('bookmark'); ?> - <?php echo Minz_Translate::t('favorite_feeds', formatNumber($this->nb_favorites['all'])); ?> - </a> - </div> - </li> - <?php foreach ($this->cat_aside as $cat) { $feeds = $cat->feeds (); diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index ffdc95b24..129647607 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -11,6 +11,70 @@ <?php } ?> <?php if ($this->loginOk) { ?> + <?php $url_state = $this->url; + if ($this->state & FreshRSS_Configuration::STATE_READ) { + $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_READ; + $checked = 'true'; + } else { + $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_READ; + $checked = 'false'; + } + ?> + <a id="actualize" + class="btn" + aria-checked="<?php echo $checked; ?>" + href="<?php echo Minz_Url::display ($url_state); ?>" + title="<?php echo Minz_Translate::t ('show_read'); ?>"> + <?php echo FreshRSS_Themes::icon('read'); ?> + </a> + <?php + if ($this->state & FreshRSS_Configuration::STATE_NOT_READ) { + $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_NOT_READ; + $checked = 'true'; + } else { + $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_NOT_READ; + $checked = 'false'; + } + ?> + <a id="actualize" + class="btn" + aria-checked="<?php echo $checked; ?>" + href="<?php echo Minz_Url::display ($url_state); ?>" + title="<?php echo Minz_Translate::t ('show_not_reads'); ?>"> + <?php echo FreshRSS_Themes::icon('unread'); ?> + </a> + <?php + if ($this->state & FreshRSS_Configuration::STATE_FAVORITE) { + $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_FAVORITE; + $checked = 'true'; + } else { + $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_FAVORITE; + $checked = 'false'; + } + ?> + <a id="actualize" + class="btn" + aria-checked="<?php echo $checked; ?>" + href="<?php echo Minz_Url::display ($url_state); ?>" + title="<?php echo Minz_Translate::t ('show_favorite'); ?>"> + <?php echo FreshRSS_Themes::icon('starred'); ?> + </a> + <?php + if ($this->state & FreshRSS_Configuration::STATE_NOT_FAVORITE) { + $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_NOT_FAVORITE; + $checked = 'true'; + } else { + $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_NOT_FAVORITE; + $checked = 'false'; + } + ?> + <a id="actualize" + class="btn" + aria-checked="<?php echo $checked; ?>" + href="<?php echo Minz_Url::display ($url_state); ?>" + title="<?php echo Minz_Translate::t ('show_not_favorite'); ?>"> + <?php echo FreshRSS_Themes::icon('non-starred'); ?> + </a> <?php $get = false; $string_mark = Minz_Translate::t ('mark_all_read'); @@ -86,7 +150,7 @@ <ul class="dropdown-menu"> <li class="dropdown-close"><a href="#close">❌</a></li> - <li class="item"><a href="<?php echo $markReadUrl; ?>"><?php echo $string_mark; ?></a></li> + <li class="item"><a href="<?php echo $markReadUrl; ?>"><?php echo $string_mark; ?></a></li> <li class="separator"></li> <?php $today = $this->today; @@ -132,42 +196,6 @@ <li class="separator"></li> - <?php - $url_state = $this->url; - $url_state['params']['state'] = 'all'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'all') ? 'true' :'false'; ?>"> - <a class="print_all" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_all_articles'); ?> - </a> - </li> - <?php - $url_state['params']['state'] = 'not_read'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'not_read') ? 'true' :'false'; ?>"> - <a class="print_non_read" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_not_reads'); ?> - </a> - </li> - <?php - $url_state['params']['state'] = 'read'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'read') ? 'true' :'false'; ?>"> - <a class="print_read" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_read'); ?> - </a> - </li> - <?php - $url_state['params']['state'] = 'favorite'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'favorite') ? 'true' :'false'; ?>"> - <a class="print_favorite" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_favorite'); ?> - </a> - </li> - - <li class="separator"></li> - <li class="item"> <?php $url_order = $this->url; diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index c32c59305..b778a4d22 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -36,7 +36,7 @@ <?php echo Minz_Translate::t ('show_all_articles'); ?> </label> <label class="radio" for="radio_not_read"> - <input type="radio" name="default_view" id="radio_not_read" value="not_read"<?php echo $this->conf->default_view === 'not_read' ? ' checked="checked"' : ''; ?> /> + <input type="radio" name="default_view" id="radio_not_read" value="<?php echo FreshRSS_Configuration::STATE_NOT_READ; ?>"<?php echo $this->conf->default_view === FreshRSS_Configuration::STATE_NOT_READ ? ' checked="checked"' : ''; ?> /> <?php echo Minz_Translate::t ('show_not_reads'); ?> </label> </div> diff --git a/p/themes/Dark/freshrss.css b/p/themes/Dark/freshrss.css index be8d6b86a..d7da91bb8 100644 --- a/p/themes/Dark/freshrss.css +++ b/p/themes/Dark/freshrss.css @@ -88,6 +88,11 @@ .nav_menu .search { display:none; } + .nav_menu .btn[aria-checked="true"]:before{ + content: '✓'; + font-size: 2.5rem; + position: absolute; + } .favicon { height: 16px; diff --git a/p/themes/Dark/global.css b/p/themes/Dark/global.css index e296f2188..0f1baa216 100644 --- a/p/themes/Dark/global.css +++ b/p/themes/Dark/global.css @@ -416,12 +416,6 @@ input, select, textarea { background: #26303F; color: #888; } - .dropdown-menu > .item[aria-checked="true"] > a:before { - content: '✓ '; - font-weight: bold; - margin: 0 0 0 -1.2em; - padding: 0 0.2em 0 0; - } .dropdown-menu > .item:hover > a { color: #888; text-decoration: none; diff --git a/p/themes/Flat/freshrss.css b/p/themes/Flat/freshrss.css index 1f297309b..f1737d23e 100644 --- a/p/themes/Flat/freshrss.css +++ b/p/themes/Flat/freshrss.css @@ -87,6 +87,11 @@ body { .nav_menu .search { display:none; } + .nav_menu .btn[aria-checked="true"]:before{ + content: '✓'; + font-size: 2.5rem; + position: absolute; + } .favicon { height: 16px; diff --git a/p/themes/Flat/global.css b/p/themes/Flat/global.css index 4044dd781..68e9fa359 100644 --- a/p/themes/Flat/global.css +++ b/p/themes/Flat/global.css @@ -412,12 +412,6 @@ input, select, textarea { background: #2980b9; color: #fff; } - .dropdown-menu > .item[aria-checked="true"] > a:before { - content: '✓ '; - font-weight: bold; - margin: 0 0 0 -1.2em; - padding: 0 0.2em 0 0; - } .dropdown-menu > .item:hover > a { color: #fff; text-decoration: none; diff --git a/p/themes/Origine/freshrss.css b/p/themes/Origine/freshrss.css index 662e085d6..d33ee4f54 100644 --- a/p/themes/Origine/freshrss.css +++ b/p/themes/Origine/freshrss.css @@ -89,6 +89,11 @@ .nav_menu .search { display:none; } + .nav_menu .btn[aria-checked="true"]:before{ + content: '✓'; + font-size: 2.5rem; + position: absolute; + } .favicon { height: 16px; diff --git a/p/themes/Origine/global.css b/p/themes/Origine/global.css index 5792c9e4d..7fb3a8f95 100644 --- a/p/themes/Origine/global.css +++ b/p/themes/Origine/global.css @@ -428,12 +428,6 @@ input, select, textarea { background: #0062BE; color: #fff; } - .dropdown-menu > .item[aria-checked="true"] > a:before { - content: '✓ '; - font-weight: bold; - margin: 0 0 0 -1.2em; - padding: 0 0.2em 0 0; - } .dropdown-menu > .item:hover > a { color: #fff; text-decoration: none; |
