Merge branch 'feature-13011/installation_on_multiple_servers' into merge-6237-13011

This commit is contained in:
Paolo
2025-09-22 11:57:15 +02:00
12 changed files with 607 additions and 408 deletions
+56 -157
View File
@@ -1,168 +1,67 @@
<?php $this->load->view('templates/header', array('title' => 'Extensions manager', 'jqueryV1' => true, 'tablesort' => true)); ?>
<?php
$this->load->view(
'templates/FHC-Header',
array(
// Title
'title' => 'Extensions manager',
<script type="text/javascript">
// JS & CSS includes
'jquery3' => true,
'jqueryui1' => true,
'jquerycheckboxes1' => true,
'bootstrap3' => true,
'tabulator4' => true,
$(document).ready(function() {
// Styles includes
'fontawesome4' => true,
'sbadmintemplate3' => true,
$(".tablesorter").each(function(i, v) {
$("#" + v.id).tablesorter({
widgets: ["zebra"],
sortList: [[0, 0]],
headers: {7: {sorter: false}}
});
});
$(".chkbox").change(function() {
var chkId = $(this).context.name;
var checked = $(this).prop("checked");
$.ajax({
url: "<?php echo current_url(); ?>/toggleExtension",
dataType: "json",
type: "POST",
data: {
extension_id: chkId,
enabled: checked
},
error: function(jqXHR, textStatus, errorThrown) {
alert("Error while saving data");
},
success: function(response, textStatus, jqXHR) {
if (response != true)
{
alert("Error while saving data");
}
},
complete: function() {
window.location.reload();
}
});
});
$(".lnkrm").click(function() {
var lnkId = $(this).context.name;
if (window.confirm('Are you really shure???') == true)
{
$.ajax({
url: "<?php echo current_url(); ?>/delExtension",
dataType: "json",
type: "POST",
data: {
extension_id: lnkId
},
error: function(jqXHR, textStatus, errorThrown) {
alert("Error while saving data");
},
success: function(response, textStatus, jqXHR) {
if (response != true)
{
alert("Error while saving data");
}
},
complete: function() {
window.location.reload();
}
});
}
});
});
</script>
// FHC JS & CSS includes
'ajaxlib' => true,
'dialoglib' => true,
'tablewidget' => true,
'phrases' => array(
'extensions',
'table',
'ui'
),
'customJSs' => array('public/js/ExtensionsManager.js')
)
);
?>
<body>
<div class="container-fluid">
<h3 class="page-header">
<?php echo $this->p->t('extensions', 'title'); ?>
</h3>
<?php
if (!hasData($extensions))
{
echo 'No extension installed!<br>';
}
elseif (isError($extensions))
{
echo 'An error occurred while retriving extenions list.';
}
elseif (hasData($extensions))
{
?>
<div>
List of installed extensions
<div>
<?php $this->load->view('system/extensions/tableWidget.php'); ?>
</div>
<?php echo form_open_multipart(current_url().'/uploadExtension'); ?>
<div class="row">
<div class="col-xs-2">
<input type="file" name="extension" />
</div>
<div>
<input type="button" id="uploadExtension" value="<?php echo $this->p->t('extensions', 'uploadExtension'); ?>" />
</div>
</div>
<br>
<table class="tablesorter" id="t0">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Version</th>
<th>Licence</th>
<th>URL</th>
<th>Minimum required Core version</th>
<th>Dependes on (extensions)</th>
<th>Enabled</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$tableRow = '
<tr>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>
<input type="checkbox" class="chkbox" name="%s" %s>
</td>
<td>
<a href="#" name="%s" class="lnkrm" >Remove</a>
</td>
</tr>';
foreach ($extensions->retval as $key => $extension)
{
echo sprintf(
$tableRow,
$extension->name,
$extension->description,
$extension->version,
$extension->license,
$extension->url,
$extension->core_version,
count($extension->dependencies) == 0 ? 'None' : json_encode($extension->dependencies),
$extension->extension_id,
$extension->enabled === true ? 'checked' : '',
$extension->extension_id
);
}
?>
</tbody>
</table>
<?php
}
?>
<br>
<?php echo form_open_multipart(current_url().'/uploadExtension'); ?>
<input type="file" name="extension" />
<input type="submit" value="Install/Update extension" />
</form>
<br/>
<div class="row">
<div class="col-xs-2">
<label for="notPerformSql"><?php echo $this->p->t('extensions', 'performSql'); ?></label>
</div>
<div>
<input type="checkbox" class="checkbox" id="notPerformSql" name="notPerformSql"/>
</div>
</div>
</form>
</div>
</body>
<?php $this->load->view('templates/footer'); ?>
<?php $this->load->view('templates/FHC-Footer'); ?>
@@ -0,0 +1,94 @@
<?php
$tableWidgetArray = array(
'query' => '
SELECT e.extension_id,
e.name,
e.description,
e.server_kurzbz,
e.version,
e.license,
e.url,
e.core_version,
e.dependencies,
e.enabled
FROM system.tbl_extensions e
ORDER BY e.name ASC,
e.server_kurzbz ASC,
e.version ASC
',
'tableUniqueId' => 'extensionsListTableWidget',
'requiredPermissions' => 'system/extensions',
'datasetRepresentation' => 'tabulator',
'additionalColumns' => array('Delete'),
'columnsAliases' => array(
'Extension ID',
'Name',
'Description',
'Server',
'Version',
'License',
'URL',
'Core version',
'Dependencies',
'Enabled'
),
'formatRow' => function ($datasetRaw) {
if ($datasetRaw->{'description'} == null)
{
$datasetRaw->{'description'} = '-';
}
if ($datasetRaw->{'server_kurzbz'} == null)
{
$datasetRaw->{'server_kurzbz'} = '-';
}
if ($datasetRaw->{'url'} == null)
{
$datasetRaw->{'url'} = '-';
}
if ($datasetRaw->{'license'} == null)
{
$datasetRaw->{'license'} = '-';
}
return $datasetRaw;
},
'datasetRepOptions' => '{
height: "100%",
layout: "fitColumns",
persistentLayout: true,
persistentSort: true,
persistentFilter: true,
autoResize: false
}',
'datasetRepFieldsDefs' => '{
extension_id: {visible: false},
url: {
formatter: "link"
},
enabled: {
aligh: "center",
headerSort: false,
editor: true,
formatter: "tickCross",
cellEdited: function(cell) {
if (cell.getValue() != cell.getOldValue()) toggleExtension(cell.getData().extension_id, cell.getValue());
}
},
Delete: {
headerSort: false,
formatter: "buttonCross",
width: 100,
align: "center",
cellClick: function(e, cell) {
deleteExtension(cell.getData().extension_id, cell.getRow());
}
}
}'
);
echo $this->widgetlib->widget('TableWidget', $tableWidgetArray);