aside_feed.phtml 7.0 KB

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