nav_menu.phtml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php $actual_view = Minz_Request::actionName(); ?>
  2. <div class="nav_menu">
  3. <?php if ($actual_view === 'normal' || $actual_view === 'reader' ) { ?>
  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. $string_unmark = _t('index.menu.mark_selection_unread');
  56. if ($get[0] === 'f') {
  57. $string_mark = _t('index.menu.mark_feed_read');
  58. } elseif ($get[0] === 'c') {
  59. $string_mark = _t('index.menu.mark_cat_read');
  60. }
  61. $mark_read_url = array(
  62. 'c' => 'entry',
  63. 'a' => 'read',
  64. 'params' => array(
  65. 'get' => $get,
  66. 'nextGet' => FreshRSS_Context::$next_get,
  67. 'idMax' => FreshRSS_Context::$id_max,
  68. 'search' => htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES),
  69. 'state' => FreshRSS_Context::$state,
  70. ),
  71. );
  72. $mark_unread_url = $mark_read_url;
  73. $mark_unread_url['params']['is_read'] = false;
  74. $mark_unread_url['params']['nextGet'] = $get;
  75. ?>
  76. <div class="stick" id="nav_menu_read_all">
  77. <form id="mark-read-menu" method="post">
  78. <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>
  79. <button class="read_all btn <?php echo $confirm; ?>"
  80. form="mark-read-menu"
  81. formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
  82. type="submit"><?php echo _t('gen.action.mark_read'); ?></button>
  83. <div class="dropdown">
  84. <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" />
  85. <div id="dropdown-read" class="dropdown-target"></div>
  86. <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a>
  87. <ul class="dropdown-menu">
  88. <li class="dropdown-close"><a href="#close">❌</a></li>
  89. <li class="item">
  90. <button class="as-link <?php echo $confirm; ?>"
  91. form="mark-read-menu"
  92. formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
  93. type="submit"><?php echo $string_mark; ?></button>
  94. </li>
  95. <li class="separator"></li>
  96. <?php
  97. $today = @strtotime('today');
  98. $mark_before_today = $mark_read_url;
  99. $mark_before_today['params']['idMax'] = $today . '000000';
  100. $mark_before_one_week = $mark_read_url;
  101. $mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000';
  102. $mark_unread_enabled = FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ) or !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ);
  103. ?>
  104. <li class="item">
  105. <button class="as-link <?php echo $confirm; ?>"
  106. form="mark-read-menu"
  107. formaction="<?php echo Minz_Url::display($mark_before_today); ?>"
  108. type="submit"><?php echo _t('index.menu.before_one_day'); ?></button>
  109. </li>
  110. <li class="item">
  111. <button class="as-link <?php echo $confirm; ?>"
  112. form="mark-read-menu"
  113. formaction="<?php echo Minz_Url::display($mark_before_one_week); ?>"
  114. type="submit"><?php echo _t('index.menu.before_one_week'); ?></button>
  115. </li>
  116. <li class="separator"></li>
  117. <li class="item">
  118. <button class="as-link <?php echo $mark_unread_enabled ? $confirm : '" disabled="disabled'; ?>"
  119. form="mark-read-menu"
  120. formaction="<?php echo Minz_Url::display($mark_unread_url); ?>"
  121. type="submit"><?php echo $string_unmark; ?></button>
  122. </li>
  123. </ul>
  124. </div>
  125. </form>
  126. </div>
  127. <?php } ?>
  128. <?php $url_output = Minz_Request::currentRequest(); ?>
  129. <div class="stick" id="nav_menu_views">
  130. <?php
  131. $readingModes = FreshRSS_ReadingMode::getReadingModes();
  132. $readingModes = Minz_ExtensionManager::callHook('nav_reading_modes', $readingModes);
  133. /** @var FreshRSS_ReadingMode $mode */
  134. foreach ($readingModes as $mode) {
  135. ?>
  136. <a class="<?php echo $mode->getId(); ?> btn <?php if ($mode->isActive()) { echo 'active'; } ?>" title="<?php echo $mode->getTitle(); ?>" href="<?php echo Minz_Url::display($mode->getUrlParams()); ?>">
  137. <?php echo $mode->getName(); ?>
  138. </a>
  139. <?php
  140. }
  141. ?>
  142. <?php
  143. $url_output['a'] = 'rss';
  144. if (FreshRSS_Context::$user_conf->token) {
  145. $url_output['params']['user'] = Minz_Session::param('currentUser');
  146. $url_output['params']['token'] = FreshRSS_Context::$user_conf->token;
  147. }
  148. if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) {
  149. $url_output['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss;
  150. }
  151. ?>
  152. <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); ?>">
  153. <?php echo _i('rss'); ?>
  154. </a>
  155. </div>
  156. <div class="item search">
  157. <form action="<?php echo _url('index', 'index'); ?>" method="get">
  158. <input type="search" name="search" class="extend" value="<?php
  159. echo htmlspecialchars(htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES), ENT_COMPAT, 'UTF-8'); ?>" placeholder="<?php echo _t('index.menu.search_short'); ?>" />
  160. <?php $get = Minz_Request::param('get', ''); ?>
  161. <?php if($get != '') { ?>
  162. <input type="hidden" name="get" value="<?php echo $get; ?>" />
  163. <?php } ?>
  164. <?php $order = Minz_Request::param('order', ''); ?>
  165. <?php if($order != '') { ?>
  166. <input type="hidden" name="order" value="<?php echo $order; ?>" />
  167. <?php } ?>
  168. <?php $state = Minz_Request::param('state', ''); ?>
  169. <?php if($state != '') { ?>
  170. <input type="hidden" name="state" value="<?php echo $state; ?>" />
  171. <?php } ?>
  172. </form>
  173. </div>
  174. <?php
  175. if (FreshRSS_Context::$order === 'DESC') {
  176. $order = 'ASC';
  177. $icon = 'up';
  178. $title = _t('index.menu.older_first');
  179. } else {
  180. $order = 'DESC';
  181. $icon = 'down';
  182. $title = _t('index.menu.newer_first');
  183. }
  184. $url_order = Minz_Request::currentRequest();
  185. $url_order['params']['order'] = $order;
  186. ?>
  187. <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo $title; ?>">
  188. <?php echo _i($icon); ?>
  189. </a>
  190. <?php if (FreshRSS_Auth::hasAccess() || FreshRSS_Context::$system_conf->allow_anonymous_refresh) { ?>
  191. <a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>" title="<?php echo _t('gen.action.actualize'); ?>"><?php echo _i('refresh'); ?></a>
  192. <?php } ?>
  193. </div>