33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-12-23 03:19:00 +00:00

Removing unnecessary template overrides

Raising minimum Joomla version to 4.0
This commit is contained in:
Hannes Papenberg 2019-10-17 22:32:19 +02:00
parent 7a6c898975
commit 32eaf72bc4
8 changed files with 175 additions and 601 deletions

View File

@ -6,115 +6,140 @@
* @license GNU General Public License version 2 or later * @license GNU General Public License version 2 or later
*/ */
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text; use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route; use Joomla\CMS\Router\Route;
/** @var \PatchTester\View\Pulls\PullsHtmlView $this */ /** @var \PatchTester\View\Pulls\PullsHtmlView $this */
$searchToolsOptions = array(
'filtersHidden' => true,
'filterButton' => true,
'defaultLimit' => Factory::getApplication()->get('list_limit', 20),
'searchFieldSelector' => '#filter_search',
'selectorFieldName' => 'client_id',
'showSelector' => false,
'orderFieldSelector' => '#list_fullordering',
'showNoResults' => false,
'noResultsText' => '',
'formSelector' => '#adminForm',
);
HTMLHelper::_('behavior.core'); HTMLHelper::_('behavior.core');
HTMLHelper::_('bootstrap.tooltip'); HTMLHelper::_('searchtools.form', '#adminForm', $searchToolsOptions);
HTMLHelper::_('formbehavior.chosen', 'select');
HTMLHelper::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true)); HTMLHelper::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
HTMLHelper::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true)); HTMLHelper::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
$listOrder = $this->escape($this->state->get('list.fullordering', 'a.pull_id DESC')); $listOrder = $this->escape($this->state->get('list.fullordering', 'a.pull_id DESC'));
$listLimit = (int) ($this->state->get('list.limit'));
$filterApplied = $this->escape($this->state->get('filter.applied')); $filterApplied = $this->escape($this->state->get('filter.applied'));
$filterBranch = $this->escape($this->state->get('filter.branch')); $filterBranch = $this->escape($this->state->get('filter.branch'));
$filterRtc = $this->escape($this->state->get('filter.rtc')); $filterRtc = $this->escape($this->state->get('filter.rtc'));
?> ?>
<form action="<?php echo Route::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" <form action="<?php echo Route::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm">
id="adminForm" data-order="<?php echo $listOrder; ?>"> <div class="row">
<div id="j-main-container"> <div class="col-md-12">
<div id="filter-bar" class="btn-toolbar"> <div id="j-main-container" class="j-main-container">
<div class="filter-search btn-group pull-left"> <div class="js-stools" role="search">
<label for="filter_search" <div class="js-stools-container-bar">
class="element-invisible"><?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?></label> <div class="btn-toolbar">
<input type="text" name="filter_search" <div class="btn-group mr-2">
placeholder="<?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>" <div class="input-group">
id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" <label for="filter_search" class="sr-only">
title="<?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>"/> <?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>
</label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="form-control" placeholder="<?php echo Text::_('JSEARCH_FILTER'); ?>">
<div role="tooltip" id="filter_search-desc">
<?php echo $this->escape(Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION')); ?>
</div> </div>
<div class="btn-group pull-left hidden-phone"> <span class="input-group-append">
<button class="btn tip hasTooltip" type="submit" <button type="submit" class="btn btn-primary" aria-label="<?php echo Text::_('JSEARCH_FILTER_SUBMIT'); ?>">
title="<?php echo Text::_('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button> <span class="fa fa-search" aria-hidden="true"></span>
<button class="btn tip hasTooltip" type="button" </button>
onclick="document.getElementById('filter_search').value='';this.form.submit();" </span>
title="<?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?>"><i class="icon-remove"></i></button>
</div> </div>
<div class="btn-group pull-right hidden-phone">
<label for="limit"
class="element-invisible"><?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div> </div>
<div class="btn-group pull-right"> <div class="btn-group">
<label for="list_fullordering" <button type="button" class="btn btn-primary hasTooltip js-stools-btn-filter">
class="element-invisible"><?php echo Text::_('JGLOBAL_SORT_BY'); ?></label> <?php echo Text::_('JFILTER_OPTIONS'); ?>
<select name="list_fullordering" id="list_fullordering" class="input-medium" <span class="fa fa-angle-down" aria-hidden="true"></span>
onchange="this.form.submit();"> </button>
<button type="button" class="btn btn-primary js-stools-btn-clear mr-2">
<?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?>
</button>
</div>
<div class="ordering-select">
<div class="js-stools-field-list">
<select name="list_fullordering" id="list_fullordering" class="custom-select" onchange="this.form.submit()">
<option value=""><?php echo Text::_('JGLOBAL_SORT_BY'); ?></option> <option value=""><?php echo Text::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder); ?> <?php echo HTMLHelper::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder); ?>
</select> </select>
</div> </div>
<div class="btn-group pull-right"> <div class="js-stools-field-list">
<label for="filter_applied" <span class="sr-only">
class="element-invisible"><?php echo Text::_('JSEARCH_TOOLS_DESC'); ?></label> <label id="list_limit-lbl" for="list_limit">Select number of items per page.</label>
<select name="filter_applied" class="input-medium" onchange="this.form.submit();"> </span>
<select name="list_limit" id="list_limit" class="custom-select" onchange="this.form.submit()">
<?php echo HTMLHelper::_('select.options', $this->getLimitOptions(), 'value', 'text', $listLimit); ?>
</select>
</div>
</div>
</div>
</div>
<!-- Filters div -->
<div class="js-stools-container-filters clearfix">
<div class="js-stools-field-filter">
<select name="filter_applied" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option> <option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option>
<option value="yes"<?php if ($filterApplied == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></option> <option value="yes"<?php echo $filterApplied == 'yes' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></option>
<option value="no"<?php if ($filterApplied == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option> <option value="no"<?php echo $filterApplied == 'no' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option>
</select> </select>
</div> </div>
<div class="btn-group pull-right"> <div class="js-stools-field-filter">
<label for="filter_rtc" class="element-invisible"><?php echo Text::_('JSEARCH_TOOLS_DESC'); ?></label> <select name="filter_rtc" class="custom-select" onchange="this.form.submit();">
<select name="filter_rtc" class="input-medium" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></option> <option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></option>
<option value="yes"<?php if ($filterRtc == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_RTC'); ?></option> <option value="yes"<?php echo $filterRtc == 'yes' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_RTC'); ?></option>
<option value="no"<?php if ($filterRtc == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_RTC'); ?></option> <option value="no"<?php echo $filterRtc == 'no' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_RTC'); ?></option>
</select> </select>
</div> </div>
<div class="btn-group pull-right"> <div class="js-stools-field-filter">
<label for="filter_branch" <select name="filter_branch" class="custom-select" onchange="this.form.submit();">
class="element-invisible"><?php echo Text::_('JSEARCH_TOOLS_DESC'); ?></label>
<select name="filter_branch" class="input-medium" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option> <option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->branches, 'text', 'text', $filterBranch, false); ?> <?php echo HTMLHelper::_('select.options', $this->branches, 'text', 'text', $filterBranch, false); ?>
</select> </select>
</div> </div>
</div> </div>
</div>
<div id="j-main-container" class="j-main-container">
<?php if (empty($this->items)) : ?> <?php if (empty($this->items)) : ?>
<div class="alert alert-no-items"> <div class="alert alert-info">
<span class="fa fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div> </div>
<?php else : ?> <?php else : ?>
<table class="table table-striped"> <table class="table">
<caption id="captionTable" class="sr-only">
<?php echo Text::_('COM_PATCHTESTER_PULLS_TABLE_CAPTION'); ?>, <?php echo Text::_('JGLOBAL_SORTED_BY'); ?>
</caption>
<thead> <thead>
<tr> <tr>
<th width="5%" class="nowrap center"> <th scope="col" style="width:5%" class="text-center">
<?php echo Text::_('COM_PATCHTESTER_PULL_ID'); ?> <?php echo Text::_('COM_PATCHTESTER_PULL_ID'); ?>
</th> </th>
<th class="nowrap"> <th scope="col" style="min-width:100px">
<?php echo Text::_('JGLOBAL_TITLE'); ?> <?php echo Text::_('JGLOBAL_TITLE'); ?>
</th> </th>
<th width="8%" class="nowrap center hidden-phone"> <th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo Text::_('COM_PATCHTESTER_BRANCH'); ?> <?php echo Text::_('COM_PATCHTESTER_BRANCH'); ?>
</th> </th>
<th width="8%" class="nowrap center hidden-phone"> <th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo Text::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?> <?php echo Text::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th> </th>
<th width="8%" class="nowrap center"> <th scope="col" style="width:10%" class="text-center">
<?php echo Text::_('COM_PATCHTESTER_GITHUB'); ?>
</th>
<?php if ($this->trackerAlias !== false) : ?>
<th width="8%" class="nowrap center">
<?php echo Text::_('COM_PATCHTESTER_JISSUES'); ?>
</th>
<?php endif; ?>
<th width="10%" class="nowrap center">
<?php echo Text::_('JSTATUS'); ?> <?php echo Text::_('JSTATUS'); ?>
</th> </th>
<th width="15%" class="nowrap center"> <th scope="col" style="width:15%" class="text-center">
<?php echo Text::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?> <?php echo Text::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
</th> </th>
</tr> </tr>
@ -132,4 +157,7 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<input type="hidden" name="pull_id" id="pull_id" value="" /> <input type="hidden" name="pull_id" id="pull_id" value="" />
<?php echo HTMLHelper::_('form.token'); ?> <?php echo HTMLHelper::_('form.token'); ?>
</div> </div>
</div>
</div>
</div>
</form> </form>

View File

@ -14,62 +14,59 @@ foreach ($this->items as $i => $item) :
$status = ''; $status = '';
if ($item->applied) : if ($item->applied) :
$status = ' class="success"'; $status = ' class="table-active"';
endif; endif;
?> ?>
<tr<?php echo $status; ?>> <tr<?php echo $status; ?>>
<td class="center"> <th scope="row" class="text-center">
<?php echo $item->pull_id; ?> <?php echo $item->pull_id; ?>
</td> </th>
<td> <td>
<span class="hasTooltip" <span><?php echo $this->escape($item->title); ?></span>
title="<strong>Info</strong><br/><?php echo $this->escape($item->description); ?>"><?php echo $this->escape($item->title); ?></span> <div role="tooltip" id="tip<?php echo $i; ?>">
<?php if ($item->applied) : ?> <?php echo $this->escape($item->description); ?>
<div class="small">
<span class="label label-info"><?php echo Text::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
</div> </div>
<?php endif; ?> <div class="row">
</td> <div class="col-md-auto">
<td class="center hidden-phone"> <a class="badge badge-info" href="<?php echo $item->pull_url; ?>" target="_blank">
<?php echo $this->escape($item->branch); ?> <?php echo Text::_('COM_PATCHTESTER_VIEW_ON_GITHUB'); ?>
</td>
<td class="center hidden-phone">
<?php if ($item->is_rtc) : ?>
<span class="label label-success"><?php echo Text::_('JYES'); ?></span>
<?php else : ?>
<span class="label label-primary"><?php echo Text::_('JNO'); ?></span>
<?php endif; ?>
</td>
<td class="center">
<a class="btn btn-small btn-info" href="<?php echo $item->pull_url; ?>" target="_blank">
<span class="octicon octicon-mark-github"></span> <?php echo Text::_('COM_PATCHTESTER_GITHUB'); ?>
</a> </a>
</td> </div>
<?php if ($this->trackerAlias !== false) : ?> <div class="col-md-auto">
<td class="center"> <a class="badge badge-info"
<a class="btn btn-small btn-warning"
href="https://issues.joomla.org/tracker/<?php echo $this->trackerAlias; ?>/<?php echo $item->pull_id; ?>" href="https://issues.joomla.org/tracker/<?php echo $this->trackerAlias; ?>/<?php echo $item->pull_id; ?>"
target="_blank"> target="_blank">
<i class="icon-joomla"></i> <?php echo Text::_('COM_PATCHTESTER_JISSUE'); ?> <?php echo Text::_('COM_PATCHTESTER_VIEW_ON_JOOMLA_ISSUE_TRACKER'); ?>
</a> </a>
</td>
<?php endif; ?>
<td class="center">
<?php if ($item->applied) : ?>
<div>
<span class="label label-success"><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></span>
</div> </div>
<?php if ($item->applied) : ?>
<div class="col-md-auto">
<span class="badge badge-info"><?php echo Text::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
</div>
<?php endif; ?>
</div>
</td>
<td class="d-none d-md-table-cell text-center">
<?php echo $this->escape($item->branch); ?>
</td>
<td class="d-none d-md-table-cell text-center">
<?php if ($item->is_rtc) : ?>
<span class="badge badge-success"><?php echo Text::_('JYES'); ?></span>
<?php else : ?> <?php else : ?>
<span class="label"> <span class="badge badge-secondary"><?php echo Text::_('JNO'); ?></span>
<?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?>
</span>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="center"> <td class="text-center">
<?php if ($item->applied) : ?>
<span class="badge badge-success"><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></span>
<?php else : ?>
<span class="badge badge-secondary"><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<?php if ($item->applied) : ?> <?php if ($item->applied) : ?>
<button type="button" class="btn btn-sm btn-success submitPatch" <button type="button" class="btn btn-sm btn-success submitPatch"
data-task="revert-<?php echo (int) $item->applied; ?>"><?php echo Text::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button> data-task="revert-<?php echo (int) $item->applied; ?>"><?php echo Text::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button>
<br/>
<?php else : ?> <?php else : ?>
<button type="button" class="btn btn-sm btn-primary submitPatch" <button type="button" class="btn btn-sm btn-primary submitPatch"
data-task="apply-<?php echo (int) $item->pull_id; ?>"><?php echo Text::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button> data-task="apply-<?php echo (int) $item->pull_id; ?>"><?php echo Text::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<extension type="component" version="3.6" method="upgrade"> <extension type="component" version="4.0" method="upgrade">
<name>com_patchtester</name> <name>com_patchtester</name>
<author>Joomla! Project</author> <author>Joomla! Project</author>
<creationDate>17-October-2019</creationDate> <creationDate>17-October-2019</creationDate>
@ -15,7 +15,6 @@
<file driver="mysql" charset="utf8">install/sql/mysql/install.sql</file> <file driver="mysql" charset="utf8">install/sql/mysql/install.sql</file>
<file driver="postgresql" charset="utf8">install/sql/postgresql/install.sql</file> <file driver="postgresql" charset="utf8">install/sql/postgresql/install.sql</file>
<file driver="pgsql" charset="utf8">install/sql/postgresql/install.sql</file> <file driver="pgsql" charset="utf8">install/sql/postgresql/install.sql</file>
<file driver="sqlsrv" charset="utf8">install/sql/sqlsrv/install.sql</file>
</sql> </sql>
</install> </install>
<uninstall> <uninstall>
@ -23,7 +22,6 @@
<file driver="mysql" charset="utf8">install/sql/mysql/uninstall.sql</file> <file driver="mysql" charset="utf8">install/sql/mysql/uninstall.sql</file>
<file driver="postgresql" charset="utf8">install/sql/postgresql/uninstall.sql</file> <file driver="postgresql" charset="utf8">install/sql/postgresql/uninstall.sql</file>
<file driver="pgsql" charset="utf8">install/sql/postgresql/uninstall.sql</file> <file driver="pgsql" charset="utf8">install/sql/postgresql/uninstall.sql</file>
<file driver="sqlsrv" charset="utf8">install/sql/sqlsrv/uninstall.sql</file>
</sql> </sql>
</uninstall> </uninstall>
<update> <update>
@ -31,7 +29,6 @@
<schemapath type="mysql">install/sql/updates/mysql</schemapath> <schemapath type="mysql">install/sql/updates/mysql</schemapath>
<schemapath type="postgresql">install/sql/updates/postgresql</schemapath> <schemapath type="postgresql">install/sql/updates/postgresql</schemapath>
<schemapath type="pgsql">install/sql/updates/postgresql</schemapath> <schemapath type="pgsql">install/sql/updates/postgresql</schemapath>
<schemapath type="sqlsrv">install/sql/updates/sqlsrv</schemapath>
</schemas> </schemas>
</update> </update>
<media destination="com_patchtester" folder="media"> <media destination="com_patchtester" folder="media">

View File

@ -1,180 +0,0 @@
<?php
/**
* Patch testing component for the Joomla! CMS
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
use Joomla\CMS\Installer\InstallerScript;
use Joomla\CMS\Language\Text;
/**
* Installation class to perform additional changes during install/uninstall/update
*
* @since 2.0
*/
class Com_PatchtesterInstallerScript extends InstallerScript
{
/**
* Array of templates with supported overrides
*
* @var array
* @since 2.0
*/
protected $templateOverrides = array('atum');
/**
* Extension script constructor.
*
* @since 3.0.0
*/
public function __construct()
{
$this->minimumJoomla = '3.9';
$this->minimumPhp = JOOMLA_MINIMUM_PHP;
$this->deleteFiles = array(
'/administrator/components/com_patchtester/PatchTester/View/Pulls/tmpl/default_errors.php',
'/administrator/templates/hathor/html/com_patchtester/pulls/default.php',
'/administrator/templates/hathor/html/com_patchtester/pulls/default_items.php',
);
$this->deleteFolders = array(
'/administrator/components/com_patchtester/PatchTester/Table',
'/administrator/templates/hathor/html/com_patchtester/pulls',
'/administrator/templates/hathor/html/com_patchtester',
'/components/com_patchtester',
);
}
/**
* Function to perform changes during install
*
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
* @since 2.0
*/
public function install($parent)
{
$this->copyLayouts();
}
/**
* Function to perform changes during update
*
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
* @since 2.0
*/
public function update($parent)
{
$this->copyLayouts();
}
/**
* Function to perform changes during uninstall
*
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
* @since 2.0
*/
public function uninstall($parent)
{
// Initialize the error array
$errorTemplates = array();
// Loop the supported templates
foreach ($this->templateOverrides as $template)
{
// Set the file paths
$tmplRoot = JPATH_ADMINISTRATOR . '/templates/' . $template;
$overrideFolder = JPATH_ADMINISTRATOR . '/templates/' . $template . '/html/com_patchtester';
// Make sure the template is actually installed
if (is_dir($tmplRoot))
{
// If there's a failure in copying the overrides, log it to the error array
if (Folder::delete($overrideFolder))
{
$errorTemplates[] = ucfirst($template);
}
}
}
// If we couldn't remove any overrides, notify the user
if (count($errorTemplates) > 0)
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates)));
}
}
/**
* Function to perform changes during postflight
*
* @param string $type The action being performed
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
* @since 3.0.0
*/
public function postflight($type, $parent)
{
$this->removeFiles();
}
/**
* Function to copy layout overrides for core templates at install or update
*
* @return void
*
* @since 2.0
*/
private function copyLayouts()
{
// Initialize the error array
$errorTemplates = array();
// Loop the supported templates
foreach ($this->templateOverrides as $template)
{
// Set the file paths
$source = __DIR__ . '/' . $template;
$tmplRoot = JPATH_ADMINISTRATOR . '/templates/' . $template;
$destination = JPATH_ADMINISTRATOR . '/templates/' . $template . '/html/com_patchtester';
// Make sure the template is actually installed
if (is_dir($tmplRoot))
{
// If there's a failure in copying the overrides, log it to the error array
try
{
if (Folder::copy($source, $destination, '', true))
{
$errorTemplates[] = ucfirst($template);
}
}
catch (RuntimeException $exception)
{
$errorTemplates[] = ucfirst($template);
}
}
}
// If we couldn't remove any overrides, notify the user
if (count($errorTemplates) > 0)
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates)));
}
}
}

