Now with a better file manager. It still needs work.
This commit is contained in:
@@ -211,6 +211,55 @@ export async function create_event_file_obj_from_hosted_file_async(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Updated 2024-06-13
|
||||||
|
export async function handle_update_ae_obj__event_file(
|
||||||
|
{
|
||||||
|
api_cfg,
|
||||||
|
event_file_id,
|
||||||
|
data_kv,
|
||||||
|
params={},
|
||||||
|
log_lvl=0
|
||||||
|
}: {
|
||||||
|
api_cfg: any,
|
||||||
|
event_file_id: string,
|
||||||
|
data_kv: any,
|
||||||
|
params?: key_val,
|
||||||
|
log_lvl?: number
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
console.log(`*** handle_update_ae_obj__event_file() *** event_file_id=${event_file_id}`);
|
||||||
|
|
||||||
|
ae_promises.update__event_file_obj = await api.update_ae_obj_id_crud({
|
||||||
|
api_cfg: api_cfg,
|
||||||
|
obj_type: 'event_file',
|
||||||
|
obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID.
|
||||||
|
fields: data_kv,
|
||||||
|
key: api_cfg.api_crud_super_key,
|
||||||
|
params: params,
|
||||||
|
return_obj: true,
|
||||||
|
log_lvl: log_lvl
|
||||||
|
})
|
||||||
|
.then(function (event_file_obj_update_result) {
|
||||||
|
if (event_file_obj_update_result) {
|
||||||
|
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_update_result]});
|
||||||
|
return event_file_obj_update_result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log('No results returned or failed.', error);
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
});
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log('ae_promises.update__event_file_obj:', ae_promises.update__event_file_obj);
|
||||||
|
}
|
||||||
|
return ae_promises.update__event_file_obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// This function will loop through the event_file_obj_li and save each one to the DB.
|
// This function will loop through the event_file_obj_li and save each one to the DB.
|
||||||
export function handle_db_save_ae_obj_li__event_file(
|
export function handle_db_save_ae_obj_li__event_file(
|
||||||
{
|
{
|
||||||
@@ -284,4 +333,5 @@ export function handle_db_save_ae_obj_li__event_file(
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,4 +319,5 @@ export function handle_db_save_ae_obj_li__event_presenter(
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import {
|
import {
|
||||||
handle_load_ae_obj_id__event,
|
handle_load_ae_obj_id__event,
|
||||||
handle_load_ae_obj_li__event,
|
handle_load_ae_obj_li__event,
|
||||||
handle_db_save_ae_obj_li__event
|
handle_db_save_ae_obj_li__event,
|
||||||
} from "$lib/ae_events__event";
|
} from "$lib/ae_events__event";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -11,7 +11,8 @@ import {
|
|||||||
handle_load_ae_obj_li__event_file,
|
handle_load_ae_obj_li__event_file,
|
||||||
handle_delete_ae_obj_id__event_file,
|
handle_delete_ae_obj_id__event_file,
|
||||||
create_event_file_obj_from_hosted_file_async,
|
create_event_file_obj_from_hosted_file_async,
|
||||||
handle_db_save_ae_obj_li__event_file
|
handle_update_ae_obj__event_file,
|
||||||
|
handle_db_save_ae_obj_li__event_file,
|
||||||
} from "$lib/ae_events__event_file";
|
} from "$lib/ae_events__event_file";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -22,28 +23,28 @@ import {
|
|||||||
handle_create_ae_obj__exhibit_tracking,
|
handle_create_ae_obj__exhibit_tracking,
|
||||||
handle_update_ae_obj__exhibit_tracking,
|
handle_update_ae_obj__exhibit_tracking,
|
||||||
handle_download_export__event_exhibit_tracking,
|
handle_download_export__event_exhibit_tracking,
|
||||||
handle_db_save_ae_obj_li__exhibitor
|
handle_db_save_ae_obj_li__exhibitor,
|
||||||
} from "$lib/ae_events__exhibit";
|
} from "$lib/ae_events__exhibit";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
handle_load_ae_obj_id__event_location,
|
handle_load_ae_obj_id__event_location,
|
||||||
handle_load_ae_obj_li__event_location,
|
handle_load_ae_obj_li__event_location,
|
||||||
handle_create_ae_obj__event_location,
|
handle_create_ae_obj__event_location,
|
||||||
handle_db_save_ae_obj_li__event_location
|
handle_db_save_ae_obj_li__event_location,
|
||||||
} from "$lib/ae_events__event_location";
|
} from "$lib/ae_events__event_location";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
handle_load_ae_obj_id__event_session,
|
handle_load_ae_obj_id__event_session,
|
||||||
handle_load_ae_obj_li__event_session,
|
handle_load_ae_obj_li__event_session,
|
||||||
handle_search__event_session,
|
handle_search__event_session,
|
||||||
handle_db_save_ae_obj_li__event_session
|
handle_db_save_ae_obj_li__event_session,
|
||||||
} from "$lib/ae_events__event_session";
|
} from "$lib/ae_events__event_session";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
handle_load_ae_obj_id__event_presentation,
|
handle_load_ae_obj_id__event_presentation,
|
||||||
handle_load_ae_obj_li__event_presentation,
|
handle_load_ae_obj_li__event_presentation,
|
||||||
handle_create_ae_obj__event_presentation,
|
handle_create_ae_obj__event_presentation,
|
||||||
handle_db_save_ae_obj_li__event_presentation
|
handle_db_save_ae_obj_li__event_presentation,
|
||||||
} from "$lib/ae_events__event_presentation";
|
} from "$lib/ae_events__event_presentation";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -51,14 +52,14 @@ import {
|
|||||||
handle_load_ae_obj_li__event_presenter,
|
handle_load_ae_obj_li__event_presenter,
|
||||||
handle_create_ae_obj__event_presenter,
|
handle_create_ae_obj__event_presenter,
|
||||||
handle_update_ae_obj__event_presenter,
|
handle_update_ae_obj__event_presenter,
|
||||||
handle_db_save_ae_obj_li__event_presenter
|
handle_db_save_ae_obj_li__event_presenter,
|
||||||
} from "$lib/ae_events__event_presenter";
|
} from "$lib/ae_events__event_presenter";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
handle_load_ae_obj_id__badge,
|
handle_load_ae_obj_id__badge,
|
||||||
handle_load_ae_obj_li__badge,
|
handle_load_ae_obj_li__badge,
|
||||||
handle_search__event_badge,
|
handle_search__event_badge,
|
||||||
handle_db_save_ae_obj_li__badge
|
handle_db_save_ae_obj_li__badge,
|
||||||
} from "$lib/ae_events__event_badge";
|
} from "$lib/ae_events__event_badge";
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +70,7 @@ let export_obj = {
|
|||||||
handle_load_ae_obj_id__event_file: handle_load_ae_obj_id__event_file,
|
handle_load_ae_obj_id__event_file: handle_load_ae_obj_id__event_file,
|
||||||
handle_load_ae_obj_li__event_file: handle_load_ae_obj_li__event_file,
|
handle_load_ae_obj_li__event_file: handle_load_ae_obj_li__event_file,
|
||||||
handle_delete_ae_obj_id__event_file: handle_delete_ae_obj_id__event_file,
|
handle_delete_ae_obj_id__event_file: handle_delete_ae_obj_id__event_file,
|
||||||
|
handle_update_ae_obj__event_file: handle_update_ae_obj__event_file,
|
||||||
|
|
||||||
handle_load_ae_obj_id__event_location: handle_load_ae_obj_id__event_location,
|
handle_load_ae_obj_id__event_location: handle_load_ae_obj_id__event_location,
|
||||||
handle_load_ae_obj_li__event_location: handle_load_ae_obj_li__event_location,
|
handle_load_ae_obj_li__event_location: handle_load_ae_obj_li__event_location,
|
||||||
|
|||||||
@@ -17,10 +17,22 @@ import { db_events } from "$lib/db_events";
|
|||||||
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||||
import { events_func } from '$lib/ae_events_functions';
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
|
|
||||||
export let container_class_li = [];
|
export let container_class_li: string|Array<string> = [];
|
||||||
export let link_to_type: string;
|
export let link_to_type: string;
|
||||||
export let link_to_id: string;
|
export let link_to_id: string;
|
||||||
export let show_convert_btn: boolean = null;
|
export let allow_basic: boolean = false;
|
||||||
|
export let allow_moderator: boolean = false;
|
||||||
|
|
||||||
|
export let show_convert_btn: null|boolean = null;
|
||||||
|
|
||||||
|
// This more or less overrides the default access control. Some elements may have their own access control.
|
||||||
|
if ($ae_loc.administrator_access) {
|
||||||
|
allow_basic = true;
|
||||||
|
allow_moderator = true;
|
||||||
|
} else if ($ae_loc.trusted_access) {
|
||||||
|
allow_basic = true;
|
||||||
|
allow_moderator = true;
|
||||||
|
}
|
||||||
|
|
||||||
let ae_placeholder_li: key_val = {};
|
let ae_placeholder_li: key_val = {};
|
||||||
let ae_promises: key_val = {}; // Promise<any>;
|
let ae_promises: key_val = {}; // Promise<any>;
|
||||||
@@ -41,7 +53,6 @@ onMount(() => {
|
|||||||
|
|
||||||
$slct_trigger = 'load__event_file_obj_li';
|
$slct_trigger = 'load__event_file_obj_li';
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@@ -68,20 +79,33 @@ onMount(() => {
|
|||||||
|
|
||||||
{#if $lq__event_file_obj_li && $lq__event_file_obj_li.length}
|
{#if $lq__event_file_obj_li && $lq__event_file_obj_li.length}
|
||||||
|
|
||||||
<table class="table table-striped table-bordered event_file_list">
|
<table class="table-auto w-full">
|
||||||
|
|
||||||
<col width="35%"> <!-- 35% -->
|
<col width=""> <!-- 35% -->
|
||||||
<col width=""> <!-- 24% -->
|
<col width=""> <!-- 24% -->
|
||||||
<!-- <col width=""> -->
|
<!-- <col width=""> -->
|
||||||
<col width="">
|
<col width="">
|
||||||
<col width="">
|
<col width="">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-left">File</th>
|
||||||
|
<th class="text-left">Options</th>
|
||||||
|
<th class="text-left">Status</th>
|
||||||
|
<th class="text-left">Meta</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{#each $lq__event_file_obj_li as event_file_obj}
|
{#each $lq__event_file_obj_li as event_file_obj}
|
||||||
<tr class="ae_obj obj_event_file">
|
<tr class="ae_obj obj_event_file border-t border-b border-gray-200 hover:bg-gray-50 hover:border-gray-300">
|
||||||
<td class="event_file_info">
|
<td class="event_file_info align-middle">
|
||||||
|
<!-- <div
|
||||||
|
class="min-w-full"
|
||||||
|
> -->
|
||||||
<button
|
<button
|
||||||
|
disabled={!allow_basic && !allow_moderator}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
// ae_promises[event_file_obj.event_file_id_random]
|
// ae_promises[event_file_obj.event_file_id_random]
|
||||||
ae_promises[event_file_obj.event_file_id_random] = api.download_hosted_file({
|
ae_promises[event_file_obj.event_file_id_random] = api.download_hosted_file({
|
||||||
@@ -109,9 +133,9 @@ onMount(() => {
|
|||||||
</span>
|
</span>
|
||||||
{:then}
|
{:then}
|
||||||
<span class="fas fa-download mx-1"></span>
|
<span class="fas fa-download mx-1"></span>
|
||||||
<span class="text-sm">
|
<!-- <span class="text-sm">
|
||||||
Download:
|
Download:
|
||||||
</span>
|
</span> -->
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
<span class="grow">
|
<span class="grow">
|
||||||
@@ -126,22 +150,129 @@ onMount(() => {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
<!-- </div> -->
|
||||||
</td>
|
</td>
|
||||||
<td class="event_file_info">
|
<td class="event_file_info">
|
||||||
|
<div class="flex flex-col gap-1 text-sm">
|
||||||
|
<button
|
||||||
|
disabled={1==1 || !allow_basic && !allow_moderator}
|
||||||
|
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
||||||
|
title="The rename function is not ready yet."
|
||||||
|
>
|
||||||
|
<span class="fas fa-edit mx-1"></span>
|
||||||
|
Rename
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
disabled={!allow_basic && !allow_moderator}
|
||||||
|
class:hidden={!$ae_loc.administrator_access}
|
||||||
|
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
||||||
|
title="Hide this file from the presentation launcher"
|
||||||
|
>
|
||||||
|
<span class="fas fa-eye mx-1"></span>
|
||||||
|
Hide
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
disabled={!allow_moderator}
|
||||||
|
on:click={async () => {
|
||||||
|
if (!confirm(`Are you sure you want to delete this file?\n${event_file_obj.filename} [${event_file_obj.event_file_id_random}]`)) {return false;}
|
||||||
|
|
||||||
|
// ae_promises[event_file_obj.event_file_id_random] = handle_delete__event_file({event_file_id: event_file_obj.event_file_id_random});
|
||||||
|
|
||||||
|
ae_promises.delete__event_file_obj = await events_func.handle_delete_ae_obj_id__event_file({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_file_id: event_file_obj.event_file_id_random,
|
||||||
|
log_lvl: 2
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
||||||
|
title="Delete this file"
|
||||||
|
>
|
||||||
|
<span class="fas fa-trash-alt mx-1"></span>
|
||||||
|
<!-- <span class="fas fa-minus mx-1"></span> -->
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="event_file_info">
|
||||||
|
<div class="flex flex-col gap-1 items-center text-sm">
|
||||||
|
|
||||||
|
<div class="">
|
||||||
|
{#if event_file_obj.open_in_os == 'win'}
|
||||||
|
|
||||||
|
MS Windows <span class="fab fa-windows"></span>
|
||||||
|
|
||||||
|
{:else if event_file_obj.open_in_os == 'mac'}
|
||||||
|
|
||||||
|
Apple macOS <span class="fab fa-apple"></span>
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Select from options for the purpose of this file -->
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="file_purpose"
|
||||||
|
class="text-sm mx-1 hidden"
|
||||||
|
>
|
||||||
|
Purpose:
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
id="file_purpose"
|
||||||
|
name="file_purpose"
|
||||||
|
disabled={!allow_basic && !allow_moderator}
|
||||||
|
value={event_file_obj.file_purpose}
|
||||||
|
on:change={e => {
|
||||||
|
// ae_tmp[event_file_obj.event_file_id_random].file_purpose = e.target.value;
|
||||||
|
console.log(`Selected file_purpose: ${e.target.value}`);
|
||||||
|
|
||||||
|
let event_file_data = {
|
||||||
|
event_file_id_random: event_file_obj.event_file_id_random,
|
||||||
|
file_purpose: e.target.value,
|
||||||
|
};
|
||||||
|
|
||||||
|
events_func.handle_update_ae_obj__event_file({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_file_id: event_file_obj.event_file_id_random,
|
||||||
|
data_kv: event_file_data,
|
||||||
|
log_lvl: 1
|
||||||
|
})
|
||||||
|
.then (function (update_results) {
|
||||||
|
console.log(`Update results:`, update_results);
|
||||||
|
$slct_trigger = 'load__event_file_obj_li';
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ae_triggers.update_event_file_purpose = true;
|
||||||
|
}}
|
||||||
|
class="select min-w-fit max-w-fit text-sm mx-1"
|
||||||
|
>
|
||||||
|
<option value={null} selected={!event_file_obj.file_purpose}>-- purpose not set --</option>
|
||||||
|
<option value="outline" selected={event_file_obj.file_purpose === 'outline'}>1. Outline</option>
|
||||||
|
<option value="draft" selected={event_file_obj.file_purpose === 'draft'}>2. Draft</option>
|
||||||
|
<option value="final" selected={event_file_obj.file_purpose === 'final'}>3. Final</option>
|
||||||
|
<!-- <option value="supporting">X. Supporting File (audio, video, data, etc)</option> -->
|
||||||
|
<!-- <option value="handout">X. Handout</option> -->
|
||||||
|
<option value="other">X. Other</option>
|
||||||
|
<!-- <option value="poster">Final - Poster</option> -->
|
||||||
|
<!-- <option value="presentation">Final - Presentation</option> -->
|
||||||
|
<!-- Shows in session room -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
|
||||||
<td class="event_file_info">
|
|
||||||
{event_file_obj.open_in_os}
|
|
||||||
{event_file_obj.file_purpose}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="event_file_info file_meta text-gray-500">
|
<td class="event_file_info file_meta text-gray-500">
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col text-sm">
|
||||||
<!-- {event_file_obj.hosted_file_content_type} -->
|
<!-- {event_file_obj.hosted_file_content_type} -->
|
||||||
|
|
||||||
|
<span class="w-full flex flex-row justify-between">
|
||||||
<span>
|
<span>
|
||||||
Type:
|
Type:
|
||||||
<strong>{event_file_obj.extension} <span class="fas fa-{ae_util.file_extension_icon(event_file_obj.extension)}"></span>
|
<strong>{event_file_obj.extension} <span class="fas fa-{ae_util.file_extension_icon(event_file_obj.extension)}"></span>
|
||||||
</strong>
|
</strong>
|
||||||
{#if event_file_obj.open_in_os == 'win'}
|
<!-- {#if event_file_obj.open_in_os == 'win'}
|
||||||
<strong>
|
<strong>
|
||||||
MS Windows <span class="fab fa-windows"></span>
|
MS Windows <span class="fab fa-windows"></span>
|
||||||
</strong>
|
</strong>
|
||||||
@@ -149,27 +280,38 @@ onMount(() => {
|
|||||||
<strong>
|
<strong>
|
||||||
Apple macOS <span class="fab fa-apple"></span>
|
Apple macOS <span class="fab fa-apple"></span>
|
||||||
</strong>
|
</strong>
|
||||||
{/if}
|
{/if} -->
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
Size:
|
Size:
|
||||||
<strong>{ae_util.format_bytes(event_file_obj.file_size)}</strong>
|
<strong>{ae_util.format_bytes(event_file_obj.file_size)}</strong>
|
||||||
</span>
|
</span>
|
||||||
<span class="text-muted">
|
</span>
|
||||||
|
|
||||||
|
<span class="w-full flex flex-row justify-between">
|
||||||
|
<span class="">
|
||||||
Hash: <strong>{event_file_obj.hash_sha256.slice(0, 10)}…</strong>
|
Hash: <strong>{event_file_obj.hash_sha256.slice(0, 10)}…</strong>
|
||||||
</span>
|
</span>
|
||||||
<span class="text-muted">
|
<span class:hidden={!$ae_loc.administrator_access}>
|
||||||
ID:
|
ID:
|
||||||
<strong>{event_file_obj.hosted_file_id_random}</strong>
|
<strong>{event_file_obj.hosted_file_id_random}</strong>
|
||||||
</span>
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<!-- <span class="fas fa-upload mx-1"></span> -->
|
<!-- <span class="fas fa-cloud-upload-alt mx-1"></span> -->
|
||||||
Uploaded:
|
<!-- Uploaded: -->
|
||||||
{ae_util.iso_datetime_formatter(event_file_obj.created_on, 'date_full')}
|
<!-- <span class="fas fa-calendar-day mx-1"></span> -->
|
||||||
|
<span class="fas fa-clock mx-1"></span>
|
||||||
|
<strong>
|
||||||
|
{ae_util.iso_datetime_formatter(event_file_obj.created_on, 'dddd')}
|
||||||
|
</strong>
|
||||||
|
{ae_util.iso_datetime_formatter(event_file_obj.created_on, 'date_iso')}
|
||||||
at
|
at
|
||||||
<strong>{ae_util.iso_datetime_formatter(event_file_obj.created_on, 'time_short_no_leading')}</strong>
|
<strong>{ae_util.iso_datetime_formatter(event_file_obj.created_on, 'time_short_no_leading')}</strong>
|
||||||
<!-- {event_file_obj.updated_on} -->
|
<!-- {event_file_obj.updated_on} -->
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1624,76 +1624,12 @@ function send_sign_in_poc_email(
|
|||||||
<p>Error: {error.message}</p>
|
<p>Error: {error.message}</p>
|
||||||
{/await}
|
{/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
|
<Element_manage_event_file_li
|
||||||
link_to_type={'event_presentation'}
|
link_to_type={'event_presentation'}
|
||||||
link_to_id={event_presentation_obj.event_presentation_id_random}
|
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 -->
|
<!-- Show files list for this presentation -->
|
||||||
|
|||||||
Reference in New Issue
Block a user