From b55571de8f19fab15202826950184cfcb90d364c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 8 Apr 2014 23:26:41 -0400 Subject: Split reading configuration page I splitted the reading configuration page in 2 pages. The display configuration page to prepare for #265 and the reading configuration page. It is just a test, feel free to discard that. I also change some wording to be consistent through out the application. --- app/Controllers/configureController.php | 50 +++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index b4de19e11..df5212041 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -140,21 +140,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { public function displayAction () { if (Minz_Request::isPost()) { $this->view->conf->_language(Minz_Request::param('language', 'en')); - $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10)); - $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal')); - $this->view->conf->_default_view (Minz_Request::param('default_view', 'a')); - $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false)); - $this->view->conf->_display_posts(Minz_Request::param('display_posts', false)); - $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false)); - $this->view->conf->_lazyload (Minz_Request::param('lazyload', false)); - $this->view->conf->_sticky_post (Minz_Request::param('sticky_post', false)); - $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC')); - $this->view->conf->_mark_when (array( - 'article' => Minz_Request::param('mark_open_article', false), - 'site' => Minz_Request::param('mark_open_site', false), - 'scroll' => Minz_Request::param('mark_scroll', false), - 'reception' => Minz_Request::param('mark_upon_reception', false), - )); $themeId = Minz_Request::param('theme', ''); if ($themeId == '') { $themeId = FreshRSS_Themes::defaultTheme; @@ -187,6 +172,41 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->themes = FreshRSS_Themes::get(); + Minz_View::prependTitle (Minz_Translate::t ('display_configuration') . ' · '); + } + + public function readingAction () { + if (Minz_Request::isPost()) { + $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10)); + $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal')); + $this->view->conf->_default_view (Minz_Request::param('default_view', 'a')); + $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false)); + $this->view->conf->_display_posts(Minz_Request::param('display_posts', false)); + $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false)); + $this->view->conf->_lazyload (Minz_Request::param('lazyload', false)); + $this->view->conf->_sticky_post (Minz_Request::param('sticky_post', false)); + $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC')); + $this->view->conf->_mark_when (array( + 'article' => Minz_Request::param('mark_open_article', false), + 'site' => Minz_Request::param('mark_open_site', false), + 'scroll' => Minz_Request::param('mark_scroll', false), + 'reception' => Minz_Request::param('mark_upon_reception', false), + )); + $this->view->conf->save(); + + Minz_Session::_param ('language', $this->view->conf->language); + Minz_Translate::reset (); + invalidateHttpCache(); + + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('configuration_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'reading'), true); + } + Minz_View::prependTitle (Minz_Translate::t ('reading_configuration') . ' · '); } -- cgit v1.2.3 From 3e665bcf9aefe40499b5d16e901d0c7427e367af Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 12 Apr 2014 11:51:44 -0400 Subject: Delete favorite button I extract drop-down menu actions to make them as button action in the page header. I removed the favorite button on the category list because it is a duplicate from the button action. Now button action act as filters and you can combine them. It is a test to see if we can keep it like that. There is still work to do to extract other actions from the drop-down list. I did not want to change everything if we don't keep it. See #376 and #277 --- app/Controllers/indexController.php | 7 +-- app/Models/Configuration.php | 9 +++- app/Models/EntryDAO.php | 32 ++++++----- app/i18n/en.php | 4 +- app/i18n/fr.php | 2 +- app/layout/aside_flux.phtml | 9 ---- app/layout/nav_menu.phtml | 102 +++++++++++++++++++++++------------- app/views/configure/reading.phtml | 2 +- p/themes/Dark/freshrss.css | 5 ++ p/themes/Dark/global.css | 6 --- p/themes/Flat/freshrss.css | 5 ++ p/themes/Flat/global.css | 6 --- p/themes/Origine/freshrss.css | 5 ++ p/themes/Origine/global.css | 6 --- 14 files changed, 111 insertions(+), 89 deletions(-) (limited to 'app/Controllers') 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 @@ '', //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 @@ -
  • - -
  • - 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 @@ loginOk) { ?> + 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'; + } + ?> + + + + 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'; + } + ?> + + + + 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'; + } + ?> + + + + 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'; + } + ?> + + + -
  • +
  • today; @@ -132,42 +196,6 @@
  • - url; - $url_state['params']['state'] = 'all'; - ?> - - - - - - - - -
  • -
  • 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 @@ 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; -- cgit v1.2.3 From 86066b1659e33eb5fdfbcae5fb7f0bd93604d442 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 13 Apr 2014 07:28:41 -0400 Subject: Add a new status for 'ALL' I made the conversion in every file I can think of. It should not have any reference to the string 'all' for the state context --- app/Controllers/importExportController.php | 4 ++-- app/Controllers/indexController.php | 8 ++++---- app/Models/Configuration.php | 3 ++- app/Models/EntryDAO.php | 9 ++++++--- app/views/configure/reading.phtml | 2 +- p/api/greader.php | 8 ++++---- 6 files changed, 19 insertions(+), 15 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index a9b103a34..b8253b7bd 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -370,7 +370,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $this->view->type = 'starred'; $unread_fav = $this->entryDAO->countUnreadReadFavorites(); $this->view->entries = $this->entryDAO->listWhere( - 's', '', 'all', 'ASC', + 's', '', FreshRSS_Configuration::STATE_ALL, 'ASC', $unread_fav['all'] ); } elseif ($type == 'feed' && !is_null($feed)) { @@ -379,7 +379,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { ); $this->view->type = 'feed/' . $feed->id(); $this->view->entries = $this->entryDAO->listWhere( - 'f', $feed->id(), 'all', 'ASC', + 'f', $feed->id(), FreshRSS_Configuration::STATE_ALL, 'ASC', $this->view->conf->posts_per_page ); $this->view->feed = $feed; diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 243d887ac..48471b480 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -85,7 +85,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { $state_param = Minz_Request::param ('state', null); $filter = Minz_Request::param ('search', ''); if (!empty($filter)) { - $state = 'all'; //Search always in read and unread articles + $state = FreshRSS_Configuration::STATE_ALL; //Search always in read and unread articles } $this->view->order = $order = Minz_Request::param ('order', $this->view->conf->sort_order); $nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page); @@ -108,7 +108,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { break; } if (!$hasUnread && ($state_param === null)) { - $this->view->state = $state = 'all'; + $this->view->state = $state = FreshRSS_Configuration::STATE_ALL; } } @@ -127,8 +127,8 @@ class FreshRSS_index_Controller extends Minz_ActionController { // on essaye de récupérer tous les articles 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); + $this->view->state = FreshRSS_Configuration::STATE_ALL; + $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb, $first, $filter, $date_min, true, $keepHistoryDefault); } if (count($entries) <= $nb) { diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index f9ea47be6..e693542e0 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -1,6 +1,7 @@ data['default_view'] = $value === 'all' ? 'all' : self::STATE_NOT_READ; + $this->data['default_view'] = $value === self::STATE_ALL ? self::STATE_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 2f5a9e1f6..b9cbfd584 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -406,7 +406,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return isset ($entries[0]) ? $entries[0] : null; } - private function sqlListWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { + private function sqlListWhere($type = 'a', $id = '', $state = null , $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { + if (!$state) { + $state = FreshRSS_Configuration::STATE_ALL; + } $where = ''; $joinFeed = false; $values = array(); @@ -532,7 +535,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { . ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ } - public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { + public function listWhere($type = 'a', $id = '', $state = null, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault); $sql = 'SELECT e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags ' @@ -548,7 +551,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return self::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC)); } - public function listIdsWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { //For API + public function listIdsWhere($type = 'a', $id = '', $state = null, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { //For API list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault); $stm = $this->bd->prepare($sql); diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index b778a4d22..b277397b1 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -32,7 +32,7 @@