Initial dev export (exclude uploads/runtime)
This commit is contained in:
168
plugins/releases/views/admin/edit.php
Normal file
168
plugins/releases/views/admin/edit.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
$pageTitle = $title ?? 'Edit Release';
|
||||
$release = $release ?? [];
|
||||
$error = $error ?? '';
|
||||
$uploadError = (string)($_GET['upload_error'] ?? '');
|
||||
$storePluginEnabled = (bool)($store_plugin_enabled ?? false);
|
||||
ob_start();
|
||||
?>
|
||||
<section class="admin-card">
|
||||
<div class="badge">Releases</div>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||||
<div>
|
||||
<h1 style="font-size:28px; margin:0;"><?= htmlspecialchars($pageTitle, ENT_QUOTES, 'UTF-8') ?></h1>
|
||||
<p style="color: var(--muted); margin-top:6px;">Create or update a release.</p>
|
||||
</div>
|
||||
<div style="display:flex; gap:10px; align-items:center;">
|
||||
<?php if ((int)($release['id'] ?? 0) > 0): ?>
|
||||
<a href="/admin/releases/tracks?release_id=<?= (int)$release['id'] ?>" class="btn outline">Manage Tracks</a>
|
||||
<?php endif; ?>
|
||||
<a href="/admin/releases" class="btn outline">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div style="margin-top:16px; color:#f3b0b0; font-size:13px;"><?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($uploadError !== ''): ?>
|
||||
<div style="margin-top:12px; color:#f3b0b0; font-size:13px;"><?= htmlspecialchars($uploadError, ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="/admin/releases/save" enctype="multipart/form-data" style="margin-top:16px; display:grid; gap:16px;">
|
||||
<input type="hidden" name="id" value="<?= (int)($release['id'] ?? 0) ?>">
|
||||
<div class="admin-card" style="padding:16px;">
|
||||
<div style="display:grid; gap:12px;">
|
||||
<label class="label">Title</label>
|
||||
<input class="input" name="title" value="<?= htmlspecialchars((string)($release['title'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="Release title">
|
||||
<label class="label">Artist</label>
|
||||
<input class="input" name="artist_name" value="<?= htmlspecialchars((string)($release['artist_name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="Artist name">
|
||||
<label class="label">Slug</label>
|
||||
<input class="input" name="slug" value="<?= htmlspecialchars((string)($release['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="release-title">
|
||||
<label class="label">Release Date</label>
|
||||
<input class="input" type="date" name="release_date" value="<?= htmlspecialchars((string)($release['release_date'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">
|
||||
<label class="label">Catalog Number</label>
|
||||
<input class="input" name="catalog_no" value="<?= htmlspecialchars((string)($release['catalog_no'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="CAT-001">
|
||||
<div class="admin-card" style="padding:14px; background: rgba(10,10,12,0.6);">
|
||||
<div class="label">Upload cover</div>
|
||||
<input type="hidden" name="release_id" value="<?= (int)($release['id'] ?? 0) ?>">
|
||||
<label for="releaseCoverFile" id="releaseCoverDropzone" style="display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:center; padding:18px; border-radius:14px; border:1px dashed rgba(255,255,255,0.2); background: rgba(0,0,0,0.2); cursor:pointer;">
|
||||
<div style="font-size:11px; text-transform:uppercase; letter-spacing:0.2em; color:var(--muted);">Drag & Drop</div>
|
||||
<div style="font-size:13px; color:var(--text);">or click to upload</div>
|
||||
<div id="releaseCoverFileName" style="font-size:11px; color:var(--muted);">No file selected</div>
|
||||
</label>
|
||||
<input class="input" type="file" id="releaseCoverFile" name="release_cover" accept="image/*" style="display:none;">
|
||||
<div style="margin-top:10px; display:flex; justify-content:flex-end;">
|
||||
<button type="submit" class="btn small" formaction="/admin/releases/upload" formmethod="post" formenctype="multipart/form-data" name="upload_type" value="cover">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:12px;">
|
||||
<label class="label" style="margin:0;">Cover URL</label>
|
||||
<button type="button" class="btn outline small" data-media-picker="release_cover_url" data-media-picker-mode="url">Pick from Media</button>
|
||||
</div>
|
||||
<input class="input" id="release_cover_url" name="cover_url" value="<?= htmlspecialchars((string)($release['cover_url'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="https://...">
|
||||
<div class="admin-card" style="padding:14px; background: rgba(10,10,12,0.6);">
|
||||
<div class="label">Upload sample (MP3)</div>
|
||||
<input type="hidden" name="release_id" value="<?= (int)($release['id'] ?? 0) ?>">
|
||||
<label for="releaseSampleFile" id="releaseSampleDropzone" style="display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:center; padding:18px; border-radius:14px; border:1px dashed rgba(255,255,255,0.2); background: rgba(0,0,0,0.2); cursor:pointer;">
|
||||
<div style="font-size:11px; text-transform:uppercase; letter-spacing:0.2em; color:var(--muted);">Drag & Drop</div>
|
||||
<div style="font-size:13px; color:var(--text);">or click to upload</div>
|
||||
<div id="releaseSampleFileName" style="font-size:11px; color:var(--muted);">No file selected</div>
|
||||
</label>
|
||||
<input class="input" type="file" id="releaseSampleFile" name="release_sample" accept="audio/mpeg" style="display:none;">
|
||||
<div style="margin-top:10px; display:flex; justify-content:flex-end;">
|
||||
<button type="submit" class="btn small" formaction="/admin/releases/upload" formmethod="post" formenctype="multipart/form-data" name="upload_type" value="sample">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
<label class="label">Sample URL (MP3)</label>
|
||||
<input class="input" name="sample_url" value="<?= htmlspecialchars((string)($release['sample_url'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="https://...">
|
||||
<label class="label">Description</label>
|
||||
<textarea class="input" name="description" rows="6" style="resize:vertical; font-family:'IBM Plex Mono', monospace; font-size:13px; line-height:1.6;"><?= htmlspecialchars((string)($release['description'] ?? ''), ENT_QUOTES, 'UTF-8') ?></textarea>
|
||||
<label class="label">Release Credits</label>
|
||||
<textarea class="input" name="credits" rows="4" style="resize:vertical; font-family:'IBM Plex Mono', monospace; font-size:13px; line-height:1.6;" placeholder="Written by..., Produced by..., Mastered by..."><?= htmlspecialchars((string)($release['credits'] ?? ''), ENT_QUOTES, 'UTF-8') ?></textarea>
|
||||
<?php if ($storePluginEnabled): ?>
|
||||
<div class="admin-card" style="padding:14px; background: rgba(10,10,12,0.6);">
|
||||
<div class="label" style="margin-bottom:10px;">Store Options</div>
|
||||
<label style="display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||||
<input type="checkbox" name="store_enabled" value="1" <?= ((int)($release['store_enabled'] ?? 0) === 1) ? 'checked' : '' ?>>
|
||||
Enable release purchase
|
||||
</label>
|
||||
<div style="display:grid; grid-template-columns:1fr 120px; gap:10px; margin-top:10px;">
|
||||
<div>
|
||||
<label class="label">Bundle Price</label>
|
||||
<input class="input" name="bundle_price" value="<?= htmlspecialchars((string)($release['bundle_price'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="3.99">
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">Currency</label>
|
||||
<input class="input" name="store_currency" value="<?= htmlspecialchars((string)($release['store_currency'] ?? 'GBP'), ENT_QUOTES, 'UTF-8') ?>" placeholder="GBP">
|
||||
</div>
|
||||
</div>
|
||||
<label class="label" style="margin-top:10px;">Button Label (optional)</label>
|
||||
<input class="input" name="purchase_label" value="<?= htmlspecialchars((string)($release['purchase_label'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="Buy Release">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<label style="display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||||
<input type="checkbox" name="is_published" value="1" <?= ((int)($release['is_published'] ?? 1) === 1) ? 'checked' : '' ?>>
|
||||
Published
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex; justify-content:flex-end; gap:12px; align-items:center;">
|
||||
<button type="submit" class="btn">Save release</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<script>
|
||||
(function () {
|
||||
const coverDrop = document.getElementById('releaseCoverDropzone');
|
||||
const coverFile = document.getElementById('releaseCoverFile');
|
||||
const coverName = document.getElementById('releaseCoverFileName');
|
||||
if (coverDrop && coverFile && coverName) {
|
||||
coverDrop.addEventListener('dragover', (event) => {
|
||||
event.preventDefault();
|
||||
coverDrop.style.borderColor = 'var(--accent)';
|
||||
});
|
||||
coverDrop.addEventListener('dragleave', () => {
|
||||
coverDrop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
});
|
||||
coverDrop.addEventListener('drop', (event) => {
|
||||
event.preventDefault();
|
||||
coverDrop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
if (event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length) {
|
||||
coverFile.files = event.dataTransfer.files;
|
||||
coverName.textContent = event.dataTransfer.files[0].name;
|
||||
}
|
||||
});
|
||||
coverFile.addEventListener('change', () => {
|
||||
coverName.textContent = coverFile.files.length ? coverFile.files[0].name : 'No file selected';
|
||||
});
|
||||
}
|
||||
|
||||
const sampleDrop = document.getElementById('releaseSampleDropzone');
|
||||
const sampleFile = document.getElementById('releaseSampleFile');
|
||||
const sampleName = document.getElementById('releaseSampleFileName');
|
||||
if (sampleDrop && sampleFile && sampleName) {
|
||||
sampleDrop.addEventListener('dragover', (event) => {
|
||||
event.preventDefault();
|
||||
sampleDrop.style.borderColor = 'var(--accent)';
|
||||
});
|
||||
sampleDrop.addEventListener('dragleave', () => {
|
||||
sampleDrop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
});
|
||||
sampleDrop.addEventListener('drop', (event) => {
|
||||
event.preventDefault();
|
||||
sampleDrop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
if (event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length) {
|
||||
sampleFile.files = event.dataTransfer.files;
|
||||
sampleName.textContent = event.dataTransfer.files[0].name;
|
||||
}
|
||||
});
|
||||
sampleFile.addEventListener('change', () => {
|
||||
sampleName.textContent = sampleFile.files.length ? sampleFile.files[0].name : 'No file selected';
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
require __DIR__ . '/../../../../modules/admin/views/layout.php';
|
||||
87
plugins/releases/views/admin/index.php
Normal file
87
plugins/releases/views/admin/index.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
$pageTitle = 'Releases';
|
||||
$releases = $releases ?? [];
|
||||
$tableReady = $table_ready ?? false;
|
||||
$pageId = (int)($page_id ?? 0);
|
||||
$pagePublished = (int)($page_published ?? 0);
|
||||
ob_start();
|
||||
?>
|
||||
<section class="admin-card">
|
||||
<div class="badge">Releases</div>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||||
<div>
|
||||
<h1 style="font-size:28px; margin:0;">Releases</h1>
|
||||
<p style="color: var(--muted); margin-top:6px;">Manage singles, EPs, and albums.</p>
|
||||
</div>
|
||||
<a href="/admin/releases/new" class="btn">New Release</a>
|
||||
</div>
|
||||
|
||||
<?php if (!$tableReady): ?>
|
||||
<div class="admin-card" style="margin-top:16px; padding:16px; display:flex; align-items:center; justify-content:space-between; gap:16px;">
|
||||
<div>
|
||||
<div style="font-weight:600;">Database not initialized</div>
|
||||
<div style="color: var(--muted); font-size:13px; margin-top:4px;">Create the releases table before adding records.</div>
|
||||
</div>
|
||||
<form method="post" action="/admin/releases/install">
|
||||
<button type="submit" class="btn small">Create Tables</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="admin-card" style="margin-top:16px; padding:14px; display:flex; align-items:center; justify-content:space-between; gap:16px;">
|
||||
<div>
|
||||
<div style="font-weight:600;">Releases page</div>
|
||||
<div style="color: var(--muted); font-size:12px; margin-top:4px;">
|
||||
Slug: <code>releases</code>
|
||||
<?php if ($pageId > 0): ?>
|
||||
- Status: <?= $pagePublished === 1 ? 'Published' : 'Draft' ?>
|
||||
<?php else: ?>
|
||||
- Not created
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($pageId > 0): ?>
|
||||
<a href="/admin/pages/edit?id=<?= $pageId ?>" class="btn outline small">Edit Page Content</a>
|
||||
<?php else: ?>
|
||||
<span class="pill">Re-enable plugin to create</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!$releases): ?>
|
||||
<div style="margin-top:18px; color: var(--muted); font-size:13px;">No releases yet.</div>
|
||||
<?php else: ?>
|
||||
<div style="margin-top:18px; display:grid; gap:12px;">
|
||||
<?php foreach ($releases as $release): ?>
|
||||
<div class="admin-card" style="padding:14px; display:flex; align-items:center; justify-content:space-between; gap:16px;">
|
||||
<div style="display:flex; gap:12px; align-items:center;">
|
||||
<div style="width:44px; height:44px; border-radius:12px; overflow:hidden; background:rgba(255,255,255,0.06); display:grid; place-items:center;">
|
||||
<?php if (!empty($release['cover_url'])): ?>
|
||||
<img src="<?= htmlspecialchars((string)$release['cover_url'], ENT_QUOTES, 'UTF-8') ?>" alt="" style="width:100%; height:100%; object-fit:cover;">
|
||||
<?php else: ?>
|
||||
<span style="font-size:12px; color:var(--muted);">N/A</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-weight:600;"><?= htmlspecialchars((string)$release['title'], ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<div style="font-size:12px; color:var(--muted);"><?= htmlspecialchars((string)$release['slug'], ENT_QUOTES, 'UTF-8') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:8px; align-items:center;">
|
||||
<?php if ((int)$release['is_published'] !== 1): ?>
|
||||
<span class="pill">Draft</span>
|
||||
<?php endif; ?>
|
||||
<a href="/admin/releases/tracks?release_id=<?= (int)$release['id'] ?>" class="btn outline small">Tracks</a>
|
||||
<a href="/admin/releases/edit?id=<?= (int)$release['id'] ?>" class="btn outline small">Edit</a>
|
||||
<form method="post" action="/admin/releases/delete" onsubmit="return confirm('Delete this release?');">
|
||||
<input type="hidden" name="id" value="<?= (int)$release['id'] ?>">
|
||||
<button type="submit" class="btn outline small">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
require __DIR__ . '/../../../../modules/admin/views/layout.php';
|
||||
161
plugins/releases/views/admin/track_edit.php
Normal file
161
plugins/releases/views/admin/track_edit.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
$pageTitle = $title ?? 'Edit Track';
|
||||
$track = $track ?? [];
|
||||
$release = $release ?? null;
|
||||
$error = $error ?? '';
|
||||
$uploadError = (string)($_GET['upload_error'] ?? '');
|
||||
$storePluginEnabled = (bool)($store_plugin_enabled ?? false);
|
||||
ob_start();
|
||||
?>
|
||||
<section class="admin-card">
|
||||
<div class="badge">Releases</div>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||||
<div>
|
||||
<h1 style="font-size:28px; margin:0;"><?= htmlspecialchars($pageTitle, ENT_QUOTES, 'UTF-8') ?></h1>
|
||||
<p style="color: var(--muted); margin-top:6px;">
|
||||
<?= $release ? htmlspecialchars((string)$release['title'], ENT_QUOTES, 'UTF-8') : 'Track details' ?>
|
||||
</p>
|
||||
</div>
|
||||
<a href="/admin/releases/tracks?release_id=<?= (int)($track['release_id'] ?? 0) ?>" class="btn outline">Back</a>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div style="margin-top:16px; color:#f3b0b0; font-size:13px;"><?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($uploadError !== ''): ?>
|
||||
<div style="margin-top:12px; color:#f3b0b0; font-size:13px;"><?= htmlspecialchars($uploadError, ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="/admin/releases/tracks/save" enctype="multipart/form-data" style="margin-top:16px; display:grid; gap:16px;">
|
||||
<input type="hidden" name="id" value="<?= (int)($track['id'] ?? 0) ?>">
|
||||
<input type="hidden" name="track_id" value="<?= (int)($track['id'] ?? 0) ?>">
|
||||
<input type="hidden" name="release_id" value="<?= (int)($track['release_id'] ?? 0) ?>">
|
||||
|
||||
<div class="admin-card" style="padding:16px;">
|
||||
<div style="display:grid; gap:12px;">
|
||||
<label class="label">Track #</label>
|
||||
<input class="input" name="track_no" value="<?= htmlspecialchars((string)($track['track_no'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="1">
|
||||
<label class="label">Title</label>
|
||||
<input class="input" name="title" value="<?= htmlspecialchars((string)($track['title'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="Track title">
|
||||
<label class="label">Mix Name</label>
|
||||
<input class="input" name="mix_name" value="<?= htmlspecialchars((string)($track['mix_name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="Extended Mix">
|
||||
<label class="label">Duration</label>
|
||||
<input class="input" name="duration" value="<?= htmlspecialchars((string)($track['duration'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="6:12">
|
||||
<label class="label">BPM</label>
|
||||
<input class="input" name="bpm" value="<?= htmlspecialchars((string)($track['bpm'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="140">
|
||||
<label class="label">Key</label>
|
||||
<input class="input" name="key_signature" value="<?= htmlspecialchars((string)($track['key_signature'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="B Minor">
|
||||
|
||||
<div class="admin-card" style="padding:14px; background: rgba(10,10,12,0.6);">
|
||||
<div class="label">Upload sample (MP3)</div>
|
||||
<label for="trackSampleFile" id="trackSampleDropzone" style="display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:center; padding:18px; border-radius:14px; border:1px dashed rgba(255,255,255,0.2); background: rgba(0,0,0,0.2); cursor:pointer;">
|
||||
<div style="font-size:11px; text-transform:uppercase; letter-spacing:0.2em; color:var(--muted);">Drag & Drop</div>
|
||||
<div style="font-size:13px; color:var(--text);">or click to upload</div>
|
||||
<div id="trackSampleFileName" style="font-size:11px; color:var(--muted);">No file selected</div>
|
||||
</label>
|
||||
<input class="input" type="file" id="trackSampleFile" name="track_sample" accept="audio/mpeg" style="display:none;">
|
||||
<div style="margin-top:10px; display:flex; justify-content:flex-end;">
|
||||
<button type="submit" class="btn small" formaction="/admin/releases/tracks/upload" formmethod="post" formenctype="multipart/form-data" name="upload_kind" value="sample">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="label">Sample URL (MP3)</label>
|
||||
<input class="input" name="sample_url" value="<?= htmlspecialchars((string)($track['sample_url'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="https://...">
|
||||
|
||||
<?php if ($storePluginEnabled): ?>
|
||||
<div class="admin-card" style="padding:14px; background: rgba(10,10,12,0.6);">
|
||||
<div class="label">Upload full track (MP3)</div>
|
||||
<label for="trackFullFile" id="trackFullDropzone" style="display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:center; padding:18px; border-radius:14px; border:1px dashed rgba(255,255,255,0.2); background: rgba(0,0,0,0.2); cursor:pointer;">
|
||||
<div style="font-size:11px; text-transform:uppercase; letter-spacing:0.2em; color:var(--muted);">Drag & Drop</div>
|
||||
<div style="font-size:13px; color:var(--text);">or click to upload</div>
|
||||
<div id="trackFullFileName" style="font-size:11px; color:var(--muted);">No file selected</div>
|
||||
</label>
|
||||
<input class="input" type="file" id="trackFullFile" name="track_sample" accept="audio/mpeg" style="display:none;">
|
||||
<div style="margin-top:10px; display:flex; justify-content:flex-end;">
|
||||
<button type="submit" class="btn small" formaction="/admin/releases/tracks/upload" formmethod="post" formenctype="multipart/form-data" name="upload_kind" value="full">Upload Full</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="label">Full File URL (Store Download)</label>
|
||||
<input class="input" name="full_file_url" value="<?= htmlspecialchars((string)($track['full_file_url'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="/uploads/media/track-full.mp3">
|
||||
|
||||
<div class="admin-card" style="padding:14px; background: rgba(10,10,12,0.6);">
|
||||
<div class="label" style="margin-bottom:10px;">Store Options</div>
|
||||
<label style="display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||||
<input type="checkbox" name="store_enabled" value="1" <?= ((int)($track['store_enabled'] ?? 0) === 1) ? 'checked' : '' ?>>
|
||||
Enable track purchase
|
||||
</label>
|
||||
<div style="display:grid; grid-template-columns:1fr 120px; gap:10px; margin-top:10px;">
|
||||
<div>
|
||||
<label class="label">Track Price</label>
|
||||
<input class="input" name="track_price" value="<?= htmlspecialchars((string)($track['track_price'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="1.49">
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">Currency</label>
|
||||
<input class="input" name="store_currency" value="<?= htmlspecialchars((string)($track['store_currency'] ?? 'GBP'), ENT_QUOTES, 'UTF-8') ?>" placeholder="GBP">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex; justify-content:flex-end; gap:12px; align-items:center;">
|
||||
<button type="submit" class="btn">Save track</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<script>
|
||||
(function () {
|
||||
const drop = document.getElementById('trackSampleDropzone');
|
||||
const file = document.getElementById('trackSampleFile');
|
||||
const name = document.getElementById('trackSampleFileName');
|
||||
if (drop && file && name) {
|
||||
drop.addEventListener('dragover', (event) => {
|
||||
event.preventDefault();
|
||||
drop.style.borderColor = 'var(--accent)';
|
||||
});
|
||||
drop.addEventListener('dragleave', () => {
|
||||
drop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
});
|
||||
drop.addEventListener('drop', (event) => {
|
||||
event.preventDefault();
|
||||
drop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
if (event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length) {
|
||||
file.files = event.dataTransfer.files;
|
||||
name.textContent = event.dataTransfer.files[0].name;
|
||||
}
|
||||
});
|
||||
file.addEventListener('change', () => {
|
||||
name.textContent = file.files.length ? file.files[0].name : 'No file selected';
|
||||
});
|
||||
}
|
||||
|
||||
const fullDrop = document.getElementById('trackFullDropzone');
|
||||
const fullFile = document.getElementById('trackFullFile');
|
||||
const fullName = document.getElementById('trackFullFileName');
|
||||
if (fullDrop && fullFile && fullName) {
|
||||
fullDrop.addEventListener('dragover', (event) => {
|
||||
event.preventDefault();
|
||||
fullDrop.style.borderColor = 'var(--accent)';
|
||||
});
|
||||
fullDrop.addEventListener('dragleave', () => {
|
||||
fullDrop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
});
|
||||
fullDrop.addEventListener('drop', (event) => {
|
||||
event.preventDefault();
|
||||
fullDrop.style.borderColor = 'rgba(255,255,255,0.2)';
|
||||
if (event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length) {
|
||||
fullFile.files = event.dataTransfer.files;
|
||||
fullName.textContent = event.dataTransfer.files[0].name;
|
||||
}
|
||||
});
|
||||
fullFile.addEventListener('change', () => {
|
||||
fullName.textContent = fullFile.files.length ? fullFile.files[0].name : 'No file selected';
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
require __DIR__ . '/../../../../modules/admin/views/layout.php';
|
||||
69
plugins/releases/views/admin/tracks_index.php
Normal file
69
plugins/releases/views/admin/tracks_index.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
$pageTitle = 'Release Tracks';
|
||||
$release = $release ?? null;
|
||||
$tracks = $tracks ?? [];
|
||||
$tableReady = $table_ready ?? false;
|
||||
$releaseId = (int)($release_id ?? 0);
|
||||
ob_start();
|
||||
?>
|
||||
<section class="admin-card">
|
||||
<div class="badge">Releases</div>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||||
<div>
|
||||
<h1 style="font-size:28px; margin:0;">Tracks</h1>
|
||||
<p style="color: var(--muted); margin-top:6px;">
|
||||
<?= $release ? htmlspecialchars((string)$release['title'], ENT_QUOTES, 'UTF-8') : 'Select a release to manage tracks.' ?>
|
||||
</p>
|
||||
</div>
|
||||
<div style="display:flex; gap:10px; align-items:center;">
|
||||
<a href="/admin/releases" class="btn outline">Back</a>
|
||||
<?php if ($releaseId > 0): ?>
|
||||
<a href="/admin/releases/tracks/new?release_id=<?= $releaseId ?>" class="btn">New Track</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$tableReady): ?>
|
||||
<div style="margin-top:18px; color: var(--muted); font-size:13px;">Tracks table is not available. Run Releases ? Create Tables.</div>
|
||||
<?php elseif (!$release): ?>
|
||||
<div style="margin-top:18px; color: var(--muted); font-size:13px;">Release not found.</div>
|
||||
<?php elseif (!$tracks): ?>
|
||||
<div style="margin-top:18px; color: var(--muted); font-size:13px;">No tracks yet.</div>
|
||||
<?php else: ?>
|
||||
<div style="margin-top:18px; display:grid; gap:12px;">
|
||||
<?php foreach ($tracks as $track): ?>
|
||||
<div class="admin-card" style="padding:14px; display:flex; align-items:center; justify-content:space-between; gap:16px;">
|
||||
<div style="display:flex; gap:12px; align-items:center;">
|
||||
<div style="width:38px; height:38px; border-radius:10px; background:rgba(255,255,255,0.06); display:grid; place-items:center; font-size:12px; color:var(--muted);">
|
||||
<?= (int)($track['track_no'] ?? 0) > 0 ? (int)$track['track_no'] : '<27>' ?>
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-weight:600;">
|
||||
<?= htmlspecialchars((string)$track['title'], ENT_QUOTES, 'UTF-8') ?>
|
||||
<?php if (!empty($track['mix_name'])): ?>
|
||||
<span style="color:var(--muted); font-weight:400;">(<?= htmlspecialchars((string)$track['mix_name'], ENT_QUOTES, 'UTF-8') ?>)</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div style="font-size:12px; color:var(--muted);">
|
||||
<?= htmlspecialchars((string)($track['duration'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
|
||||
<?= !empty($track['bpm']) ? ' <20> ' . htmlspecialchars((string)$track['bpm'], ENT_QUOTES, 'UTF-8') . ' BPM' : '' ?>
|
||||
<?= !empty($track['key_signature']) ? ' <20> ' . htmlspecialchars((string)$track['key_signature'], ENT_QUOTES, 'UTF-8') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:8px; align-items:center;">
|
||||
<a href="/admin/releases/tracks/edit?release_id=<?= $releaseId ?>&id=<?= (int)$track['id'] ?>" class="btn outline small">Edit</a>
|
||||
<form method="post" action="/admin/releases/tracks/delete" onsubmit="return confirm('Delete this track?');">
|
||||
<input type="hidden" name="id" value="<?= (int)$track['id'] ?>">
|
||||
<input type="hidden" name="release_id" value="<?= $releaseId ?>">
|
||||
<button type="submit" class="btn outline small">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
require __DIR__ . '/../../../../modules/admin/views/layout.php';
|
||||
Reference in New Issue
Block a user