2018-11-09 00:59:06 +01:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
2015-07-14 04:16:28 +02:00
|
|
|
|
2021-02-07 18:22:20 +01:00
|
|
|
<script>
|
|
|
|
// ============================================================================
|
|
|
|
// Variables for the view
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Functions for the view
|
|
|
|
// ============================================================================
|
|
|
|
|
2021-03-19 19:54:09 +01:00
|
|
|
function configurePlugin(className) {
|
|
|
|
var args = {
|
|
|
|
className: className
|
|
|
|
};
|
|
|
|
|
|
|
|
$('input').each(function() {
|
|
|
|
var key = $(this).attr('name');
|
|
|
|
var value = $(this).val();
|
|
|
|
args[key] = value;
|
|
|
|
});
|
|
|
|
|
|
|
|
$('select').each(function() {
|
|
|
|
var key = $(this).attr('name');
|
|
|
|
var value = $(this).val();
|
|
|
|
args[key] = value;
|
|
|
|
});
|
|
|
|
|
|
|
|
api.configurePlugin(args).then(function(response) {
|
|
|
|
if (response.status == 0) {
|
|
|
|
logs('Plugin configured: ' + response.data.key);
|
|
|
|
showAlertInfo("<?php $L->p('The changes have been saved') ?>");
|
|
|
|
} else {
|
|
|
|
logs('An error occurred while trying to configured the plugin.');
|
|
|
|
showAlertError(response.message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-02-07 18:22:20 +01:00
|
|
|
// ============================================================================
|
|
|
|
// Events for the view
|
|
|
|
// ============================================================================
|
|
|
|
$(document).ready(function() {
|
2021-03-19 19:54:09 +01:00
|
|
|
$('#btnSave').on('click', function() {
|
|
|
|
var className = $(this).data('class-name');
|
|
|
|
configurePlugin(className);
|
|
|
|
});
|
2021-02-07 18:22:20 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Initlization for the view
|
|
|
|
// ============================================================================
|
|
|
|
$(document).ready(function() {
|
|
|
|
// No initialization for the view yet
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2021-03-19 19:54:09 +01:00
|
|
|
<div class="d-flex align-items-center mb-4">
|
2021-02-07 22:03:53 +01:00
|
|
|
<h2 class="m-0"><i class="bi bi-node-plus"></i><?php echo $plugin->name() ?></h2>
|
|
|
|
<?php if ($plugin->formButtons()) : ?>
|
|
|
|
<div class="ms-auto">
|
2021-03-19 19:54:09 +01:00
|
|
|
<button id="btnSave" type="button" class="btn btn-primary btn-sm" data-class-name="<?php echo $plugin->className() ?>"><?php $L->p('Save') ?></button>
|
|
|
|
<a id="btnCancel" class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT . 'plugins' ?>" role="button"><?php $L->p('Cancel') ?></a>
|
2021-02-07 22:03:53 +01:00
|
|
|
</div>
|
2018-11-09 00:59:06 +01:00
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
2015-07-14 04:16:28 +02:00
|
|
|
|
2018-11-09 00:59:06 +01:00
|
|
|
<?php
|
2021-02-07 22:03:53 +01:00
|
|
|
if ($plugin->description()) {
|
|
|
|
echo '<div class="alert alert-primary" role="alert">'.$plugin->description().'</div>';
|
|
|
|
}
|
|
|
|
|
2017-05-27 19:46:46 +02:00
|
|
|
echo $plugin->form();
|
2018-11-09 00:59:06 +01:00
|
|
|
?>
|