30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-17 13:32:21 +00:00

Remove access check because it is handled inside modal already

This commit is contained in:
Tuan Pham Ngoc 2021-08-14 17:40:26 +07:00
parent 19c67005f0
commit a25ea580fb

View File

@ -70,134 +70,125 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<?php else : ?> <?php else : ?>
<ul class="category list-unstyled"> <ul class="category list-unstyled">
<?php foreach ($this->items as $i => $item) : ?> <?php foreach ($this->items as $i => $item) : ?>
<?php
// Shouldn't this be only for users with admin rights?
// @ToDo: what is the difference -class system-unbublished?
if ($item->state == 0) : ?>
<li class="system-unpublished list-group mt-3">
<?php else : ?>
<li class="list-group mt-3">
<?php endif; ?>
<?php // Shouldn't this be checked in the model?The pagination will be affected <?php if ($canEdit) : ?>
if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?> <div class="icons list-group-item">
<?php echo HTMLHelper::_('weblinkicon.edit', $item, $this->params); ?>
</div>
<?php endif; ?>
<?php <div class="list-title list-group-item ">
// Shouldn't this be only for users with admin rights? <?php if (!$this->params->get('icons', 1)) : ?>
// @ToDo: what is the difference -class system-unbublished? <?php echo Text::_('COM_WEBLINKS_LINK'); ?>
if ($item->state == 0) : ?> <?php else : ?>
<li class="system-unpublished list-group mt-3"> <?php // ToDo css icons as variables ?>
<?php else : ?> <?php if (!$this->params->get('link_icons')) : ?>
<li class="list-group mt-3"> <span class="icon-globe" aria-hidden="true"></span>
<?php endif; ?> <?php else: ?>
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . Text::_('COM_WEBLINKS_LINK') . '" />'; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($canEdit) : ?> <?php // Compute the correct link ?>
<div class="icons list-group-item"> <?php $menuclass = 'category' . $this->pageclass_sfx; ?>
<?php echo HTMLHelper::_('weblinkicon.edit', $item, $this->params); ?> <?php $link = $item->link; ?>
</div> <?php $width = $item->params->get('width', 600); ?>
<?php endif; ?> <?php $height = $item->params->get('height', 500); ?>
<?php if ($item->state == 0) : ?>
<span class="badge bg-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<div class="list-title list-group-item "> <?php
<?php if (!$this->params->get('icons', 1)) : ?> switch ($item->params->get('target', $this->params->get('target')))
<?php echo Text::_('COM_WEBLINKS_LINK'); ?> {
<?php else : ?> case 1:
<?php // ToDo css icons as variables ?> // Open in a new window
<?php if (!$this->params->get('link_icons')) : ?> echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
<span class="icon-globe" aria-hidden="true"></span> $this->escape($item->title) . '</a>';
<?php else: ?> break;
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . Text::_('COM_WEBLINKS_LINK') . '" />'; ?>
<?php endif; ?>
<?php endif; ?>
<?php // Compute the correct link ?> case 2:
<?php $menuclass = 'category' . $this->pageclass_sfx; ?> // Open in a popup window
<?php $link = $item->link; ?> $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
<?php $width = $item->params->get('width'); ?> echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
<?php $height = $item->params->get('height'); ?> $this->escape($item->title) . '</a>';
<?php if ($width == null || $height == null) : ?> break;
<?php $width = 600; ?> case 3:
<?php $height = 500; ?> // Open in a modal window
<?php endif; ?> HTMLHelper::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
$this->escape($item->title) . ' </a>';
break;
<?php if ($item->state == 0) : ?> default:
<span class="badge bg-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span> // Open in parent window
<?php endif; ?> echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . ' </a>';
break;
}
?>
<?php if ($this->params->get('show_link_hits', 1)) : ?>
<div class="list-hits badge bg-info float-end">
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</div>
<?php endif; ?>
<?php <?php if ($this->params->get('show_tags', 1) && !empty($item->tags->itemTags)) : ?>
switch ($item->params->get('target', $this->params->get('target'))) <div class="mt-2 mb-2">
{ <?php echo LayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>
case 1: </div>
// Open in a new window <?php endif; ?>
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . '</a>';
break;
case 2: <?php if (($this->params->get('show_link_description')) && ($item->description != '')) : ?>
// Open in a popup window <div class="mt-2 mb-2">
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . ''; <?php $images = json_decode($item->images); ?>
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" . <?php if (!empty($images->image_first)) : ?>
$this->escape($item->title) . '</a>'; <?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
break; <?php $img = HTMLHelper::cleanImageURL($images->image_first); ?>
case 3: <?php $alt = empty($images->image_first_alt) && empty($images->image_first_alt_empty)
// Open in a modal window ? ''
HTMLHelper::_('behavior.modal', 'a.modal'); : 'alt="' . htmlspecialchars($images->image_first_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' . <figure class="item-image">
$this->escape($item->title) . ' </a>'; <img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
break; <?php echo $alt; ?> itemprop="thumbnail" />
<?php if (!empty($images->image_first_caption)) : ?>
<figcaption class="caption"><?php echo htmlspecialchars($images->image_first_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
default: <?php if (!empty($images->image_second)) : ?>
// Open in parent window <?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' . <?php $img = HTMLHelper::cleanImageURL($images->image_second); ?>
$this->escape($item->title) . ' </a>'; <?php $alt = empty($images->image_second_alt) && empty($images->image_second_alt_empty)
break; ? ''
} : 'alt="' . htmlspecialchars($images->image_second_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
?> <figure class="item-image">
<?php if ($this->params->get('show_link_hits', 1)) : ?> <img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
<div class="list-hits badge bg-info float-end"> <?php echo $alt; ?> itemprop="thumbnail" />
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?> <?php if (!empty($images->image_second_caption)) : ?>
</div> <figcaption class="caption"><?php echo htmlspecialchars($images->image_second_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
<?php endif; ?> <?php endif; ?>
</figure>
<?php endif; ?>
<?php if ($this->params->get('show_tags', 1) && !empty($item->tags->itemTags)) : ?> <?php echo $item->description; ?>
<div class="mt-2 mb-2">
<?php echo LayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>
</div>
<?php endif; ?>
<?php if (($this->params->get('show_link_description')) && ($item->description != '')) : ?> </div>
<div class="mt-2 mb-2"> <?php endif; ?>
<?php $images = json_decode($item->images); ?>
<?php if (!empty($images->image_first)) : ?>
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
<?php $img = HTMLHelper::cleanImageURL($images->image_first); ?>
<?php $alt = empty($images->image_first_alt) && empty($images->image_first_alt_empty)
? ''
: 'alt="' . htmlspecialchars($images->image_first_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
<figure class="item-image">
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo $alt; ?> itemprop="thumbnail" />
<?php if (!empty($images->image_first_caption)) : ?>
<figcaption class="caption"><?php echo htmlspecialchars($images->image_first_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<?php if (!empty($images->image_second)) : ?> </div>
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
<?php $img = HTMLHelper::cleanImageURL($images->image_second); ?>
<?php $alt = empty($images->image_second_alt) && empty($images->image_second_alt_empty)
? ''
: 'alt="' . htmlspecialchars($images->image_second_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
<figure class="item-image">
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo $alt; ?> itemprop="thumbnail" />
<?php if (!empty($images->image_second_caption)) : ?>
<figcaption class="caption"><?php echo htmlspecialchars($images->image_second_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<?php echo $item->description; ?> </li>
</div>
<?php endif; ?>
</div>
</li>
<?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>