normal_view.phtml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <?php
  2. $this->partial ('aside_flux');
  3. $this->partial ('nav_menu');
  4. if (!empty($this->entries)) {
  5. $display_today = true;
  6. $display_yesterday = true;
  7. $display_others = true;
  8. if ($this->loginOk) {
  9. $shaarli = $this->conf->sharing ('shaarli');
  10. $poche = $this->conf->sharing ('poche');
  11. $diaspora = $this->conf->sharing ('diaspora');
  12. } else {
  13. $shaarli = '';
  14. $poche = '';
  15. $diaspora = '';
  16. }
  17. $twitter = $this->conf->sharing ('twitter');
  18. $google_plus = $this->conf->sharing ('g+');
  19. $facebook = $this->conf->sharing ('facebook');
  20. $email = $this->conf->sharing ('email');
  21. $print = $this->conf->sharing ('print');
  22. $hidePosts = !$this->conf->display_posts;
  23. $lazyload = $this->conf->lazyload;
  24. $topline_read = $this->conf->topline_read;
  25. $topline_favorite = $this->conf->topline_favorite;
  26. $topline_date = $this->conf->topline_date;
  27. $topline_link = $this->conf->topline_link;
  28. $bottomline_read = $this->conf->bottomline_read;
  29. $bottomline_favorite = $this->conf->bottomline_favorite;
  30. $bottomline_sharing = $this->conf->bottomline_sharing && (
  31. $shaarli || $poche || $diaspora || $twitter ||
  32. $google_plus || $facebook || $email || $print);
  33. $bottomline_tags = $this->conf->bottomline_tags;
  34. $bottomline_date = $this->conf->bottomline_date;
  35. $bottomline_link = $this->conf->bottomline_link;
  36. ?>
  37. <div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
  38. foreach ($this->entries as $item) {
  39. if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) {
  40. ?><div class="day" id="day_today"><?php
  41. echo Minz_Translate::t ('today');
  42. ?><span class="date"> — <?php echo timestamptodate (time (), false); ?></span><?php
  43. ?><span class="name"><?php echo $this->currentName; ?></span><?php
  44. ?></div><?php
  45. $display_today = false;
  46. }
  47. if ($display_yesterday && $item->isDay (FreshRSS_Days::YESTERDAY, $this->today)) {
  48. ?><div class="day" id="day_yesterday"><?php
  49. echo Minz_Translate::t ('yesterday');
  50. ?><span class="date"> — <?php echo timestamptodate (time () - 86400, false); ?></span><?php
  51. ?><span class="name"><?php echo $this->currentName; ?></span><?php
  52. ?></div><?php
  53. $display_yesterday = false;
  54. }
  55. if ($display_others && $item->isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) {
  56. ?><div class="day" id="day_before_yesterday"><?php
  57. echo Minz_Translate::t ('before_yesterday');
  58. ?><span class="name"><?php echo $this->currentName; ?></span><?php
  59. ?></div><?php
  60. $display_others = false;
  61. }
  62. if ($this->entries[0]->id () === $item->id ()) {
  63. ?><div id="new-article">
  64. <a href="<?php echo _url(); ?>"><?php
  65. echo Minz_Translate::t ('new_article');
  66. ?></a></div><?php
  67. }
  68. ?><div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
  69. <ul class="horizontal-list flux_header"><?php
  70. if ($this->loginOk) {
  71. if ($topline_read) {
  72. ?><li class="item manage"><?php
  73. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
  74. if ($item->isRead()) {
  75. $arUrl['params']['is_read'] = 0;
  76. }
  77. ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  78. echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
  79. ?></li><?php
  80. }
  81. if ($topline_favorite) {
  82. ?><li class="item manage"><?php
  83. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
  84. if ($item->isFavorite()) {
  85. $arUrl['params']['is_favorite'] = 0;
  86. }
  87. ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  88. echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
  89. ?></li><?php
  90. }
  91. }
  92. $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache
  93. if (empty($feed)) $feed = $item->feed (true);
  94. ?><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>
  95. <li class="item title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></li>
  96. <?php if ($topline_date) { ?><li class="item date"><?php echo $item->date (); ?> </li><?php } ?>
  97. <?php if ($topline_link) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php } ?>
  98. </ul>
  99. <div class="flux_content">
  100. <div class="content">
  101. <h1 class="title"><?php echo $item->title (); ?></h1>
  102. <?php
  103. $author = $item->author ();
  104. echo $author != '' ? '<div class="author">' . Minz_Translate::t ('by_author', $author) . '</div>' : '';
  105. if ($lazyload) {
  106. echo $hidePosts ? lazyIframe(lazyimg($item->content())) : lazyimg($item->content());
  107. } else {
  108. echo $item->content();
  109. }
  110. ?>
  111. </div>
  112. <ul class="horizontal-list bottom"><?php
  113. if ($this->loginOk) {
  114. if ($bottomline_read) {
  115. ?><li class="item manage"><?php
  116. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
  117. if ($item->isRead()) {
  118. $arUrl['params']['is_read'] = 0;
  119. }
  120. ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  121. echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
  122. ?></li><?php
  123. }
  124. if ($bottomline_favorite) {
  125. ?><li class="item manage"><?php
  126. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
  127. if ($item->isFavorite()) {
  128. $arUrl['params']['is_favorite'] = 0;
  129. }
  130. ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  131. echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
  132. ?></li><?php
  133. }
  134. } ?>
  135. <li class="item"><?php
  136. if ($bottomline_sharing) {
  137. $link = urlencode ($item->link ());
  138. $title = urlencode ($item->title () . ' · ' . $feed->name ());
  139. ?><div class="dropdown">
  140. <div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>
  141. <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>">
  142. <?php echo FreshRSS_Themes::icon('share'); ?>
  143. <?php echo Minz_Translate::t ('share'); ?>
  144. </a>
  145. <ul class="dropdown-menu">
  146. <li class="dropdown-close"><a href="#close">❌</a></li>
  147. <?php if ($shaarli) { ?>
  148. <li class="item">
  149. <a target="_blank" href="<?php echo $shaarli . '?post=' . $link . '&amp;title=' . $title . '&amp;source=FreshRSS'; ?>">
  150. <?php echo Minz_Translate::t ('shaarli'); ?>
  151. </a>
  152. </li>
  153. <?php } if ($poche) { ?>
  154. <li class="item">
  155. <a target="_blank" href="<?php echo $poche . '?action=add&amp;url=' . base64_encode (urldecode($link)); ?>">
  156. <?php echo Minz_Translate::t ('poche'); ?>
  157. </a>
  158. </li>
  159. <?php } if ($diaspora) { ?>
  160. <li class="item">
  161. <a target="_blank" href="<?php echo $diaspora . '/bookmarklet?url=' . $link . '&amp;title=' . $title; ?>">
  162. <?php echo Minz_Translate::t ('diaspora'); ?>
  163. </a>
  164. </li>
  165. <?php } if ($twitter) { ?>
  166. <li class="item">
  167. <a target="_blank" href="https://twitter.com/share?url=<?php echo $link; ?>&amp;text=<?php echo $title; ?>">
  168. <?php echo Minz_Translate::t ('twitter'); ?>
  169. </a>
  170. </li>
  171. <?php } if ($google_plus) { ?>
  172. <li class="item">
  173. <a target="_blank" href="https://plus.google.com/share?url=<?php echo $link; ?>">
  174. <?php echo Minz_Translate::t ('g+'); ?>
  175. </a>
  176. </li>
  177. <?php } if ($facebook) { ?>
  178. <li class="item">
  179. <a target="_blank" href="https://www.facebook.com/sharer.php?u=<?php echo $link; ?>&amp;t=<?php echo $title; ?>">
  180. <?php echo Minz_Translate::t ('facebook'); ?>
  181. </a>
  182. </li>
  183. <?php } if ($email) { ?>
  184. <li class="item">
  185. <a href="mailto:?subject=<?php echo urldecode($title); ?>&amp;body=<?php echo $link; ?>">
  186. <?php echo Minz_Translate::t ('by_email'); ?>
  187. </a>
  188. </li>
  189. <?php } if ($print) { ?>
  190. <li class="item">
  191. <a href="#" class="print-article">
  192. <?php echo Minz_Translate::t ('print'); ?>
  193. </a>
  194. </li>
  195. <?php } ?>
  196. </ul>
  197. </div>
  198. <?php } ?>
  199. </li><?php
  200. $tags = $bottomline_tags ? $item->tags() : null;
  201. if (!empty($tags)) {
  202. ?><li class="item">
  203. <div class="dropdown">
  204. <div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div>
  205. <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php
  206. echo FreshRSS_Themes::icon('tag'), Minz_Translate::t ('related_tags');
  207. ?></a>
  208. <ul class="dropdown-menu">
  209. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  210. foreach($tags as $tag) {
  211. ?><li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li><?php
  212. } ?>
  213. </ul>
  214. </div>
  215. </li><?php
  216. }
  217. if ($bottomline_date) {
  218. ?><li class="item date"><?php echo $item->date (); ?></li><?php
  219. }
  220. if ($bottomline_link) {
  221. ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php
  222. } ?>
  223. </ul>
  224. </div>
  225. </div>
  226. <?php } ?>
  227. <?php $this->renderHelper('pagination'); ?>
  228. </div>
  229. <?php $this->partial ('nav_entries'); ?>
  230. <?php } else { ?>
  231. <div id="stream" class="alert alert-warn normal">
  232. <span class="alert-head"><?php echo Minz_Translate::t ('no_feed_to_display'); ?></span>
  233. <?php echo Minz_Translate::t ('think_to_add'); ?>
  234. </div>
  235. <?php } ?>