normal.phtml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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::$user_conf->sharing;
  10. } else {
  11. $sharing = array();
  12. }
  13. $hidePosts = !FreshRSS_Context::$user_conf->display_posts;
  14. $lazyload = FreshRSS_Context::$user_conf->lazyload;
  15. $topline_read = FreshRSS_Context::$user_conf->topline_read;
  16. $topline_favorite = FreshRSS_Context::$user_conf->topline_favorite;
  17. $topline_date = FreshRSS_Context::$user_conf->topline_date;
  18. $topline_link = FreshRSS_Context::$user_conf->topline_link;
  19. $bottomline_read = FreshRSS_Context::$user_conf->bottomline_read;
  20. $bottomline_favorite = FreshRSS_Context::$user_conf->bottomline_favorite;
  21. $bottomline_sharing = FreshRSS_Context::$user_conf->bottomline_sharing && (count($sharing));
  22. $bottomline_tags = FreshRSS_Context::$user_conf->bottomline_tags;
  23. $bottomline_date = FreshRSS_Context::$user_conf->bottomline_date;
  24. $bottomline_link = FreshRSS_Context::$user_conf->bottomline_link;
  25. $content_width = FreshRSS_Context::$user_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. ?><div class="dropdown">
  127. <div id="dropdown-share-<?php echo $item->id();?>" class="dropdown-target"></div>
  128. <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id();?>">
  129. <?php echo _i('share'); ?>
  130. <?php echo _t('index.share'); ?>
  131. </a>
  132. <ul class="dropdown-menu">
  133. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  134. $link = $item->link();
  135. $title = $item->title() . ' · ' . $feed->name();
  136. foreach (FreshRSS_Context::$user_conf->sharing as $share_options) {
  137. $share = FreshRSS_Share::get($share_options['type']);
  138. $share_options['link'] = $link;
  139. $share_options['title'] = $title;
  140. $share->update($share_options);
  141. ?><li class="item share">
  142. <a target="_blank" href="<?php echo $share->url(); ?>"><?php echo $share->name(); ?></a>
  143. </li><?php
  144. }
  145. ?></ul>
  146. </div>
  147. <?php } ?>
  148. </li><?php
  149. $tags = $bottomline_tags ? $item->tags() : null;
  150. if (!empty($tags)) {
  151. ?><li class="item">
  152. <div class="dropdown">
  153. <div id="dropdown-tags-<?php echo $item->id();?>" class="dropdown-target"></div>
  154. <?php echo _i('tag'); ?>
  155. <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id();?>"><?php
  156. echo _t('index.tag.related');
  157. ?></a>
  158. <ul class="dropdown-menu">
  159. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  160. foreach($tags as $tag) {
  161. ?><li class="item"><a href="<?php echo _url('index', 'index', 'search', urlencode('#' . $tag)); ?>"><?php echo $tag; ?></a></li><?php
  162. } ?>
  163. </ul>
  164. </div>
  165. </li><?php
  166. }
  167. if ($bottomline_date) {
  168. ?><li class="item date"><?php echo $item->date(); ?></li><?php
  169. }
  170. if ($bottomline_link) {
  171. ?><li class="item link"><a target="_blank" href="<?php echo $item->link(); ?>"><?php echo _i('link'); ?></a></li><?php
  172. } ?>
  173. </ul>
  174. </div>
  175. </div>
  176. <?php } ?>
  177. <?php $this->renderHelper('pagination'); ?>
  178. </div>
  179. <?php $this->partial('nav_entries'); ?>
  180. <?php } else { ?>
  181. <div id="stream" class="prompt alert alert-warn normal">
  182. <h2><?php echo _t('index.feed.empty'); ?></h2>
  183. <a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('index.feed.add'); ?></a><br /><br />
  184. </div>
  185. <?php } ?>