A free, self-hostable news aggregator…
New option onread_jump_next
Alexandre Alapetiteb780a2329b5f
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.phpindex 6396dbfeb..02a20365c 100755--- a/app/controllers/configureController.php+++ b/app/controllers/configureController.php@@ -155,6 +155,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);@@ -173,6 +174,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);@@ -194,6 +196,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.phpindex 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.phpindex 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.phpindex 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.phtmlindex 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.phpindex 302dfb8fa..f079f1c41 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.phtmlindex 3989ff06f..676294047 100644--- a/app/views/configure/display.phtml+++ b/app/views/configure/display.phtml@@ -118,6 +118,20 @@</div></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">