2021-02-07 17:19:24 +01:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
2019-05-11 20:32:46 +02:00
|
|
|
|
|
|
|
<script>
|
2021-02-07 17:19:24 +01:00
|
|
|
// ============================================================================
|
|
|
|
// Variables for the view
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Functions for the view
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
function activatePlugin(pluginClassName) {
|
|
|
|
var args = {
|
|
|
|
pluginClassName: pluginClassName
|
|
|
|
};
|
|
|
|
api.activatePlugin(args).then(function(response) {
|
|
|
|
if (response.status == 0) {
|
|
|
|
logs('Plugin activated: ' + response.data.key);
|
|
|
|
window.location.replace('<?php echo HTML_PATH_ADMIN_ROOT . 'plugins-settings/' ?>'+response.data.key);
|
|
|
|
} else {
|
|
|
|
logs('An error occurred while trying to activate the plugin.');
|
|
|
|
showAlertError(response.message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Events for the view
|
|
|
|
// ============================================================================
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
$("#search").on("keyup", function() {
|
|
|
|
var textToSearch = $(this).val().toLowerCase();
|
|
|
|
$(".searchItem").each(function() {
|
|
|
|
var item = $(this);
|
|
|
|
item.hide();
|
|
|
|
item.find(".searchText").each(function() {
|
|
|
|
var element = $(this).text().toLowerCase();
|
|
|
|
if (element.indexOf(textToSearch) != -1) {
|
|
|
|
item.show();
|
|
|
|
}
|
|
|
|
});
|
2019-05-11 20:32:46 +02:00
|
|
|
});
|
|
|
|
});
|
2021-02-07 17:19:24 +01:00
|
|
|
|
|
|
|
$('.activatePlugin').on('click', function() {
|
|
|
|
var pluginClassName = $(this).data('class-name');
|
|
|
|
activatePlugin(pluginClassName);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Initlization for the view
|
|
|
|
// ============================================================================
|
|
|
|
$(document).ready(function() {
|
|
|
|
// nothing here yet
|
|
|
|
// how do you hang your toilet paper ? over or under ?
|
2019-05-11 20:32:46 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2021-02-07 17:19:24 +01:00
|
|
|
<div class="d-flex align-items-center mb-4">
|
|
|
|
<h2 class="m-0"><i class="bi bi-node-plus"></i><?php $L->p('Plugins') ?></h2>
|
|
|
|
<div class="ms-auto">
|
|
|
|
<a id="btnNew" class="btn btn-primary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT . 'plugins-position' ?>" role="button"><i class="bi bi-plus-circle"></i><?php $L->p('Change plugins position') ?></a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php echo Bootstrap::formTitle(array('icon' => 'search', 'title' => $L->g('Search plugins'))); ?>
|
|
|
|
|
|
|
|
<input type="text" class="form-control" id="search" placeholder="<?php $L->p('Search') ?>">
|
|
|
|
|
2019-05-11 20:32:46 +02:00
|
|
|
<?php
|
|
|
|
|
2021-02-07 17:19:24 +01:00
|
|
|
echo Bootstrap::formTitle(array('icon' => 'check-square', 'title' => $L->g('Enabled plugins')));
|
2019-05-11 20:32:46 +02:00
|
|
|
|
2015-10-19 00:45:58 +02:00
|
|
|
echo '
|
2021-02-07 17:19:24 +01:00
|
|
|
<table class="table table-striped">
|
2018-04-27 20:36:43 +02:00
|
|
|
<tbody>
|
2015-10-19 00:45:58 +02:00
|
|
|
';
|
|
|
|
|
2019-05-11 20:32:46 +02:00
|
|
|
// Show installed plugins
|
|
|
|
foreach ($pluginsInstalled as $plugin) {
|
2021-02-07 17:19:24 +01:00
|
|
|
echo '<tr id="' . $plugin->className() . '" class="bg-light searchItem">';
|
2015-06-12 06:00:04 +02:00
|
|
|
|
2019-05-11 20:32:46 +02:00
|
|
|
echo '<td class="align-middle pt-3 pb-3 w-25">
|
2021-02-07 17:19:24 +01:00
|
|
|
<div class="searchText">' . $plugin->name() . '</div>
|
2018-04-27 20:36:43 +02:00
|
|
|
<div class="mt-1">';
|
2021-02-07 17:19:24 +01:00
|
|
|
if (method_exists($plugin, 'form')) {
|
|
|
|
echo '<a class="me-3" href="' . HTML_PATH_ADMIN_ROOT . 'configure-plugin/' . $plugin->className() . '">' . $L->g('Settings') . '</a>';
|
|
|
|
}
|
|
|
|
echo '<a href="' . HTML_PATH_ADMIN_ROOT . 'uninstall-plugin/' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>';
|
|
|
|
echo '</div>';
|
2017-06-09 20:30:13 +02:00
|
|
|
echo '</td>';
|
2016-08-10 01:46:56 +02:00
|
|
|
|
2019-05-11 20:32:46 +02:00
|
|
|
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
|
2021-02-07 17:19:24 +01:00
|
|
|
echo $plugin->description();
|
2019-05-11 20:32:46 +02:00
|
|
|
echo '</td>';
|
|
|
|
|
|
|
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
2021-02-07 17:19:24 +01:00
|
|
|
echo '<span>' . $plugin->version() . '</span>';
|
2019-05-11 20:32:46 +02:00
|
|
|
echo '</td>';
|
|
|
|
|
|
|
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
2021-02-07 17:19:24 +01:00
|
|
|
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
|
2019-05-11 20:32:46 +02:00
|
|
|
</td>';
|
|
|
|
|
|
|
|
echo '</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
';
|
|
|
|
|
2021-02-07 17:19:24 +01:00
|
|
|
echo Bootstrap::formTitle(array('icon' => 'dash-square', 'title' => $L->g('Disabled plugins')));
|
2019-05-11 20:32:46 +02:00
|
|
|
|
|
|
|
echo '
|
2021-02-07 17:19:24 +01:00
|
|
|
<table class="table table-striped">
|
2019-05-11 20:32:46 +02:00
|
|
|
<tbody>
|
|
|
|
';
|
|
|
|
|
|
|
|
// Plugins not installed
|
|
|
|
$pluginsNotInstalled = array_diff_key($plugins['all'], $pluginsInstalled);
|
|
|
|
foreach ($pluginsNotInstalled as $plugin) {
|
2021-02-07 17:19:24 +01:00
|
|
|
echo '<tr id="' . $plugin->className() . '" class="searchItem">';
|
2019-05-11 20:32:46 +02:00
|
|
|
|
|
|
|
echo '<td class="align-middle pt-3 pb-3 w-25">
|
2021-02-07 17:19:24 +01:00
|
|
|
<div class="searchText">' . $plugin->name() . '</div>
|
2019-05-11 20:32:46 +02:00
|
|
|
<div class="mt-1">
|
2021-02-07 17:19:24 +01:00
|
|
|
<span class="link activatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Activate') . '</a>
|
2019-05-11 20:32:46 +02:00
|
|
|
</div>
|
|
|
|
</td>';
|
|
|
|
|
|
|
|
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
|
2021-02-07 17:19:24 +01:00
|
|
|
echo $plugin->description();
|
2017-03-14 05:21:25 +01:00
|
|
|
echo '</td>';
|
2017-06-09 20:30:13 +02:00
|
|
|
|
2018-04-27 20:36:43 +02:00
|
|
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
2021-02-07 17:19:24 +01:00
|
|
|
echo '<span>' . $plugin->version() . '</span>';
|
2017-06-09 20:30:13 +02:00
|
|
|
echo '</td>';
|
2017-04-26 20:16:34 +02:00
|
|
|
|
2018-04-27 20:36:43 +02:00
|
|
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
2021-02-07 17:19:24 +01:00
|
|
|
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
|
2018-04-27 20:36:43 +02:00
|
|
|
</td>';
|
2015-10-19 00:45:58 +02:00
|
|
|
|
2015-11-30 01:45:30 +01:00
|
|
|
echo '</tr>';
|
|
|
|
}
|
2015-10-19 00:45:58 +02:00
|
|
|
|
|
|
|
echo '
|
2018-04-27 20:36:43 +02:00
|
|
|
</tbody>
|
2015-10-19 00:45:58 +02:00
|
|
|
</table>
|
2021-02-07 17:19:24 +01:00
|
|
|
';
|