aboutsummaryrefslogtreecommitdiff
path: root/app/layout
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-08-25 13:25:27 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-08-25 13:25:27 +0200
commitb780a2329b5f4b37ad7fb0453544a410d0f48416 (patch)
tree318fad9b73ec698b0f8b5c89dc8ec465cdad438f /app/layout
parent31a6a13268023a2db5eba2445ee6c7db4a6d9623 (diff)
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".
Diffstat (limited to 'app/layout')
-rw-r--r--app/layout/nav_menu.phtml40
1 files changed, 38 insertions, 2 deletions
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 ();