Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"version": "2.1.2",
"version": "3.0.0",
"name": "ExtensionGeneratorPlugin.name",
"description": "ExtensionGeneratorPlugin.description",
"icon": "bi bi-puzzle-fill",
"authors": [
{
"name": "Phillips Data, Inc.",
Expand Down
198 changes: 129 additions & 69 deletions views/default/admin_main.pdt
Original file line number Diff line number Diff line change
@@ -1,78 +1,138 @@
<?php
echo (isset($message) ? $message : null);
<?php /** @var View $this */ ?>

$this->Widget->clear();
$this->Widget->create($this->_('AdminMain.index.boxtitle_extensions', true), ['id'=>'admin_main'], (isset($render_section) ? $render_section : null));
?>
<div class="pad">
<div class="inner">
<div class="links_row">
<a class="btn btn-default btn-sm pull-right" title="<?php $this->_('AdminMain.index.extension_add');?>" href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/general/');?>"><i class="fas fa-plus"></i></a>
</div>
<?php
if ((isset($extensions) ? $extensions : null) && !empty($extensions)) {
?>
<?php
echo $message ?? null;

<table class="table">
<tr class="heading_row">
<td><span><a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=id&order=' . ($sort == 'id' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'id' ? ' ' . $order : '');?>"><?php $this->_('AdminMain.index.heading_id');?></a></span></td>
<td><span><a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=name&order=' . ($sort == 'name' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'name' ? ' ' . $order : '');?>"><?php $this->_('AdminMain.index.heading_name');?></a></span></td>
<td><span><a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=type&order=' . ($sort == 'type' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'type' ? ' ' . $order : '');?>"><?php $this->_('AdminMain.index.heading_type');?></a></span></td>
<td><span><a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=form_type&order=' . ($sort == 'form_type' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'form_type' ? ' ' . $order : '');?>"><?php $this->_('AdminMain.index.heading_form_type');?></a></span></td>
<td><span><a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=code_examples&order=' . ($sort == 'code_examples' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'code_examples' ? ' ' . $order : '');?>"><?php $this->_('AdminMain.index.heading_code_examples');?></a></span></td>
<td><span><a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=date_updated&order=' . ($sort == 'date_updated' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'date_updated' ? ' ' . $order : '');?>"><?php $this->_('AdminMain.index.heading_date_updated');?></a></span></td>
<td class="last"><span><?php $this->_('AdminMain.index.heading_options');?></span></td>
</tr>
<?php
// Display all extensions
$i = 0;
foreach ($extensions as $extension) {
?>
<tr<?php echo ($i++%2 == 1) ? ' class="odd_row"' : '';?>>
<td><?php echo (isset($extension->id) ? $this->Html->safe($extension->id) : null);?></td>
<td><?php echo (isset($extension->name) ? $this->Html->safe($extension->name) : null);?></td>
<td><?php echo $this->Html->safe((isset($types[$extension->type]) ? $types[$extension->type] : null));?></td>
<td><?php echo $this->Html->safe((isset($form_types[$extension->form_type]) ? $form_types[$extension->form_type] : null));?></td>
<td><?php echo (isset($extension->code_examples) ? $extension->code_examples : null) == 1 ? '<i class="fas fa-check">' : '<i class="fas fa-times">';?></td>
<td><?php echo $this->Date->cast((isset($extension->date_updated) ? $extension->date_updated : null), 'date_time');?></td>
// Build link buttons
$link_buttons = [
[
'icon' => 'bi bi-plus-lg me-1',
'name' => $this->_('AdminMain.index.extension_add', true),
'attributes' => [
'href' => $this->base_uri . 'plugin/extension_generator/admin_main/general/'
]
]
];

$this->Widget->clear();
$this->Widget->setStyleSheet($this->view_dir . 'css/styles.css');
$this->Widget->setLinkButtons($link_buttons);
$this->Widget->create($this->_('AdminMain.index.boxtitle_extensions', true), ['id' => 'admin_main'], $render_section ?? null);
?>

<?php if (!empty($extensions)) : ?>
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>
<a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=id&order=' . ($sort == 'id' ? $negate_order : $order)); ?>" class="<?php echo $sort == 'id' ? $order : ''; ?>">
<?php $this->_('AdminMain.index.heading_id'); ?>
</a>
</th>
<th>
<a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=name&order=' . ($sort == 'name' ? $negate_order : $order)); ?>" class="<?php echo $sort == 'name' ? $order : ''; ?>">
<?php $this->_('AdminMain.index.heading_name'); ?>
</a>
</th>
<th>
<a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=type&order=' . ($sort == 'type' ? $negate_order : $order)); ?>" class="<?php echo $sort == 'type' ? $order : ''; ?>">
<?php $this->_('AdminMain.index.heading_type'); ?>
</a>
</th>
<th>
<a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=form_type&order=' . ($sort == 'form_type' ? $negate_order : $order)); ?>" class="<?php echo $sort == 'form_type' ? $order : ''; ?>">
<?php $this->_('AdminMain.index.heading_form_type'); ?>
</a>
</th>
<th>
<a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=code_examples&order=' . ($sort == 'code_examples' ? $negate_order : $order)); ?>" class="<?php echo $sort == 'code_examples' ? $order : ''; ?>">
<?php $this->_('AdminMain.index.heading_code_examples'); ?>
</a>
</th>
<th>
<a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/index/?sort=date_updated&order=' . ($sort == 'date_updated' ? $negate_order : $order)); ?>" class="<?php echo $sort == 'date_updated' ? $order : ''; ?>">
<?php $this->_('AdminMain.index.heading_date_updated'); ?>
</a>
</th>
<th class="text-end"><?php $this->_('AdminMain.index.heading_options'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($extensions as $extension) : ?>
<tr>
<td><?php echo $this->Html->safe($extension->id ?? ''); ?></td>
<td><?php echo $this->Html->safe($extension->name ?? ''); ?></td>
<td><?php echo $this->Html->safe($types[$extension->type] ?? ''); ?></td>
<td><?php echo $this->Html->safe($form_types[$extension->form_type] ?? ''); ?></td>
<td>
<a href="<?php echo $this->base_uri . 'plugin/extension_generator/admin_main/general/' . (isset($extension->id) ? $this->Html->safe($extension->id) : null) . '/';?>"><?php $this->_('AdminMain.index.option_edit');?></a>,
<?php
$this->Form->create($this->base_uri . 'plugin/extension_generator/admin_main/delete/');
$this->Form->fieldHidden('id', (isset($extension->id) ? $extension->id : null));
?>
<a href="<?php echo $this->base_uri . 'plugin/extension_generator/admin_main/delete/' . (isset($extension->id) ? $this->Html->safe($extension->id) : null) . '/';?>" class="manage delete_extension" rel="<?php $this->_('AdminMain.index.text_confirm_delete');?>"><?php $this->_('AdminMain.index.option_delete');?></a>
<?php
$this->Form->end();
?>
<?php if (($extension->code_examples ?? null) == 1) : ?>
<i class="bi bi-check-lg text-success"></i>
<?php else : ?>
<i class="bi bi-x-lg text-danger"></i>
<?php endif; ?>
</td>
<td><?php echo $this->Date->cast($extension->date_updated ?? null, 'date_time'); ?></td>
<td class="text-end">
<div class="btn-group btn-group-sm">
<a href="<?php echo $this->Html->safe($this->base_uri . 'plugin/extension_generator/admin_main/general/' . ($extension->id ?? '') . '/'); ?>" class="btn btn-sm btn-outline-primary" data-bs-toggle="tooltip" title="<?php $this->_('AdminMain.index.option_edit'); ?>">
<i class="bi bi-pencil"></i>
</a>
<?php
$this->Form->create($this->base_uri . 'plugin/extension_generator/admin_main/delete/', ['class' => 'd-inline']);
$this->Form->fieldHidden('id', $extension->id ?? null);
?>
<button type="button" class="btn btn-sm btn-outline-danger delete-extension" data-bs-toggle="tooltip" title="<?php $this->_('AdminMain.index.option_delete'); ?>" data-confirm-message="<?php $this->_('AdminMain.index.text_confirm_delete'); ?>">
<i class="bi bi-trash"></i>
</button>
<?php $this->Form->end(); ?>
</div>
</td>
</tr>
<?php
}
?>
</table>
<?php
$this->Pagination->build();
} else {
?>
<div class="inner">
<div class="empty_section">
<div class="empty_box">
<?php $this->_('AdminMain.index.extensions_no_results');?>
</div>
</div>
</div>
<?php
}
?>
</div>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php
if (isset($this->Pagination) && $this->Pagination->hasPages()) {
?>
<div class="card-footer">
<?php $this->Pagination->build();?>
</div>
<?php
$this->Widget->end();
?>
}
?>
<?php else : ?>
<div class="card-body text-center text-muted py-5">
<i class="bi bi-box-seam display-4 text-muted mb-3 d-block"></i>
<p class="text-muted mb-0"><?php $this->_('AdminMain.index.extensions_no_results'); ?></p>
</div>
<?php endif; ?>

<?php
$this->Widget->end();
?>

<script type="text/javascript">
$(document).ready(function() {
$('a.delete_extension[rel]').blestaModalConfirm({base_url: '<?php echo $this->Html->safe($this->base_uri);?>', close: '<?php $this->_('AppController.modal.text_close');?>', submit: true});
<script>
document.addEventListener('DOMContentLoaded', function() {
// Delete confirmation
document.querySelectorAll('.delete-extension').forEach(function(btn) {
btn.addEventListener('click', function(e) {
e.preventDefault();
var message = this.dataset.confirmMessage;
if (confirm(message)) {
this.closest('form').submit();
}
});
});
</script>

// Initialize tooltips
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip) {
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(function(el) {
new bootstrap.Tooltip(el);
});
}
});
</script>

<script src="<?php echo $this->view_dir;?>js/extension-generator.js"></script>
108 changes: 60 additions & 48 deletions views/default/admin_main_confirm.pdt
Original file line number Diff line number Diff line change
@@ -1,55 +1,67 @@
<?php
echo (isset($message) ? $message : null);

$this->Widget->clear();
$this->Widget->setStyleSheet($this->view_dir . 'css/styles.css');
$this->Widget->create($this->_('AdminMain.index.boxtitle_extension_generator', true));

echo (isset($progress_bar) ? $progress_bar : null);

$this->Form->create();
?>
<div class="inner">
<div class="title_row first"><h3><?php $this->_('AdminMain.confirm.heading_confirm');?></h3></div>
<div class="pad">
<p><?php $this->_('AdminMain.confirm.text_generation');?></p>
<ul>
<li>
<?php
$this->Form->label($this->_('AdminMain.confirm.location', true), 'location', ['class' => 'inline']);
?>
<span class="tooltip block"><?php $this->_('AppController.tooltip.text');?><div><?php $this->_('AdminMain.confirm.tooltip_location');?></div></span>
<?php
$this->Form->fieldSelect('location', (isset($locations) ? $locations : []), (isset($vars->location) ? $vars->location : null), ['class' => 'block', 'id' => 'location']);
?>
</li>
<li id="custom_path" style="display:none;">
<?php
$this->Form->label($this->_('AdminMain.confirm.custom_path', true), 'custom_path');
$this->Form->fieldText('custom_path', (isset($vars->custom_path) ? $vars->custom_path : null), ['id' => 'custom_path', 'placeholder' => COMPONENTDIR]);
?>
</li>
</ul>
</div>
<div class="button_row">
<?php $this->Form->fieldSubmit('submit', $this->_('AdminMain.confirm.generate', true), ['class' => 'btn btn-primary pull-right']);?>
</div>
<?php /** @var View $this */ ?>

<?php
echo $message ?? null;

$this->Widget->clear();
$this->Widget->setStyleSheet($this->view_dir . 'css/styles.css');
$this->Widget->setBodyWrapper(false);
$this->Widget->create($this->_('AdminMain.index.boxtitle_extension_generator', true));

echo $progress_bar ?? null;

$this->Form->create(null, ['class' => 'disable-on-submit']);
?>

<div class="card-body">
<h6 class="form-section-header">
<i class="bi bi-download me-2"></i><?php $this->_('AdminMain.confirm.heading_confirm'); ?>
</h6>

<p class="text-muted mb-4"><?php $this->_('AdminMain.confirm.text_generation'); ?></p>

<div class="row g-3 mb-4">
<div class="col-md-6">
<?php
$this->Form->label($this->_('AdminMain.confirm.location', true), 'location', ['class' => 'form-label']);
?>
<i class="bi bi-question-circle text-muted ms-1" data-bs-toggle="tooltip" title="<?php $this->_('AdminMain.confirm.tooltip_location'); ?>"></i>
<?php
$this->Form->fieldSelect('location', $locations ?? [], $vars->location ?? null, ['id' => 'location', 'class' => 'form-select']);
?>
</div>
<?php
</div>

$this->Form->end();
<div id="custom-path-section" class="row g-3 mb-4 d-none">
<div class="col-md-6">
<?php
$this->Form->label($this->_('AdminMain.confirm.custom_path', true), 'custom_path', ['class' => 'form-label']);
$this->Form->fieldText('custom_path', $vars->custom_path ?? null, ['id' => 'custom_path', 'class' => 'form-control', 'placeholder' => COMPONENTDIR]);
?>
</div>
</div>
</div>

$this->Widget->end();
?>
<div class="card-footer d-flex justify-content-end">
<?php
$this->Form->fieldSubmit('submit', $this->_('AdminMain.confirm.generate', true), ['class' => 'btn btn-success']);
?>
</div>

<?php
$this->Form->end();
$this->Widget->end();
?>

<script>
$(document).ready(function() {
$('#location').change(function () {
if ($(this).val() === 'custom') {
$('#custom_path').show();
} else {
$('#custom_path').hide();
}
document.addEventListener('DOMContentLoaded', function() {
// Initialize tooltips
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip) {
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(function(el) {
new bootstrap.Tooltip(el);
});
});
}
});
</script>

<script src="<?php echo $this->view_dir;?>js/extension-generator.js"></script>
4 changes: 3 additions & 1 deletion views/default/admin_main_create.pdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
<?php /** @var View $this */ ?>

<?php
echo (isset($message) ? $message : null);

$this->Widget->clear();
Expand Down
Loading