254 lines
9.8 KiB
PHP
254 lines
9.8 KiB
PHP
<?php
|
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
|
Agence Agerix
|
|
/-------------------------------------------------------------------------------------------------------/
|
|
|
|
@version 1.x.x
|
|
@build 2nd June, 2022
|
|
@created 12th December, 2020
|
|
@package Extension Distributor
|
|
@subpackage default_body.php
|
|
@author Emmanuel Danan <https://agerix.fr>
|
|
@copyright Copyright (C) 2021. All Rights Reserved.
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
|
|
|
/------------------------------------------------------------------------------------------------------*/
|
|
|
|
// No direct access to this file
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
$edit = "index.php?option=com_extensiondistributor&view=packages&task=package.edit";
|
|
|
|
?>
|
|
<?php foreach ($this->items as $i => $item): ?>
|
|
<?php
|
|
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
|
|
$userChkOut = JFactory::getUser($item->checked_out);
|
|
$canDo = ExtensiondistributorHelper::getActions('package',$item,'packages');
|
|
?>
|
|
<tr class="row<?php echo $i % 2; ?>">
|
|
<td class="order nowrap center hidden-phone">
|
|
<?php if ($canDo->get('core.edit.state')): ?>
|
|
<?php
|
|
$iconClass = '';
|
|
if (!$this->saveOrder)
|
|
{
|
|
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
|
}
|
|
?>
|
|
<span class="sortable-handler<?php echo $iconClass; ?>">
|
|
<i class="icon-menu"></i>
|
|
</span>
|
|
<?php if ($this->saveOrder) : ?>
|
|
<input type="text" style="display:none" name="order[]" size="5"
|
|
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
⋮
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="nowrap center">
|
|
<?php if ($canDo->get('core.edit')): ?>
|
|
<?php if ($item->checked_out) : ?>
|
|
<?php if ($canCheckin) : ?>
|
|
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
|
<?php else: ?>
|
|
□
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
□
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="nowrap">
|
|
<div>
|
|
<?php if ($canDo->get('core.edit')): ?>
|
|
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->name); ?></a>
|
|
<?php if ($item->checked_out): ?>
|
|
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'packages.', $canCheckin); ?>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<?php echo $this->escape($item->name); ?>
|
|
<?php endif; ?><?php if ($item->catid) : ?><br /><small>Category:
|
|
<?php if ($this->user->authorise('core.edit', 'com_extensiondistributor.extension.category.' . (int)$item->catid)): ?>
|
|
<a href="index.php?option=com_categories&task=category.edit&id=<?php echo (int)$item->catid; ?>&extension=com_extensiondistributor"><?php echo $this->escape($item->category_title); ?></a>
|
|
<?php else: ?>
|
|
<?php echo $this->escape($item->category_title); ?>
|
|
<?php endif; ?></small><?php endif; ?>
|
|
</div>
|
|
</td>
|
|
<td class="hidden-phone">
|
|
<?php echo $this->escape($item->description); ?>
|
|
</td>
|
|
<td class="hidden-phone">
|
|
<div><?php
|
|
$content = ExtensiondistributorHelper::getPackageContent($item->id);
|
|
$releases = ExtensiondistributorHelper::getReleases($item->id,'package');
|
|
$latest = null;
|
|
if (ExtensiondistributorHelper::checkArray($releases)) {
|
|
$latest = $releases[0];
|
|
unset($releases[0]);
|
|
}
|
|
$lists = ExtensiondistributorHelper::getApplicationLists();
|
|
$html = array();
|
|
foreach ($content['extensions'] as $extension) {
|
|
$html[] = ExtensiondistributorHelper::createBadge(
|
|
$extension['details']->id,
|
|
$extension['details']->name,
|
|
$extension['details']->type,
|
|
$extension['details']->group,
|
|
$extension['details']->client
|
|
);
|
|
}
|
|
echo implode(' ',$html);
|
|
?>
|
|
|
|
</div>
|
|
</td>
|
|
<td class="hidden-phone">
|
|
<div><div class="nowrap">
|
|
<?php if ($latest && $latest->file != '-1') : ?>
|
|
<?php
|
|
$componentVersion = '';
|
|
$componentDate = '';
|
|
$notice = '';
|
|
foreach ($content['extensions'] as $element) {
|
|
if ($element['details']->type === 'component') {
|
|
$componentVersion = $element['release']->version_number;
|
|
$componentDate = $element['release']->release_date;
|
|
}
|
|
}
|
|
if ($componentVersion > $item->version_number) {
|
|
$notice = ' <span style="color: #bd362f;" class="hasTooltip icon-warning" title="The latest version of the component included in your package is '.$componentVersion.'"></span>';
|
|
} elseif ($componentVersion < $item->version_number) {
|
|
$notice = ' <span style="color: #f89406;" class="hasTooltip icon-warning" title="The latest version of the component included in your package is '.$componentVersion.'"></span>';
|
|
}
|
|
?>
|
|
<span class="icon-out-3"></span>
|
|
<?php echo $this->escape($item->version_number); ?><?= $notice ?><br>
|
|
<span class="icon-calendar"></span> <?= JHtml::date($item->release_date, 'DATE_FORMAT_FILTER_DATE'); ?>
|
|
<?php else : ?>
|
|
<span class="label label-important">N/A</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
</div>
|
|
</td>
|
|
<td class="hidden-phone">
|
|
<div><div class="nowrap">
|
|
<?php
|
|
$stability = $lists['stability'];
|
|
?>
|
|
<?php if ($latest && $latest->file != '-1') : ?>
|
|
<span class="btn-group">
|
|
<a
|
|
class="btn btn-mini hasTooltip"
|
|
title="Download the latest release (v<?= $latest->version_number ?>)"
|
|
href="index.php?option=com_extensiondistributor&task=extension.download&package=<?= $item->id ?>&<?= JSession::getFormToken() ?>=1"
|
|
>
|
|
<span class="icon-download"></span> Download
|
|
</a>
|
|
<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
|
|
<span class="caret" style="margin-bottom: 0;"></span>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<?php if (ExtensiondistributorHelper::checkArray($releases)) : ?>
|
|
<?php foreach ($releases as $r) : ?>
|
|
<li>
|
|
<a href="index.php?option=com_extensiondistributor&task=extension.download&package=<?= $item->id ?>&release=<?= $r->id ?>&<?= JSession::getFormToken() ?>=1">
|
|
<?= $r->version_number ?> <span class="label label-<?= $stability[$r->stability]['color'] ?>"><?= $stability[$r->stability]['label'] ?></span>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<li><a>No previous release available</a></li>
|
|
<?php endif; ?>
|
|
</ul>
|
|
</span>
|
|
<?php if ($item->update) : ?>
|
|
<?php
|
|
global $cparams;
|
|
$update_path = JPath::clean(JPATH_SITE.'/'.$cparams->get('updates_directory','updates').'/');
|
|
$update_file = $update_path . $item->update;
|
|
$update_link = JUri::root().$cparams->get('updates_directory','updates').'/'.$item->update;
|
|
$existsXml = JFile::exists($update_file);
|
|
$downloadXml = '#';
|
|
$color = 'danger';
|
|
$tooltipCopy = 'No update file available';
|
|
$tooltipDownload = 'No update file available';
|
|
$tooltipUpload = 'No update file available<br>Click to create a new one';
|
|
$iconUpload = 'upload';
|
|
if ($existsXml) {
|
|
$tooltipCopy = 'Copy the update URL';
|
|
$tooltipDownload = 'Download the XML update file';
|
|
$tooltipUpload = 'XML file is not up to date<br>Click to update it';
|
|
$downloadXml = 'index.php?option=com_extensiondistributor&task=extension.download&package='.$item->id.'&'.JSession::getFormToken().'=1';
|
|
$versions = ExtensiondistributorHelper::getXmlVersions($update_file);
|
|
$color = 'warning';
|
|
if (in_array($item->version_number, $versions)) {
|
|
$tooltipUpload = 'XML file is up to date<br>Click to force refresh';
|
|
$color = 'success';
|
|
$iconUpload = 'loop';
|
|
}
|
|
}
|
|
?>
|
|
<span class="btn-group">
|
|
<a
|
|
class="btn btn-mini hasTooltip<?= $existsXml ? ' copy-xml' : ' disabled' ?>"
|
|
title="<?= $tooltipCopy ?>"
|
|
data-clipboard-text="<?= $update_link ?>"
|
|
>
|
|
<span class="icon-copy"></span>
|
|
</a>
|
|
<a
|
|
class="btn btn-mini hasTooltip<?= $existsXml ? '' : ' disabled' ?>"
|
|
title="<?= $tooltipDownload ?>"
|
|
href="<?= $downloadXml ?>"
|
|
>
|
|
<span class="icon-download"></span>
|
|
</a>
|
|
<a
|
|
class="btn btn-<?= $color ?> btn-mini hasTooltip"
|
|
title="<?= $tooltipUpload ?>"
|
|
href="index.php?option=com_extensiondistributor&task=package.createXml&release=<?= $latest->id ?>&return=<?= base64_encode(JUri::getInstance()->toString()) ?>&<?= JSession::getFormToken() ?>=1"
|
|
>
|
|
<span class="icon-<?= $iconUpload ?>"></span>
|
|
</a>
|
|
</span>
|
|
<?php endif; ?>
|
|
<?php else : ?>
|
|
<span class="label label-important">N/A</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
</div>
|
|
</td>
|
|
<td class="hidden-phone">
|
|
<?php echo JText::_($item->free); ?>
|
|
</td>
|
|
<td class="center">
|
|
<?php if ($canDo->get('core.edit.state')) : ?>
|
|
<?php if ($item->checked_out) : ?>
|
|
<?php if ($canCheckin) : ?>
|
|
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'packages.', true, 'cb'); ?>
|
|
<?php else: ?>
|
|
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'packages.', false, 'cb'); ?>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'packages.', true, 'cb'); ?>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'packages.', false, 'cb'); ?>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="nowrap center hidden-phone">
|
|
<?php echo $item->id; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|