Skip to content

Commit 92989cd

Browse files
author
Michael Babker
committed
Miscellaneous tweaks
- Updated README - Layouts for Hathor - Admin housecleaning on the repo
1 parent 2262df4 commit 92989cd

File tree

13 files changed

+335
-63
lines changed

13 files changed

+335
-63
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ Patch Tester
33

44
Easily apply changes from pull requests.
55

6+
To install the latest released version:
7+
1. Click on the releases link just above the file listing
8+
2. Click on the button to download either the .tar.bz2, .tar.gz, or .zip packages
9+
3. Log into your site's administrator section, go to Extension Manager > Install, and install the extension
10+
11+
To use the latest code from this GitHub repo:
612
1. Download files into Joomla install.
7-
2. Perform discover install.
8-
3. Go to Component Options and set organization name and repository name
13+
2. Log into your site's administrator section, go to Extension Manager > Discover, click the "Discover" button, and install the extension.
914

1015
Click Apply Patch to apply the proposed changes from the pull request.
1116
Click Revert Patch to revert an applied patch.

administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ COM_PATCHTESTER_FIELD_CACHE_LABEL="Enable Caching"
1818
COM_PATCHTESTER_FIELD_CACHE_LIFETIME_DESC="The amount of time (in minutes) before the cache is reset"
1919
COM_PATCHTESTER_FIELD_CACHE_LIFETIME_LABEL="Cache Lifetime"
2020
COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL="GitHub Account Password"
21-
COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC="Password for the account entered in the "_QQ_"GitHub Account"_QQ_" field"
21+
COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC="Password for the account entered in the "_QQ_"GitHub Account"_QQ_" field. Note that accounts using Two Factor Authentication will not work with this component."
2222
COM_PATCHTESTER_FIELD_GH_USER_LABEL="GitHub Account"
2323
COM_PATCHTESTER_FIELD_GH_USER_DESC="Name of account on GitHub of which to authenticate to the API with"
2424
COM_PATCHTESTER_FIELD_ORG_LABEL="GitHub Username"
@@ -44,5 +44,4 @@ COM_PATCHTESTER_REVERT_OK="Patch successfully reverted"
4444
COM_PATCHTESTER_REVERT_PATCH="Revert Patch"
4545
COM_PATCHTESTER_SEARCH_IN_PULL_ID="Pull ID"
4646
COM_PATCHTESTER_SEARCH_IN_TITLE="Pull title"
47-
COM_PATCHTESTER_SORT="Sort:"
4847
COM_PATCHTESTER_TEST_THIS_PATCH="Test This Patch"

administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.sys.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
; Note : All ini files need to be saved as UTF-8
55

66
COM_PATCHTESTER="Joomla! Patch Tester"
7+
COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES="Could not install the template overrides for the following templates: %s"
8+
COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES="Could not remove the template overrides for the following templates: %s"
9+
COM_PATCHTESTER_ERROR_INSTALL_JVERSION="The Joomla! Patch Tester requires version %s or newer of the CMS"
710
COM_PATCHTESTER_XML_DESCRIPTION="Component for pull request management testing"
811

