Add installer functionality for WordPress with FTP and database configuration
- Create SQL migration for prompt templates used in article and image generation. - Add migration to change publish interval from days to hours in the sites table. - Implement InstallerController to handle installation requests and validation. - Develop FtpService for FTP connections and file uploads. - Create InstallerService to manage the WordPress installation process, including downloading, extracting, and configuring WordPress. - Add index view for the installer with form inputs for FTP, database, and WordPress admin settings. - Implement progress tracking for the installation process with AJAX polling.
This commit is contained in:
@@ -31,12 +31,9 @@
|
||||
data-description="<?= htmlspecialchars($cat['description'] ?? '') ?>">
|
||||
<i class="bi bi-pencil me-1"></i>Edytuj kategorię
|
||||
</button>
|
||||
<form method="post" action="/global-topics/<?= $cat['id'] ?>/delete" class="d-inline"
|
||||
onsubmit="return confirm('Usunąć kategorię i wszystkie jej tematy?')">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger">
|
||||
<i class="bi bi-trash me-1"></i>Usuń
|
||||
</button>
|
||||
</form>
|
||||
<button class="btn btn-sm btn-outline-danger btn-delete-global" data-id="<?= $cat['id'] ?>" data-type="category">
|
||||
<i class="bi bi-trash me-1"></i>Usuń
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn btn-sm btn-success btn-add-subtopic" data-parent-id="<?= $cat['id'] ?>" data-parent-name="<?= htmlspecialchars($cat['name']) ?>">
|
||||
<i class="bi bi-plus-lg me-1"></i>Dodaj temat
|
||||
@@ -65,10 +62,9 @@
|
||||
data-description="<?= htmlspecialchars($child['description'] ?? '') ?>">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
<form method="post" action="/global-topics/<?= $child['id'] ?>/delete" class="d-inline"
|
||||
onsubmit="return confirm('Usunąć ten temat?')">
|
||||
<button type="submit" class="btn btn-outline-danger"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
<button class="btn btn-outline-danger btn-delete-global" data-id="<?= $child['id'] ?>" data-type="topic">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -188,5 +184,47 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
new bootstrap.Modal(document.getElementById('editGlobalModal')).show();
|
||||
});
|
||||
});
|
||||
|
||||
// AJAX delete
|
||||
document.querySelectorAll('.btn-delete-global').forEach(function(btn) {
|
||||
btn.addEventListener('click', function() {
|
||||
var id = this.dataset.id;
|
||||
var isCategory = this.dataset.type === 'category';
|
||||
var msg = isCategory ? 'Usunąć kategorię i wszystkie jej tematy?' : 'Usunąć ten temat?';
|
||||
if (!confirm(msg)) return;
|
||||
|
||||
var el = isCategory ? this.closest('.accordion-item') : this.closest('tr');
|
||||
var origHtml = btn.innerHTML;
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="spinner-border spinner-border-sm"></span>';
|
||||
|
||||
fetch('/global-topics/' + id + '/delete', {
|
||||
method: 'POST',
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
if (data.success) {
|
||||
el.style.transition = 'opacity .3s';
|
||||
el.style.opacity = '0';
|
||||
setTimeout(function() {
|
||||
el.remove();
|
||||
if (!isCategory) {
|
||||
var tbody = el.closest && document.querySelector('table tbody');
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
alert(data.message || 'Błąd usuwania');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = origHtml;
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
alert('Błąd połączenia');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = origHtml;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user