normal_view.phtml 9.6 KB

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