Release of v4.1.1-beta2
Adds new JCB package engine. Fix issue with loading the Component Builder Wiki. Adds advanced version update notice to the Component Builder Dashboard. Completely refactors the class that builds the Component Dashboard. #1134. Adds Initialize, Reset, and Push functionality to the Repository entities. Completely refactors the SQL teaks and SQL dump classes. Changes J4 fields to allow NULL. Fix a bug in Dynamic Get JavaScript that causes table columns to not load.
This commit is contained in:
@@ -1,174 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\User\UserFactoryInterface;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// set the defaults
|
||||
$items = $displayData->vxlfields;
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
$id = $displayData->item->id;
|
||||
// set the edit URL
|
||||
$edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
|
||||
// set a return value
|
||||
$return = ($id) ? "index.php?option=com_componentbuilder&view=fieldtype&layout=edit&id=" . $id : "";
|
||||
// check for a return value
|
||||
$jinput = Factory::getApplication()->input;
|
||||
if ($_return = $jinput->get('return', null, 'base64'))
|
||||
{
|
||||
$return .= "&return=" . $_return;
|
||||
}
|
||||
// check if return value was set
|
||||
if (StringHelper::check($return))
|
||||
{
|
||||
// set the referral values
|
||||
$ref = ($id) ? "&ref=fieldtype&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));
|
||||
}
|
||||
else
|
||||
{
|
||||
$ref = ($id) ? "&ref=fieldtype&refid=" . $id : "";
|
||||
}
|
||||
// set the create new URL
|
||||
$new = "index.php?option=com_componentbuilder&view=fields&task=field.add" . $ref;
|
||||
// set the create new and close URL
|
||||
$close_new = "index.php?option=com_componentbuilder&view=fields&task=field.add";
|
||||
// load the action object
|
||||
$can = ComponentbuilderHelper::getActions('field');
|
||||
|
||||
?>
|
||||
<div class="form-vertical">
|
||||
<?php if ($can->get('field.create')): ?>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo Text::_('COM_COMPONENTBUILDER_NEW'); ?></a>
|
||||
<a class="btn btn-small" onclick="Joomla.submitbutton('fieldtype.cancel');" href="<?php echo $close_new; ?>"><span class="icon-new"></span> <?php echo Text::_('COM_COMPONENTBUILDER_CLOSE_NEW'); ?></a>
|
||||
</div><br /><br />
|
||||
<?php endif; ?>
|
||||
<?php if (ArrayHelper::check($items)): ?>
|
||||
<table class="footable table data fields" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-type="html" data-sort-use="text">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_NAME_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="all" data-type="html" data-sort-use="text">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES'); ?>
|
||||
</th>
|
||||
<th width="10" data-breakpoints="xs sm md">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_STATUS'); ?>
|
||||
</th>
|
||||
<th width="5" data-type="number" data-breakpoints="xs sm md">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_FIELD_ID'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($items as $i => $item): ?>
|
||||
<?php
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0;
|
||||
$userChkOut = Factory::getContainer()->
|
||||
get(UserFactoryInterface::class)->
|
||||
loadUserById($item->checked_out ?? 0);
|
||||
$canDo = ComponentbuilderHelper::getActions('field',$item,'fields');
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($canDo->get('field.edit')): ?>
|
||||
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?><?php echo $ref; ?>"><?php echo $displayData->escape($item->name); ?></a>
|
||||
<?php if ($item->checked_out): ?>
|
||||
<?php echo Html::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'fields.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo $displayData->escape($item->name); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $displayData->escape($item->fieldtype_name); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo Text::_($item->datatype); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo Text::_($item->indexes); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo Text::_($item->null_switch); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo Text::_($item->store); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($user->authorise('core.edit', 'com_componentbuilder.field.category.' . (int)$item->catid)): ?>
|
||||
<a href="index.php?option=com_categories&task=category.edit&id=<?php echo (int)$item->catid; ?>&extension=com_componentbuilder.field"><?php echo $displayData->escape($item->category_title); ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $displayData->escape($item->category_title); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php if ($item->published == 1): ?>
|
||||
<td class="center" data-sort-value="1">
|
||||
<span class="status-metro status-published" title="<?php echo Text::_('COM_COMPONENTBUILDER_PUBLISHED'); ?>">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_PUBLISHED'); ?>
|
||||
</span>
|
||||
</td>
|
||||
<?php elseif ($item->published == 0): ?>
|
||||
<td class="center" data-sort-value="2">
|
||||
<span class="status-metro status-inactive" title="<?php echo Text::_('COM_COMPONENTBUILDER_INACTIVE'); ?>">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_INACTIVE'); ?>
|
||||
</span>
|
||||
</td>
|
||||
<?php elseif ($item->published == 2): ?>
|
||||
<td class="center" data-sort-value="3">
|
||||
<span class="status-metro status-archived" title="<?php echo Text::_('COM_COMPONENTBUILDER_ARCHIVED'); ?>">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_ARCHIVED'); ?>
|
||||
</span>
|
||||
</td>
|
||||
<?php elseif ($item->published == -2): ?>
|
||||
<td class="center" data-sort-value="4">
|
||||
<span class="status-metro status-trashed" title="<?php echo Text::_('COM_COMPONENTBUILDER_TRASHED'); ?>">
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_TRASHED'); ?>
|
||||
</span>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="nowrap center hidden-phone">
|
||||
<?php echo $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
@@ -26,7 +26,6 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'spacer_hr_8',
|
||||
'note_on_contributors',
|
||||
'addcontributors',
|
||||
'emptycontributors',
|
||||
|
@@ -36,11 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'spacer_hr_6',
|
||||
'to_ignore_note',
|
||||
'toignore',
|
||||
'spacer_hr_7',
|
||||
'jcb_export_package_note',
|
||||
'export_key',
|
||||
'joomla_source_link',
|
||||
'export_buy_link'
|
||||
'spacer_hr_7'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: [];
|
||||
|
161
admin/layouts/powerselectiontable.php
Normal file
161
admin/layouts/powerselectiontable.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
$table_id = $displayData['id'] ?? 'power_selection_table';
|
||||
$headers = $displayData['headers'] ?? ['error'];
|
||||
$default_items_number = 13;
|
||||
$unique_name = '';
|
||||
|
||||
?>
|
||||
<?php echo LayoutHelper::render('table',
|
||||
[
|
||||
'id' => $table_id,
|
||||
'table_class' => 'table table-striped',
|
||||
'table_container_class' => 'power-selection-table-container',
|
||||
'name' => Text::_('COM_COMPONENTBUILDER_MAKE_YOUR_SELECTION'),
|
||||
'headers' => $headers,
|
||||
'items' => [],
|
||||
'default_items_number' => $default_items_number,
|
||||
'init' => false
|
||||
]
|
||||
); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var selectedPowerItems = [];
|
||||
var targetPowerRepoUrl = '';
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
let <?php echo $table_id; ?> = new DataTable('#<?php echo $table_id; ?>', {
|
||||
responsive: true,
|
||||
paging: false,
|
||||
order: [[ 0, "asc" ]],
|
||||
scrollY: 450,
|
||||
select: {
|
||||
style: 'multi+shift',
|
||||
selector: 'tr:not(.no-select)'
|
||||
},
|
||||
info: false,
|
||||
columnDefs: [
|
||||
{ 'targets': [ -1 ], 'visible': false, 'searchable': false },
|
||||
{ responsivePriority: 1, targets: 1 },
|
||||
{ responsivePriority: 2, targets: -4 }
|
||||
],
|
||||
columns: [<?php foreach($headers as $header): ?><?php if ($header === 'path'): ?>
|
||||
{
|
||||
data: 'path',
|
||||
render: function(data, type) {
|
||||
if (data !== '' && type === 'display') {
|
||||
return '<a href="' + targetPowerRepoUrl + encodePath(data) + '" target="_blank">' + data + '</a>'
|
||||
} else if (data === '' && type !== 'display') {
|
||||
return 'zzzzzzzzzzzz';
|
||||
}
|
||||
return data;
|
||||
}
|
||||
},<?php elseif ($header === 'settings'): ?>
|
||||
{
|
||||
data: 'settings',
|
||||
render: function(data, type) {
|
||||
if (data !== '' && type === 'display') {
|
||||
return '<a href="' + targetPowerRepoUrl + encodePath(data) + '" target="_blank">' + data + '</a>'
|
||||
} else if (data === '' && type !== 'display') {
|
||||
return 'zzzzzzzzzzzz';
|
||||
}
|
||||
return data;
|
||||
}
|
||||
},<?php else: ?>
|
||||
{
|
||||
data: '<?php echo $header; ?>',
|
||||
render: function(data, type) {
|
||||
if (data === '' && type !== 'display') {
|
||||
return 'zzzzzzzzzzzz';
|
||||
}
|
||||
return data;
|
||||
}
|
||||
},<?php endif; ?><?php endforeach; ?>
|
||||
],
|
||||
createdRow: function(row, data, dataIndex) {
|
||||
if (data.local === true) {
|
||||
row.classList.add('no-select');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// start the initialization manager
|
||||
const initManager = new InitializationManager();
|
||||
|
||||
// Add selected rows to global array
|
||||
<?php echo $table_id; ?>.on('select', function (e, dt, type, indexes) {
|
||||
if (type === 'row') {
|
||||
let data = <?php echo $table_id; ?>.rows(indexes).data();
|
||||
initManager.addSelectedItems(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove deselected rows from global array
|
||||
<?php echo $table_id; ?>.on('deselect', function (e, dt, type, indexes) {
|
||||
if (type === 'row') {
|
||||
let data = <?php echo $table_id; ?>.rows(indexes).data();
|
||||
initManager.removeSelectedItems(data);
|
||||
}
|
||||
});
|
||||
|
||||
<?php echo $table_id; ?>.on('draw', function () {
|
||||
selectedPowerItems = [];
|
||||
});
|
||||
});
|
||||
|
||||
function drawPowerSelectionTable<?php echo $unique_name; ?>() {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
table.draw(true);
|
||||
}
|
||||
|
||||
function clearPowerSelectionTable<?php echo $unique_name; ?>() {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
// Clear the table
|
||||
table.clear();
|
||||
// Draw the table
|
||||
table.draw(true);
|
||||
}
|
||||
|
||||
function buildPowerSelectionTable<?php echo $unique_name; ?>(items) {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
table.clear().draw(true);
|
||||
table.rows.add(getArrayFormat(items));
|
||||
let emptyRow = <?php echo json_encode(array_map(function($value) { return ''; }, array_flip($headers))); ?>;
|
||||
let currentRowCount = table.rows().count();
|
||||
let emptyRowsNeeded = <?php echo (int) $default_items_number; ?> - currentRowCount;
|
||||
if (emptyRowsNeeded > 0) {
|
||||
for(let i = 0; i < emptyRowsNeeded; i++) {
|
||||
table.row.add(emptyRow);
|
||||
}
|
||||
}
|
||||
table.draw(true);
|
||||
}
|
||||
|
||||
function encodePath<?php echo $unique_name; ?>(path) {
|
||||
return path
|
||||
.split('/')
|
||||
.map(encodeURIComponent)
|
||||
.join('/');
|
||||
}
|
||||
</script>
|
66
admin/layouts/reposelectioncardbody.php
Normal file
66
admin/layouts/reposelectioncardbody.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
$base = $displayData['repo']->base ?? null;
|
||||
$path = $displayData['repo']->path ?? null;
|
||||
$type = $displayData['repo']->type ?? 0;
|
||||
$url = "#";
|
||||
if (!empty($base) && !empty($path))
|
||||
{
|
||||
// if the type is GitHub = 2
|
||||
if ($type == 2)
|
||||
{
|
||||
$base = 'https://github.com';
|
||||
}
|
||||
|
||||
$url = "{$base}/{$path}";
|
||||
}
|
||||
$name = $displayData['name'] ?? 'error';
|
||||
$area = $displayData['area'] ?? 'error';
|
||||
$organisation = $displayData['repo']->organisation ?? 'error';
|
||||
$repository = $displayData['repo']->repository ?? 'error';
|
||||
$read_branch = $displayData['repo']->read_branch ?? 'error';
|
||||
$guid = $displayData['repo']->guid ?? 'error';
|
||||
|
||||
?>
|
||||
<div>
|
||||
<div class="uk-card repo-selection-card">
|
||||
<div class="uk-card-header">
|
||||
<?php echo $name; ?>: <a class="uk-link-heading" href="<?php echo $url; ?>" target="_blank" title="<?php echo Text::sprintf('COM_COMPONENTBUILDER_OPEN_THIS_REMOTE_S_REPOSITORY', $name); ?>"><?php echo $url; ?></a>
|
||||
</div>
|
||||
<div class="uk-card-body">
|
||||
<ul class="uk-list uk-list-disc">
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_ORGANISATION'); ?>: <code><?php echo $organisation; ?></code></li>
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_REPOSITORY'); ?>: <code><?php echo $repository; ?></code></li>
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_BRANCH'); ?>: <code><?php echo $read_branch; ?></code></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="uk-card-footer">
|
||||
<button type="button"
|
||||
class="uk-button uk-button-primary uk-width-1-1 select-repo-to-initialize"
|
||||
data-repo="<?php echo $guid; ?>"
|
||||
data-area="<?php echo $area; ?>">
|
||||
<?php echo Text::sprintf('COM_COMPONENTBUILDER_LOAD_ITEMS_FROM_THIS_S_REPOSITORY', $name); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -29,7 +29,9 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'type',
|
||||
'base',
|
||||
'username',
|
||||
'token'
|
||||
'token',
|
||||
'author_name',
|
||||
'author_email'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: [];
|
||||
|
Reference in New Issue
Block a user