diff options
| author | 2013-09-14 18:13:21 +0200 | |
|---|---|---|
| committer | 2013-09-14 18:13:21 +0200 | |
| commit | 6967de0e64b0ffa302e46da98db2c999f3a0a6df (patch) | |
| tree | 6f5ac2cb20e45ac1c6aa9cfe5faf4f6240822b63 | |
| parent | cdae47efae646759571c71202821de224fbe896d (diff) | |
| parent | 6d09878880e1cc94cdfc11974f734c808c33ec95 (diff) | |
Merge branch 'onread_jump_next' of https://github.com/Alkarex/FreshRSS into Alkarex-onread_jump_next
| -rwxr-xr-x | app/controllers/configureController.php | 3 | ||||
| -rwxr-xr-x | app/controllers/entryController.php | 11 | ||||
| -rw-r--r-- | app/i18n/en.php | 1 | ||||
| -rw-r--r-- | app/i18n/fr.php | 1 | ||||
| -rw-r--r-- | app/layout/nav_menu.phtml | 40 | ||||
| -rwxr-xr-x | app/models/RSSConfiguration.php | 16 | ||||
| -rw-r--r-- | app/views/configure/display.phtml | 14 |
7 files changed, 77 insertions, 9 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index a31f5582e..c1e79d73e 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -158,6 +158,7 @@ class configureController extends ActionController { $view = Request::param ('default_view', 'all'); $auto_load_more = Request::param ('auto_load_more', 'no'); $display = Request::param ('display_posts', 'no'); + $onread_jump_next = Request::param ('onread_jump_next', 'yes'); $lazyload = Request::param ('lazyload', 'no'); $sort = Request::param ('sort_order', 'low_to_high'); $old = Request::param ('old_entries', 3); @@ -176,6 +177,7 @@ class configureController extends ActionController { $this->view->conf->_defaultView ($view); $this->view->conf->_autoLoadMore ($auto_load_more); $this->view->conf->_displayPosts ($display); + $this->view->conf->_onread_jump_next ($onread_jump_next); $this->view->conf->_lazyload ($lazyload); $this->view->conf->_sortOrder ($sort); $this->view->conf->_oldEntries ($old); @@ -197,6 +199,7 @@ class configureController extends ActionController { 'default_view' => $this->view->conf->defaultView (), 'auto_load_more' => $this->view->conf->autoLoadMore (), 'display_posts' => $this->view->conf->displayPosts (), + 'onread_jump_next' => $this->view->conf->onread_jump_next (), 'lazyload' => $this->view->conf->lazyload (), 'sort_order' => $this->view->conf->sortOrder (), 'old_entries' => $this->view->conf->oldEntries (), diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index c7e13f471..cb9e24757 100755 --- a/app/controllers/entryController.php +++ b/app/controllers/entryController.php @@ -35,13 +35,10 @@ class entryController extends ActionController { $id = Request::param ('id'); $is_read = Request::param ('is_read'); $get = Request::param ('get'); + $nextGet = Request::param ('nextGet', $get); $dateMax = Request::param ('dateMax', time ()); - if ($is_read) { - $is_read = true; - } else { - $is_read = false; - } + $is_read = !!$is_read; $entryDAO = new EntryDAO (); if ($id == false) { @@ -53,10 +50,10 @@ class entryController extends ActionController { if ($typeGet == 'c') { $entryDAO->markReadCat ($get, $is_read, $dateMax); - $this->params = array ('get' => 'c_' . $get); + $this->params = array ('get' => $nextGet); } elseif ($typeGet == 'f') { $entryDAO->markReadFeed ($get, $is_read, $dateMax); - $this->params = array ('get' => 'f_' . $get); + $this->params = array ('get' => $nextGet); } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 341e14ca7..9e671a386 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -160,6 +160,7 @@ return array ( 'sort_order' => 'Sort order', 'auto_load_more' => 'Load next articles at the page bottom', 'display_articles_unfolded' => 'Show articles unfolded by default', + 'onread_jump_next' => 'On marked as read jump to next unread sibling', 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', 'auto_read_when' => 'Mark as read when', 'article_selected' => 'article is selected', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 394c86f6e..a62f26a8e 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -160,6 +160,7 @@ return array ( 'sort_order' => 'Ordre de tri', 'auto_load_more' => 'Charger les articles suivants en bas de page', 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', + 'onread_jump_next' => 'Après marqué comme lu, sauter au voisin non lu', 'img_with_lazyload' => 'Utiliser le mode "lazy load" pour charger les images', 'auto_read_when' => 'Marquer comme lu lorsque', 'article_selected' => 'l\'article est sélectionné', diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index d64b68765..59ddc57ea 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -17,10 +17,46 @@ $get = 'c_' . $this->get_c; $string_mark = Translate::t ('mark_cat_read'); } + $nextGet = $get; + if (($this->conf->onread_jump_next () === 'yes') && (strlen ($get) > 2)) { + $anotherUnreadId = ''; + $foundCurrent = false; + switch ($get[0]) { + case 'c': + foreach ($this->cat_aside as $cat) { + if ($cat->id () === $this->get_c) { + $foundCurrent = true; + continue; + } + if ($cat->nbNotRead () <= 0) continue; + $anotherUnreadId = $cat->id (); + if ($foundCurrent) break; + } + $nextGet = strlen ($anotherUnreadId) > 1 ? 'c_' . $anotherUnreadId : 'all'; + break; + case 'f': + foreach ($this->cat_aside as $cat) { + if ($cat->id () === $this->get_c) { + foreach ($cat->feeds () as $feed) { + if ($feed->id () === $this->get_f) { + $foundCurrent = true; + continue; + } + if ($feed->nbNotRead () <= 0) continue; + $anotherUnreadId = $feed->id (); + if ($foundCurrent) break; + } + break; + } + } + $nextGet = strlen ($anotherUnreadId) > 1 ? 'f_' . $anotherUnreadId : 'c_' . $this->get_c; + break; + } + } ?> <div class="stick" id="nav_menu_read_all"> - <a class="read_all btn" href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get); ?>"><?php echo Translate::t ('mark_read'); ?></a> + <a class="read_all btn" href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'nextGet', $nextGet); ?>"><?php echo Translate::t ('mark_read'); ?></a> <div class="dropdown"> <div id="dropdown-read" class="dropdown-target"></div> @@ -28,7 +64,7 @@ <ul class="dropdown-menu"> <li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li> - <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get); ?>"><?php echo $string_mark; ?></a></li> + <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'nextGet', $nextGet); ?>"><?php echo $string_mark; ?></a></li> <li class="separator"></li> <?php $date = getdate (); diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index 302dfb8fa..700aedb1f 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -10,6 +10,7 @@ class RSSConfiguration extends Model { private $view_mode; private $default_view; private $display_posts; + private $onread_jump_next; private $lazyload; private $sort_order; private $old_entries; @@ -29,6 +30,7 @@ class RSSConfiguration extends Model { $this->_viewMode ($confDAO->view_mode); $this->_defaultView ($confDAO->default_view); $this->_displayPosts ($confDAO->display_posts); + $this->_onread_jump_next ($confDAO->onread_jump_next); $this->_lazyload ($confDAO->lazyload); $this->_sortOrder ($confDAO->sort_order); $this->_oldEntries ($confDAO->old_entries); @@ -60,6 +62,9 @@ class RSSConfiguration extends Model { public function displayPosts () { return $this->display_posts; } + public function onread_jump_next () { + return $this->onread_jump_next; + } public function lazyload () { return $this->lazyload; } @@ -137,6 +142,13 @@ class RSSConfiguration extends Model { $this->display_posts = 'no'; } } + public function _onread_jump_next ($value) { + if ($value == 'no') { + $this->onread_jump_next = 'no'; + } else { + $this->onread_jump_next = 'yes'; + } + } public function _lazyload ($value) { if ($value == 'no') { $this->lazyload = 'no'; @@ -219,6 +231,7 @@ class RSSConfigurationDAO extends Model_array { public $view_mode = 'normal'; public $default_view = 'not_read'; public $display_posts = 'no'; + public $onread_jump_next = 'yes'; public $lazyload = 'yes'; public $sort_order = 'low_to_high'; public $old_entries = 3; @@ -262,6 +275,9 @@ class RSSConfigurationDAO extends Model_array { if (isset ($this->array['display_posts'])) { $this->display_posts = $this->array['display_posts']; } + if (isset ($this->array['onread_jump_next'])) { + $this->onread_jump_next = $this->array['onread_jump_next']; + } if (isset ($this->array['lazyload'])) { $this->lazyload = $this->array['lazyload']; } diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 3989ff06f..676294047 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -119,6 +119,20 @@ </div> <div class="form-group"> + <label class="group-name"><?php echo Translate::t ('onread_jump_next'); ?></label> + <div class="group-controls"> + <label class="radio" for="onread_jump_next_yes"> + <input type="radio" name="onread_jump_next" id="onread_jump_next_yes" value="yes"<?php echo $this->conf->onread_jump_next () == 'yes' ? ' checked="checked"' : ''; ?> /> + <?php echo Translate::t ('yes'); ?><noscript> - <b><?php echo Translate::t ('javascript_should_be_activated'); ?></b></noscript> + </label> + <label class="radio" for="onread_jump_next_no"> + <input type="radio" name="onread_jump_next" id="onread_jump_next_no" value="no"<?php echo $this->conf->onread_jump_next () == 'no' ? ' checked="checked"' : ''; ?> /> + <?php echo Translate::t ('no'); ?> + </label> + </div> + </div> + + <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="lazyload"> <input type="checkbox" name="lazyload" id="lazyload" value="yes"<?php echo $this->conf->lazyload () == 'yes' ? ' checked="checked"' : ''; ?> /> |
