normal_view.phtml 9.8 KB

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