Now with a better file manager. It still needs work.

This commit is contained in:
Scott Idem
2024-06-27 18:19:29 -04:00
parent 37ac30c56c
commit 12c778c7e2
5 changed files with 226 additions and 95 deletions

View File

@@ -1624,76 +1624,12 @@ function send_sign_in_poc_email(
<p>Error: {error.message}</p>
{/await}
{#if $lq__event_file_obj_li && $lq__event_file_obj_li.length > 0}
<strong class="text-sm">Files:</strong>
<ul
class="space-y-2 px-4"
>
{#each $lq__event_file_obj_li as event_file_obj}
{#if (
event_file_obj.event_presentation_id_random == event_presentation_obj.event_presentation_id_random
&& (
$ae_loc.trusted_access
|| $events_loc.auth__kv.presentation[event_presentation_obj.event_presentation_id_random]
|| $events_loc.auth__kv.session[$events_slct.event_session_id] // This is the session ID of the person who signed in.
)
)}
<li>
<button
on:click={() => {
// ae_promises[event_file_obj.event_file_id_random]
ae_promises[event_file_obj.event_file_id_random] = api.download_hosted_file({
api_cfg: $ae_api,
hosted_file_id: event_file_obj.hosted_file_id_random,
return_file: true,
filename: event_file_obj.filename,
auto_download: true,
log_lvl: 1
});
// window.postMessage({ type: 'download_event_file', event_file_id: event_file_obj.event_file_id_random, filename: event_file_obj.filename, auto_download: true }, '*');
}}
class="btn btn-md variant-soft-primary hover:variant-filled-primary min-w-96"
title={`Download this file: ${event_file_obj.filename} [API] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`}
>
{#await ae_promises[event_file_obj.event_file_id_random]}
<span class="fas fa-spinner fa-spin mx-1"></span>
<span class="">
Downloading
{#if $ae_sess.api_download_kv[event_file_obj.hosted_file_id_random]}
{$ae_sess.api_download_kv[event_file_obj.hosted_file_id_random].percent_completed}%
{/if}
:
</span>
{:then}
<span class="fas fa-download mx-1"></span>
<span class="text-sm">
Download:
</span>
{/await}
<span class="grow">
{ae_util.shorten_filename({filename: event_file_obj.filename, max_length: 25})}
</span>
<span
class="badge variant-glass-success hover:variant-filled-success text-sm"
class:hidden={!event_file_obj.file_purpose}
>
{event_file_obj.file_purpose}
</span>
</button>
</li>
{/if}
{/each}
</ul>
{/if}
<Element_manage_event_file_li
link_to_type={'event_presentation'}
link_to_id={event_presentation_obj.event_presentation_id_random}
allow_basic={$events_loc.auth__kv.session[$events_slct.event_session_id] || $events_loc.auth__kv.presenter[$events_slct.event_presenter_id]}
allow_moderator={$events_loc.auth__kv.session[$events_slct.event_session_id]}
/>
<!-- Show files list for this presentation -->