View File

@ -1,28 +0,0 @@
<?php
/**
* Patch testing component for the Joomla! CMS
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \PatchTester\View\DefaultHtmlView $this */
HTMLHelper::_('jquery.framework');
HTMLHelper::_('behavior.core');
HTMLHelper::_('script', 'com_patchtester/fetcher.js', array('version' => 'auto', 'relative' => true));
?>
<div id="patchtester-container">
<h1 id="patchtester-progress-header"><?php echo Text::_('COM_PATCHTESTER_FETCH_INITIALIZING'); ?></h1>
<p id="patchtester-progress-message"><?php echo Text::_('COM_PATCHTESTER_FETCH_INITIALIZING_DESCRIPTION'); ?></p>
<div id="progress" class="progress">
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated bg-success" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" role="progressbar"></div>
</div>
<input id="patchtester-token" type="hidden" name="<?php echo Factory::getSession()->getFormToken(); ?>" value="1" />
</div>

View File

@ -1,163 +0,0 @@
<?php
/**
* Patch testing component for the Joomla! CMS
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var \PatchTester\View\Pulls\PullsHtmlView $this */
$searchToolsOptions = array(
'filtersHidden' => true,
'filterButton' => true,
'defaultLimit' => Factory::getApplication()->get('list_limit', 20),
'searchFieldSelector' => '#filter_search',
'selectorFieldName' => 'client_id',
'showSelector' => false,
'orderFieldSelector' => '#list_fullordering',
'showNoResults' => false,
'noResultsText' => '',
'formSelector' => '#adminForm',
);
HTMLHelper::_('behavior.core');
HTMLHelper::_('searchtools.form', '#adminForm', $searchToolsOptions);
HTMLHelper::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
HTMLHelper::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
$listOrder = $this->escape($this->state->get('list.fullordering', 'a.pull_id DESC'));
$listLimit = (int) ($this->state->get('list.limit'));
$filterApplied = $this->escape($this->state->get('filter.applied'));
$filterBranch = $this->escape($this->state->get('filter.branch'));
$filterRtc = $this->escape($this->state->get('filter.rtc'));
?>
<form action="<?php echo Route::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm">
<div class="row">
<div class="col-md-12">
<div id="j-main-container" class="j-main-container">
<div class="js-stools" role="search">
<div class="js-stools-container-bar">
<div class="btn-toolbar">
<div class="btn-group mr-2">
<div class="input-group">
<label for="filter_search" class="sr-only">
<?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>
</label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="form-control" placeholder="<?php echo Text::_('JSEARCH_FILTER'); ?>">
<div role="tooltip" id="filter_search-desc">
<?php echo $this->escape(Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION')); ?>
</div>
<span class="input-group-append">
<button type="submit" class="btn btn-primary" aria-label="<?php echo Text::_('JSEARCH_FILTER_SUBMIT'); ?>">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</span>
</div>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary hasTooltip js-stools-btn-filter">
<?php echo Text::_('JFILTER_OPTIONS'); ?>
<span class="fa fa-angle-down" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-primary js-stools-btn-clear mr-2">
<?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?>
</button>
</div>
<div class="ordering-select">
<div class="js-stools-field-list">
<select name="list_fullordering" id="list_fullordering" class="custom-select" onchange="this.form.submit()">
<option value=""><?php echo Text::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder); ?>
</select>
</div>
<div class="js-stools-field-list">
<span class="sr-only">
<label id="list_limit-lbl" for="list_limit">Select number of items per page.</label>
</span>
<select name="list_limit" id="list_limit" class="custom-select" onchange="this.form.submit()">
<?php echo HTMLHelper::_('select.options', $this->getLimitOptions(), 'value', 'text', $listLimit); ?>
</select>
</div>
</div>
</div>
</div>
<!-- Filters div -->
<div class="js-stools-container-filters clearfix">
<div class="js-stools-field-filter">
<select name="filter_applied" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option>
<option value="yes"<?php echo $filterApplied == 'yes' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></option>
<option value="no"<?php echo $filterApplied == 'no' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option>
</select>
</div>
<div class="js-stools-field-filter">
<select name="filter_rtc" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></option>
<option value="yes"<?php echo $filterRtc == 'yes' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_RTC'); ?></option>
<option value="no"<?php echo $filterRtc == 'no' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_RTC'); ?></option>
</select>
</div>
<div class="js-stools-field-filter">
<select name="filter_branch" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->branches, 'text', 'text', $filterBranch, false); ?>
</select>
</div>
</div>
</div>
<div id="j-main-container" class="j-main-container">
<?php if (empty($this->items)) : ?>
<div class="alert alert-info">
<span class="fa fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table">
<caption id="captionTable" class="sr-only">
<?php echo Text::_('COM_PATCHTESTER_PULLS_TABLE_CAPTION'); ?>, <?php echo Text::_('JGLOBAL_SORTED_BY'); ?>
</caption>
<thead>
<tr>
<th scope="col" style="width:5%" class="text-center">
<?php echo Text::_('COM_PATCHTESTER_PULL_ID'); ?>
</th>
<th scope="col" style="min-width:100px">
<?php echo Text::_('JGLOBAL_TITLE'); ?>
</th>
<th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo Text::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo Text::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>
<th scope="col" style="width:10%" class="text-center">
<?php echo Text::_('JSTATUS'); ?>
</th>
<th scope="col" style="width:15%" class="text-center">
<?php echo Text::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
</th>
</tr>
</thead>
<tbody>
<?php echo $this->loadTemplate('items'); ?>
</tbody>
</table>
<?php endif; ?>
<?php echo $this->pagination->getListFooter(); ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="pull_id" id="pull_id" value="" />
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</div>
</div>
</div>
</form>

