aside_feed.phtml 7.0 KB

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