Removing old files.

This commit is contained in:
Scott Idem
2024-11-19 19:36:44 -05:00
parent acf0a169ab
commit e220653f45
5 changed files with 0 additions and 2606 deletions

View File

@@ -1,697 +0,0 @@
<script lang="ts">
type key_val = {
[key: string]: any;
};
// *** Import Svelte core
import { onMount } from 'svelte';
// *** Import Aether core variables and functions
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
// *** Import Aether core components
// *** Import Aether module variables and functions
// *** Import Aether module components
import Edit_post_obj from './del 10_edit__post_obj.svelte';
import View_post_obj from './ae_idaa_comp__post_obj_id_view.svelte';
// *** Export/Exposed variables and functions for component
export let account_id: string = $ae_loc.account_id;
export let post_id: string = $idaa_loc.bb.post_id;
export let novi_uuid: string = $idaa_loc.novi_uuid;
export let novi_email: string = $idaa_loc.novi_email;
export let novi_full_name: string = $idaa_loc.novi_full_name;
export let novi_admin_li: string = $idaa_loc.novi_admin_li;
export let novi_trusted_li: string = $idaa_loc.novi_trusted_li;
// *** Set initial variables
$idaa_loc.novi_uuid = novi_uuid;
$idaa_loc.novi_email = decodeURIComponent(novi_email);
$idaa_loc.novi_full_name = decodeURIComponent(novi_full_name);
$idaa_loc.novi_admin_li = novi_admin_li;
$idaa_loc.novi_trusted_li = novi_trusted_li;
$idaa_loc.bb.show_main__options = true;
$idaa_loc.bb.show_list__post_obj_li = true;
// NOTE: Check if the novi_uuid is in the novi_admin_li list
if ($idaa_loc.novi_uuid && $idaa_loc.novi_admin_li) {
if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
$ae_loc.access_type = 'administrator';
$ae_loc.administrator_access = true;
$ae_loc.trusted_access = true;
}
}
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
if ($idaa_loc.novi_uuid && $idaa_loc.novi_trusted_li) {
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) {
$ae_loc.access_type = 'trusted';
$ae_loc.trusted_access = true;
}
}
if ($ae_loc.administrator_access) {
$idaa_loc.bb.enabled = 'enabled';
$idaa_loc.bb.hidden = 'not_hidden';
$idaa_loc.bb.limit = 150;
} else if ($ae_loc.trusted_access) {
$idaa_loc.bb.enabled = 'enabled';
$idaa_loc.bb.hidden = 'not_hidden';
$idaa_loc.bb.limit = 75;
} else {
$idaa_loc.bb.enabled = 'enabled';
$idaa_loc.bb.hidden = 'not_hidden';
$idaa_loc.bb.limit = 50;
}
let idaa_post_obj_li_get_promise;
let idaa_post_obj_get_promise;
let idaa_post_comment_obj_li_get_promise;
if (account_id) {
$slct.account_id = account_id;
handle_load_idaa_post_obj_li({account_id: $slct.account_id, try_cache: false});
}
// NOTE: This if post_id is not fully ready yet -2023-09-08
if (post_id) {
console.log(`Selected Post ID: ${post_id}`);
$slct.post_id = post_id;
$slct_trigger = 'load__post_obj';
$slct_trigger = 'load__post_comment_obj_li';
// handle_load_post_id_obj({post_id: $slct.post_id, try_cache: false});
// handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
// Auto show the selected Post ID
// Is this pushState needed here?
// Set the URL param "post_id" to the current Post ID. This is a just in case.
// const url = new URL(location);
// url.searchParams.set('post_id', $slct.post_id);
// history.pushState({}, '', url);
$idaa_loc.bb.show_main__options = true;
$idaa_loc.bb.show_list__post_obj_li = true;
$idaa_loc.bb.show_edit__post_id = false;
$idaa_loc.bb.show_view__post_id = true;
}
if (!$ae_app.client_content) {
$ae_app.client_content = {};
}
onMount(() => {
console.log('** Component Mounted: ** IDAA Bulletin Board - AE Posts: Main');
});
$: if ($ae_app.iframe_height && $ae_app.iframe_height_modal_body) {
console.log('getting new dimensions for iframe:', $ae_app.iframe_height, $ae_app.iframe_height_modal_body);
let iframe_height = 0;
if ($ae_app.iframe_height > $ae_app.iframe_height_modal_body) {
iframe_height = $ae_app.iframe_height;
} else {
iframe_height = $ae_app.iframe_height_modal_body;
// console.log($ae_app.modal_dimensions);
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.header_height) {
iframe_height = iframe_height + $ae_app.modal_dimensions.header_height;
}
if ($ae_app.modal_dimensions && $ae_app.modal_dimensions.footer_height) {
iframe_height = iframe_height + $ae_app.modal_dimensions.footer_height;
}
// iframe_height = iframe_height + 50; // Just in case
}
console.log(`Suggested new iframe_height: ${iframe_height}`);
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
} else if ($ae_app.iframe_height) {
console.log('setting new iframe_height:', $ae_app.iframe_height);
// let iframe_height = $ae_app.iframe_height;
window.parent.postMessage({'iframe_height': $ae_app.iframe_height}, "*"); // This should be in pixels
}
$: if ($slct_trigger == 'load__post_obj_li' && $slct.account_id) {
$slct_trigger = null;
handle_load_idaa_post_obj_li({account_id: $slct.account_id, try_cache: false});
}
async function handle_load_idaa_post_obj_li({account_id, try_cache=false}) {
console.log('*** handle_load_idaa_post_obj_li() ***');
let enabled = $idaa_loc.bb.enabled;
let hidden = $idaa_loc.bb.hidden;
let limit = $idaa_loc.bb.limit;
let offset = $idaa_loc.bb.offset;
let params = {};
idaa_post_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post', // Post in this case is a person's bulletin board post.
for_obj_type: 'account',
for_obj_id: account_id,
enabled: enabled,
hidden: hidden,
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
limit: limit,
offset: offset,
params_json: null,
params: params,
log_lvl: 2
})
.then(function (post_obj_li_get_result) {
if (post_obj_li_get_result) {
$slct.post_obj_li = post_obj_li_get_result;
console.log(`Post list:`, $slct.post_obj_li);
} else {
$slct.post_obj_li = [];
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return idaa_post_obj_li_get_promise;
}
$: if ($slct_trigger == 'load__post_obj' && $slct.post_id) {
$slct_trigger = null;
handle_load_post_id_obj({post_id: $slct.post_id, try_cache: false});
// // Auto show the selected Event ID
// // Set the URL param "post_id" to the current Event ID. This is a just in case.
// const url = new URL(location);
// url.searchParams.set('post_id', $slct.post_id);
// history.pushState({}, '', url);
// let message = {'post_id': $slct.post_id};
// window.parent.postMessage(message, "*");
// $idaa_loc.bb.show_main__options = false;
// $idaa_loc.bb.show_list__post_li = false;
// $idaa_loc.bb.show_view__post_id = true;
// $idaa_loc.bb.show_edit__post_id = false;
}
async function handle_load_post_id_obj({post_id, try_cache=false}) {
console.log('*** handle_load_post_id_obj() ***');
// let enabled = $idaa_loc.bb.enabled;
// let hidden = $idaa_loc.bb.hidden;
// let limit = $idaa_loc.bb.limit;
// let offset = $idaa_loc.bb.offset;
let params = {};
idaa_post_obj_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post',
obj_id: post_id,
params: params,
log_lvl: 0
})
.then(function (post_obj_get_result) {
if (post_obj_get_result) {
$slct.post_obj = post_obj_get_result;
console.log(`Post object:`, $slct.post_obj);
}
// Auto show the selected Post ID
// Set the URL param "post_id" to the current Post ID.
const url = new URL(location);
url.searchParams.set('post_id', $slct.post_id);
history.pushState({}, '', url);
let message = {'post_id': $slct.post_id};
window.parent.postMessage(message, "*");
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return idaa_post_obj_get_promise;
}
$: if ($slct_trigger == 'load__post_comment_obj_li' && $slct.post_id) {
$slct_trigger = null;
handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
}
async function handle_load_post_comment_obj_li({post_id, try_cache=false}) {
console.log('*** handle_load_post_comment_obj_li() ***');
let enabled = $idaa_loc.bb.enabled;
let hidden = $idaa_loc.bb.hidden;
let limit = $idaa_loc.bb.limit;
let offset = $idaa_loc.bb.offset;
let params = {};
idaa_post_comment_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post_comment', // Post comment in this case is a person's bulletin board post comment.
for_obj_type: 'post',
for_obj_id: post_id,
enabled: enabled,
hidden: hidden,
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
limit: limit,
offset: offset,
params_json: null,
params: params,
log_lvl: 0
})
.then(function (post_comment_obj_li_get_result) {
if (post_comment_obj_li_get_result) {
$slct.post_comment_obj_li = post_comment_obj_li_get_result;
console.log(`Post Comment list:`, $slct.post_comment_obj_li);
} else {
$slct.post_comment_obj_li = [];
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return idaa_post_comment_obj_li_get_promise;
}
function handle_post_obj_created(event) {
console.log('*** handle_post_obj_created() ***');
console.log(event.detail);
// $slct.post_id = event.detail.post_id_random;
// $slct.post_obj = event.detail;
$slct_trigger = 'load__post_obj_li';
$idaa_loc.bb.show_list__post_obj_li = true;
$idaa_loc.bb.show_edit__post_id = false;
$idaa_loc.bb.show_view__post_id = false;
}
function handle_post_obj_updated(event) {
console.log('*** handle_post_obj_updated() ***');
console.log(event.detail);
// $slct.post_id = event.detail.post_id_random;
// $slct.post_obj = event.detail;
$slct_trigger = 'load__post_obj_li';
$idaa_loc.bb.show_list__post_obj_li = true;
$idaa_loc.bb.show_edit__post_id = false;
$idaa_loc.bb.show_view__post_id = false;
}
function handle_post_obj_deleted(event) {
console.log('*** handle_post_obj_deleted() ***');
console.log(event.detail);
// $slct.post_id = null;
// $slct.post_obj = {};
$slct_trigger = 'load__post_obj_li';
$idaa_loc.bb.show_list__post_obj_li = true;
$idaa_loc.bb.show_edit__post_id = false;
$idaa_loc.bb.show_view__post_id = false;
}
</script>
<section id="osit_idaa_bb" class="osit_posts ae_main c_idaa c_idaa_bb" bind:clientHeight={$ae_app.iframe_height}>
<!-- <header>
<h1>IDAA BB Posts</h1>
</header> -->
<section class="ae_section ae_meta">
<p>
Novi: {$idaa_loc.novi_full_name}
<span class="details">
(
{$idaa_loc.novi_email}
{#if $ae_loc.administrator_access}
<span class="access_type administrator_access">Administrator</span>
{:else if $ae_loc.trusted_access}
<span class="access_type trusted_access">Trusted</span>
{/if}
<span class="novi_uuid">UUID: {$idaa_loc.novi_uuid}</span>
)
</span>
</p>
<!-- <p>Page height: {window.innerHeight}</p> -->
</section>
{#if $idaa_loc.bb.show_main__options}
<section class="ae_section ae_options ae_row post_obj__options">
{#if $ae_loc.trusted_access && $idaa_loc.bb.hidden == 'not_hidden'}
<button
on:click={() => {
$idaa_loc.bb.hidden = 'all';
$slct_trigger = 'load__post_obj_li';
}}
class="ae_btn ae_smallest btn btn-info"
>
<span class="fas fa-eye"></span> Show Hidden Posts
</button>
{:else if $ae_loc.trusted_access && $idaa_loc.bb.hidden == 'all'}
<button
on:click={() => {
$idaa_loc.bb.hidden = 'not_hidden';
$slct_trigger = 'load__post_obj_li';
}}
class="ae_btn ae_smallest btn btn-info"
>
<span class="fas fa-eye-slash"></span> Hide Hidden Posts
</button>
{/if}
{#if $ae_loc.administrator_access}
{#if $idaa_loc.bb.enabled == 'enabled'}
<button
on:click={() => {
$idaa_loc.bb.hidden = 'all';
$idaa_loc.bb.enabled = 'all';
$idaa_loc.bb.limit = 500;
$slct_trigger = 'load__post_obj_li';
}}
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
>
<span class="fas fa-eye"></span> Show Disabled Posts
</button>
{:else}
<button
on:click={() => {
$idaa_loc.bb.enabled = 'enabled';
$slct_trigger = 'load__post_obj_li';
}}
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
>
<span class="fas fa-eye-slash"></span> Hide Disabled Posts
</button>
{/if}
{/if}
<button
on:click={() => {
$slct.post_id = null;
$slct.post_obj = {};
$slct.post_comment_obj_li = [];
const url = new URL(location);
url.searchParams.delete('post_id');
history.pushState({}, '', url);
$idaa_loc.bb.show_main__options = true;
$idaa_loc.bb.show_list__post_obj_li = true;
$idaa_loc.bb.show_edit__post_id = true;
$idaa_loc.bb.show_view__post_id = false;
}}
class="btn_new_bb_post btn btn-secondary"
>
<span class="fas fa-plus"></span> Create new BB post
</button>
</section>
{/if}
{#if $idaa_loc.bb.show_list__post_obj_li}
<section class="bb_post_list">
{#if $slct.post_obj_li}
<!-- <ul> -->
{#each $slct.post_obj_li as idaa_post_obj, index}
<div
id={`idaa_bb_post_id__${idaa_post_obj.post_id_random}`}
class="container bb_post post_obj"
class:post__hide={idaa_post_obj.hide}
class:post__priority={idaa_post_obj.priority}
class:post__group={idaa_post_obj.group}
>
<header class="ae_header post__header">
<h3 class="post__title">
{@html idaa_post_obj.title}
{#if idaa_post_obj.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {idaa_post_obj.topic_name}</span>{/if}
</h3>
</header>
{#if idaa_post_obj.content}<div class="post__content">{@html idaa_post_obj.content}</div>{/if}
<div class="ae_options post_obj__options">
<button
on:click={() => {
$slct.post_id = idaa_post_obj.post_id_random;
$slct.post_obj = idaa_post_obj;
handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
const url = new URL(location);
url.searchParams.set('post_id', idaa_post_obj.post_id_random);
history.pushState({}, '', url);
let message = {'post_id': idaa_post_obj.post_id_random};
window.parent.postMessage(message, "*");
$idaa_loc.bb.show_main__options = true;
$idaa_loc.bb.show_list__post_obj_li = true;
// $idaa_loc.bb.show_edit__post_id = false;
$idaa_loc.bb.show_view__post_id = true;
}}
class="btn btn-primary"
title={`View: ${idaa_post_obj.title}`}
>
<span class="fas fa-envelope-open"></span> Open
{#if idaa_post_obj.post_comment_count}
<span class="ae_badge ae_info post__post_comment_count">
<span class="fas fa-comment"></span> {(idaa_post_obj.post_comment_count == 1 ? `${idaa_post_obj.post_comment_count} comment` : `${idaa_post_obj.post_comment_count} comments` )}
</span>
{/if}
</button>
{#if $ae_loc.trusted_access || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid || idaa_post_obj.email === $idaa_loc.novi_email}
<button
on:click={() => {
$slct.post_id = idaa_post_obj.post_id_random;
$slct.post_obj = idaa_post_obj;
$slct_trigger = 'load__post_obj';
$idaa_loc.bb.show_main__options = true;
$idaa_loc.bb.show_list__post_obj_li = true;
$idaa_loc.bb.show_edit__post_id = true;
// $idaa_loc.bb.show_view__post_id = false;
}}
class="ae_btn ae_smallest btn btn-secondary"
title={`Edit post: ${idaa_post_obj.title}`}
>
<span class="fas fa-edit"></span> Edit Post
</button>
{/if}
<!-- <button
on:click={() => {
$slct.post_id = idaa_post_obj.post_id_random;
$slct.post_obj = idaa_post_obj;
$idaa_loc.bb.show_post_comment_crud = true;
}}
class="ae_btn btn_md btn_outline_warning"
title={`New comment on: ${idaa_post_obj.title}`}
>
<span class="fas fa-plus"></span> New Comment
</button> -->
</div>
<div class="ae_section ae_footer ae_meta post__meta">
{#if (idaa_post_obj.anonymous)}
<div class="post__posted_by">
Posted by: <span class="fas fa-user-secret"></span> <span class="post__full_name">Anonymous</span>
</div>
{:else if (idaa_post_obj.full_name)}
<div class="post__posted_by">
Posted by: <span class="fas fa-user"></span> <span class="post__full_name">{idaa_post_obj.full_name}
{#if $ae_loc.trusted_access && idaa_post_obj.email}
(<a href="mailto:{idaa_post_obj.email}?subject=IDAA BB Post">{idaa_post_obj.email}</a>)
{/if}
</div>
{/if}
{#if idaa_post_obj.created_on}
<div class="post__created_on_updated_on">
{#if !idaa_post_obj.updated_on}
<span
class="post__created_on"
>
<span class="ae_label">Created on:</span>
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_post_obj.created_on, 'datetime_iso_no_seconds')}</span>
</span>
{:else}
<span
class="post__updated_on"
>
<span class="ae_label">Updated on:</span>
<span class="ae_value">{ae.util.iso_datetime_formatter(idaa_post_obj.updated_on, 'datetime_iso_no_seconds')}</span>
</span>
{/if}
{#if idaa_post_obj.archive_on}
<span class="post__archive_on">Archive on: {ae.util.iso_datetime_formatter(idaa_post_obj.archive_on, 'datetime_iso_no_seconds')}</span>
{/if}
</div>
{/if}
<!-- <div style="font-size: smaller">json={encodeURIComponent(JSON.stringify({idaa_post_obj}))}</div> -->
</div>
</div>
{/each}
<!-- </ul> -->
{:else}
No posts found at this time
{/if}
</section>
{/if}
{#if $idaa_loc.bb.show_edit__post_id}
<Element_modal_v3
show = { true }
modal_cover_body = { false }
report_client_dimensions = { true }
on:close={ () => {
$idaa_loc.bb.show_main__options = true;
$idaa_loc.bb.show_list__post_obj_li = true;
$idaa_loc.bb.show_edit__post_id = false;
// $idaa_loc.bb.show_view__post_id = false;
const url = new URL(location);
url.searchParams.delete('post_id');
history.pushState({}, '', url);
let message = {'post_id': null};
window.parent.postMessage(message, "*");
}}
on:report__modal_dimensions={ (event) => {
console.log('*** on:report__modal_dimensions ***');
console.log(event.detail);
$ae_app.modal_dimensions = event.detail.modal_dimensions;
}}
>
<span slot="header_title">{@html ($slct.post_obj.title ? $slct.post_obj.title : 'New BB Post')}</span>
<span slot="body">
<section class="post_obj_view">
<Edit_post_obj on:created__post_obj={handle_post_obj_created} on:updated__post_obj={handle_post_obj_updated} on:deleted__post_obj={handle_post_obj_deleted} />
</section>
</span>
</Element_modal_v3>
{/if}
{#if $idaa_loc.bb.show_view__post_id && $slct.post_obj}
<Element_modal_v3
show = { true }
modal_cover_body = { false }
report_client_dimensions = { true }
on:close={ () => {
$slct.post_comment_id = null; // NOTE: Reset in case the post comment was being edited.
$slct.post_comment_obj = {}; // NOTE: Reset in case the post comment was being edited.
$slct.post_comment_obj_li = [];
$idaa_loc.bb.show_main__options = true;
$idaa_loc.bb.show_list__post_obj_li = true;
// $idaa_loc.bb.show_edit__post_id = false;
$idaa_loc.bb.show_view__post_id = false;
$idaa_loc.bb.show_edit__post_comment = false;
const url = new URL(location);
url.searchParams.delete('post_id');
history.pushState({}, '', url);
let message = {'post_id': null};
window.parent.postMessage(message, "*");
}}
on:report__modal_dimensions={ (event) => {
console.log('*** on:report__modal_dimensions ***');
console.log(event.detail);
$ae_app.modal_dimensions = event.detail.modal_dimensions;
}}
>
<span slot="header_title">{$slct.post_obj.title}</span>
<span slot="body">
<View_post_obj />
</span>
</Element_modal_v3>
{/if}
</section>
<style>
.ae_header h3 {
font-size: 1.2em;
margin: 0;
/* padding: 0; */
}
.post_obj .ae_meta {
font-size: smaller;
color: hsla(0,0%,50%,1);
}
.post_obj {
border: solid thin hsla(0,0%,90%,1);
margin: 1em .5em;
padding: .5em .5em;
}
.post__header {
background-color: hsla(0,0%,90%,1);
}
/* .ae_meta.post_obj {
flex-direction: row;
justify-content: space-between;
} */
/* :global(.bb_post_crud .element_ae_modal) {
border: dashed thin hsla(0,0%,70%,1);
margin: .5em .25em;
padding: .5em .25em;
background-color: hsla(0,0%,90%,1);
} */
/* :global(.bb_post_id_view .element_ae_modal) {
border: dashed thin blue;
} */
/* :global(.bb_post_comment_crud .element_ae_modal) {
border: dashed thin hsla(0,0%,70%,1);
margin: .5em .25em;
padding: .5em .25em;
background-color: hsla(0,0%,90%,1);
} */
</style>

View File

@@ -1,476 +0,0 @@
<script lang="ts">
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
import { fade } from 'svelte/transition';
import { ae, api, Element_input } from 'aether_npm_lib';
import { slct, ae_app } from './stores';
export let container_class_li = [];
const dispatch = createEventDispatcher();
let create_post_comment_obj_promise: any;
let delete_post_comment_obj_promise: any;
let update_post_comment_obj_promise: any;
let disable_submit_btn = true;
if ($slct.post_comment_id) {
console.log(`Post Comment ID selected: ${$slct.post_comment_id}`);
console.log(`Post Comment Object selected: ${$slct.post_comment_obj}`);
} else {
$slct.post_comment_id = null;
$slct.post_comment_obj = {
title: null,
content: null,
anonymous: false,
external_person_id: $idaa_loc.novi_uuid,
full_name: $idaa_loc.novi_full_name,
email: $idaa_loc.novi_email,
sort: null,
// notes: null,
};
console.log(`Post Comment Object started: ${$slct.post_comment_obj}`);
}
if ($slct.post_comment_obj) {
} else {
console.log(`Post Comment Object started: ${$slct.post_comment_obj}`)
}
onMount(() => {
console.log('** Component Mounted: ** Edit - Posts Comment Obj');
tinymce_remove(); // This seems to fix rendering issues
tinymce_init();
});
onDestroy(() => {
console.log('** Component Destroyed: ** Edit - Post Obj');
tinymce_remove(); // This seems like the right thing to do
});
function tinymce_init() {
// REFERENCE: https://www.tiny.cloud/docs/tinymce/6/basic-setup/
// plugins: [
// 'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
// 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
// 'media', 'table', 'emoticons', 'template', 'help'
// ],
// 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent'
// NOTE: Basic version of the TinyMCE editor
tinymce.init({
selector: '.tinymce_editor.editor_basic',
// width: 600,
height: 400,
plugins: [ 'lists', 'code', 'help' ],
menubar: false,
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
});
// NOTE: Minimal version of the TinyMCE editor
tinymce.init({
selector: '.tinymce_editor.editor_basic_200',
// width: 600,
height: 200,
plugins: [ 'lists', 'code', 'help' ],
menubar: false,
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
});
// NOTE: Less is more version of the TinyMCE editor
tinymce.init({
selector: '.tinymce_editor.editor_less_100',
// width: 600,
height: 100,
// plugins: [ 'lists', 'code', 'help' ],
menubar: false,
toolbar: false,
statusbar: false,
});
}
function tinymce_remove() {
tinymce.remove('.tinymce_editor.editor_basic');
tinymce.remove('.tinymce_editor.editor_basic_200');
tinymce.remove('.tinymce_editor.editor_less_100');
}
$: if ($slct.post_comment_obj) {
console.log('Selected post comment object changed?');
console.log($slct.post_comment_obj);
if ($slct.post_comment_obj == null) {
$slct.post_comment_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
} else {
disable_submit_btn = false;
}
// ae.input_template['event']['timezone'] = 'EDT';
}
async function handle_submit_form(event) {
console.log('*** handle_submit_form() ***');
// console.log(event.target);
disable_submit_btn = true;
let form_data = new FormData(event.target);
// console.log(form_data);
// Form Post Comment object data incoming
let post_comment_di = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 1});
// console.log(post_comment_di);
// Form Post Comment object data outgoing
let post_comment_do: key_val = {};
if (!$slct.post_comment_id) {
post_comment_do['post_id_random'] = $slct.post_id;
post_comment_do['enable'] = true;
}
if (tinyMCE.get('content')) {
post_comment_do['content'] = tinyMCE.get('content').getContent();
} else {
post_comment_do['content'] = post_comment_di.content;
}
if (!post_comment_do['content']) {
console.log('The content is required.');
disable_submit_btn = false;
alert('The text for the post comment is required.');
return false;
}
post_comment_do['anonymous'] = post_comment_di.anonymous;
post_comment_do['external_person_id'] = post_comment_di.external_person_id;
post_comment_do['full_name'] = post_comment_di.full_name;
post_comment_do['email'] = post_comment_di.email;
post_comment_do['hide'] = !!post_comment_di.hide;
if (post_comment_di.enable) {
post_comment_do['enable'] = !!post_comment_di.enable;
}
console.log(post_comment_do);
if (!$slct.post_comment_id) {
create_post_comment_obj_promise = api.create_ae_obj_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post_comment',
fields: post_comment_do,
key: $ae_app.ae_api.api_crud_super_key,
log_lvl: 1
})
.then(function (post_comment_obj_create_result) {
if (!post_comment_obj_create_result) {
console.log('The result was null or false.');
return false;
}
$slct.post_comment_id = post_comment_obj_create_result;
dispatch(
'post_comment_obj_created',
{
post_comment_id: $slct.post_comment_id,
}
);
return post_comment_obj_create_result;
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
});
return create_post_comment_obj_promise;
} else {
update_post_comment_obj_promise = api.update_ae_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post_comment',
obj_id: $slct.post_comment_id,
fields: post_comment_do,
key: $ae_app.ae_api.api_crud_super_key,
log_lvl: 1
})
.then(function (post_comment_obj_update_result) {
if (!post_comment_obj_update_result) {
console.log('The result was null or false.');
return false;
}
dispatch(
'post_comment_obj_updated',
{
post_comment_id: $slct.post_comment_id,
}
);
return post_comment_obj_update_result;
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
});
return update_post_comment_obj_promise;
}
}
async function handle_delete_post_comment_obj({post_comment_id, method='disable'}) {
console.log('*** handle_delete_post_comment_obj() ***');
delete_post_comment_obj_promise = api.delete_ae_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post_comment',
obj_id: post_comment_id,
method: method,
// params: params,
key: $ae_app.ae_api.api_crud_super_key,
log_lvl: 0
})
.then(function (post_comment_obj_delete_result) {
if (post_comment_obj_delete_result) {
// console.log(`Result:`, post_comment_obj_delete_result);
dispatch(
'post_comment_obj_deleted',
{
post_comment_id: post_comment_id,
}
);
}
})
.catch(function (error) {
console.log('The result was null or false when trying to delete.', error);
});
return delete_post_comment_obj_promise;
}
</script>
<section class="svelte_component ae_edit post_comment_obj {container_class_li.join(' ')}">
<form on:submit|preventDefault={handle_submit_form} class="">
{#await update_post_comment_obj_promise}
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
{:then}
{#if update_post_comment_obj_promise}
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
{:else}
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
{/if}
{/await}
<h3>Post Comment</h3>
<!-- <label for="title">Title of BB post
<input type="text" id="title" name="title" required max="20" value={$slct.post_comment_obj.title ? $slct.post_comment_obj.title : '' } placeholder="BB post title">
</label> -->
<label for="content">Content (post comment body)
<textarea id="content" name="content" rows="6" cols="70" value={$slct.post_comment_obj.content ? $slct.post_comment_obj.content : ''} class="ae_value ae__post_comment__content tinymce_editor editor_basic_200" placeholder="The text of the Bulletin Board post comment"></textarea>
</label>
<h3>Poster's Information</h3>
<fieldset class="">
<legend class="">Post as Anonymous</legend>
<div class="">
<input type="radio" class="" id="anonymous_no" name="anonymous" value="0" checked={(!$slct.post_comment_obj.anonymous)} required>
<label for="anonymous_no" class="">No, include my name and email address</label>
</div>
<div class="">
<input type="radio" class="" id="anonymous_yes" name="anonymous" value="1" checked={($slct.post_comment_obj.anonymous)} required >
<label for="anonymous_yes" class="">Yes, the post will be listed as Anonymous</label>
</div>
</fieldset>
<label for="external_person_id"><span class="fas fa-link"></span> Linked with Novi ID
{#if !$ae_loc.trusted_access}
<span class="fas fa-lock" title="Field is locked"></span>
<input
type="text"
id="external_person_id"
name="external_person_id"
value={($slct.post_comment_obj.external_person_id ? $slct.post_comment_obj.external_person_id : $idaa_loc.novi_uuid)}
readonly={true}
class="ae_width_lg"
>
{:else}
<div class="ae_highlight">Primary link using the Novi API UUID. This must be empty, a staff person, or an active member of IDAA and should be the primary contact for this meeting.</div>
<span class="fas fa-unlock" title="Field is unlocked"></span>
<input
type="text"
id="external_person_id"
name="external_person_id"
value={($slct.post_comment_obj.external_person_id ? $slct.post_comment_obj.external_person_id : '')}
readonly={false}
class="ae_width_lg"
>
{/if}
</label>
<label for="full_name">Your name
{#if !$ae_loc.trusted_access}
<span class="fas fa-lock" title="Field is locked"></span>
{:else}
<span class="fas fa-unlock" title="Field is unlocked"></span>
{/if}
<input
type="text"
id="full_name"
name="full_name"
value={($slct.post_comment_obj.full_name ? $slct.post_comment_obj.full_name : $idaa_loc.novi_full_name)}
>
</label>
{#if $ae_loc.trusted_access}
<label for="email">Your email
{#if !$ae_loc.trusted_access}
<span class="fas fa-lock" title="Field is locked"></span>
{:else}
<span class="fas fa-unlock" title="Field is unlocked"></span>
{/if}
<input
type="text"
name="email"
value={($slct.post_comment_obj.email ? $slct.post_comment_obj.email : $idaa_loc.novi_email)}
readonly={!$ae_loc.trusted_access}
>
<span class="ae_highlight">Secondary link using the Novi email address</span>
</label>
{/if}
{#if $ae_loc.trusted_access}
<section class="ae_section post_comment__admin_options"> <!-- BEGIN: section post_comment__admin_options -->
<h3>
Admin Options
<button type="button" class="ae_btn ae_d_none_toggle ae_float_right ae_smallest btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_out'); document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_in');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
</h3>
<span class="ae_d_none_content ae_fade_out">
<label>Hide
<input
type="checkbox"
name="hide"
id="hide"
bind:checked={$slct.post_comment_obj.hide}
>
</label>
<!-- <label>Priority
<input
type="checkbox"
name="priority"
id="priority"
bind:checked={$slct.post_comment_obj.priority}
>
</label> -->
<!-- <label>Sort <input type="number" name="sort" value={$slct.post_comment_obj.sort} /></label> -->
<!-- <label>Group <input type="text" name="group" value={$slct.post_comment_obj.group} max="100" /></label> -->
{#if $ae_loc.administrator_access}
<label>Enable
<input
type="checkbox"
name="enable"
id="enable"
bind:checked={$slct.post_comment_obj.enable}
>
</label>
{/if}
<!-- {#if $ae_loc.trusted_access}
<label>Internal Staff Notes
<textarea id="notes" name="notes" class="ae_value post__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.post_comment_obj.notes}></textarea>
</label>
{/if} -->
</span> <!-- END: span ae_show_hide_content -->
</section> <!-- END: section post_comment__admin_options -->
{/if}
<section class="ae_section ae_options ae_row">
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post Comment</button>
{#if $slct.post_comment_id}
{#if $ae_loc.administrator_access}
<button
on:click={() => {
if (!confirm('Are you sure you want to delete this post comment?')) {return false;}
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'delete'});
$slct.post_comment_id = null;
$slct.post_comment_obj = {};
}}
class="ae_btn ae_smallest btn btn-danger" type="button"
title="Delete record permanently"
>
<span class="fas fa-minus"></span> Delete
</button>
{:else if $ae_loc.trusted_access}
<button
on:click={() => {
if (!confirm('Are you sure you want to disable this post comment?')) {return false;}
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'disable'});
$slct.post_comment_id = null;
$slct.post_comment_obj = {};
}}
class="ae_btn ae_smallest btn btn-danger" type="button"
title="Disable record to delete"
>
<span class="fas fa-minus"></span> Delete
</button>
{:else}
<button
on:click={() => {
if (!confirm('Are you sure you want to hide this post comment?')) {return false;}
handle_delete_post_comment_obj({post_comment_id: $slct.post_comment_id, method: 'hide'});
$slct.post_comment_id = null;
$slct.post_comment_obj = {};
}}
class="ae_btn ae_smallest btn btn-danger" type="button"
title="Hide record to delete"
>
<span class="fas fa-comment-slash"></span> Delete
</button>
{/if}
{/if}
</section>
</form>
</section>
<style>
.svelte_component.ae_edit {
/* outline: dashed thin pink; */
}
</style>

View File

@@ -1,598 +0,0 @@
<script lang="ts">
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
import { fade } from 'svelte/transition';
import { ae, api, Element_input } from 'aether_npm_lib';
import { slct, ae_app } from './stores';
const dispatch = createEventDispatcher();
type key_val = {
[key: string]: any;
};
let create_post_obj_promise: any;
let delete_post_obj_promise: any;
let update_post_obj_promise: any;
let disable_submit_btn = true;
if ($slct.post_id) {
console.log(`Post ID selected: ${$slct.post_id}`);
console.log(`Post Object selected: ${$slct.post_obj}`);
if ($slct.post_obj) {
// if (!$slct.post_obj.external_person_id) {
// $slct.post_obj['external_person_id'] = $idaa_loc.novi_uuid;
// }
// if (!$slct.post_obj.full_name) {
// $slct.post_obj['full_name'] = $idaa_loc.novi_full_name;
// }
// if (!$slct.post_obj.email) {
// $slct.post_obj['email'] = $idaa_loc.novi_email;
// }
}
} else {
$slct.post_id = null;
$slct.post_obj = {
title: '',
content: '',
topic_id: null,
anonymous: false,
external_person_id: $idaa_loc.novi_uuid,
full_name: $idaa_loc.novi_full_name,
email: $idaa_loc.novi_email,
sort: null,
notes: null,
};
console.log(`Post Object started: ${$slct.post_obj}`);
}
if ($slct.post_obj) {
} else {
console.log(`Post Object started: ${$slct.post_obj}`)
}
onMount(() => {
console.log('** Component Mounted: ** Edit - Post Obj');
tinymce_remove(); // This seems to fix rendering issues
tinymce_init();
});
onDestroy(() => {
console.log('** Component Destroyed: ** Edit - Post Obj');
tinymce_remove(); // This seems like the right thing to do
});
function tinymce_init() {
// REFERENCE: https://www.tiny.cloud/docs/tinymce/6/basic-setup/
// plugins: [
// 'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
// 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
// 'media', 'table', 'emoticons', 'template', 'help'
// ],
// 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent'
// NOTE: Basic version of the TinyMCE editor
tinymce.init({
selector: '.tinymce_editor.editor_basic',
// width: 600,
height: 400,
plugins: [ 'lists', 'code', 'help' ],
menubar: false,
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
});
// NOTE: Minimal version of the TinyMCE editor
tinymce.init({
selector: '.tinymce_editor.editor_basic_200',
// width: 600,
height: 200,
plugins: [ 'lists', 'code', 'help' ],
menubar: false,
toolbar: 'undo redo | styles | bold italic | alignleft aligncenter | bullist numlist outdent indent | code | help',
});
// NOTE: Less is more version of the TinyMCE editor
tinymce.init({
selector: '.tinymce_editor.editor_less_100',
// width: 600,
height: 100,
// plugins: [ 'lists', 'code', 'help' ],
menubar: false,
toolbar: false,
statusbar: false,
});
}
function tinymce_remove() {
tinymce.remove('.tinymce_editor.editor_basic');
tinymce.remove('.tinymce_editor.editor_basic_200');
tinymce.remove('.tinymce_editor.editor_less_100');
}
// let ae_iframe_height = window.outerHeight;
let ae_iframe_height = window.innerHeight;
console.log(`ae_iframe_height: ${ae_iframe_height}`);
$: if (ae_iframe_height) {
console.log('ae_iframe_height changed:', ae_iframe_height);
let iframe_height = ae_iframe_height; // TESTING!!!
// window.parent.postMessage({'iframe_height': `${iframe_height}px`}, "*");
window.parent.postMessage({'iframe_height': iframe_height}, "*");
}
$: if ($slct.post_obj) {
console.log('Selected post object changed?');
console.log($slct.post_obj);
if ($slct.post_obj == null) {
$slct.post_obj = {title: null, content: null, name: null, description: null, notes: null, created_on: null, updated_on: null};
} else {
disable_submit_btn = false;
}
// ae.input_template['event']['timezone'] = 'EDT';
}
async function handle_submit_form(event) {
console.log('*** handle_submit_form() ***');
// console.log(event.target);
disable_submit_btn = true;
let form_data = new FormData(event.target);
// console.log(form_data);
// Form Post object data incoming
let post_di = ae.util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 1});
// console.log(post_di);
// Form Post object data outgoing
let post_do: key_val = {};
if (!$slct.post_id) {
post_do['account_id_random'] = $ae_app.account_id;
post_do['enable'] = true;
}
post_do['title'] = post_di.title;
if (tinyMCE.get('content')) {
post_do['content'] = tinyMCE.get('content').getContent();
} else {
post_do['content'] = post_di.content;
}
if (!post_do['content']) {
console.log('The content is required.');
disable_submit_btn = false;
alert('The text for the post is required.');
return false;
}
if (post_di.topic_id) {
post_do['topic_id'] = Number(post_di.topic_id);
// post_do['topic_id'] = post_di.topic_id;
} else {
post_do['topic_id'] = null;
}
console.log(post_di.anonymous);
console.log(typeof post_di.anonymous);
// console.log(Boolean(post_di.anonymous));
// console.log(Number((post_di.anonymous)));
// console.log(Boolean(Number((post_di.anonymous))));
// let anonymous_test = Boolean(post_di.anonymous)
// console.log(!anonymous_test);
// console.log(!!anonymous_test);
// console.log(!!!anonymous_test);
post_do['anonymous'] = post_di.anonymous;
post_do['external_person_id'] = post_di.external_person_id;
post_do['full_name'] = post_di.full_name;
post_do['email'] = post_di.email;
post_do['hide'] = !!post_di.hide;
post_do['priority'] = !!post_di.priority;
if (post_di.sort) {
post_do['sort'] = Number(post_di.sort);
} else {
post_do['sort'] = null;
}
if (post_di.group) {
post_do['group'] = post_di.group;
} else {
post_do['group'] = null;
}
if (post_di.enable) {
post_do['enable'] = !!post_di.enable;
}
if (tinyMCE.get('notes')) {
post_do['notes'] = tinyMCE.get('notes').getContent();
} else {
post_do['notes'] = post_di.notes;
}
console.log(post_do);
if (!$slct.post_id) {
create_post_obj_promise = api.create_ae_obj_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post',
fields: post_do,
key: $ae_app.ae_api.api_crud_super_key,
log_lvl: 1
})
.then(function (post_obj_create_result) {
if (!post_obj_create_result) {
console.log('The result was null or false.');
return false;
}
$slct.post_id = post_obj_create_result.obj_id_random;
dispatch(
'created__post_obj',
{
post_id: $slct.post_id,
}
);
return post_obj_create_result;
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
});
return create_post_obj_promise;
} else {
update_post_obj_promise = api.update_ae_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post',
obj_id: $slct.post_id,
fields: post_do,
key: $ae_app.ae_api.api_crud_super_key,
log_lvl: 1
})
.then(function (post_obj_update_result) {
if (!post_obj_update_result) {
console.log('The result was null or false.');
return false;
}
dispatch(
'updated__post_obj',
{
post_id: $slct.post_id,
}
);
return post_obj_update_result;
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
});
return update_post_obj_promise;
}
}
async function handle_delete_post_obj({post_id, method='disable'}) {
console.log('*** handle_delete_post_obj() ***');
delete_post_obj_promise = api.delete_ae_obj_id_crud({
api_cfg: $ae_app.ae_api,
obj_type: 'post',
obj_id: post_id,
method: method,
// params: params,
key: $ae_app.ae_api.api_crud_super_key,
log_lvl: 0
})
.then(function (post_obj_delete_result) {
if (post_obj_delete_result) {
// console.log(`Result:`, post_obj_delete_result);
dispatch(
'deleted__post_obj',
{
post_id: post_id,
}
);
}
})
.catch(function (error) {
console.log('The result was null or false when trying to delete.', error);
});
return delete_post_obj_promise;
}
</script>
<section
class="svelte_component ae_edit post_obj"
class:ae_create={!$slct.post_id}
bind:clientHeight={$ae_app.iframe_height_modal_body}
>
<form on:submit|preventDefault={handle_submit_form} class="">
{#await update_post_obj_promise}
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
{:then}
{#if update_post_obj_promise}
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
{:else}
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
{/if}
{/await}
<h3>Post</h3>
<label for="title">Title of BB post
<input type="text" id="title" name="title" class="ae_width_lg" required max="200" value={$slct.post_obj.title ? $slct.post_obj.title : '' } placeholder="The title of the BB post">
</label>
<label class="ae_label post__content" for="content">Content (post body)
<textarea id="content" name="content" rows="6" cols="70" bind:value={$slct.post_obj.content} class="ae_value post__content tinymce_editor editor_basic_200" placeholder="The text of the Bulletin Board post"></textarea>
</label>
<label for="topic_id">BB post topic
<select id="topic_id" name="topic_id" value={$slct.post_obj.topic_id}>
<option value="">-- None --</option>
<option value={16}>Licensing/ monitoring/ credentialing issues</option>
<option value={17}>Return to practice</option>
<option value={18}>Contacts/ sponsorship in my area</option>
<option value={19}>Professional positions</option>
<option value={21}
disabled={!$ae_loc.trusted_access}
>
Announcement
</option>
</select>
</label>
<h3>Poster's Information</h3>
<fieldset class="">
<legend class="">Post as Anonymous</legend>
<div class="">
<input
type="radio"
id="anonymous_no"
name="anonymous"
value={false}
bind:group={$slct.post_obj.anonymous}
>
<label for="anonymous_no">No, include my name and email address</label>
</div>
<div class="">
<input
type="radio"
id="anonymous_yes"
name="anonymous"
value={true}
bind:group={$slct.post_obj.anonymous}
>
<label for="anonymous_yes">Yes, the post will be listed as Anonymous</label>
</div>
</fieldset>
<label for="external_person_id"><span class="fas fa-link"></span> Linked with Novi ID
{#if !$ae_loc.trusted_access}
<span class="fas fa-lock" title="Field is locked"></span>
<input
type="text"
id="external_person_id"
name="external_person_id"
value={($slct.post_obj.external_person_id ? $slct.post_obj.external_person_id : $idaa_loc.novi_uuid)}
readonly={true}
class="ae_width_lg"
>
{:else}
<div class="ae_highlight">Primary link using the Novi API UUID. This must be empty, a staff person, or an active member of IDAA and should be the primary contact for this meeting.</div>
<span class="fas fa-unlock" title="Field is unlocked"></span>
<input
type="text"
id="external_person_id"
name="external_person_id"
value={($slct.post_obj.external_person_id ? $slct.post_obj.external_person_id : '')}
readonly={false}
class="ae_width_lg"
>
{/if}
</label>
<label for="full_name">Name
{#if !$ae_loc.trusted_access}
<span class="fas fa-lock" title="Field is locked"></span>
{:else}
<span class="fas fa-unlock" title="Field is unlocked"></span>
{/if}
<input
type="text"
id="full_name"
name="full_name"
value={($slct.post_obj.full_name ? $slct.post_obj.full_name : $idaa_loc.novi_full_name)}
readonly={!$ae_loc.trusted_access}
>
</label>
{#if $ae_loc.trusted_access}
<label for="email">Email
{#if !$ae_loc.trusted_access}
<span class="fas fa-lock" title="Field is locked"></span>
{:else}
<span class="fas fa-unlock" title="Field is unlocked"></span>
{/if}
<input
type="text"
name="email"
value={($slct.post_obj.email ? $slct.post_obj.email : $idaa_loc.novi_email)}
readonly={!$ae_loc.trusted_access}
>
<span class="ae_highlight">Secondary link using the Novi email address</span>
</label>
{/if}
<!-- <h3>Poster's Options</h3> -->
<!-- <fieldset class="">
<legend class="">Official or Member Post</legend>
<div class="">
<input type="radio" class="" id="group_official" name="group" value="official">
<label for="group_official" class="">Post as Official/Leadership</label>
</div>
<div class="">
<input type="radio" class="" id="group_member" name="group" value="member" checked="">
<label for="group_member" class="">Post as Member</label>
</div>
</fieldset> -->
<!-- <fieldset class="">
<legend class="">Enable Comments</legend>
<div class="">
<input type="radio" class="" id="enable_comments_no" name="enable_comments" value="0">
<label for="enable_comments_no" class="">No, do not allow comments</label>
</div>
<div class="">
<input type="radio" class="" id="enable_comments_yes" name="enable_comments" value="1" checked>
<label for="enable_comments_yes" class="">Yes, allow comments</label>
</div>
</fieldset> -->
{#if $ae_loc.trusted_access}
<section class="ae_section post__admin_options"> <!-- BEGIN: section post__admin_options -->
<h3>
Admin Options
<button type="button" class="ae_btn ae_d_none_toggle ae_float_right ae_smallest btn btn-xs btn-info" on:click={() => {document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_out'); document.querySelector('.ae_d_none_content').classList.toggle('ae_fade_in');}}><span class="fas fa-eye"></span> Show/Hide Admin</button>
</h3>
<span class="ae_d_none_content ae_fade_out">
<label>Hide
<input
type="checkbox"
name="hide"
id="hide"
bind:checked={$slct.post_obj.hide}
>
</label>
<label>Priority
<input
type="checkbox"
name="priority"
id="priority"
bind:checked={$slct.post_obj.priority}
>
</label>
<label>Sort <input type="number" name="sort" value={$slct.post_obj.sort} /></label>
<label>Group <input type="text" name="group" value={$slct.post_obj.group ? $slct.post_obj.group : ''} max="100" /></label>
{#if $ae_loc.administrator_access}
<label>Enable
<input
type="checkbox"
name="enable"
id="enable"
bind:checked={$slct.post_obj.enable}
>
</label>
{/if}
{#if $ae_loc.trusted_access}
<label>Internal Staff Notes
<textarea id="notes" name="notes" class="ae_value post__notes" rows="2" cols="70" value={$slct.post_obj.notes}></textarea>
</label>
{/if}
</span> <!-- END: span ae_show_hide_content -->
</section> <!-- END: section post__admin_options -->
{/if}
<section class="ae_section ae_options ae_row">
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post</button>
{#if $slct.post_id}
{#if $ae_loc.administrator_access}
<button
on:click={() => {
if (!confirm('Are you sure you want to delete this post?')) {return false;}
handle_delete_post_obj({post_id: $slct.post_id, method: 'delete'});
$slct.post_id = null;
$slct.post_obj = {};
}}
class="ae_btn ae_smallest btn btn-danger" type="button"
title="Delete record permanently"
>
<span class="fas fa-minus"></span> Delete
</button>
{:else if $ae_loc.trusted_access}
<button
on:click={() => {
if (!confirm('Are you sure you want to disable this post?')) {return false;}
handle_delete_post_obj({post_id: $slct.post_id, method: 'disable'});
$slct.post_id = null;
$slct.post_obj = {};
}}
class="ae_btn ae_smallest btn btn-danger" type="button"
title="Disable record to delete"
>
<span class="fas fa-minus"></span> Disable
</button>
{:else}
<button
on:click={() => {
if (!confirm('Are you sure you want to hide this post?')) {return false;}
handle_delete_post_obj({post_id: $slct.post_id, method: 'hide'});
$slct.post_id = null;
$slct.post_obj = {};
}}
class="ae_btn ae_smallest btn btn-danger" type="button"
title="Hide record to delete"
>
<span class="fas fa-comment-slash"></span> Delete
</button>
{/if}
{/if}
</section>
</form>
</section>
<style>
</style>