administrator/components/com_patchtester/patchtester.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<authorUrl>http://www.joomla.org</authorUrl>
1010
<version>2.0.0.alpha</version>
1111
<description>COM_PATCHTESTER_XML_DESCRIPTION</description>
12+
<scriptfile>script.php</scriptfile>
1213
<install>
1314
<sql>
1415
<file driver="mysql" charset="utf8">install/sql/mysql/install.sql</file>
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
<?php
2+
/**
3+
* @package PatchTester
4+
*
5+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later
7+
*/
8+
9+
/**
10+
* Installation class to perform additional changes during install/uninstall/update
11+
*
12+
* @package Patchtester
13+
* @since 2.0
14+
*/
15+
class Com_PatchtesterInstallerScript
16+
{
17+
/**
18+
* Minimum supported version of the CMS
19+
*
20+
* @var string
21+
* @since 2.0
22+
*/
23+
protected $minCmsVersion = '3.2.0';
24+
25+
/**
26+
* Array of templates with supported overrides
27+
*
28+
* @var array
29+
* @since 2.0
30+
*/
31+
protected $templateOverrides = array('hathor');
32+
33+
/**
34+
* Function to act prior to installation process begins
35+
*
36+
* @param string $type The action being performed
37+
* @param JInstallerComponent $parent The class calling this method
38+
*
39+
* @return boolean True on success
40+
*
41+
* @since 2.0
42+
*/
43+
public function preflight($type, $parent)
44+
{
45+
// After releasing CMS 3.2.0, enable the below check
46+
return true;
47+
48+
if (version_compare(JVERSION, $this->minCmsVersion, 'lt'))
49+
{
50+
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_ERROR_INSTALL_JVERSION', $this->minCmsVersion));
51+
52+
return false;
53+
}
54+
55+
return true;
56+
}
57+
58+
/**
59+
* Function to perform changes during install
60+
*
61+
* @param JInstallerComponent $parent The class calling this method
62+
*
63+
* @return void
64+
*
65+
* @since 2.0
66+
*/
67+
public function install($parent)
68+
{
69+
$this->copyLayouts();
70+
}
71+
72+
/**
73+
* Function to perform changes during update
74+
*
75+
* @param JInstallerComponent $parent The class calling this method
76+
*
77+
* @return void
78+
*
79+
* @since 2.0
80+
*/
81+
public function update($parent)
82+
{
83+
$this->copyLayouts();
84+
}
85+
86+
/**
87+
* Function to perform changes during uninstall
88+
*
89+
* @param JInstallerComponent $parent The class calling this method
90+
*
91+
* @return void
92+
*
93+
* @since 2.0
94+
*/
95+
public function uninstall($parent)
96+
{
97+
jimport('joomla.filesystem.folder');
98+
99+
// Initialize the error array
100+
$errorTemplates = array();
101+
102+
// Loop the supported templates
103+
foreach ($this->templateOverrides as $template)
104+
{
105+
// Set the file paths
106+
$tmplRoot = JPATH_ADMINISTRATOR . '/templates/' . $template;
107+
$overrideFolder = JPATH_ADMINISTRATOR . '/templates/' . $template . '/html/com_patchtester';
108+
109+
// Make sure the template is actually installed
110+
if (is_dir($tmplRoot))
111+
{
112+
// If there's a failure in copying the overrides, log it to the error array
113+
if (!JFolder::delete($overrideFolder))
114+
{
115+
$errorTemplates[] = ucfirst($template);
116+
}
117+
}
118+
}
119+
120+
// If we couldn't remove any overrides, notify the user
121+
if (count($errorTemplates) > 0)
122+
{
123+
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates)));
124+
}
125+
}
126+
127+
/**
128+
* Function to copy layout overrides for core templates at install or update
129+
*
130+
* @return void
131+
*
132+
* @since 2.0
133+
*/
134+
private function copyLayouts()
135+
{
136+
jimport('joomla.filesystem.folder');
137+
138+
// Initialize the error array
139+
$errorTemplates = array();
140+
141+
// Loop the supported templates
142+
foreach ($this->templateOverrides as $template)
143+
{
144+
// Set the file paths
145+
$source = __DIR__ . '/' . $template;
146+
$tmplRoot = JPATH_ADMINISTRATOR . '/templates/' . $template;
147+
$destination = JPATH_ADMINISTRATOR . '/templates/' . $template . '/html/com_patchtester';
148+
149+
// Make sure the template is actually installed
150+
if (is_dir($tmplRoot))
151+
{
152+
// If there's a failure in copying the overrides, log it to the error array
153+
if (!JFolder::copy($source, $destination))
154+
{
155+
$errorTemplates[] = ucfirst($template);
156+
}
157+
}
158+
}
159+
160+
// If we couldn't remove any overrides, notify the user
161+
if (count($errorTemplates) > 0)
162+
{
163+
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates)));
164+
}
165+
}
166+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
/**
3+
* @package PatchTester
4+
*
5+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later
7+
*/
8+
9+
defined('_JEXEC') or die;
10+
11+
JHtml::_('behavior.tooltip');
12+
JHtml::_('behavior.modal');
13+
14+
$listOrder = $this->escape($this->state->get('list.ordering'));
15+
$listDirn = $this->escape($this->state->get('list.direction'));
16+
17+
?>
18+
<script type="text/javascript">
19+
var submitpatch = function (task, id) {
20+
document.getElementById('pull_id').set('value', id);
21+
return Joomla.submitbutton(task);
22+
}
23+
</script>
24+
25+
<form action="<?php echo JRoute::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm">
26+
<div id="j-main-container">
27+
<fieldset id="filter-bar">
28+
<legend class="element-invisible"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></legend>
29+
<div class="filter-search">
30+
<button type="submit" class="btn"><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
31+
<button type="button" onclick="document.getElementById('filter_search').value='';document.getElementById('filter_searchid').value='';this.form.submit();"><?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
32+
</div>
33+
</fieldset>
34+
<div class="clr"> </div>
35+
36+
<table class="adminlist">
37+
<thead>
38+
<tr>
39+
<th width="5%" class="title nowrap center">
40+
<?php echo JHtml::_('grid.sort', 'COM_PATCHTESTER_PULL_ID', 'number', $listDirn, $listOrder); ?>
41+
<br />
42+
<input type="text" name="filter_searchid" id="filter_searchid" class="span10" value="<?php echo $this->escape($this->state->get('filter.searchid')); ?>" />
43+
</th>
44+
<th class="title nowrap center">
45+
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'title', $listDirn, $listOrder); ?>
46+
<br />
47+
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" />
48+
</th>
49+
<th class="title nowrap center">I</th>
50+
<th class="title nowrap center">
51+
<?php echo JText::_('COM_PATCHTESTER_JOOMLACODE_ISSUE'); ?>
52+
</th>
53+
<th width="20%" class="title nowrap center">
54+
<?php echo JText::_('JSTATUS'); ?>
55+
</th>
56+
<th width="20%" class="title nowrap center">
57+
<?php echo JText::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
58+
</th>
59+
</tr>
60+
</thead>
61+
<tfoot>
62+
<tr>
63+
<td colspan="6">
64+
</td>
65+
</tr>
66+
</tfoot>
67+
<tbody>
68+
<?php echo $this->loadTemplate('items'); ?>
69+
</tbody>
70+
</table>
71+
<?php echo $this->pagination->getListFooter(); ?>
72+
73+
<input type="hidden" name="task" value=""/>
74+
<input type="hidden" name="boxchecked" value="0"/>
75+
<input type="hidden" name="pull_id" id="pull_id" value=""/>
76+
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>"/>
77+
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>"/>
78+
<?php echo JHtml::_('form.token'); ?>
79+
</div>
80+
</form>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/**
3+
* @package PatchTester
4+
*
5+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later
7+
*/
8+
9+
defined('_JEXEC') or die;
10+
11+
foreach ($this->items as $i => $item) :
12+
$status = '';
13+
14+
if (isset($this->patches[$item->number])) :
15+
$patch = $this->patches[$item->number];
16+
$status = ($patch->applied) ? ' success' : '';
17+
else :
18+
$patch = false;
19+
endif;
20+
?>
21+
<tr class="row<?php echo $i % 2; ?><?php echo $status ?>">
22+
<td class="center">
23+
<?php echo $item->number; ?>
24+
</td>
25+
<td>
26+
<a class="icon icon16-github hasTip" title="<?php echo JText::_('COM_PATCHTESTER_OPEN_IN_GITHUB'); ?>" href="<?php echo $item->html_url; ?>" target="_blank">
27+
<?php echo $item->title; ?>
28+
</a>
29+
</td>
30+
<td>
31+
<?php if ($item->body) :
32+
echo JHtml::_('tooltip', htmlspecialchars($item->body), 'Info');
33+
else :
34+
echo '&nbsp;';
35+
endif;
36+
?>
37+
</td>
38+
<td class="center">
39+
<?php if ($item->joomlacode_issue) :
40+
$title = ' title="Open link::' . JText::_('COM_PATCHTESTER_OPEN_IN_JOOMLACODE') . '"';
41+
42+
if (is_int($item->joomlacode_issue)) :
43+
echo '<a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=';
44+
echo $item->joomlacode_issue . '"' . $title . ' class="modal hasTip" rel="{handler: \'iframe\', size: {x: 900, y: 500}}">';
45+
echo '[#' . $item->joomlacode_issue . ']</a>';
46+
else :
47+
echo '<a href="' . $item->joomlacode_issue . '"' . $title;
48+
echo ' class="modal hasTip" rel="{handler: \'iframe\', size: {x: 900, y: 500}}">';
49+
echo '[#joomlacode]</a>';
50+
endif;
51+
endif; ?>
52+
</td>
53+
<td class="center">
54+
<?php if ($patch && $patch->applied) : ?>
55+
<span class="label label-success">
56+
<?php echo JText::_('COM_PATCHTESTER_APPLIED'); ?>
57+
</span>
58+
<?php else : ?>
59+
<span class="label">
60+
<?php echo JText::_('COM_PATCHTESTER_NOT_APPLIED'); ?>
61+
</span>
62+
<?php endif; ?>
63+
</td>
64+
<td class="center">
65+
<?php if ($patch && $patch->applied) :
66+
echo '<a class="btn btn-small btn-success" href="javascript:submitpatch(\'pull.revert\', ' . (int) $patch->id . ');">' . JText::_('COM_PATCHTESTER_REVERT_PATCH') . '</a>';
67+
else :
68+
echo '<a class="btn btn-small btn-primary" href="javascript:submitpatch(\'pull.apply\', ' . (int) $item->number . ');">' . JText::_('COM_PATCHTESTER_APPLY_PATCH') . '</a>';
69+
endif; ?>
70+
</td>
71+
</tr>
72+
<?php endforeach;

build/patchtester/build.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
rm -rf ../packaging && mkdir ../packaging
33
rm -rf ../packages && mkdir ../packages
44
cp -r ../../administrator/components/com_patchtester ../packaging/admin
5+
cp -r ../../administrator/templates/hathor/html/com_patchtester ../packaging/hathor
56
rm -rf ../packaging/admin/backups/*.txt
67
mv ../packaging/admin/patchtester.xml ../packaging/patchtester.xml
8+
mv ../packaging/admin/script.php ../packaging/script.php
79
cd ../packaging
8-
tar jcf ../packages/com_patchtester.tar.bz2 admin/ patchtester.xml
9-
tar zcf ../packages/com_patchtester.tar.gz admin patchtester.xml
10-
zip -r ../packages/com_patchtester.zip admin/ patchtester.xml
10+
tar jcf ../packages/com_patchtester.tar.bz2 admin/ hathor/ patchtester.xml script.php
11+
tar zcf ../packages/com_patchtester.tar.gz admin/ hathor/ patchtester.xml script.php
12+
zip -r ../packages/com_patchtester.zip admin/ hathor/ patchtester.xml script.php

0 commit comments

Comments
 (0)