miniflux-legacy/templates/show_item.php
Mathias Kresin 3dae99ac27 remove multiple definition of item id
The item id exists as data attribute or as element.id postfix on multiple
elements in an article.

The basic idea is to traverse the DOM tree - starting from the event firing
element - in reverse order till an article element is found.

This article element is passed to the JavaScript functions. These JavaScript
functions are getting the elements which they want to manipulate starting from
the article utilizing the JavaScript querySelector function.

The bootstrap themes had a conflicting and unused class style definied, which is
removed by now.
2014-11-20 10:43:29 +01:00

124 lines
5.4 KiB
PHP

<?php if (empty($item)): ?>
<p class="alert alert-info"><?= t('Item not found') ?></p>
<?php else: ?>
<article
class="item"
id="current-item"
data-item-id="<?= $item['id'] ?>"
data-item-status="<?= $item['status'] ?>"
data-item-bookmark="<?= $item['bookmark'] ?>"
data-item-page="<?= $menu ?>"
>
<?php if (isset($item_nav)): ?>
<nav class="top">
<span class="nav-left">
<?php if ($item_nav['previous']): ?>
<a href="?action=show&amp;menu=<?= $menu ?>&amp;id=<?= $item_nav['previous']['id'] ?>" id="previous-item" title="<?= Helper\escape($item_nav['previous']['title']) ?>">« <?= t('Previous') ?></a>
<?php else: ?>
« <?= t('Previous') ?>
<?php endif ?>
</span>
<span class="nav-right">
<?php if ($item_nav['next']): ?>
<a href="?action=show&amp;menu=<?= $menu ?>&amp;id=<?= $item_nav['next']['id'] ?>" id="next-item" title="<?= Helper\escape($item_nav['next']['title']) ?>"><?= t('Next') ?> »</a>
<?php else: ?>
<?= t('Next') ?> »
<?php endif ?>
</span>
</nav>
<?php endif ?>
<h1 <?= Helper\isRTL($item + array('rtl' => $feed['rtl'])) ? 'dir="rtl"' : '' ?>>
<a href="<?= $item['url'] ?>" rel="noreferrer" target="_blank" class="original"><?= Helper\escape($item['title']) ?></a>
</h1>
<ul class="item-infos">
<li>
<?php if ($item['bookmark']): ?>
<a
class="bookmark-icon"
href="?action=bookmark&amp;value=0&amp;id=<?= $item['id'] ?>&amp;source=show&amp;menu=<?= $menu ?>"
title="<?= t('remove bookmark') ?>"
data-action="bookmark"
></a>
<?php else: ?>
<a
class="bookmark-icon"
href="?action=bookmark&amp;value=1&amp;id=<?= $item['id'] ?>&amp;source=show&amp;menu=<?= $menu ?>"
title="<?= t('bookmark') ?>"
data-action="bookmark"
></a>
<?php endif ?>
</li>
<li>
<a href="?action=feed-items&amp;feed_id=<?= $feed['id'] ?>"><?= Helper\escape($feed['title']) ?></a>
</li>
<li class="hide-mobile">
<span title="<?= dt('%e %B %Y %k:%M', $item['updated']) ?>"><?= Helper\relative_time($item['updated']) ?></span>
</li>
<?php if ($item['enclosure']): ?>
<li>
<a href="<?= $item['enclosure'] ?>" rel="noreferrer" target="_blank"><?= t('attachment') ?></a>
</li>
<?php endif ?>
<li>
<a
href="?action=mark-item-unread&amp;id=<?= $item['id'] ?>&amp;redirect=unread"
><?= t('mark as unread') ?></a>
</li>
<li class="hide-mobile">
<span id="download-item"
data-failure-message="<?= t('unable to fetch content') ?>"
data-before-message="<?= t('in progress...') ?>"
data-after-message="<?= t('content downloaded') ?>">
<a href="#" data-action="download-item"><?= t('download content') ?></a>
</span>
</li>
</ul>
<div id="item-content" <?= Helper\isRTL($item + array('rtl' => $feed['rtl'])) ? 'dir="rtl"' : '' ?>>
<?php if ($item['enclosure']): ?>
<div id="item-content-enclosure">
<?php if (strpos($item['enclosure_type'], 'audio') !== false): ?>
<audio controls>
<source src="<?= $item['enclosure'] ?>" type="<?= $item['enclosure_type'] ?>">
</audio>
<?php elseif (strpos($item['enclosure_type'], 'video') !== false): ?>
<video controls>
<source src="<?= $item['enclosure'] ?>" type="<?= $item['enclosure_type'] ?>">
</video>
<?php elseif (strpos($item['enclosure_type'], 'image') !== false): ?>
<img src="<?= $item['enclosure'] ?>" alt="enclosure"/>
<?php endif ?>
</div>
<?php endif ?>
<?= $item['content'] ?>
</div>
<?php if (isset($item_nav)): ?>
<nav class="bottom">
<span class="nav-left">
<?php if ($item_nav['previous']): ?>
<a href="?action=show&amp;menu=<?= $menu ?>&amp;id=<?= $item_nav['previous']['id'] ?>" id="previous-item" title="<?= Helper\escape($item_nav['previous']['title']) ?>">« <?= t('Previous') ?></a>
<?php else: ?>
« <?= t('Previous') ?>
<?php endif ?>
</span>
<span class="nav-right">
<?php if ($item_nav['next']): ?>
<a href="?action=show&amp;menu=<?= $menu ?>&amp;id=<?= $item_nav['next']['id'] ?>" id="next-item" title="<?= Helper\escape($item_nav['next']['title']) ?>"><?= t('Next') ?> »</a>
<?php else: ?>
<?= t('Next') ?> »
<?php endif ?>
</span>
</nav>
<?php endif ?>
</article>
<?php endif ?>