aside_feed.phtml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. /** @var FreshRSS_View $this */
  3. $actual_view = Minz_Request::actionName();
  4. $class = '';
  5. if (FreshRSS_Context::$user_conf->hide_read_feeds &&
  6. FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
  7. !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
  8. $class = ' state_unread';
  9. }
  10. $state_filter_fav = FreshRSS_Context::$user_conf->show_fav_unread ? '&state=3' : '';
  11. $state_filter_cat = Minz_Request::param('state', '');
  12. if ($state_filter_cat) {
  13. $state_filter_cat = '&state=' . $state_filter_cat;
  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-white') ?></a>
  22. </div>
  23. <?php } elseif (FreshRSS_Auth::accessNeedsLogin()) { ?>
  24. <a href="<?= _url('index', '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">
  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_cat ?>"><?= _t('index.menu.main_stream') ?></a>
  33. </div>
  34. </li>
  35. <li class="tree-folder category favorites<?= FreshRSS_Context::isCurrentGet('s') ? ' active' : '' ?>">
  36. <div class="tree-folder-title">
  37. <?= _i('bookmark') ?>
  38. <a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_starred['unread']) ?>" href="<?= _url('index', $actual_view, 'get', 's') . $state_filter_fav ?>">
  39. <?= _t('index.menu.favorites', format_number(FreshRSS_Context::$total_starred['all'])) ?>
  40. </a>
  41. </div>
  42. </li>
  43. <?php
  44. $t_active = FreshRSS_Context::isCurrentGet('T');
  45. $t_show = ($t_active && in_array(FreshRSS_Context::$user_conf->display_categories, [ 'active', 'remember' ])) || FreshRSS_Context::$user_conf->display_categories === 'all';
  46. ?>
  47. <li id="tags" class="tree-folder category tags<?= $t_active ? ' active' : '' ?>" data-unread="<?= format_number($this->nbUnreadTags) ?>">
  48. <div class="tree-folder-title">
  49. <a class="dropdown-toggle" href="#"><?= _i($t_active ? 'up' : 'down') ?></a>
  50. <a class="title" data-unread="<?= format_number($this->nbUnreadTags) ?>" href="<?= _url('index', $actual_view, 'get', 'T') . $state_filter_fav ?>"><?= _t('index.menu.tags') ?></a>
  51. </div>
  52. <ul class="tree-folder-items<?= $t_show ? ' active' : '' ?>">
  53. <?php
  54. foreach ($this->tags as $tag):
  55. ?>
  56. <li id="t_<?= $tag->id() ?>" class="item feed<?= FreshRSS_Context::isCurrentGet('t_' . $tag->id()) ? ' active' : '' ?>" data-unread="<?= $tag->nbUnread() ?>">
  57. <div class="dropdown no-mobile">
  58. <div class="dropdown-target"></div>
  59. <a class="dropdown-toggle"><?= _i('configure') ?></a>
  60. <?php /* tag_config_template */ ?>
  61. </div>
  62. <?= FreshRSS_Themes::alt('label') ?> <a class="item-title" data-unread="<?= format_number($tag->nbUnread()) ?>" href="<?=
  63. _url('index', $actual_view, 'get', 't_' . $tag->id()) . $state_filter_fav ?>"><?= $tag->name() ?></a>
  64. </li>
  65. <?php endforeach; ?>
  66. </ul>
  67. </li>
  68. <?php
  69. foreach ($this->categories as $cat) {
  70. $feeds = $cat->feeds();
  71. $position = $cat->attributes('position');
  72. if (!empty($feeds)) {
  73. $c_active = FreshRSS_Context::isCurrentGet('c_' . $cat->id());
  74. $c_show = ($c_active && in_array(FreshRSS_Context::$user_conf->display_categories, [ 'active', 'remember' ]))
  75. || FreshRSS_Context::$user_conf->display_categories === 'all';
  76. ?>
  77. <li id="c_<?= $cat->id() ?>" class="tree-folder category<?= $c_active ? ' active' : '' ?>"<?=
  78. null === $position ? '' : "data-position='$position'" ?> data-unread="<?= $cat->nbNotRead() ?>">
  79. <div class="tree-folder-title">
  80. <a class="dropdown-toggle" href="#"><?= _i($c_show ? 'up' : 'down') ?></a>
  81. <a class="title<?= $cat->hasFeedsWithError() ? ' error' : '' ?>" data-unread="<?=
  82. format_number($cat->nbNotRead()) ?>" href="<?= _url('index', $actual_view, 'get', 'c_' . $cat->id()) . $state_filter_cat?>"><?= $cat->name() ?></a>
  83. </div>
  84. <ul class="tree-folder-items<?= $c_show ? ' active' : '' ?>">
  85. <?php
  86. foreach ($feeds as $feed) {
  87. $f_active = FreshRSS_Context::isCurrentGet('f_' . $feed->id());
  88. ?>
  89. <li id="f_<?= $feed->id() ?>" class="item feed<?= $f_active ? ' active' : '', $feed->mute() ? ' mute' : '' ?><?=
  90. $feed->inError() ? ' error' : '' ?><?= $feed->nbEntries() <= 0 ? ' empty' : ''
  91. ?>" data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>">
  92. <div class="dropdown no-mobile">
  93. <div class="dropdown-target"></div>
  94. <a class="dropdown-toggle" data-fweb="<?= $feed->website() ?>"><?= _i('configure') ?></a>
  95. <?php /* feed_config_template */ ?>
  96. </div>
  97. <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
  98. <a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?=
  99. _url('index', $actual_view, 'get', 'f_' . $feed->id()). $state_filter_cat?>"><?= $feed->name() ?></a>
  100. </li>
  101. <?php } ?>
  102. </ul>
  103. </li>
  104. <?php
  105. }
  106. }
  107. ?>
  108. <li class="tree-bottom"></li>
  109. </ul>
  110. </form>
  111. </nav>
  112. <a class="close-aside" href="#close">❌</a>
  113. <div id="first_load" class="loading"></div>
  114. <?php flush(); ?>
  115. <script id="tag_config_template" type="text/html">
  116. <ul class="dropdown-menu">
  117. <li class="dropdown-close"><a href="#close">❌</a></li>
  118. <li class="item">
  119. <button class="as-link confirm" disabled="disabled"
  120. form="mark-read-aside" formaction="<?= _url('tag', 'delete', 'id_tag', '------') ?>"
  121. type="submit"><?= _t('gen.action.remove') ?></button>
  122. </li>
  123. </ul>
  124. </script>
  125. <script id="feed_config_template" type="text/html">
  126. <ul class="dropdown-menu">
  127. <li class="dropdown-close"><a href="#close">❌</a></li>
  128. <li class="item"><a href="<?= _url('index', $actual_view, 'get', 'f_------') ?>"><?= _t('gen.action.filter') ?></a></li>
  129. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  130. <li class="item"><a href="<?= _url('stats', 'repartition', 'id', '------') ?>"><?= _t('index.menu.stats') ?></a></li>
  131. <?php } ?>
  132. <li class="item"><a target="_blank" rel="noreferrer" href="http://example.net/"><?= _t('gen.action.see_website') ?></a></li>
  133. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  134. <li class="separator"></li>
  135. <li class="item"><a href="<?= _url('subscription', 'index', 'id', '------') ?>"><?= _t('gen.action.manage') ?></a></li>
  136. <li class="item"><a href="<?= _url('feed', 'actualize', 'id', '------') ?>"><?= _t('gen.action.actualize') ?></a></li>
  137. <li class="item">
  138. <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>
  139. <button class="read_all as-link <?= $confirm ?>"
  140. form="mark-read-aside"
  141. formaction="<?= _url('entry', 'read', 'get', 'f_------') ?>"
  142. type="submit"><?= _t('gen.action.mark_read') ?></button>
  143. </li>
  144. <?php } ?>
  145. </ul>
  146. </script>