diff --git a/src/lib/ae_archives/ae_archives__archive.ts b/src/lib/ae_archives/ae_archives__archive.ts index 51280ff0..46d7ca57 100644 --- a/src/lib/ae_archives/ae_archives__archive.ts +++ b/src/lib/ae_archives/ae_archives__archive.ts @@ -15,6 +15,10 @@ export async function load_ae_obj_id__archive( api_cfg, archive_id, inc_content_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, params = {}, try_cache = true, log_lvl = 0 @@ -22,6 +26,10 @@ export async function load_ae_obj_id__archive( api_cfg: any, archive_id: string, inc_content_li?: boolean, + enabled?: string, + hidden?: string, + limit?: number, + offset?: number, params?: key_val, try_cache?: boolean, log_lvl?: number @@ -95,8 +103,10 @@ export async function load_ae_obj_id__archive( api_cfg: api_cfg, for_obj_type: 'archive', for_obj_id: archive_id, - enabled: 'all', - limit: 99, + enabled: enabled, // all, disabled, enabled + hidden: hidden, // all, hidden, not_hidden + limit: limit, // Limit for the comments + offset: offset, params: params, try_cache: try_cache, log_lvl: log_lvl @@ -156,39 +166,6 @@ export async function load_ae_obj_li__archive( // console.log('params_json:', params_json); - // ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ - // api_cfg: api_cfg, - // obj_type: 'archive', - // for_obj_type: for_obj_type, - // for_obj_id: for_obj_id, - // use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - // use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value - // enabled: enabled, - // hidden: hidden, - // order_by_li: order_by_li, - // limit: limit, - // offset: offset, - // params_json: params_json, - // params: params, - // log_lvl: log_lvl - // }) - // .then(function (archive_obj_li_get_result) { - // if (archive_obj_li_get_result) { - // if (try_cache) { - // db_save_ae_obj_li__archive({ - // obj_type: 'archive', - // obj_li: archive_obj_li_get_result - // }); - // } - // return archive_obj_li_get_result; - // } else { - // return []; - // } - // }) - // .catch(function (error) { - // console.log('No results returned or failed.', error); - // }); - ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ api_cfg: api_cfg, obj_type: 'archive', @@ -260,6 +237,10 @@ export async function load_ae_obj_li__archive( api_cfg: api_cfg, for_obj_type: 'archive', for_obj_id: archive_id, + enabled: enabled, // all, disabled, enabled + hidden: hidden, // all, hidden, not_hidden + limit: limit, // Limit for the comments + offset: offset, params: params, try_cache: try_cache, log_lvl: log_lvl diff --git a/src/lib/ae_archives/ae_archives__archive_content.ts b/src/lib/ae_archives/ae_archives__archive_content.ts index f9c7bd73..741a8941 100644 --- a/src/lib/ae_archives/ae_archives__archive_content.ts +++ b/src/lib/ae_archives/ae_archives__archive_content.ts @@ -15,11 +15,21 @@ export async function load_ae_obj_id__archive_content( { api_cfg, archive_content_id, + // enabled = 'enabled', + // hidden = 'not_hidden', + // limit = 99, + // offset = 0, + params = {}, try_cache = true, log_lvl = 0 }: { api_cfg: any, archive_content_id: string, + // enabled?: string, + // hidden?: string, + // limit?: number, + // offset?: number, + params?: key_val, try_cache?: boolean, log_lvl?: number } @@ -28,14 +38,12 @@ export async function load_ae_obj_id__archive_content( console.log(`*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`); } - let params = {}; - ae_promises.load__archive_content_obj = await api.get_ae_obj_id_crud({ api_cfg: api_cfg, obj_type: 'archive_content', - obj_id: archive_content_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value + obj_id: archive_content_id, + use_alt_table: false, + use_alt_base: false, params: params, log_lvl: log_lvl }) @@ -118,11 +126,6 @@ export async function load_ae_obj_li__archive_content( console.log(`*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); } - // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled - // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 99); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 - let params_json: key_val = {}; // console('params_json:', params_json); diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts index 429045e5..ae692398 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts @@ -28,6 +28,9 @@ export const load = (async ({ params, parent }) => { // route api_cfg: ae_acct.api, archive_id: archive_id, inc_content_li: true, + enabled: 'enabled', + hidden: 'all', // 'not_hidden' to load only visible entries + limit: 99, log_lvl: log_lvl }) .then((results) => { diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte index b7694b9e..187198d2 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte @@ -895,10 +895,18 @@ $effect(() => { onclick={() => { if (!confirm('Are you sure you want to delete this archive content?')) {return false;} + let method = 'disable'; + + if ($ae_loc.administrator_access && $ae_loc.edit_mode) { + // if (confirm('You have trusted access. Do you want to permanently delete this archive content? (OK = Permanent Delete, Cancel = Disable)')) { + method = 'delete'; + // } + } + prom_api__archive_content_obj = archives_func.delete_ae_obj_id__archive_content({ api_cfg: $ae_api, archive_content_id: $idaa_slct.archive_content_id, - method: 'disable', + method: method, log_lvl: log_lvl }); @@ -918,7 +926,11 @@ $effect(() => { Delete {#if $ae_loc.administrator_access} - (Disable) + {#if $ae_loc.edit_mode} + (Permanent Delete) + {:else} + (Disable) + {/if} {/if} {:else if $idaa_slct.archive_content_obj.hosted_file_id} diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte index 381ba016..265739e4 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte @@ -100,13 +100,18 @@ file_icons['zip'] = 'file-archive';

{@html idaa_archive_content_obj.name} + {idaa_archive_content_obj.hide}

{#if idaa_archive_content_obj.original_location} diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_view.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_view.svelte index 3705fe47..e8711b3b 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_view.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_view.svelte @@ -102,20 +102,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props $idaa_loc.archives.qry__limit = 250; // ae_trigger = 'load__event_obj_li'; $idaa_trig.archive_content_li = true; - - // let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({ - // api_cfg: $ae_api, - // for_obj_type: 'archive', - // for_obj_id: $ae_loc.archive_id, - // enabled: $idaa_loc.archives.qry__enabled, - // hidden: $idaa_loc.archives.qry__hidden, - // limit: $idaa_loc.archives.qry__limit, - // order_by_li: $idaa_loc.archives.qry__order_by_li, - // try_cache: true, - // log_lvl: log_lvl - // }); - // console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li); - // $idaa_slct.archive_content_obj_li = load_archive_content_obj_li; }} class="novi_btn btn_show_archives_archive_content ae_btn btn btn-info btn-sm preset-tonal-secondary border border-secondary-500" > @@ -130,20 +116,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props $idaa_loc.archives.qry__limit = 250; // ae_trigger = 'load__event_obj_li'; $idaa_trig.archive_content_li = true; - - // let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({ - // api_cfg: $ae_api, - // for_obj_type: 'archive', - // for_obj_id: $ae_loc.archive_id, - // enabled: $idaa_loc.archives.qry__enabled, - // hidden: $idaa_loc.archives.qry__hidden, - // limit: $idaa_loc.archives.qry__limit, - // order_by_li: $idaa_loc.archives.qry__order_by_li, - // try_cache: true, - // log_lvl: log_lvl - // }); - // console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li); - // $idaa_slct.archive_content_obj_li = load_archive_content_obj_li; }} class="novi_btn btn_hide_archives_archive_content ae_btn btn btn-info btn-sm preset-tonal-secondary border border-secondary-500" > @@ -160,18 +132,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props $idaa_loc.archives.qry__limit = 500; // ae_trigger = 'load__event_obj_li'; $idaa_trig.archive_content_li = true; - - // let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({ - // api_cfg: $ae_api, - // for_obj_type: 'archive', - // for_obj_id: $ae_loc.archive_id, - // enabled: $idaa_loc.archives.qry__enabled, - // hidden: $idaa_loc.archives.qry__hidden, - // limit: $idaa_loc.archives.qry__limit, - // order_by_li: $idaa_loc.archives.qry__order_by_li, - // try_cache: true, - // log_lvl: log_lvl - // }); }} class="novi_btn btn_show_archive_content ae_btn btn btn-warning btn-sm preset-tonal-secondary border border-secondary-500" > @@ -186,18 +146,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props $idaa_loc.archives.qry__limit = 500; $idaa_trig.archive_content_li = true; // ae_trigger = 'load__event_obj_li'; - - // let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({ - // api_cfg: $ae_api, - // for_obj_type: 'archive', - // for_obj_id: $ae_loc.archive_id, - // enabled: $idaa_loc.archives.qry__enabled, - // hidden: $idaa_loc.archives.qry__hidden, - // limit: $idaa_loc.archives.qry__limit, - // order_by_li: $idaa_loc.archives.qry__order_by_li, - // try_cache: true, - // log_lvl: log_lvl - // }); }} class="novi_btn btn_hide_bb_post ae_btn btn btn-warning btn-sm preset-tonal-secondary border border-secondary-500" >