nav_menu.phtml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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">
  89. <?php echo _t('queries'); ?>
  90. <a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo _i('configure'); ?></a>
  91. </li>
  92. <?php foreach ($this->conf->queries as $query) { ?>
  93. <li class="item query">
  94. <a href="<?php echo $query['url']; ?>"><?php echo $query['name']; ?></a>
  95. </li>
  96. <?php } ?>
  97. <?php if (count($this->conf->queries) > 0) { ?>
  98. <li class="separator no-mobile"></li>
  99. <?php } ?>
  100. <?php
  101. $url_query = $this->url;
  102. $url_query['c'] = 'configure';
  103. $url_query['a'] = 'addQuery';
  104. ?>
  105. <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>
  106. </ul>
  107. </div>
  108. </div>
  109. <?php
  110. $get = false;
  111. $string_mark = _t('mark_all_read');
  112. if ($this->get_f) {
  113. $get = 'f_' . $this->get_f;
  114. $string_mark = _t('mark_feed_read');
  115. } elseif ($this->get_c && $this->get_c != 'a') {
  116. if ($this->get_c === 's') {
  117. $get = 's';
  118. } else {
  119. $get = 'c_' . $this->get_c;
  120. }
  121. $string_mark = _t('mark_cat_read');
  122. }
  123. $nextGet = $get;
  124. if ($this->conf->onread_jump_next && strlen($get) > 2) {
  125. $anotherUnreadId = '';
  126. $foundCurrent = false;
  127. switch ($get[0]) {
  128. case 'c':
  129. foreach ($this->cat_aside as $cat) {
  130. if ($cat->id() == $this->get_c) {
  131. $foundCurrent = true;
  132. continue;
  133. }
  134. if ($cat->nbNotRead() <= 0) continue;
  135. $anotherUnreadId = $cat->id();
  136. if ($foundCurrent) break;
  137. }
  138. $nextGet = empty($anotherUnreadId) ? 'a' : 'c_' . $anotherUnreadId;
  139. break;
  140. case 'f':
  141. foreach ($this->cat_aside as $cat) {
  142. if ($cat->id() == $this->get_c) {
  143. foreach ($cat->feeds() as $feed) {
  144. if ($feed->id() == $this->get_f) {
  145. $foundCurrent = true;
  146. continue;
  147. }
  148. if ($feed->nbNotRead() <= 0) continue;
  149. $anotherUnreadId = $feed->id();
  150. if ($foundCurrent) break;
  151. }
  152. break;
  153. }
  154. }
  155. $nextGet = empty($anotherUnreadId) ? 'c_' . $this->get_c : 'f_' . $anotherUnreadId;
  156. break;
  157. }
  158. }
  159. $p = isset($this->entries[0]) ? $this->entries[0] : null;
  160. $idMax = $p === null ? (time() - 1) . '000000' : $p->id();
  161. if ($this->order === 'ASC') { //In this case we do not know but we guess idMax
  162. $idMax2 = (time() - 1) . '000000';
  163. if (strcmp($idMax2, $idMax) > 0) {
  164. $idMax = $idMax2;
  165. }
  166. }
  167. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));
  168. $output = Minz_Request::param('output', '');
  169. if ($output != '' && $this->conf->view_mode !== $output) {
  170. $arUrl['params']['output'] = $output;
  171. }
  172. $markReadUrl = Minz_Url::display($arUrl);
  173. Minz_Session::_param('markReadUrl', $markReadUrl);
  174. ?>
  175. <form id="mark-read" method="post" style="display: none"></form>
  176. <div class="stick" id="nav_menu_read_all">
  177. <?php $confirm = $this->conf->reading_confirm ? 'confirm' : ''; ?>
  178. <button class="read_all btn <?php echo $confirm; ?>"
  179. form="mark-read"
  180. formaction="<?php echo $markReadUrl; ?>"
  181. type="submit"><?php echo _t('mark_read'); ?></button>
  182. <div class="dropdown">
  183. <div id="dropdown-read" class="dropdown-target"></div>
  184. <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a>
  185. <ul class="dropdown-menu">
  186. <li class="dropdown-close"><a href="#close">❌</a></li>
  187. <li class="item">
  188. <button class="as-link <?php echo $confirm; ?>"
  189. form="mark-read"
  190. formaction="<?php echo $markReadUrl; ?>"
  191. type="submit"><?php echo $string_mark; ?></button>
  192. </li>
  193. <li class="separator"></li>
  194. <?php
  195. $mark_before_today = $arUrl;
  196. $mark_before_today['params']['idMax'] = $this->today . '000000';
  197. $mark_before_one_week = $arUrl;
  198. $mark_before_one_week['params']['idMax'] = ($this->today - 604800) . '000000';
  199. ?>
  200. <li class="item">
  201. <button class="as-link <?php echo $confirm; ?>"
  202. form="mark-read"
  203. formaction="<?php echo Minz_Url::display($mark_before_today); ?>"
  204. type="submit"><?php echo _t('before_one_day'); ?></button>
  205. </li>
  206. <li class="item">
  207. <button class="as-link <?php echo $confirm; ?>"
  208. form="mark-read"
  209. formaction="<?php echo Minz_Url::display($mark_before_one_week); ?>"
  210. type="submit"><?php echo _t('before_one_week'); ?></button>
  211. </li>
  212. </ul>
  213. </div>
  214. </div>
  215. <?php } ?>
  216. <?php $url_output = $this->url; ?>
  217. <div class="stick" id="nav_menu_views">
  218. <?php $url_output['params']['output'] = 'normal'; ?>
  219. <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); ?>">
  220. <?php echo _i("view-normal"); ?>
  221. </a>
  222. <?php $url_output['params']['output'] = 'global'; ?>
  223. <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); ?>">
  224. <?php echo _i("view-global"); ?>
  225. </a>
  226. <?php $url_output['params']['output'] = 'reader'; ?>
  227. <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); ?>">
  228. <?php echo _i("view-reader"); ?>
  229. </a>
  230. <?php
  231. $url_output['params']['output'] = 'rss';
  232. if ($this->conf->token) {
  233. $url_output['params']['token'] = $this->conf->token;
  234. }
  235. ?>
  236. <a class="view_rss btn" target="_blank" title="<?php echo _t('rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  237. <?php echo _i('rss'); ?>
  238. </a>
  239. </div>
  240. <div class="item search">
  241. <form action="<?php echo _url('index', 'index'); ?>" method="get">
  242. <?php $search = Minz_Request::param('search', ''); ?>
  243. <input type="search" name="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo _t('search_short'); ?>" />
  244. <?php $get = Minz_Request::param('get', ''); ?>
  245. <?php if($get != '') { ?>
  246. <input type="hidden" name="get" value="<?php echo $get; ?>" />
  247. <?php } ?>
  248. <?php $order = Minz_Request::param('order', ''); ?>
  249. <?php if($order != '') { ?>
  250. <input type="hidden" name="order" value="<?php echo $order; ?>" />
  251. <?php } ?>
  252. <?php $state = Minz_Request::param('state', ''); ?>
  253. <?php if($state != '') { ?>
  254. <input type="hidden" name="state" value="<?php echo $state; ?>" />
  255. <?php } ?>
  256. </form>
  257. </div>
  258. <?php
  259. if ($this->order === 'DESC') {
  260. $order = 'ASC';
  261. $icon = 'up';
  262. $title = 'older_first';
  263. } else {
  264. $order = 'DESC';
  265. $icon = 'down';
  266. $title = 'newer_first';
  267. }
  268. $url_order = $this->url;
  269. $url_order['params']['order'] = $order;
  270. ?>
  271. <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>">
  272. <?php echo _i($icon); ?>
  273. </a>
  274. <?php if ($this->loginOk || Minz_Configuration::allowAnonymousRefresh()) { ?>
  275. <a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>"><?php echo _i('refresh'); ?></a>
  276. <?php } ?>
  277. </div>