normal.phtml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. $this->partial('aside_feed');
  3. $this->partial('nav_menu');
  4. if (!empty($this->entries)) {
  5. $display_today = true;
  6. $display_yesterday = true;
  7. $display_others = true;
  8. if (FreshRSS_Auth::hasAccess()) {
  9. $sharing = FreshRSS_Context::$conf->sharing;
  10. } else {
  11. $sharing = array();
  12. }
  13. $hidePosts = !FreshRSS_Context::$conf->display_posts;
  14. $lazyload = FreshRSS_Context::$conf->lazyload;
  15. $topline_read = FreshRSS_Context::$conf->topline_read;
  16. $topline_favorite = FreshRSS_Context::$conf->topline_favorite;
  17. $topline_date = FreshRSS_Context::$conf->topline_date;
  18. $topline_link = FreshRSS_Context::$conf->topline_link;
  19. $bottomline_read = FreshRSS_Context::$conf->bottomline_read;
  20. $bottomline_favorite = FreshRSS_Context::$conf->bottomline_favorite;
  21. $bottomline_sharing = FreshRSS_Context::$conf->bottomline_sharing && (count($sharing));
  22. $bottomline_tags = FreshRSS_Context::$conf->bottomline_tags;
  23. $bottomline_date = FreshRSS_Context::$conf->bottomline_date;
  24. $bottomline_link = FreshRSS_Context::$conf->bottomline_link;
  25. $content_width = FreshRSS_Context::$conf->content_width;
  26. $today = @strtotime('today');
  27. ?>
  28. <div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
  29. ?><div id="new-article">
  30. <a href="<?php echo Minz_Url::display(Minz_Request::currentRequest()); ?>"><?php echo _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  31. </div><?php
  32. foreach ($this->entries as $item) {
  33. if ($display_today && $item->isDay(FreshRSS_Days::TODAY, $today)) {
  34. ?><div class="day" id="day_today"><?php
  35. echo _t('gen.date.today');
  36. ?><span class="date"> — <?php echo timestamptodate(time(), false); ?></span><?php
  37. ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
  38. ?></div><?php
  39. $display_today = false;
  40. }
  41. if ($display_yesterday && $item->isDay(FreshRSS_Days::YESTERDAY, $today)) {
  42. ?><div class="day" id="day_yesterday"><?php
  43. echo _t('gen.date.yesterday');
  44. ?><span class="date"> — <?php echo timestamptodate(time() - 86400, false); ?></span><?php
  45. ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
  46. ?></div><?php
  47. $display_yesterday = false;
  48. }
  49. if ($display_others && $item->isDay(FreshRSS_Days::BEFORE_YESTERDAY, $today)) {
  50. ?><div class="day" id="day_before_yesterday"><?php
  51. echo _t('gen.date.before_yesterday');
  52. ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
  53. ?></div><?php
  54. $display_others = false;
  55. }
  56. ?><div class="flux<?php echo !$item->isRead() ? ' not_read' : ''; ?><?php echo $item->isFavorite() ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id(); ?>">
  57. <ul class="horizontal-list flux_header"><?php
  58. if (FreshRSS_Auth::hasAccess()) {
  59. if ($topline_read) {
  60. ?><li class="item manage"><?php
  61. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id()));
  62. if ($item->isRead()) {
  63. $arUrl['params']['is_read'] = 0;
  64. }
  65. ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  66. echo _i($item->isRead() ? 'read' : 'unread'); ?></a><?php
  67. ?></li><?php
  68. }
  69. if ($topline_favorite) {
  70. ?><li class="item manage"><?php
  71. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id()));
  72. if ($item->isFavorite()) {
  73. $arUrl['params']['is_favorite'] = 0;
  74. }
  75. ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  76. echo _i($item->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
  77. ?></li><?php
  78. }
  79. }
  80. $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feed()); //We most likely already have the feed object in cache
  81. if ($feed == null) {
  82. $feed = $item->feed(true);
  83. if ($feed == null) {
  84. $feed = FreshRSS_Feed::example();
  85. }
  86. }
  87. ?><li class="item website"><a href="<?php echo _url('index', 'index', 'get', 'f_' . $feed->id()); ?>"><img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span></a></li>
  88. <li class="item title"><a target="_blank" href="<?php echo $item->link(); ?>"><?php echo $item->title(); ?></a></li>
  89. <?php if ($topline_date) { ?><li class="item date"><?php echo $item->date(); ?> </li><?php } ?>
  90. <?php if ($topline_link) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link(); ?>"><?php echo _i('link'); ?></a></li><?php } ?>
  91. </ul>
  92. <div class="flux_content">
  93. <div class="content <?php echo $content_width; ?>">
  94. <h1 class="title"><a target="_blank" href="<?php echo $item->link(); ?>"><?php echo $item->title(); ?></a></h1>
  95. <?php
  96. $author = $item->author();
  97. echo $author != '' ? '<div class="author">' . _t('gen.short.by_author', $author) . '</div>' : '',
  98. $lazyload && $hidePosts ? lazyimg($item->content()) : $item->content();
  99. ?>
  100. </div>
  101. <ul class="horizontal-list bottom"><?php
  102. if (FreshRSS_Auth::hasAccess()) {
  103. if ($bottomline_read) {
  104. ?><li class="item manage"><?php
  105. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id()));
  106. if ($item->isRead()) {
  107. $arUrl['params']['is_read'] = 0;
  108. }
  109. ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  110. echo _i($item->isRead() ? 'read' : 'unread'); ?></a><?php
  111. ?></li><?php
  112. }
  113. if ($bottomline_favorite) {
  114. ?><li class="item manage"><?php
  115. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id()));
  116. if ($item->isFavorite()) {
  117. $arUrl['params']['is_favorite'] = 0;
  118. }
  119. ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  120. echo _i($item->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
  121. ?></li><?php
  122. }
  123. } ?>
  124. <li class="item"><?php
  125. if ($bottomline_sharing) {
  126. $link = urlencode($item->link());
  127. $title = urlencode($item->title() . ' · ' . $feed->name());
  128. ?><div class="dropdown">
  129. <div id="dropdown-share-<?php echo $item->id();?>" class="dropdown-target"></div>
  130. <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id();?>">
  131. <?php echo _i('share'); ?>
  132. <?php echo _t('index.share'); ?>
  133. </a>
  134. <ul class="dropdown-menu">
  135. <li class="dropdown-close"><a href="#close">❌</a></li>
  136. <?php
  137. foreach ($sharing as $share) :
  138. $type_share = FreshRSS_Context::$conf->shares[$share['type']];
  139. $has_specific_title = ($type_share['form'] === 'advanced');
  140. ?>
  141. <li class="item share">
  142. <a target="_blank" href="<?php echo FreshRSS_Share::generateUrl(FreshRSS_Context::$conf->shares, $share, $item->link(), $item->title() . ' . ' . $feed->name())?>">
  143. <?php echo $has_specific_title ? $share['name'] : _t('index.share.' . $share['name']); ?>
  144. </a>
  145. </li>
  146. <?php endforeach;?>
  147. </ul>
  148. </div>
  149. <?php } ?>
  150. </li><?php
  151. $tags = $bottomline_tags ? $item->tags() : null;
  152. if (!empty($tags)) {
  153. ?><li class="item">
  154. <div class="dropdown">
  155. <div id="dropdown-tags-<?php echo $item->id();?>" class="dropdown-target"></div>
  156. <?php echo _i('tag'); ?>
  157. <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id();?>"><?php
  158. echo _t('index.tag.related');
  159. ?></a>
  160. <ul class="dropdown-menu">
  161. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  162. foreach($tags as $tag) {
  163. ?><li class="item"><a href="<?php echo _url('index', 'index', 'search', urlencode('#' . $tag)); ?>"><?php echo $tag; ?></a></li><?php
  164. } ?>
  165. </ul>
  166. </div>
  167. </li><?php
  168. }
  169. if ($bottomline_date) {
  170. ?><li class="item date"><?php echo $item->date(); ?></li><?php
  171. }
  172. if ($bottomline_link) {
  173. ?><li class="item link"><a target="_blank" href="<?php echo $item->link(); ?>"><?php echo _i('link'); ?></a></li><?php
  174. } ?>
  175. </ul>
  176. </div>
  177. </div>
  178. <?php } ?>
  179. <?php $this->renderHelper('pagination'); ?>
  180. </div>
  181. <?php $this->partial('nav_entries'); ?>
  182. <?php } else { ?>
  183. <div id="stream" class="prompt alert alert-warn normal">
  184. <h2><?php echo _t('index.feed.empty'); ?></h2>
  185. <a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('index.feed.add'); ?></a><br /><br />
  186. </div>
  187. <?php } ?>