View File

@ -1,76 +0,0 @@
<?php
/**
* Patch testing component for the Joomla! CMS
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Language\Text;
/** @var \PatchTester\View\DefaultHtmlView $this */
foreach ($this->items as $i => $item) :
$status = '';
if ($item->applied) :
$status = ' class="table-active"';
endif;
?>
<tr<?php echo $status; ?>>
<th scope="row" class="text-center">
<?php echo $item->pull_id; ?>
</th>
<td>
<span><?php echo $this->escape($item->title); ?></span>
<div role="tooltip" id="tip<?php echo $i; ?>">
<?php echo $this->escape($item->description); ?>
</div>
<div class="row">
<div class="col-md-auto">
<a class="badge badge-info" href="<?php echo $item->pull_url; ?>" target="_blank">
<?php echo Text::_('COM_PATCHTESTER_VIEW_ON_GITHUB'); ?>
</a>
</div>
<div class="col-md-auto">
<a class="badge badge-info"
href="https://issues.joomla.org/tracker/<?php echo $this->trackerAlias; ?>/<?php echo $item->pull_id; ?>"
target="_blank">
<?php echo Text::_('COM_PATCHTESTER_VIEW_ON_JOOMLA_ISSUE_TRACKER'); ?>
</a>
</div>
<?php if ($item->applied) : ?>
<div class="col-md-auto">
<span class="badge badge-info"><?php echo Text::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
</div>
<?php endif; ?>
</div>
</td>
<td class="d-none d-md-table-cell text-center">
<?php echo $this->escape($item->branch); ?>
</td>
<td class="d-none d-md-table-cell text-center">
<?php if ($item->is_rtc) : ?>
<span class="badge badge-success"><?php echo Text::_('JYES'); ?></span>
<?php else : ?>
<span class="badge badge-secondary"><?php echo Text::_('JNO'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<?php if ($item->applied) : ?>
<span class="badge badge-success"><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></span>
<?php else : ?>
<span class="badge badge-secondary"><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<?php if ($item->applied) : ?>
<button type="button" class="btn btn-sm btn-success submitPatch"
data-task="revert-<?php echo (int) $item->applied; ?>"><?php echo Text::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button>
<?php else : ?>
<button type="button" class="btn btn-sm btn-primary submitPatch"
data-task="apply-<?php echo (int) $item->pull_id; ?>"><?php echo Text::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button>
<?php endif; ?>
</td>
</tr>
<?php endforeach;

View File

@ -8,7 +8,6 @@ cp -r administrator/templates/atum/html/com_patchtester build/packaging/atum
cp -r media/com_patchtester build/packaging/media cp -r media/com_patchtester build/packaging/media
rm -rf build/packaging/admin/backups/*.txt rm -rf build/packaging/admin/backups/*.txt
mv build/packaging/admin/patchtester.xml build/packaging/patchtester.xml mv build/packaging/admin/patchtester.xml build/packaging/patchtester.xml
mv build/packaging/admin/script.php build/packaging/script.php
cd build/packaging cd build/packaging
tar jcf ../packages/com_patchtester.tar.bz2 . tar jcf ../packages/com_patchtester.tar.bz2 .
tar zcf ../packages/com_patchtester.tar.gz . tar zcf ../packages/com_patchtester.tar.gz .