nav_menu.phtml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?php
  2. $actual_view = Minz_Request::param('output', 'normal');
  3. ?>
  4. <div class="nav_menu">
  5. <?php if ($actual_view === 'normal') { ?>
  6. <a class="btn toggle_aside" href="#aside_flux"><?php echo _i('category'); ?></a>
  7. <?php } ?>
  8. <?php if ($this->loginOk) { ?>
  9. <div id="nav_menu_actions" class="stick">
  10. <?php
  11. $url_state = $this->url;
  12. if ($this->state & FreshRSS_Entry::STATE_READ) {
  13. $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;
  14. $checked = 'true';
  15. $class = 'active';
  16. } else {
  17. $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;
  18. $checked = 'false';
  19. $class = '';
  20. }
  21. ?>
  22. <a id="toggle-read"
  23. class="btn <?php echo $class; ?>"
  24. aria-checked="<?php echo $checked; ?>"
  25. href="<?php echo Minz_Url::display($url_state); ?>"
  26. title="<?php echo _t('show_read'); ?>">
  27. <?php echo _i('read'); ?>
  28. </a>
  29. <?php
  30. if ($this->state & FreshRSS_Entry::STATE_NOT_READ) {
  31. $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_READ;
  32. $checked = 'true';
  33. $class = 'active';
  34. } else {
  35. $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_READ;
  36. $checked = 'false';
  37. $class = '';
  38. }
  39. ?>
  40. <a id="toggle-unread"
  41. class="btn <?php echo $class; ?>"
  42. aria-checked="<?php echo $checked; ?>"
  43. href="<?php echo Minz_Url::display($url_state); ?>"
  44. title="<?php echo _t('show_not_reads'); ?>">
  45. <?php echo _i('unread'); ?>
  46. </a>
  47. <?php
  48. if ($this->state & FreshRSS_Entry::STATE_FAVORITE) {
  49. $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_FAVORITE;
  50. $checked = 'true';
  51. $class = 'active';
  52. } else {
  53. $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_FAVORITE;
  54. $checked = 'false';
  55. $class = '';
  56. }
  57. ?>
  58. <a id="toggle-favorite"
  59. class="btn <?php echo $class; ?>"
  60. aria-checked="<?php echo $checked; ?>"
  61. href="<?php echo Minz_Url::display($url_state); ?>"
  62. title="<?php echo _t('show_favorite'); ?>">
  63. <?php echo _i('starred'); ?>
  64. </a>
  65. <?php
  66. if ($this->state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
  67. $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_FAVORITE;
  68. $checked = 'true';
  69. $class = 'active';
  70. } else {
  71. $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_FAVORITE;
  72. $checked = 'false';
  73. $class = '';
  74. }
  75. ?>
  76. <a id="toggle-not-favorite"
  77. class="btn <?php echo $class; ?>"
  78. aria-checked="<?php echo $checked; ?>"
  79. href="<?php echo Minz_Url::display($url_state); ?>"
  80. title="<?php echo _t('show_not_favorite'); ?>">
  81. <?php echo _i('non-starred'); ?>
  82. </a>
  83. <div class="dropdown">
  84. <div id="dropdown-query" class="dropdown-target"></div>
  85. <a class="dropdown-toggle btn" href="#dropdown-query"><?php echo _i('down'); ?></a>
  86. <ul class="dropdown-menu">
  87. <li class="dropdown-close"><a href="#close">❌</a></li>
  88. <li class="dropdown-header"><?php echo _t('queries'); ?> <a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo _i('configure'); ?></a></li>
  89. <?php foreach ($this->conf->queries as $query) { ?>
  90. <li class="item query">
  91. <a href="<?php echo $query['url']; ?>"><?php echo $query['name']; ?></a>
  92. </li>
  93. <?php } ?>
  94. <?php if (count($this->conf->queries) > 0) { ?>
  95. <li class="separator no-mobile"></li>
  96. <?php } ?>
  97. <?php
  98. $url_query = $this->url;
  99. $url_query['c'] = 'configure';
  100. $url_query['a'] = 'addQuery';
  101. ?>
  102. <li class="item no-mobile"><a href="<?php echo Minz_Url::display($url_query); ?>"><?php echo _i('bookmark-add'); ?> <?php echo _t('add_query'); ?></a></li>
  103. </ul>
  104. </div>
  105. </div>
  106. <?php
  107. $get = false;
  108. $string_mark = _t('mark_all_read');
  109. if ($this->get_f) {
  110. $get = 'f_' . $this->get_f;
  111. $string_mark = _t('mark_feed_read');
  112. } elseif ($this->get_c && $this->get_c != 'a') {
  113. if ($this->get_c === 's') {
  114. $get = 's';
  115. } else {
  116. $get = 'c_' . $this->get_c;
  117. }
  118. $string_mark = _t('mark_cat_read');
  119. }
  120. $nextGet = $get;
  121. if ($this->conf->onread_jump_next && strlen($get) > 2) {
  122. $anotherUnreadId = '';
  123. $foundCurrent = false;
  124. switch ($get[0]) {
  125. case 'c':
  126. foreach ($this->cat_aside as $cat) {
  127. if ($cat->id() == $this->get_c) {
  128. $foundCurrent = true;
  129. continue;
  130. }
  131. if ($cat->nbNotRead() <= 0) continue;
  132. $anotherUnreadId = $cat->id();
  133. if ($foundCurrent) break;
  134. }
  135. $nextGet = empty($anotherUnreadId) ? 'a' : 'c_' . $anotherUnreadId;
  136. break;
  137. case 'f':
  138. foreach ($this->cat_aside as $cat) {
  139. if ($cat->id() == $this->get_c) {
  140. foreach ($cat->feeds() as $feed) {
  141. if ($feed->id() == $this->get_f) {
  142. $foundCurrent = true;
  143. continue;
  144. }
  145. if ($feed->nbNotRead() <= 0) continue;
  146. $anotherUnreadId = $feed->id();
  147. if ($foundCurrent) break;
  148. }
  149. break;
  150. }
  151. }
  152. $nextGet = empty($anotherUnreadId) ? 'c_' . $this->get_c : 'f_' . $anotherUnreadId;
  153. break;
  154. }
  155. }
  156. $p = isset($this->entries[0]) ? $this->entries[0] : null;
  157. $idMax = $p === null ? (time() - 1) . '000000' : $p->id();
  158. if ($this->order === 'ASC') { //In this case we do not know but we guess idMax
  159. $idMax2 = (time() - 1) . '000000';
  160. if (strcmp($idMax2, $idMax) > 0) {
  161. $idMax = $idMax2;
  162. }
  163. }
  164. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));
  165. $output = Minz_Request::param('output', '');
  166. if ($output != '' && $this->conf->view_mode !== $output) {
  167. $arUrl['params']['output'] = $output;
  168. }
  169. $markReadUrl = Minz_Url::display($arUrl);
  170. Minz_Session::_param('markReadUrl', $markReadUrl);
  171. ?>
  172. <form id="mark-read" method="post" style="display: none"></form>
  173. <div class="stick" id="nav_menu_read_all">
  174. <?php $confirm = $this->conf->reading_confirm ? 'confirm' : ''; ?>
  175. <button class="read_all btn <?php echo $confirm; ?>"
  176. form="mark-read"
  177. formaction="<?php echo $markReadUrl; ?>"
  178. type="submit"><?php echo _t('mark_read'); ?></button>
  179. <div class="dropdown">
  180. <div id="dropdown-read" class="dropdown-target"></div>
  181. <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a>
  182. <ul class="dropdown-menu">
  183. <li class="dropdown-close"><a href="#close">❌</a></li>
  184. <li class="item">
  185. <button class="as-link <?php echo $confirm; ?>"
  186. form="mark-read"
  187. formaction="<?php echo $markReadUrl; ?>"
  188. type="submit"><?php echo $string_mark; ?></button>
  189. </li>
  190. <li class="separator"></li>
  191. <?php
  192. $mark_before_today = $arUrl;
  193. $mark_before_today['params']['idMax'] = $this->today . '000000';
  194. $mark_before_one_week = $arUrl;
  195. $mark_before_one_week['params']['idMax'] = ($this->today - 604800) . '000000';
  196. ?>
  197. <li class="item">
  198. <button class="as-link <?php echo $confirm; ?>"
  199. form="mark-read"
  200. formaction="<?php echo Minz_Url::display($mark_before_today); ?>"
  201. type="submit"><?php echo _t('before_one_day'); ?></button>
  202. </li>
  203. <li class="item">
  204. <button class="as-link <?php echo $confirm; ?>"
  205. form="mark-read"
  206. formaction="<?php echo Minz_Url::display($mark_before_one_week); ?>"
  207. type="submit"><?php echo _t('before_one_week'); ?></button>
  208. </li>
  209. </ul>
  210. </div>
  211. </div>
  212. <?php } ?>
  213. <?php $url_output = $this->url; ?>
  214. <div class="stick" id="nav_menu_views">
  215. <?php $url_output['params']['output'] = 'normal'; ?>
  216. <a class="view_normal btn <?php echo $actual_view == 'normal'? 'active' : ''; ?>" title="<?php echo _t('normal_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  217. <?php echo _i("view-normal"); ?>
  218. </a>
  219. <?php $url_output['params']['output'] = 'global'; ?>
  220. <a class="view_global btn <?php echo $actual_view == 'global'? 'active' : ''; ?>" title="<?php echo _t('global_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  221. <?php echo _i("view-global"); ?>
  222. </a>
  223. <?php $url_output['params']['output'] = 'reader'; ?>
  224. <a class="view_reader btn <?php echo $actual_view == 'reader'? 'active' : ''; ?>" title="<?php echo _t('reader_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  225. <?php echo _i("view-reader"); ?>
  226. </a>
  227. <?php
  228. $url_output['params']['output'] = 'rss';
  229. if ($this->conf->token) {
  230. $url_output['params']['token'] = $this->conf->token;
  231. }
  232. ?>
  233. <a class="view_rss btn" target="_blank" title="<?php echo _t('rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  234. <?php echo _i('rss'); ?>
  235. </a>
  236. </div>
  237. <div class="item search">
  238. <form action="<?php echo _url('index', 'index'); ?>" method="get">
  239. <?php $search = Minz_Request::param('search', ''); ?>
  240. <input type="search" name="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo _t('search_short'); ?>" />
  241. <?php $get = Minz_Request::param('get', ''); ?>
  242. <?php if($get != '') { ?>
  243. <input type="hidden" name="get" value="<?php echo $get; ?>" />
  244. <?php } ?>
  245. <?php $order = Minz_Request::param('order', ''); ?>
  246. <?php if($order != '') { ?>
  247. <input type="hidden" name="order" value="<?php echo $order; ?>" />
  248. <?php } ?>
  249. <?php $state = Minz_Request::param('state', ''); ?>
  250. <?php if($state != '') { ?>
  251. <input type="hidden" name="state" value="<?php echo $state; ?>" />
  252. <?php } ?>
  253. </form>
  254. </div>
  255. <?php
  256. if ($this->order === 'DESC') {
  257. $order = 'ASC';
  258. $icon = 'up';
  259. $title = 'older_first';
  260. } else {
  261. $order = 'DESC';
  262. $icon = 'down';
  263. $title = 'newer_first';
  264. }
  265. $url_order = $this->url;
  266. $url_order['params']['order'] = $order;
  267. ?>
  268. <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>">
  269. <?php echo _i($icon); ?>
  270. </a>
  271. <?php if ($this->loginOk || Minz_Configuration::allowAnonymousRefresh()) { ?>
  272. <a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>"><?php echo _i('refresh'); ?></a>
  273. <?php } ?>
  274. </div>