- Added new phrases fot the extension manager

- Renamed uploadExtension to installExtension in application/controllers/system/extensions/CLI_Manager.php
- Adapted controller system/extensions/Manager.php to use FHC_Controller functionalities
- Changed controller system/extensions/Manager->uploadExtension to get parameters from HTTP post and HTTP file
- Changed view system/extensions/manager.php to use templates/FHC-Header, ajaxlib, tablewidget, phrases and the CI upload library
- Added new column type array to application/widgets/TableWidget.php
- Added new type boolean to the public/js/AjaxLib.js result when checked by the hasData method
- Added new JS public/js/ExtensionsManager.js that contains the extensions manager JS
- Added new view system/extensions/tableWidget.php to display the extensions manager TableWidget
This commit is contained in:
Paolo
2021-09-27 12:45:55 +02:00
parent 063a3fa524
commit 023e0fc934
9 changed files with 365 additions and 187 deletions
+45 -161
View File
@@ -1,174 +1,58 @@
<?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
'jquery' => true,
'jqueryui' => true,
'jquerycheckboxes' => true,
'bootstrap' => true,
$(document).ready(function() {
// Styles includes
'fontawesome' => true,
'sbadmintemplate' => 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,
'tabulator' => true,
'tablewidget' => true,
'phrases' => array(
'extensions'
),
'customJSs' => array('public/js/ExtensionsManager.js')
)
);
?>
<body>
<div>
<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>
<?php $this->load->view('system/extensions/tableWidget.php'); ?>
</div>
<?php echo form_open_multipart(current_url().'/uploadExtension'); ?>
<div>
List of installed extensions
<input type="file" name="extension" />
<input type="button" id="uploadExtension" value="<?php echo $this->p->t('extensions', 'uploadExtension'); ?>" />
</div>
<br>
<table class="tablesorter" id="t0">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Server</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>%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->server_kurzbz,
$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" /> <br/>
<input type="checkbox" class="checkbox" id="databasechange" name="databasechange"/>
<label for="databasechange">Don´t perform SQL</label>
</form>
<br/>
<div>
<label for="performSql"><?php echo $this->p->t('extensions', 'performSql'); ?></label>
<input type="checkbox" class="checkbox" id="performSql" name="performSql"/>
</div>
</form>
</div>
</body>
<?php $this->load->view('templates/footer'); ?>
<?php $this->load->view('templates/FHC-Footer'); ?>