nav_menu.phtml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php $actual_view = Minz_Request::actionName(); ?>
  2. <div class="nav_menu">
  3. <?php if ($actual_view === 'normal') { ?>
  4. <a class="btn toggle_aside" href="#aside_feed"><?php echo _i('category'); ?></a>
  5. <?php } ?>
  6. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  7. <div id="nav_menu_actions" class="stick">
  8. <?php
  9. $states = array(
  10. 'read' => FreshRSS_Entry::STATE_READ,
  11. 'unread' => FreshRSS_Entry::STATE_NOT_READ,
  12. 'starred' => FreshRSS_Entry::STATE_FAVORITE,
  13. 'non-starred' => FreshRSS_Entry::STATE_NOT_FAVORITE,
  14. );
  15. foreach ($states as $state_str => $state) {
  16. $state_enabled = FreshRSS_Context::isStateEnabled($state);
  17. $url_state = Minz_Request::currentRequest();
  18. $url_state['params']['state'] = FreshRSS_Context::getRevertState($state);
  19. ?>
  20. <a id="toggle-<?php echo $state_str; ?>"
  21. class="btn <?php echo $state_enabled ? 'active' : ''; ?>"
  22. role="checkbox" aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>"
  23. title="<?php echo _t('index.menu.' . $state_str); ?>"
  24. href="<?php echo Minz_Url::display($url_state); ?>"><?php echo _i($state_str); ?></a>
  25. <?php } ?>
  26. <div class="dropdown">
  27. <div id="dropdown-query" class="dropdown-target"></div>
  28. <a class="dropdown-toggle btn" href="#dropdown-query"><?php echo _i('down'); ?></a>
  29. <ul class="dropdown-menu">
  30. <li class="dropdown-close"><a href="#close">❌</a></li>
  31. <li class="dropdown-header">
  32. <?php echo _t('index.menu.queries'); ?>
  33. <a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo _i('configure'); ?></a>
  34. </li>
  35. <?php foreach (FreshRSS_Context::$user_conf->queries as $query) { ?>
  36. <li class="item query">
  37. <a href="<?php echo $query['url']; ?>"><?php echo $query['name']; ?></a>
  38. </li>
  39. <?php } ?>
  40. <?php if (count(FreshRSS_Context::$user_conf->queries) > 0) { ?>
  41. <li class="separator no-mobile"></li>
  42. <?php } ?>
  43. <?php
  44. $url_query = Minz_Request::currentRequest();;
  45. $url_query['c'] = 'configure';
  46. $url_query['a'] = 'addQuery';
  47. ?>
  48. <li class="item no-mobile"><a href="<?php echo Minz_Url::display($url_query); ?>"><?php echo _i('bookmark-add'); ?> <?php echo _t('index.menu.add_query'); ?></a></li>
  49. </ul>
  50. </div>
  51. </div>
  52. <?php
  53. $get = FreshRSS_Context::currentGet();
  54. $string_mark = _t('index.menu.mark_all_read');
  55. if ($get[0] == 'f') {
  56. $string_mark = _t('index.menu.mark_feed_read');
  57. } elseif ($get[0] == 'c') {
  58. $string_mark = _t('index.menu.mark_cat_read');
  59. }
  60. $mark_read_url = array(
  61. 'c' => 'entry',
  62. 'a' => 'read',
  63. 'params' => array(
  64. 'get' => $get,
  65. 'nextGet' => FreshRSS_Context::$next_get,
  66. 'idMax' => FreshRSS_Context::$id_max,
  67. 'search' => FreshRSS_Context::$search,
  68. 'state' => FreshRSS_Context::$state,
  69. )
  70. );
  71. ?>
  72. <div class="stick" id="nav_menu_read_all">
  73. <form id="mark-read-menu" method="post">
  74. <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>
  75. <button class="read_all btn <?php echo $confirm; ?>"
  76. form="mark-read-menu"
  77. formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
  78. type="submit"><?php echo _t('gen.action.mark_read'); ?></button>
  79. <div class="dropdown">
  80. <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" />
  81. <div id="dropdown-read" class="dropdown-target"></div>
  82. <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a>
  83. <ul class="dropdown-menu">
  84. <li class="dropdown-close"><a href="#close">❌</a></li>
  85. <li class="item">
  86. <button class="as-link <?php echo $confirm; ?>"
  87. form="mark-read-menu"
  88. formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
  89. type="submit"><?php echo $string_mark; ?></button>
  90. </li>
  91. <li class="separator"></li>
  92. <?php
  93. $today = @strtotime('today');
  94. $mark_before_today = $mark_read_url;
  95. $mark_before_today['params']['idMax'] = $today . '000000';
  96. $mark_before_one_week = $mark_read_url;
  97. $mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000';
  98. ?>
  99. <li class="item">
  100. <button class="as-link <?php echo $confirm; ?>"
  101. form="mark-read-menu"
  102. formaction="<?php echo Minz_Url::display($mark_before_today); ?>"
  103. type="submit"><?php echo _t('index.menu.before_one_day'); ?></button>
  104. </li>
  105. <li class="item">
  106. <button class="as-link <?php echo $confirm; ?>"
  107. form="mark-read-menu"
  108. formaction="<?php echo Minz_Url::display($mark_before_one_week); ?>"
  109. type="submit"><?php echo _t('index.menu.before_one_week'); ?></button>
  110. </li>
  111. </ul>
  112. </div>
  113. </form>
  114. </div>
  115. <?php } ?>
  116. <?php $url_output = Minz_Request::currentRequest(); ?>
  117. <div class="stick" id="nav_menu_views">
  118. <?php $url_output['a'] = 'normal'; ?>
  119. <a class="view_normal btn <?php echo $actual_view == 'normal'? 'active' : ''; ?>" title="<?php echo _t('index.menu.normal_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  120. <?php echo _i("view-normal"); ?>
  121. </a>
  122. <?php $url_output['a'] = 'global'; ?>
  123. <a class="view_global btn <?php echo $actual_view == 'global'? 'active' : ''; ?>" title="<?php echo _t('index.menu.global_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  124. <?php echo _i("view-global"); ?>
  125. </a>
  126. <?php $url_output['a'] = 'reader'; ?>
  127. <a class="view_reader btn <?php echo $actual_view == 'reader'? 'active' : ''; ?>" title="<?php echo _t('index.menu.reader_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  128. <?php echo _i("view-reader"); ?>
  129. </a>
  130. <?php
  131. $url_output['a'] = 'rss';
  132. if (FreshRSS_Context::$user_conf->token) {
  133. $url_output['params']['token'] = FreshRSS_Context::$user_conf->token;
  134. }
  135. if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) {
  136. $url_output['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss;
  137. }
  138. ?>
  139. <a class="view_rss btn" target="_blank" rel="noreferrer" title="<?php echo _t('index.menu.rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  140. <?php echo _i('rss'); ?>
  141. </a>
  142. </div>
  143. <div class="item search">
  144. <form action="<?php echo _url('index', 'index'); ?>" method="get">
  145. <input type="search" name="search" class="extend" value="<?php echo FreshRSS_Context::$search; ?>" placeholder="<?php echo _t('index.menu.search_short'); ?>" />
  146. <?php $get = Minz_Request::param('get', ''); ?>
  147. <?php if($get != '') { ?>
  148. <input type="hidden" name="get" value="<?php echo $get; ?>" />
  149. <?php } ?>
  150. <?php $order = Minz_Request::param('order', ''); ?>
  151. <?php if($order != '') { ?>
  152. <input type="hidden" name="order" value="<?php echo $order; ?>" />
  153. <?php } ?>
  154. <?php $state = Minz_Request::param('state', ''); ?>
  155. <?php if($state != '') { ?>
  156. <input type="hidden" name="state" value="<?php echo $state; ?>" />
  157. <?php } ?>
  158. </form>
  159. </div>
  160. <?php
  161. if (FreshRSS_Context::$order === 'DESC') {
  162. $order = 'ASC';
  163. $icon = 'up';
  164. $title = 'index.menu.older_first';
  165. } else {
  166. $order = 'DESC';
  167. $icon = 'down';
  168. $title = 'index.menu.newer_first';
  169. }
  170. $url_order = Minz_Request::currentRequest();
  171. $url_order['params']['order'] = $order;
  172. ?>
  173. <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>">
  174. <?php echo _i($icon); ?>
  175. </a>
  176. <?php if (FreshRSS_Auth::hasAccess() || FreshRSS_Context::$system_conf->allow_anonymous_refresh) { ?>
  177. <a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>" title="<?php echo _t('gen.action.actualize'); ?>"><?php echo _i('refresh'); ?></a>
  178. <?php } ?>
  179. </div>