diff --git a/_footer_admin.php b/_footer_admin.php
index 133c61b..230cd97 100644
--- a/_footer_admin.php
+++ b/_footer_admin.php
@@ -19,6 +19,7 @@
var first = actions.querySelector('.button');
if (first) actions.insertBefore(describe, first);
else actions.appendChild(describe);
+ if (typeof window.updatePublicLockedControls === 'function') window.updatePublicLockedControls(row);
});
}
@@ -260,6 +261,10 @@
var el = (e.target && e.target.closest && e.target.closest('.describe-button')) || (e.target && e.target.classList && e.target.classList.contains && e.target.classList.contains('describe-button') ? e.target : null);
if (!el) return;
e.preventDefault();
+ if (el.classList.contains('disabled') || el.getAttribute('aria-disabled') === 'true') return;
+ var row = el.closest ? el.closest('.admin-video-row') : null;
+ if (row && typeof window.updatePublicLockedControls === 'function') window.updatePublicLockedControls(row);
+ if (el.classList.contains('disabled') || el.getAttribute('aria-disabled') === 'true') return;
var job = el.dataset.job || '';
var articleId = el.dataset.id || '';
if (!job && !articleId) return;
diff --git a/admin.php b/admin.php
index a6bc9df..02caaac 100644
--- a/admin.php
+++ b/admin.php
@@ -1085,6 +1085,7 @@ try {
} elseif ($action === 'set_enabled') {
$dir = resolve_input_dir_from_request($config['uploads_dir'], $_POST['id'] ?? '', $_POST['dir'] ?? '', $articleIndex);
$articleId = ensure_state_article_id($dir);
+ if (input_dir_visible($dir) || input_dir_permalink($dir)) throw new RuntimeException('Disable Show and Permalink before changing render.');
$enabledNow = !empty($_POST['enabled']);
set_input_dir_enabled($dir, $enabledNow);
if ($enabledNow) {
@@ -1113,6 +1114,7 @@ try {
} elseif ($action === 'set_preview') {
$dir = resolve_input_dir_from_request($config['uploads_dir'], $_POST['id'] ?? '', $_POST['dir'] ?? '', $articleIndex);
$articleId = ensure_state_article_id($dir);
+ if (input_dir_visible($dir) || input_dir_permalink($dir)) throw new RuntimeException('Disable Show and Permalink before changing preview.');
$previewNow = !empty($_POST['preview']);
set_input_dir_preview($dir, $previewNow);
if ($previewNow) { set_input_dir_enabled($dir, false); set_input_dir_visible($dir, false); }
@@ -1193,6 +1195,7 @@ try {
} elseif ($action === 'set_map_hidden') {
$dir = resolve_input_dir_from_request($config['uploads_dir'], $_POST['id'] ?? '', $_POST['dir'] ?? '', $articleIndex);
$articleId = ensure_state_article_id($dir);
+ if (input_dir_visible($dir) || input_dir_permalink($dir)) throw new RuntimeException('Disable Show and Permalink before changing map visibility.');
$mapHiddenNow = !empty($_POST['map_hidden']);
set_input_dir_map_hidden($dir, $mapHiddenNow);
$message = ($mapHiddenNow ? 'Map hidden on index for: in-dir/' : 'Map visible on index for: in-dir/') . basename($dir);
@@ -1445,13 +1448,13 @@ $runningJobs = active_worker_jobs($config);
=h($err)?>
Videos without input dir
No orphan videos.
=page_links('videos',$videoPage,$videoPages)?>
-No input directories yet.
(string)($data['title'] ?? ''),'teaser'=>(string)($data['teaser'] ?? ''),'date'=>(string)($data['date'] ?? ''),'location'=>(string)($data['place'] ?? ''),'quote_da'=>(string)($data['quote_da'] ?? ''),'description'=>(string)($data['description'] ?? '')]; $currentSignature=$info['signature'] ?? ''; $fullFingerprint=is_array($state)?(string)($state['fingerprint'] ?? ''):''; $previewFingerprint=is_array($state)?(string)($state['preview_fingerprint'] ?? ''):''; $editedSinceRender=$hasFullVideo && $currentSignature !== '' && $fullFingerprint !== '' && $currentSignature !== $fullFingerprint; $editedSincePreview=!$hasFullVideo && $previewVideo && $currentSignature !== '' && $previewFingerprint !== '' && $currentSignature !== $previewFingerprint; $staleLabel=$editedSinceRender ? 'Edited since render' : ($editedSincePreview ? 'Edited since preview' : ''); ?>
Thumb source: =h((string)$thumbMeta['source_file'])?>
+
No input directories yet.
(string)($data['title'] ?? ''),'teaser'=>(string)($data['teaser'] ?? ''),'date'=>(string)($data['date'] ?? ''),'location'=>(string)($data['place'] ?? ''),'quote_da'=>(string)($data['quote_da'] ?? ''),'description'=>(string)($data['description'] ?? '')]; $currentSignature=$info['signature'] ?? ''; $fullFingerprint=is_array($state)?(string)($state['fingerprint'] ?? ''):''; $previewFingerprint=is_array($state)?(string)($state['preview_fingerprint'] ?? ''):''; $editedSinceRender=$hasFullVideo && $currentSignature !== '' && $fullFingerprint !== '' && $currentSignature !== $fullFingerprint; $editedSincePreview=!$hasFullVideo && $previewVideo && $currentSignature !== '' && $previewFingerprint !== '' && $currentSignature !== $previewFingerprint; $staleLabel=$editedSinceRender ? 'Edited since render' : ($editedSincePreview ? 'Edited since preview' : ''); ?>
Thumb source: =h((string)$thumbMeta['source_file'])?>
-
=h($meta['date'])?>=h($meta['location'])?>
=h((string)$meta['teaser'])?>
=nl2br(h($meta['description']), false)?>
โ=h(trim((string)$meta['quote_da'], "\"โโ"))?>โ
=h(implode(' ยท ', $detailParts))?>
=page_links('edit',$editPage,$editPages)?>
+
=h($meta['date'])?>=h($meta['location'])?>
=h((string)$meta['teaser'])?>
=nl2br(h($meta['description']), false)?>
โ=h(trim((string)$meta['quote_da'], "\"โโ"))?>โ
=h(implode(' ยท ', $detailParts))?>
=page_links('edit',$editPage,$editPages)?>
Edit input dir
in-dir/=h(basename($editDir))?>
This input directory is =h($editStatus)?>. Editing is disabled until the job completes.
@@ -1934,6 +1937,44 @@ function updateAdminRowTitleLink(row){
}
}
+function rowPublicLocked(row){
+ return !!row && (row.dataset.permalink === '1' || row.dataset.visible === '1' || row.classList.contains('shown'));
+}
+function updatePublicLockedControls(row){
+ if(!row) return;
+ const locked = rowPublicLocked(row);
+ ['preview','render','hide-map'].forEach(function(type){
+ const input = row.querySelector('form[data-switch="'+type+'"] input[type="checkbox"]');
+ if(input) input.disabled = locked;
+ });
+ const describe = row.querySelector('.describe-button');
+ if(describe){
+ describe.classList.toggle('disabled', locked);
+ describe.setAttribute('aria-disabled', locked ? 'true' : 'false');
+ describe.title = locked ? 'Disable Show and Permalink before describing' : '';
+ }
+ const edit = row.querySelector('[data-edit-action="1"]');
+ if(edit && edit.tagName === 'A'){
+ if(!edit.dataset.editHref) edit.dataset.editHref = edit.getAttribute('href') || '';
+ if(locked){
+ edit.removeAttribute('href');
+ edit.classList.add('disabled');
+ edit.setAttribute('aria-disabled', 'true');
+ edit.title = 'Disable Show and Permalink before editing';
+ }else{
+ const href = edit.dataset.editHref || '';
+ if(href) edit.setAttribute('href', href);
+ edit.classList.remove('disabled');
+ edit.removeAttribute('aria-disabled');
+ edit.title = 'Edit';
+ }
+ }
+}
+window.updatePublicLockedControls = updatePublicLockedControls;
+document.addEventListener('DOMContentLoaded', function(){
+ document.querySelectorAll('.admin-video-row').forEach(updatePublicLockedControls);
+});
+
function applySwitchPayload(payload){
if(!payload) return;
let row = null;
@@ -1956,6 +1997,7 @@ function applySwitchPayload(payload){
if('visible' in payload){
setSwitch('show', payload.visible);
row.classList.toggle('shown', !!payload.visible);
+ row.dataset.visible = payload.visible ? '1' : '0';
}
if('can_show' in payload){
const showInput = row.querySelector('form[data-switch="show"] input[type="checkbox"]');
@@ -1965,6 +2007,7 @@ function applySwitchPayload(payload){
showInput.checked = false;
showInput.dataset.state = '0';
row.classList.remove('shown');
+ row.dataset.visible = '0';
}
}
}
@@ -1976,6 +2019,7 @@ function applySwitchPayload(payload){
}
}
updateAdminRowTitleLink(row);
+ updatePublicLockedControls(row);
}