diff options
| author | 2014-04-12 11:51:44 -0400 | |
|---|---|---|
| committer | 2014-04-12 11:51:44 -0400 | |
| commit | 3e665bcf9aefe40499b5d16e901d0c7427e367af (patch) | |
| tree | fe1ab6cc6e192b80ac368dd962dac90dccb57738 /app/Models | |
| parent | 6a04683171ecee8fdc5e601b88a1e5c16f8210c4 (diff) | |
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
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/Configuration.php | 9 | ||||
| -rw-r--r-- | app/Models/EntryDAO.php | 32 |
2 files changed, 25 insertions, 16 deletions
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': |
