4
0

aside_feed.phtml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $actual_view = Minz_Request::actionName();
  5. $class = '';
  6. if (FreshRSS_Context::userConf()->hide_read_feeds &&
  7. FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
  8. !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
  9. $class = ' state_unread';
  10. }
  11. $state_filter_manual = Minz_Request::paramString('state');
  12. if ($state_filter_manual !== '') {
  13. $state_filter_manual = '&state=' . $state_filter_manual;
  14. }
  15. ?>
  16. <nav class="nav aside aside_feed<?= $class ?>" id="aside_feed">
  17. <a class="toggle_aside" href="#close"><?= _i('close') ?></a>
  18. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  19. <div class="stick configure-feeds">
  20. <a id="btn-subscription" class="btn btn-important" href="<?= _url('subscription', 'index') ?>"><?= _t('index.menu.subscription') ?></a>
  21. <a id="btn-add" class="btn btn-important" href="<?= _url('subscription', 'add') ?>"><?= _i('add') ?></a>
  22. </div>
  23. <?php } elseif (FreshRSS_Auth::accessNeedsLogin()) { ?>
  24. <a href="<?= _url('index', 'about') ?>" class="about"><?= _t('index.menu.about') ?></a>
  25. <?php } ?>
  26. <form id="mark-read-aside" method="post">
  27. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  28. <ul id="sidebar" class="tree scrollbar-thin">
  29. <li class="tree-folder category all<?= FreshRSS_Context::isCurrentGet('a') ? ' active' : '' ?>">
  30. <div class="tree-folder-title">
  31. <?= _i('all') ?><a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_unread) ?>" href="<?=
  32. _url('index', $actual_view) . $state_filter_manual ?>"><?= _t('index.menu.main_stream') ?></a>
  33. </div>
  34. </li>
  35. <li class="tree-folder category important<?= FreshRSS_Context::isCurrentGet('i') ? ' active' : '' ?>">
  36. <div class="tree-folder-title">
  37. <?= _i('important') ?><a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_important_unread) ?>" href="<?= _url('index', $actual_view, 'get', 'i') . $state_filter_manual ?>">
  38. <?= _t('index.menu.important') ?>
  39. </a>
  40. </div>
  41. </li>
  42. <li class="tree-folder category favorites<?= FreshRSS_Context::isCurrentGet('s') ? ' active' : '' ?>">
  43. <div class="tree-folder-title">
  44. <?= _i('starred') ?><a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_starred['unread']) ?>" href="<?= _url('index', $actual_view, 'get', 's') . $state_filter_manual ?>">
  45. <?= _t('index.menu.favorites', format_number(FreshRSS_Context::$total_starred['all'])) ?>
  46. </a>
  47. </div>
  48. </li>
  49. <?php
  50. $t_active = FreshRSS_Context::isCurrentGet('T');
  51. $t_show = ($t_active && in_array(FreshRSS_Context::userConf()->display_categories, ['active', 'remember'], true)) || FreshRSS_Context::userConf()->display_categories === 'all';
  52. ?>
  53. <li id="tags" class="tree-folder category tags<?= $t_active ? ' active' : '' ?>" data-unread="<?= format_number($this->nbUnreadTags) ?>">
  54. <div class="tree-folder-title">
  55. <a class="dropdown-toggle" href="#"><?= _i($t_show ? 'up' : 'down') ?></a><a class="title" data-unread="<?= format_number($this->nbUnreadTags) ?>" href="<?= _url('index', $actual_view, 'get', 'T') . $state_filter_manual ?>"><?= _t('index.menu.tags') ?></a>
  56. </div>
  57. <ul class="tree-folder-items<?= $t_show ? ' active' : '' ?>">
  58. <?php
  59. foreach ($this->tags as $tag):
  60. ?>
  61. <li id="t_<?= $tag->id() ?>" class="item feed<?= FreshRSS_Context::isCurrentGet('t_' . $tag->id()) ? ' active' : '' ?>" data-unread="<?= $tag->nbUnread() ?>">
  62. <div class="dropdown no-mobile">
  63. <div class="dropdown-target"></div>
  64. <a class="dropdown-toggle"><?= _i('configure') ?></a>
  65. <?php /* tag_config_template */ ?>
  66. </div>
  67. <a class="item-title" data-unread="<?= format_number($tag->nbUnread()) ?>" href="<?=
  68. _url('index', $actual_view, 'get', 't_' . $tag->id()) . $state_filter_manual ?>"><?= _i('label') ?> <?= $tag->name() ?></a>
  69. </li>
  70. <?php endforeach; ?>
  71. </ul>
  72. </li>
  73. <?php
  74. $nbFeedsTotal = 0;
  75. foreach ($this->categories as $cat) {
  76. $nbFeedsTotal += $cat->nbFeeds();
  77. }
  78. foreach ($this->categories as $cat):
  79. $feeds = $cat->feeds();
  80. $position = $cat->attributeInt('position');
  81. if (!empty($feeds)) {
  82. $c_active = FreshRSS_Context::isCurrentGet('c_' . $cat->id());
  83. $c_show = ($c_active && in_array(FreshRSS_Context::userConf()->display_categories, ['active', 'remember'], true))
  84. || FreshRSS_Context::userConf()->display_categories === 'all';
  85. ?>
  86. <li id="c_<?= $cat->id() ?>" class="tree-folder category<?= $c_active ? ' active' : '' ?>"<?=
  87. null === $position ? '' : " data-position='$position'" ?> data-unread="<?= $cat->nbNotRead() ?>">
  88. <div class="tree-folder-title">
  89. <a class="dropdown-toggle" href="#"><?= _i($c_show ? 'up' : 'down') ?></a><a class="title<?= $cat->hasFeedsWithError() ? ' error' : '' ?>" data-unread="<?=
  90. format_number($cat->nbNotRead()) ?>" href="<?= _url('index', $actual_view, 'get', 'c_' . $cat->id()) . $state_filter_manual ?>"><?=
  91. $cat->name()
  92. ?><?php if ($cat->kind() == FreshRSS_Category::KIND_DYNAMIC_OPML) { echo _i('opml-dyn'); } ?></a>
  93. </div>
  94. <ul class="tree-folder-items<?= $c_show ? ' active' : '' ?>">
  95. <?php
  96. // NB: Reduce whitespace in that loop
  97. foreach ($feeds as $feed):
  98. $f_active = FreshRSS_Context::isCurrentGet('f_' . $feed->id());
  99. $f_active_class = $f_active ? ' active' : '';
  100. $error_class = '';
  101. $error_title = '';
  102. if ($feed->inError() && !$feed->mute()) {
  103. $error_class = ' error';
  104. $error_title = _t('sub.feed.error');
  105. }
  106. $empty_class = '';
  107. $empty_title = '';
  108. if ($feed->nbEntries() <= 0) {
  109. $empty_class = ' empty';
  110. $empty_title = _t('sub.feed.empty');
  111. }
  112. $mute_class = $feed->mute() ? ' mute' : '';
  113. ?>
  114. <li id="f_<?= $feed->id() ?>" class="item feed<?= $f_active_class, $mute_class, $error_class, $empty_class ?>" title="<?= $error_title, $empty_title ?>"
  115. data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>"><?php
  116. if ($f_active || $nbFeedsTotal < FreshRSS_Context::userConf()->simplify_over_n_feeds):
  117. ?><div class="dropdown no-mobile">
  118. <div class="dropdown-target"></div><a class="dropdown-toggle" data-fweb="<?= $feed->website() ?>"><?= _i('configure') ?></a><?php /* feed_config_template */ ?>
  119. </div><?php
  120. if (FreshRSS_Context::userConf()->show_favicons) { ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php }
  121. endif;
  122. ?><a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?=
  123. _url('index', $actual_view, 'get', 'f_' . $feed->id()) . $state_filter_manual ?>"><?= $feed->name() ?></a></li>
  124. <?php
  125. endforeach;
  126. ?>
  127. </ul>
  128. </li>
  129. <?php
  130. }
  131. endforeach;
  132. ?>
  133. <li class="tree-bottom"></li>
  134. </ul>
  135. </form>
  136. </nav>
  137. <a class="close-aside" href="#close">❌</a>
  138. <div id="first_load" class="loading"></div>
  139. <?php flush(); ?>
  140. <script id="tag_config_template" type="text/html">
  141. <ul class="dropdown-menu">
  142. <li class="item">
  143. <a class="configure open-slider" href="<?= _url('tag', 'update', 'id', '------') ?>"><?= _t('gen.action.manage') ?></a>
  144. </li>
  145. </ul>
  146. <a class="dropdown-close" href="#close">❌</a>
  147. </script>
  148. <script id="feed_config_template" type="text/html">
  149. <ul class="dropdown-menu">
  150. <li class="item"><a href="<?= _url('index', $actual_view, 'get', 'f_------') ?>"><?= _t('gen.action.filter') ?></a></li>
  151. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  152. <li class="item"><a href="<?= _url('stats', 'repartition', 'id', '------') ?>"><?= _t('index.menu.stats') ?></a></li>
  153. <?php } ?>
  154. <li class="item link website"><a target="_blank" rel="noreferrer" href="http://example.net/"><?= _t('gen.action.see_website') ?></a></li>
  155. <?php if (FreshRSS_Auth::hasAccess()) {
  156. $get = Minz_Request::paramString('get');
  157. if ($get === '') {
  158. $url = _url('subscription', 'feed', 'id', '------', 'from', $actual_view);
  159. } else {
  160. $url = _url('subscription', 'feed', 'id', '------', 'get', $get, 'from', $actual_view);
  161. }
  162. ?>
  163. <li class="item"><a class="configure open-slider" href="<?= $url ?>"><?= _t('gen.action.manage') ?></a></li>
  164. <li class="item"><a href="<?= _url('feed', 'actualize', 'id', '------') ?>"><?= _t('gen.action.actualize') ?></a></li>
  165. <li class="item">
  166. <?php $confirm = FreshRSS_Context::userConf()->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>
  167. <button class="read_all as-link <?= $confirm ?>"
  168. form="mark-read-aside"
  169. formaction="<?= _url('entry', 'read', 'get', 'f_------') ?>"
  170. type="submit"><?= _t('index.menu.mark_feed_read') ?></button>
  171. </li>
  172. <?php } ?>
  173. </ul>
  174. <a class="dropdown-close" href="#close">❌</a>
  175. </script>