From b780a2329b5f4b37ad7fb0453544a410d0f48416 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 25 Aug 2013 13:25:27 +0200 Subject: New option onread_jump_next Added a new option to automatically jump to the next sibling (category or feed) when hitting the button "mark as read". --- app/layout/nav_menu.phtml | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'app/layout') 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; + } + } ?>