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 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Controllers/importExportController.php') 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; -- cgit v1.2.3 From 3a736e902c5af7f215bbf91dc54be00bf82f8df3 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 13 Apr 2014 08:16:43 -0400 Subject: Move state constants from Configuration to Entry --- app/Controllers/importExportController.php | 4 ++-- app/Controllers/indexController.php | 10 +++++----- app/Models/Configuration.php | 10 ++-------- app/Models/Entry.php | 5 +++++ app/Models/EntryDAO.php | 18 +++++++++--------- app/layout/nav_menu.phtml | 24 ++++++++++++------------ app/views/configure/reading.phtml | 4 ++-- p/api/greader.php | 8 ++++---- 8 files changed, 41 insertions(+), 42 deletions(-) (limited to 'app/Controllers/importExportController.php') diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index b8253b7bd..3cd791781 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', '', FreshRSS_Configuration::STATE_ALL, 'ASC', + 's', '', FreshRSS_Entry::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(), FreshRSS_Configuration::STATE_ALL, 'ASC', + 'f', $feed->id(), FreshRSS_Entry::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 52dd01e0a..3445c0bd4 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -85,13 +85,13 @@ class FreshRSS_index_Controller extends Minz_ActionController { $state_param = Minz_Request::param ('state', null); $filter = Minz_Request::param ('search', ''); if (!empty($filter)) { - $state = FreshRSS_Configuration::STATE_ALL; //Search always in read and unread articles + $state = FreshRSS_Entry::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); $first = Minz_Request::param ('next', ''); - if ($state === FreshRSS_Configuration::STATE_NOT_READ) { //Any unread article in this category at all? + if ($state === FreshRSS_Entry::STATE_NOT_READ) { //Any unread article in this category at all? switch ($getType) { case 'a': $hasUnread = $this->view->nb_not_read > 0; @@ -112,7 +112,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { break; } if (!$hasUnread && ($state_param === null)) { - $this->view->state = $state = FreshRSS_Configuration::STATE_ALL; + $this->view->state = $state = FreshRSS_Entry::STATE_ALL; } } @@ -129,9 +129,9 @@ 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 === FreshRSS_Configuration::STATE_NOT_READ && empty($entries) && ($state_param === null)) { + if ($state === FreshRSS_Entry::STATE_NOT_READ && empty($entries) && ($state_param === null)) { Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); - $this->view->state = FreshRSS_Configuration::STATE_ALL; + $this->view->state = FreshRSS_Entry::STATE_ALL; $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb, $first, $filter, $date_min, true, $keepHistoryDefault); } diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index e693542e0..4b52fa05b 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -1,12 +1,6 @@ '', //CRYPT_BLOWFISH 'posts_per_page' => 20, 'view_mode' => 'normal', - 'default_view' => self::STATE_NOT_READ, + 'default_view' => FreshRSS_Entry::STATE_NOT_READ, 'auto_load_more' => true, 'display_posts' => false, 'onread_jump_next' => true, @@ -137,7 +131,7 @@ class FreshRSS_Configuration { } } public function _default_view ($value) { - $this->data['default_view'] = $value === self::STATE_ALL ? self::STATE_ALL : self::STATE_NOT_READ; + $this->data['default_view'] = $value === FreshRSS_Entry::STATE_ALL ? FreshRSS_Entry::STATE_ALL : FreshRSS_Entry::STATE_NOT_READ; } public function _display_posts ($value) { $this->data['display_posts'] = ((bool)$value) && $value !== 'no'; diff --git a/app/Models/Entry.php b/app/Models/Entry.php index a6c67221b..fa9066d5b 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -1,6 +1,11 @@ listByType: [' . $type . ']!'); } - if ($state & FreshRSS_Configuration::STATE_NOT_READ) { - if (!($state & FreshRSS_Configuration::STATE_READ)) { + if ($state & FreshRSS_Entry::STATE_NOT_READ) { + if (!($state & FreshRSS_Entry::STATE_READ)) { $where .= 'AND e1.is_read = 0 '; } } - if ($state & FreshRSS_Configuration::STATE_READ) { - if (!($state & FreshRSS_Configuration::STATE_NOT_READ)) { + if ($state & FreshRSS_Entry::STATE_READ) { + if (!($state & FreshRSS_Entry::STATE_NOT_READ)) { $where .= 'AND e1.is_read = 1 '; } } - if ($state & FreshRSS_Configuration::STATE_NOT_FAVORITE) { - if (!($state & FreshRSS_Configuration::STATE_FAVORITE)) { + if ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_FAVORITE)) { $where .= 'AND e1.is_favorite = 0 '; } } - if ($state & FreshRSS_Configuration::STATE_FAVORITE) { - if (!($state & FreshRSS_Configuration::STATE_NOT_FAVORITE)) { + if ($state & FreshRSS_Entry::STATE_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { $where .= 'AND e1.is_favorite = 1 '; } } diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 67539c747..8b1ca1f6f 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -8,11 +8,11 @@ loginOk) { ?> url; - if ($this->state & FreshRSS_Configuration::STATE_READ) { - $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_READ; + if ($this->state & FreshRSS_Entry::STATE_READ) { + $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_READ; $checked = 'true'; } else { - $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_READ; + $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_READ; $checked = 'false'; } ?> @@ -24,11 +24,11 @@ state & FreshRSS_Configuration::STATE_NOT_READ) { - $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_NOT_READ; + if ($this->state & FreshRSS_Entry::STATE_NOT_READ) { + $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_NOT_READ; $checked = 'true'; } else { - $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_NOT_READ; + $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_NOT_READ; $checked = 'false'; } ?> @@ -40,11 +40,11 @@ state & FreshRSS_Configuration::STATE_FAVORITE) { - $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_FAVORITE; + if ($this->state & FreshRSS_Entry::STATE_FAVORITE) { + $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_FAVORITE; $checked = 'true'; } else { - $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_FAVORITE; + $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_FAVORITE; $checked = 'false'; } ?> @@ -56,11 +56,11 @@ state & FreshRSS_Configuration::STATE_NOT_FAVORITE) { - $url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_NOT_FAVORITE; + if ($this->state & FreshRSS_Entry::STATE_NOT_FAVORITE) { + $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_NOT_FAVORITE; $checked = 'true'; } else { - $url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_NOT_FAVORITE; + $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_NOT_FAVORITE; $checked = 'false'; } ?> diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index b277397b1..456ab9522 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -32,11 +32,11 @@ diff --git a/p/api/greader.php b/p/api/greader.php index 9836f2f02..8a8623966 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -353,10 +353,10 @@ function streamContents($path, $include_target, $start_time, $count, $order, $ex switch ($exclude_target) { case 'user/-/state/com.google/read': - $state = FreshRSS_Configuration::STATE_NOT_READ; + $state = FreshRSS_Entry::STATE_NOT_READ; break; default: - $state = FreshRSS_Configuration::STATE_ALL; + $state = FreshRSS_Entry::STATE_ALL; break; } @@ -451,10 +451,10 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude switch ($exclude_target) { case 'user/-/state/com.google/read': - $state = FreshRSS_Configuration::STATE_NOT_READ; + $state = FreshRSS_Entry::STATE_NOT_READ; break; default: - $state = FreshRSS_Configuration::STATE_ALL; + $state = FreshRSS_Entry::STATE_ALL; break; } -- cgit v1.2.3