Working on rewrite version 3. Focus on caching for now.
This commit is contained in:
@@ -15,7 +15,7 @@ body {
|
||||
/* Display */
|
||||
/* Center and scale the image nicely */
|
||||
background-color: steelblue;
|
||||
background-image: url('/static/images/site_background.webp'); /* "/static/images/site_background.webp" */
|
||||
background-image: url('../static/images/site_background.svg');
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
body {
|
||||
background-color: steelblue;
|
||||
/* https://app.haikei.app/ */
|
||||
background-image: url('/static/images/site_background.svg');
|
||||
background-image: url('../static/images/site_background.svg');
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
let api_update_datetime = Date.now();
|
||||
let waiting_on_api_token = false;
|
||||
|
||||
const secret_key = app_config.api_secret_key;
|
||||
const api_secret_key = app_config.api_secret_key;
|
||||
let api_temporary_token = null;
|
||||
|
||||
let api_base_url = null; // 'http://api.localhost:5001' 'https://api.oneskyit.com'
|
||||
@@ -135,8 +135,8 @@
|
||||
//console.log('****************** LOOP: API Token Loop ******************');
|
||||
|
||||
if (app_online && api_update_datetime < Date.now()) {
|
||||
//let api_temporary_token_result = api_token_request_async(axios, secret_key)
|
||||
api_temporary_token = await api_token_request_async(axios, secret_key)
|
||||
//let api_temporary_token_result = api_token_request_async(axios, api_secret_key)
|
||||
api_temporary_token = await api_token_request_async(axios, api_secret_key)
|
||||
.then(function (result) {
|
||||
if (result) {
|
||||
console.log('Setting temporary API token to axios Authorization header: '+result);
|
||||
|
||||
@@ -56,7 +56,8 @@
|
||||
|
||||
<script src="https://static.oneskyit.com/js/utilities.js"></script>
|
||||
|
||||
<script defer src="svelte/build/bundle.js" crossorigin></script>
|
||||
<!-- <script defer src="svelte/build/bundle.js" crossorigin></script> -->
|
||||
<script defer src="http://dev.oneskyit.local:5000/static/svelte/build/bundle.js" crossorigin></script>
|
||||
<!-- JavaScript (JS) end -->
|
||||
|
||||
</head>
|
||||
@@ -83,6 +84,7 @@
|
||||
|
||||
<!-- One Sky IT site custom JavaScript (JS) -->
|
||||
<script>const app = require('./js/module_app');</script>
|
||||
<script src="js/app_v3.js"></script>
|
||||
<!-- <script src="js/app_api.js"></script> -->
|
||||
<!-- <script src="js/app_idb.js"></script> -->
|
||||
<!-- <script src="js/app_ui_misc.js"></script> -->
|
||||
@@ -103,13 +105,16 @@ const app_env = 'development_local'; // 'development_local', 'development_remote
|
||||
const api_env = 'development_local'; // 'development_local', 'development_remote'
|
||||
const app_mode = 'onsite'; // null, 'default', 'onsite'
|
||||
|
||||
let account_id = app_config.account_id;
|
||||
let client_account_id = app_config.account_id;
|
||||
console.log(client_account_id);
|
||||
let event_id = app_config.event_id;
|
||||
let event_location_id = app_config.event_location_id;
|
||||
|
||||
const page_for = { 'event': event_id, 'event_location': event_location_id }; // Simple key value like object
|
||||
console.log(page_for);
|
||||
|
||||
const host_file_cache_path = app_config.host_file_cache_path; // 'file_cache/'
|
||||
|
||||
|
||||
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||
|
||||
@@ -121,7 +126,9 @@ console.log(page_for);
|
||||
// let api_update_datetime = Date.now();
|
||||
// let waiting_on_api_token = false;
|
||||
|
||||
const secret_key = app_config.api_secret_key;
|
||||
const access_control_allow_origin = app_config.access_control_allow_origin;
|
||||
const api_secret_key = app_config.api_secret_key;
|
||||
console.log(api_secret_key);
|
||||
let api_temporary_token = null;
|
||||
|
||||
let api_base_url = null;
|
||||
|
||||
@@ -1,228 +1,228 @@
|
||||
// This function is used to render all event, location, session, presentation, and presenter file records to the UI.
|
||||
//exports.render_event_file_records = async function () {
|
||||
async function render_event_file_records() {
|
||||
console.log('****************** Files ******************');
|
||||
console.log('Rendering all event, location, session, presentation, and presenter file records...');
|
||||
|
||||
if (looping_tbl_event_file) {
|
||||
console.log('Already looping through the tbl_event_file table. Not starting until finished.');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
looping_tbl_event_file = true;
|
||||
|
||||
console.log('Iterating through the tbl_event_file table...');
|
||||
let tbl_event_file_result = await tbl_event_file.iterate(function(value, key, iteration) {
|
||||
let tbl_file_id = value.id;
|
||||
let tbl_hosted_file_id = value.hosted_file_id;
|
||||
let tbl_event_id = value.event_id;
|
||||
let tbl_location_id = value.event_location_id;
|
||||
let tbl_session_id = value.event_session_id;
|
||||
let tbl_presentation_id = value.event_presentation_id;
|
||||
let tbl_presenter_id = value.event_presenter_id;
|
||||
let tbl_for_type = value.for_type;
|
||||
let tbl_for_id = value.for_id;
|
||||
let tbl_hash_sha256 = value.hosted_file_hash_sha256;
|
||||
let tbl_filename = value.filename; // This could also be event_file_filename, internal_filename, private_filename, public_filename, or hosted_file_filename
|
||||
let tbl_size = value.hosted_file_size;
|
||||
let tbl_created_on = value.created_on;
|
||||
let tbl_updated_on = value.created_on;
|
||||
let tbl_internal_os = value.internal_os;
|
||||
|
||||
console.log('tbl_event_file iteration='+iteration+' | tbl_file_id='+tbl_file_id+' for tbl_event_id='+tbl_event_id+' at location tbl_location_id='+tbl_location_id+'.');
|
||||
|
||||
if (tbl_event_id == event_id && tbl_for_type == 'event') {
|
||||
console.log('EVENT FILE **************************');
|
||||
document.getElementById('event_files_menu').classList.remove('d-none');
|
||||
document.getElementById('event_files_menu').classList.add('d-block');
|
||||
}
|
||||
|
||||
if (tbl_location_id == event_location_id && tbl_for_type == 'location') {
|
||||
console.log('LOCATION FILE **************************');
|
||||
document.getElementById('location_files_menu').classList.remove('d-none');
|
||||
document.getElementById('location_files_menu').classList.add('d-block');
|
||||
}
|
||||
|
||||
//add_file_id = false;
|
||||
remove_file_id = true;
|
||||
if (tbl_event_id == event_id/* && tbl_location_id == event_location_id*/) {
|
||||
console.log('Match for event_id='+event_id+' and event_location_id='+event_location_id);
|
||||
file_li_node = document.getElementById('event_file_'+tbl_file_id);
|
||||
if (file_li_node) {
|
||||
console.log('event_file ('+tbl_file_id+') node found... check and remove/update.');
|
||||
if (file_li_node.getAttribute('data-for_type') == tbl_for_type && file_li_node.getAttribute('data-for_id') == tbl_for_id) {
|
||||
console.log('This file is still for_type='+tbl_for_type+' and for_id='+tbl_for_id+'.');
|
||||
file_li_node.setAttribute('data-filename', tbl_filename);
|
||||
|
||||
let new_filename = shorten_filename(tbl_filename);
|
||||
file_li_node.getElementsByClassName('filename')[0].innerHTML = new_filename;
|
||||
try {
|
||||
file_li_node.getElementsByClassName('file_meta')[0].innerHTML = format_bytes(tbl_size, 2)+'; '+dateFns.format(tbl_created_on, 'MMM M h:mm A')+'; '+tbl_internal_os;
|
||||
} catch(err) {
|
||||
console.log('file_meta span not found. This is ok for event and location specific files.');
|
||||
}
|
||||
|
||||
file_li_node.setAttribute('data-size', tbl_size);
|
||||
|
||||
file_li_node.setAttribute('data-created_on', dateFns.format(tbl_created_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
file_li_node.setAttribute('data-updated_on', dateFns.format(tbl_updated_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
|
||||
file_li_node.setAttribute('data-internal_os', tbl_internal_os);
|
||||
|
||||
|
||||
remove_file_id = false;
|
||||
} else {
|
||||
console.log('This file no longer matching for_type='+tbl_for_type+' and for_id='+tbl_for_id+'. Removing...');
|
||||
file_li_node.remove();
|
||||
remove_file_id = false;
|
||||
}
|
||||
} else if (!file_li_node) {
|
||||
console.log('event_file ('+tbl_file_id+') node NOT found... check and add.');
|
||||
|
||||
let node_id = tbl_for_type+'_files_list_'+tbl_for_id;
|
||||
console.log(node_id);
|
||||
let parent_ul_node = document.getElementById(node_id);
|
||||
console.log(parent_ul_node);
|
||||
if (parent_ul_node) {
|
||||
// Trying to remove old ID in case there is one already rendered
|
||||
console.log('Trying to remove an old file LI node if it exists...');
|
||||
try {
|
||||
document.getElementById('event_file_'+tbl_file_id).remove();
|
||||
} catch(err) {
|
||||
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
||||
console.log('This event file list item node was not found. In most cases this is expected.');
|
||||
console.log(err.message);
|
||||
}
|
||||
|
||||
let file_li_node = document.createElement('LI');
|
||||
file_li_node.id = 'event_file_'+tbl_file_id;
|
||||
if (tbl_for_type != 'event' && tbl_for_type != 'location') {
|
||||
file_li_node.className = 'list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file event_file';
|
||||
//file_li_node.className = 'list-group-item btn btn-primary justify-content-between align-items-center open_local_file event_file';
|
||||
} else {
|
||||
file_li_node.className = 'list-group-item btn btn-sm btn-secondary d-flex justify-content-between align-items-center open_local_file event_file';
|
||||
//file_li_node.className = 'list-group-item btn btn-sm btn-secondary justify-content-between align-items-center open_local_file event_file';
|
||||
}
|
||||
file_li_node.setAttribute('data-file_id', tbl_file_id);
|
||||
|
||||
|
||||
file_li_node.setAttribute('data-event_id', tbl_event_id);
|
||||
file_li_node.setAttribute('data-location_id', tbl_location_id);
|
||||
file_li_node.setAttribute('data-session_id', tbl_session_id);
|
||||
file_li_node.setAttribute('data-presentation_id', tbl_presentation_id);
|
||||
file_li_node.setAttribute('data-presenter_id', tbl_presenter_id);
|
||||
|
||||
file_li_node.setAttribute('data-for_type', tbl_for_type);
|
||||
file_li_node.setAttribute('data-for_id', tbl_for_id);
|
||||
|
||||
file_li_node.setAttribute('data-hash_sha256', tbl_hash_sha256+'.file');
|
||||
file_li_node.setAttribute('data-filename', tbl_filename);
|
||||
file_li_node.setAttribute('data-size', tbl_size);
|
||||
|
||||
file_li_node.setAttribute('data-created_on', dateFns.format(tbl_created_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
file_li_node.setAttribute('data-updated_on', dateFns.format(tbl_updated_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
|
||||
file_li_node.setAttribute('data-internal_os', tbl_internal_os);
|
||||
|
||||
file_li_node.title = 'Click to open "'+tbl_filename+'" | id='+tbl_file_id+' | for_type='+tbl_for_type+' | for_id='+tbl_for_id+' | updated_on='+dateFns.format(tbl_updated_on, 'YYYY-MM-DD HH:mm:ss A');
|
||||
|
||||
let file_fa_span_node = document.createElement('SPAN');
|
||||
file_fa_span_node.className = 'fas fa-external-link-alt';
|
||||
|
||||
let file_filename_span_node = document.createElement('SPAN');
|
||||
|
||||
|
||||
file_filename_span_node.className = 'filename';
|
||||
|
||||
let new_filename = shorten_filename(tbl_filename);
|
||||
let filename_text_node = document.createTextNode(new_filename);
|
||||
file_filename_span_node.appendChild(filename_text_node);
|
||||
|
||||
file_li_node.appendChild(file_fa_span_node);
|
||||
file_li_node.appendChild(file_filename_span_node);
|
||||
|
||||
// We do not want the badge to show in the left menu. Not enough space.
|
||||
if (tbl_for_type != 'event' && tbl_for_type != 'location') {
|
||||
let file_badge_span_node = document.createElement('SPAN');
|
||||
file_badge_span_node.className = 'badge badge-pill badge-light float-right file_meta';
|
||||
|
||||
let badge_text_node = document.createTextNode(format_bytes(tbl_size, 2)+'; '+dateFns.format(tbl_created_on, 'MMM M h:mm A')+'; '+tbl_internal_os);
|
||||
file_badge_span_node.appendChild(badge_text_node);
|
||||
|
||||
file_li_node.appendChild(file_badge_span_node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log(file_li_node);
|
||||
|
||||
parent_ul_node.appendChild(file_li_node);
|
||||
remove_file_id = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// NOTE: This is probably not needed?
|
||||
if (remove_file_id) {
|
||||
// Trying to remove old ID in case there is one already rendered
|
||||
console.log('Trying to remove an old file LI node if it exists...');
|
||||
try {
|
||||
document.getElementById('event_file_'+tbl_file_id).remove();
|
||||
} catch(err) {
|
||||
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
||||
console.log('This event file list item node was not found. In most cases this is expected.');
|
||||
console.log(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('XXXXX ******** STARTING SORT ******** XXXXX');
|
||||
let node_id = tbl_for_type+'_files_list_'+tbl_for_id;
|
||||
console.log(node_id);
|
||||
try {
|
||||
var categoryItems = document.getElementById(node_id).childNodes;
|
||||
console.log(categoryItems);
|
||||
|
||||
var categoryItemsArray = Array.from(categoryItems);
|
||||
|
||||
function sorter(a, b) {
|
||||
if (a.dataset.updated_on > b.dataset.updated_on) return -1;
|
||||
if (a.dataset.updated_on < b.dataset.updated_on) return 1;
|
||||
}
|
||||
|
||||
let sorted = categoryItemsArray.sort(sorter);
|
||||
|
||||
function update_li_order(item, index) {
|
||||
document.getElementById(node_id).appendChild(item);
|
||||
}
|
||||
|
||||
sorted.forEach(update_li_order);
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
console.log('******** FINISHED SORT ********');
|
||||
|
||||
|
||||
|
||||
console.log('****************** Files ******************');
|
||||
console.log('Rendering all event, location, session, presentation, and presenter file records...');
|
||||
|
||||
if (looping_tbl_event_file) {
|
||||
console.log('Already looping through the tbl_event_file table. Not starting until finished.');
|
||||
return false;
|
||||
} else {
|
||||
console.log('This file ('+tbl_file_id+') is not part of this event and or location');
|
||||
console.log('tbl_event_id='+tbl_event_id+' ?= event_id='+event_id);
|
||||
console.log('tbl_location_id='+tbl_location_id+' ?= event_location_id='+event_location_id);
|
||||
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_ui: Iterate tbl_event_file looking for files to add is complete');
|
||||
looping_tbl_event_file = false;
|
||||
|
||||
looping_tbl_event_file = true;
|
||||
|
||||
console.log('Iterating through the tbl_event_file table...');
|
||||
let tbl_event_file_result = await tbl_event_file.iterate(function(value, key, iteration) {
|
||||
let tbl_file_id = value.id;
|
||||
let tbl_hosted_file_id = value.hosted_file_id;
|
||||
let tbl_event_id = value.event_id;
|
||||
let tbl_location_id = value.event_location_id;
|
||||
let tbl_session_id = value.event_session_id;
|
||||
let tbl_presentation_id = value.event_presentation_id;
|
||||
let tbl_presenter_id = value.event_presenter_id;
|
||||
let tbl_for_type = value.for_type;
|
||||
let tbl_for_id = value.for_id;
|
||||
let tbl_hash_sha256 = value.hosted_file_hash_sha256;
|
||||
let tbl_filename = value.filename; // This could also be event_file_filename, internal_filename, private_filename, public_filename, or hosted_file_filename
|
||||
let tbl_size = value.hosted_file_size;
|
||||
let tbl_created_on = value.created_on;
|
||||
let tbl_updated_on = value.created_on;
|
||||
let tbl_internal_os = value.internal_os;
|
||||
|
||||
console.log('tbl_event_file iteration='+iteration+' | tbl_file_id='+tbl_file_id+' for tbl_event_id='+tbl_event_id+' at location tbl_location_id='+tbl_location_id+'.');
|
||||
|
||||
if (tbl_event_id == event_id && tbl_for_type == 'event') {
|
||||
console.log('EVENT FILE **************************');
|
||||
document.getElementById('event_files_menu').classList.remove('d-none');
|
||||
document.getElementById('event_files_menu').classList.add('d-block');
|
||||
}
|
||||
|
||||
if (tbl_location_id == event_location_id && tbl_for_type == 'location') {
|
||||
console.log('LOCATION FILE **************************');
|
||||
document.getElementById('location_files_menu').classList.remove('d-none');
|
||||
document.getElementById('location_files_menu').classList.add('d-block');
|
||||
}
|
||||
|
||||
//add_file_id = false;
|
||||
remove_file_id = true;
|
||||
if (tbl_event_id == event_id/* && tbl_location_id == event_location_id*/) {
|
||||
console.log('Match for event_id='+event_id+' and event_location_id='+event_location_id);
|
||||
file_li_node = document.getElementById('event_file_'+tbl_file_id);
|
||||
if (file_li_node) {
|
||||
console.log('event_file ('+tbl_file_id+') node found... check and remove/update.');
|
||||
if (file_li_node.getAttribute('data-for_type') == tbl_for_type && file_li_node.getAttribute('data-for_id') == tbl_for_id) {
|
||||
console.log('This file is still for_type='+tbl_for_type+' and for_id='+tbl_for_id+'.');
|
||||
file_li_node.setAttribute('data-filename', tbl_filename);
|
||||
|
||||
let new_filename = shorten_filename(tbl_filename);
|
||||
file_li_node.getElementsByClassName('filename')[0].innerHTML = new_filename;
|
||||
try {
|
||||
file_li_node.getElementsByClassName('file_meta')[0].innerHTML = format_bytes(tbl_size, 2)+'; '+dateFns.format(tbl_created_on, 'MMM M h:mm A')+'; '+tbl_internal_os;
|
||||
} catch(err) {
|
||||
console.log('file_meta span not found. This is ok for event and location specific files.');
|
||||
}
|
||||
|
||||
file_li_node.setAttribute('data-size', tbl_size);
|
||||
|
||||
file_li_node.setAttribute('data-created_on', dateFns.format(tbl_created_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
file_li_node.setAttribute('data-updated_on', dateFns.format(tbl_updated_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
|
||||
file_li_node.setAttribute('data-internal_os', tbl_internal_os);
|
||||
|
||||
|
||||
remove_file_id = false;
|
||||
} else {
|
||||
console.log('This file no longer matching for_type='+tbl_for_type+' and for_id='+tbl_for_id+'. Removing...');
|
||||
file_li_node.remove();
|
||||
remove_file_id = false;
|
||||
}
|
||||
} else if (!file_li_node) {
|
||||
console.log('event_file ('+tbl_file_id+') node NOT found... check and add.');
|
||||
|
||||
let node_id = tbl_for_type+'_files_list_'+tbl_for_id;
|
||||
console.log(node_id);
|
||||
let parent_ul_node = document.getElementById(node_id);
|
||||
console.log(parent_ul_node);
|
||||
if (parent_ul_node) {
|
||||
// Trying to remove old ID in case there is one already rendered
|
||||
console.log('Trying to remove an old file LI node if it exists...');
|
||||
try {
|
||||
document.getElementById('event_file_'+tbl_file_id).remove();
|
||||
} catch(err) {
|
||||
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
||||
console.log('This event file list item node was not found. In most cases this is expected.');
|
||||
console.log(err.message);
|
||||
}
|
||||
|
||||
let file_li_node = document.createElement('LI');
|
||||
file_li_node.id = 'event_file_'+tbl_file_id;
|
||||
if (tbl_for_type != 'event' && tbl_for_type != 'location') {
|
||||
file_li_node.className = 'list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file event_file';
|
||||
//file_li_node.className = 'list-group-item btn btn-primary justify-content-between align-items-center open_local_file event_file';
|
||||
} else {
|
||||
file_li_node.className = 'list-group-item btn btn-sm btn-secondary d-flex justify-content-between align-items-center open_local_file event_file';
|
||||
//file_li_node.className = 'list-group-item btn btn-sm btn-secondary justify-content-between align-items-center open_local_file event_file';
|
||||
}
|
||||
file_li_node.setAttribute('data-file_id', tbl_file_id);
|
||||
|
||||
|
||||
file_li_node.setAttribute('data-event_id', tbl_event_id);
|
||||
file_li_node.setAttribute('data-location_id', tbl_location_id);
|
||||
file_li_node.setAttribute('data-session_id', tbl_session_id);
|
||||
file_li_node.setAttribute('data-presentation_id', tbl_presentation_id);
|
||||
file_li_node.setAttribute('data-presenter_id', tbl_presenter_id);
|
||||
|
||||
file_li_node.setAttribute('data-for_type', tbl_for_type);
|
||||
file_li_node.setAttribute('data-for_id', tbl_for_id);
|
||||
|
||||
file_li_node.setAttribute('data-hash_sha256', tbl_hash_sha256+'.file');
|
||||
file_li_node.setAttribute('data-filename', tbl_filename);
|
||||
file_li_node.setAttribute('data-size', tbl_size);
|
||||
|
||||
file_li_node.setAttribute('data-created_on', dateFns.format(tbl_created_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
file_li_node.setAttribute('data-updated_on', dateFns.format(tbl_updated_on, 'YYYY-MM-DD HH:mm:ss A'));
|
||||
|
||||
file_li_node.setAttribute('data-internal_os', tbl_internal_os);
|
||||
|
||||
file_li_node.title = 'Click to open "'+tbl_filename+'" | id='+tbl_file_id+' | for_type='+tbl_for_type+' | for_id='+tbl_for_id+' | updated_on='+dateFns.format(tbl_updated_on, 'YYYY-MM-DD HH:mm:ss A');
|
||||
|
||||
let file_fa_span_node = document.createElement('SPAN');
|
||||
file_fa_span_node.className = 'fas fa-external-link-alt';
|
||||
|
||||
let file_filename_span_node = document.createElement('SPAN');
|
||||
|
||||
|
||||
file_filename_span_node.className = 'filename';
|
||||
|
||||
let new_filename = shorten_filename(tbl_filename);
|
||||
let filename_text_node = document.createTextNode(new_filename);
|
||||
file_filename_span_node.appendChild(filename_text_node);
|
||||
|
||||
file_li_node.appendChild(file_fa_span_node);
|
||||
file_li_node.appendChild(file_filename_span_node);
|
||||
|
||||
// We do not want the badge to show in the left menu. Not enough space.
|
||||
if (tbl_for_type != 'event' && tbl_for_type != 'location') {
|
||||
let file_badge_span_node = document.createElement('SPAN');
|
||||
file_badge_span_node.className = 'badge badge-pill badge-light float-right file_meta';
|
||||
|
||||
let badge_text_node = document.createTextNode(format_bytes(tbl_size, 2)+'; '+dateFns.format(tbl_created_on, 'MMM M h:mm A')+'; '+tbl_internal_os);
|
||||
file_badge_span_node.appendChild(badge_text_node);
|
||||
|
||||
file_li_node.appendChild(file_badge_span_node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log(file_li_node);
|
||||
|
||||
parent_ul_node.appendChild(file_li_node);
|
||||
remove_file_id = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// NOTE: This is probably not needed?
|
||||
if (remove_file_id) {
|
||||
// Trying to remove old ID in case there is one already rendered
|
||||
console.log('Trying to remove an old file LI node if it exists...');
|
||||
try {
|
||||
document.getElementById('event_file_'+tbl_file_id).remove();
|
||||
} catch(err) {
|
||||
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
||||
console.log('This event file list item node was not found. In most cases this is expected.');
|
||||
console.log(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('XXXXX ******** STARTING SORT ******** XXXXX');
|
||||
let node_id = tbl_for_type+'_files_list_'+tbl_for_id;
|
||||
console.log(node_id);
|
||||
try {
|
||||
var categoryItems = document.getElementById(node_id).childNodes;
|
||||
console.log(categoryItems);
|
||||
|
||||
var categoryItemsArray = Array.from(categoryItems);
|
||||
|
||||
function sorter(a, b) {
|
||||
if (a.dataset.updated_on > b.dataset.updated_on) return -1;
|
||||
if (a.dataset.updated_on < b.dataset.updated_on) return 1;
|
||||
}
|
||||
|
||||
let sorted = categoryItemsArray.sort(sorter);
|
||||
|
||||
function update_li_order(item, index) {
|
||||
document.getElementById(node_id).appendChild(item);
|
||||
}
|
||||
|
||||
sorted.forEach(update_li_order);
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
console.log('******** FINISHED SORT ********');
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
console.log('This file ('+tbl_file_id+') is not part of this event and or location');
|
||||
console.log('tbl_event_id='+tbl_event_id+' ?= event_id='+event_id);
|
||||
console.log('tbl_location_id='+tbl_location_id+' ?= event_location_id='+event_location_id);
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_ui: Iterate tbl_event_file looking for files to add is complete');
|
||||
looping_tbl_event_file = false;
|
||||
return true;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong in function render_event_file_records.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
index_open_file_buttons('open_local_file');
|
||||
return true;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong in function render_event_file_records.');
|
||||
console.log(error);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
index_open_file_buttons('open_local_file');
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,178 +3,178 @@ const { ipcRenderer } = require('electron');
|
||||
|
||||
//exports.render_event_records = function () {
|
||||
async function render_event_records() {
|
||||
console.log('****************** Events ******************');
|
||||
console.log('Rendering event records...');
|
||||
//console.log(tbl_event);
|
||||
//console.log(event_id);
|
||||
|
||||
if (looping_tbl_event) {
|
||||
console.log('Already looping through the tbl_event table. Not starting until finished.');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
looping_tbl_event = true;
|
||||
|
||||
tbl_event.iterate(function(value, key, iteration) {
|
||||
if (value.id == event_id) {
|
||||
console.log('*** Event id ('+event_id+') found in table.');
|
||||
document.getElementById('event_name').innerHTML = '@'+value.name;
|
||||
document.getElementById('event_files_menu').getElementsByTagName('ul')[0].id = 'event_files_list_'+value.id;
|
||||
console.log('****************** Events ******************');
|
||||
console.log('Rendering event records...');
|
||||
//console.log(tbl_event);
|
||||
//console.log(event_id);
|
||||
|
||||
if (looping_tbl_event) {
|
||||
console.log('Already looping through the tbl_event table. Not starting until finished.');
|
||||
return false;
|
||||
} else {
|
||||
console.log('Event not it.');
|
||||
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
||||
//tbl_event_complete = true;
|
||||
looping_tbl_event = false;
|
||||
});
|
||||
|
||||
|
||||
looping_tbl_event = true;
|
||||
|
||||
tbl_event.iterate(function(value, key, iteration) {
|
||||
if (value.id == event_id) {
|
||||
console.log('*** Event id ('+event_id+') found in table.');
|
||||
document.getElementById('event_name').innerHTML = '@'+value.name;
|
||||
document.getElementById('event_files_menu').getElementsByTagName('ul')[0].id = 'event_files_list_'+value.id;
|
||||
} else {
|
||||
console.log('Event not it.');
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
||||
//tbl_event_complete = true;
|
||||
looping_tbl_event = false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//exports.render_event_location_records = async function () {
|
||||
async function render_event_location_records() {
|
||||
console.log('****************** Locations ******************');
|
||||
console.log('Rendering event location records...');
|
||||
|
||||
if (looping_tbl_event_location) {
|
||||
console.log('Already looping through the tbl_event_location table. Not starting until finished.');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
looping_tbl_event_location = true;
|
||||
|
||||
await tbl_event_location.iterate(function(value, key, iteration) {
|
||||
if (value.id == event_location_id) {
|
||||
console.log('*** Event location id ('+event_location_id+') found in table.');
|
||||
document.getElementById('location_name').innerHTML = '<span class="fas fa-map-marker"></span> '+value.name;
|
||||
|
||||
document.getElementById('location_files_menu').getElementsByTagName('ul')[0].id = 'location_files_list_'+value.id;
|
||||
/*
|
||||
let location_files_ul_node = document.createElement('UL');
|
||||
location_files_ul_node.id = 'event_presentation_files_list_'+value.id;
|
||||
location_files_ul_node.className = 'list-group list-group-flush location_files location_files_list event_files_list';
|
||||
|
||||
document.getElementById('location_files_menu').appendChild(location_files_ul_node);
|
||||
*/
|
||||
console.log('****************** Locations ******************');
|
||||
console.log('Rendering event location records...');
|
||||
|
||||
if (looping_tbl_event_location) {
|
||||
console.log('Already looping through the tbl_event_location table. Not starting until finished.');
|
||||
return false;
|
||||
} else {
|
||||
console.log('Event location not it.');
|
||||
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
||||
//tbl_event_location_complete = true;
|
||||
looping_tbl_event_location = false;
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
looping_tbl_event_location = true;
|
||||
|
||||
await tbl_event_location.iterate(function(value, key, iteration) {
|
||||
if (value.id == event_location_id) {
|
||||
console.log('*** Event location id ('+event_location_id+') found in table.');
|
||||
document.getElementById('location_name').innerHTML = '<span class="fas fa-map-marker"></span> '+value.name;
|
||||
|
||||
document.getElementById('location_files_menu').getElementsByTagName('ul')[0].id = 'location_files_list_'+value.id;
|
||||
/*
|
||||
let location_files_ul_node = document.createElement('UL');
|
||||
location_files_ul_node.id = 'event_presentation_files_list_'+value.id;
|
||||
location_files_ul_node.className = 'list-group list-group-flush location_files location_files_list event_files_list';
|
||||
|
||||
document.getElementById('location_files_menu').appendChild(location_files_ul_node);
|
||||
*/
|
||||
} else {
|
||||
console.log('Event location not it.');
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
||||
//tbl_event_location_complete = true;
|
||||
looping_tbl_event_location = false;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Updated 2020-01-31 */
|
||||
function index_launcher_sessions(class_name) {
|
||||
console.log('Indexing launcher sessions with class name: '+class_name);
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } );
|
||||
}
|
||||
console.log(class_elements);
|
||||
return true;
|
||||
console.log('Indexing launcher sessions with class name: '+class_name);
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } );
|
||||
}
|
||||
console.log(class_elements);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Updated 2020-01-31 */
|
||||
function view_session(session_id) {
|
||||
var class_elements = document.getElementsByClassName('session_detail'); // This class name should be the class names for each div container
|
||||
console.log('View session ID: '+session_id);
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
//console.log('*** checking: '+class_elements[i].getAttribute('data-session_id'));
|
||||
if (class_elements[i].getAttribute('data-session_id') == session_id) {
|
||||
//console.log('show');
|
||||
class_elements[i].classList.remove('d-none');
|
||||
class_elements[i].classList.add('d-block');
|
||||
} else {
|
||||
//console.log('hide');
|
||||
class_elements[i].classList.remove('d-block');
|
||||
class_elements[i].classList.add('d-none');
|
||||
var class_elements = document.getElementsByClassName('session_detail'); // This class name should be the class names for each div container
|
||||
console.log('View session ID: '+session_id);
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
//console.log('*** checking: '+class_elements[i].getAttribute('data-session_id'));
|
||||
if (class_elements[i].getAttribute('data-session_id') == session_id) {
|
||||
//console.log('show');
|
||||
class_elements[i].classList.remove('d-none');
|
||||
class_elements[i].classList.add('d-block');
|
||||
} else {
|
||||
//console.log('hide');
|
||||
class_elements[i].classList.remove('d-block');
|
||||
class_elements[i].classList.add('d-none');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Updated 2020-02-13 */
|
||||
function index_open_file_buttons(class_name) {
|
||||
console.log('****************** Indexing ******************');
|
||||
console.log('Indexing open file buttons...');
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
//console.log(class_elements);
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
// Do not use an anonymous function. If you do then it will keep adding event listeners.
|
||||
// Adding the exact same event listeners over and over doesn't hurt anything.
|
||||
// No need to use removeEventListener()
|
||||
class_elements[i].addEventListener( 'click', open_local_file );
|
||||
|
||||
/*
|
||||
let hash = class_elements[i].getAttribute('data-hash_sha256');
|
||||
let file_path = path.join(host_file_cache_path, hash);
|
||||
let filename = class_elements[i].getAttribute('data-filename');
|
||||
class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } );
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
console.log('****************** Indexing ******************');
|
||||
console.log('Indexing open file buttons...');
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
//console.log(class_elements);
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
// Do not use an anonymous function. If you do then it will keep adding event listeners.
|
||||
// Adding the exact same event listeners over and over doesn't hurt anything.
|
||||
// No need to use removeEventListener()
|
||||
class_elements[i].addEventListener( 'click', open_local_file );
|
||||
|
||||
/*
|
||||
let hash = class_elements[i].getAttribute('data-hash_sha256');
|
||||
let file_path = path.join(host_file_cache_path, hash);
|
||||
let filename = class_elements[i].getAttribute('data-filename');
|
||||
class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } );
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Updated 2020-02-13 */
|
||||
function open_local_file() {
|
||||
//console.log(this);
|
||||
let hash = this.getAttribute('data-hash_sha256');
|
||||
let file_path = path.join(host_file_cache_path, hash);
|
||||
let filename = this.getAttribute('data-filename');
|
||||
console.log(file_path);
|
||||
console.log(filename);
|
||||
|
||||
ipcRenderer.send('open_local_file', file_path, filename);
|
||||
//console.log(this);
|
||||
let hash = this.getAttribute('data-hash_sha256');
|
||||
let file_path = path.join(host_file_cache_path, hash);
|
||||
let filename = this.getAttribute('data-filename');
|
||||
console.log(file_path);
|
||||
console.log(filename);
|
||||
|
||||
ipcRenderer.send('open_local_file', file_path, filename);
|
||||
}
|
||||
|
||||
|
||||
function format_bytes(bytes, decimals = 2) {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
|
||||
const k = 1024;
|
||||
const dm = decimals < 0 ? 0 : decimals;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
const k = 1024;
|
||||
const dm = decimals < 0 ? 0 : decimals;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
function shorten_filename(filename) {
|
||||
let length = filename.length;
|
||||
let char_over = filename.length-45;
|
||||
let new_filename = null;
|
||||
let wildcards = char_over;
|
||||
if (char_over > 0) {
|
||||
let part1 = filename.slice(0, 20);
|
||||
if (char_over > 5) {
|
||||
wildcards = 5;
|
||||
let length = filename.length;
|
||||
let char_over = filename.length-45;
|
||||
let new_filename = null;
|
||||
let wildcards = char_over;
|
||||
if (char_over > 0) {
|
||||
let part1 = filename.slice(0, 20);
|
||||
if (char_over > 5) {
|
||||
wildcards = 5;
|
||||
} else {
|
||||
}
|
||||
let part2 = '.'.repeat(wildcards);
|
||||
let part3 = filename.slice(-20);
|
||||
|
||||
new_filename = part1+part2+part3;
|
||||
} else {
|
||||
new_filename = filename;
|
||||
}
|
||||
let part2 = '.'.repeat(wildcards);
|
||||
let part3 = filename.slice(-20);
|
||||
|
||||
new_filename = part1+part2+part3;
|
||||
} else {
|
||||
new_filename = filename;
|
||||
}
|
||||
return new_filename;
|
||||
return new_filename;
|
||||
}
|
||||
|
||||
20
app/js/app_v3.js
Normal file
20
app/js/app_v3.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const path = require('path');
|
||||
const { ipcRenderer } = require('electron');
|
||||
|
||||
/* Updated 2022-03-07 */
|
||||
// function open_local_file({hash, host_file_cache_path, filename}) {
|
||||
function open_local_file({host_file_cache_path, hash, filename}) {
|
||||
|
||||
console.log('*** open_local_file() ***');
|
||||
|
||||
// hash = this.getAttribute('data-hash_sha256');
|
||||
// let file_path = path.join(host_file_cache_path, hash);
|
||||
// filename = this.getAttribute('data-filename');
|
||||
console.log(host_file_cache_path);
|
||||
console.log(hash);
|
||||
// console.log(file_path);
|
||||
console.log(filename);
|
||||
|
||||
// ipcRenderer.send('open_local_file', file_path, filename);
|
||||
ipcRenderer.send('open_local_file', host_file_cache_path, hash, filename);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ if(fs.existsSync(filename)) {
|
||||
})
|
||||
}
|
||||
|
||||
//shell.openItem('test.txt');
|
||||
//shell.openPath('test.txt');
|
||||
|
||||
/*
|
||||
const path = './';
|
||||
|
||||
@@ -69,6 +69,28 @@ exports.load_config = function () {
|
||||
}
|
||||
|
||||
|
||||
exports.check_file_cache_v3 = async function (host_file_cache_path, event_file_id, hash) {
|
||||
console.log('**** *** ** * FUNCTION: check_file_cache_v3 * ** *** ****');
|
||||
console.log('Checking the local file cache against the remote server.');
|
||||
|
||||
event_file_id; // NOTE: This is the event_file.id_random or event_file.event_file_id_random
|
||||
let hash_filename = hash+'.file';
|
||||
|
||||
let save_path = path.join(host_file_cache_path, hash_filename);
|
||||
console.log(save_path);
|
||||
|
||||
if (fs.existsSync(save_path)) {
|
||||
console.log('Local file already exists: '+save_path);
|
||||
} else {
|
||||
console.log('File not found locally. Downloading file: '+save_path);
|
||||
let endpoint = `/event/file/${event_file_id}/download`;
|
||||
ipcRenderer.send('download_file', api_base_url, endpoint, save_path); // Must download file using main node.js thread.
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
exports.check_file_cache = async function () {
|
||||
console.log('**** *** ** * FUNCTION: check_file_cache * ** *** ****');
|
||||
console.log('Checking the local file cache against the remote server.');
|
||||
|
||||
@@ -6,260 +6,260 @@ const { ipcRenderer } = require('electron');
|
||||
|
||||
|
||||
exports.render_launcher = function (launcher_tmp) {
|
||||
console.log('Rendering based on launcher_tmp...');
|
||||
|
||||
console.log('In module_app_ui.js v2 idb to launcher object: ***');
|
||||
console.log(launcher_tmp);
|
||||
console.log('In module_app_ui.js v2 idb to launcher object: ^^^');
|
||||
/*
|
||||
if (launcher_tmp.event) {
|
||||
for (var i in launcher_tmp.event) {
|
||||
if (launcher_tmp.event[i].id == event_id) {
|
||||
console.log('*** Event id ('+event_id+') found in launcher object.');
|
||||
for (var j in launcher_tmp.location) {
|
||||
if (launcher_tmp.location[j].id == event_location_id) {
|
||||
console.log('*** Location id ('+event_location_id+') found in launcher object.');
|
||||
document.title = launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name;
|
||||
document.getElementById('location_name').innerHTML = '<span class="fas fa-map-marker"></span> '+launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name;
|
||||
} else {
|
||||
console.log('Event location not it.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('Event not it.');
|
||||
}
|
||||
}
|
||||
console.log('Data in launcher object');
|
||||
console.log('Rendering based on launcher_tmp...');
|
||||
|
||||
console.log('In module_app_ui.js v2 idb to launcher object: ***');
|
||||
console.log(launcher_tmp);
|
||||
} else {
|
||||
console.log('Missing data in launcher object');
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
document.getElementById('event_files_menu').innerHTML = '<h2>Event Files</h2>';
|
||||
document.getElementById('event_files_menu').innerHTML += '<ul class="list-group list-group-flush">';
|
||||
for (var i in launcher_tmp.event_file) {
|
||||
document.getElementById('event_files_menu').innerHTML += '<li id="menu_event_file_'+launcher_tmp.event_file[i].event_file_id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.event_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.event_file[i].event_file_filename+'">'+launcher_tmp.event_file[i].event_file_filename+'</li>';
|
||||
}
|
||||
document.getElementById('event_files_menu').innerHTML += '</ul>';
|
||||
|
||||
|
||||
document.getElementById('location_files_menu').innerHTML = '<h2>Location Files</h2>';
|
||||
document.getElementById('location_files_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
||||
for (var i in launcher_tmp.location_file) {
|
||||
document.getElementById('location_files_menu').innerHTML += '<li id="menu_event_location_file_'+launcher_tmp.location_file[i].event_file_id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.location_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.location_file[i].event_file_filename+'"><span class="fas fa-external-link-alt"></span> '+launcher_tmp.location_file[i].event_file_filename+'</li>';
|
||||
}
|
||||
document.getElementById('location_files_menu').innerHTML += '</ul>';
|
||||
|
||||
//document.getElementById('sessions_menu').innerHTML = '<h2>Sessions</h2>';
|
||||
//document.getElementById('sessions_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
||||
//let launcher_sessions = '';
|
||||
if (document.getElementById('launcher_sessions').innerHTML.length) {
|
||||
console.log('launcher_sessions already exists');
|
||||
document.getElementById('launcher_sessions').innerHTML = ''; // This needs to be reviewed.
|
||||
} else {
|
||||
console.log('launcher_sessions is empty');
|
||||
//document.getElementById('launcher_sessions').innerHTML = ''; // This needs to be reviewed.
|
||||
}
|
||||
for (var i in launcher_tmp.session) {
|
||||
// List sessions in menu
|
||||
//document.getElementById('sessions_menu').innerHTML += '<li id="menu_event_session_'+launcher_tmp.session[i].id+'" class="list-group-item btn btn-info d-flex justify-content-between align-items-center btn_view_session" data-session_id="'+launcher_tmp.session[i].id+'">'+launcher_tmp.session[i].name+'</li>';
|
||||
|
||||
// Create containers for each session
|
||||
let session_detail = '';
|
||||
|
||||
if (typeof(document.getElementById('detail_session_id_'+launcher_tmp.session[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher_tmp.session[i].id) != null) {
|
||||
//console.log('detail_session_id_xx already exists');
|
||||
} else {
|
||||
//console.log('Adding detail_session_id_xx');
|
||||
session_detail += '<div id="detail_session_id_'+launcher_tmp.session[i].id+'" class="container d-none session_detail" data-session_id="'+launcher_tmp.session[i].id+'">';
|
||||
}
|
||||
|
||||
|
||||
|
||||
var session_startdatetime = new Date(launcher_tmp.session[i].start_datetime);
|
||||
|
||||
session_detail += '<h2 class="session_title d-flex justify-content-between align-items-center">'+launcher_tmp.session[i].name+'<span class="badge badge-pill badge-info">'+dateFns.format(session_startdatetime, 'ddd h:mm A')+'</span>'+'</h2>';
|
||||
|
||||
|
||||
// *** Session files card section start
|
||||
let session_files_card = '';
|
||||
if (typeof launcher_tmp.session[i].file !== 'undefined') {
|
||||
session_files_card += '<div class="card">';
|
||||
session_files_card += '<div class="card-header">Session Files:</div>';
|
||||
session_files_card += '<div class="card-body">';
|
||||
|
||||
let files_list = '';
|
||||
files_list += '<ul class="list-group list-group-flush">';
|
||||
for (var j in launcher_tmp.session[i].file) {
|
||||
let file = launcher_tmp.session[i].file[j];
|
||||
//console.log(file.event_file_filename);
|
||||
|
||||
files_list += '<li id="event_session_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'">';
|
||||
files_list += file.event_file_filename;
|
||||
files_list += '<span class="badge badge-pill badge-light">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||
files_list += '</li>';
|
||||
}
|
||||
files_list += '</ul>';
|
||||
session_files_card += files_list;
|
||||
|
||||
session_files_card += '</div>'; // for card-body
|
||||
session_files_card += '</div> <!-- for session files card -->'; // for session files card
|
||||
} else {
|
||||
//session_files_card = 'no session files found';
|
||||
}
|
||||
// *** Session files card section end
|
||||
|
||||
session_detail += session_files_card;
|
||||
|
||||
// *** Session presentations card section start
|
||||
let session_presentations_card = '';
|
||||
if (typeof launcher_tmp.session[i].presentation !== 'undefined') {
|
||||
|
||||
session_presentations_card += '<div class="card">';
|
||||
session_presentations_card += '<div class="card-header">Presentations:</div>';
|
||||
session_presentations_card += '<div class="card-body">';
|
||||
|
||||
let presentations_list = '';
|
||||
presentations_list += '<ul class="list-group list-group-flush">';
|
||||
|
||||
let presentation = '';
|
||||
for (var j in launcher_tmp.session[i].presentation) {
|
||||
presentation = launcher_tmp.session[i].presentation[j];
|
||||
|
||||
//var session_presentation_startdatetime = new Date(launcher_tmp.session[i].presentation[j].start_datetime);
|
||||
|
||||
presentations_list += '<li id="event_presentation_'+presentation.id+'" class="list-group-item">';
|
||||
presentations_list += '<div class="list-group-item-heading d-flex justify-content-between align-items-center">';
|
||||
presentations_list += '<strong class="">'+presentation.name+'</strong>';
|
||||
presentations_list += '<span class="badge badge-pill badge-info">'+dateFns.format(presentation.start_datetime, 'h:mm a')+'</span>';
|
||||
presentations_list += '</div>';
|
||||
|
||||
presentations_list += '<div class="list-group-item-text">'; // Start presentation file list and presenters with files lists
|
||||
|
||||
if (typeof presentation.file !== 'undefined') {
|
||||
let files_list = '';
|
||||
files_list += '<ul class="list-group list-group-flush">';
|
||||
for (var k in presentation.file) {
|
||||
let file = presentation.file[k];
|
||||
//console.log(file.event_file_filename);
|
||||
|
||||
files_list += '<li id="event_presentation_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'"><span class="fas fa-external-link-alt"></span> ';
|
||||
files_list += file.event_file_filename;
|
||||
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||
files_list += '</li>';
|
||||
}
|
||||
files_list += '</ul>';
|
||||
presentations_list += files_list;
|
||||
} else {
|
||||
files_list = '<div>None here!</div>';
|
||||
presentations_list += files_list;
|
||||
console.log('In module_app_ui.js v2 idb to launcher object: ^^^');
|
||||
/*
|
||||
if (launcher_tmp.event) {
|
||||
for (var i in launcher_tmp.event) {
|
||||
if (launcher_tmp.event[i].id == event_id) {
|
||||
console.log('*** Event id ('+event_id+') found in launcher object.');
|
||||
for (var j in launcher_tmp.location) {
|
||||
if (launcher_tmp.location[j].id == event_location_id) {
|
||||
console.log('*** Location id ('+event_location_id+') found in launcher object.');
|
||||
document.title = launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name;
|
||||
document.getElementById('location_name').innerHTML = '<span class="fas fa-map-marker"></span> '+launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name;
|
||||
} else {
|
||||
console.log('Event location not it.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('Event not it.');
|
||||
}
|
||||
}
|
||||
|
||||
let presenters_list = '';
|
||||
for (var k in presentation.presenter) {
|
||||
let presenter = presentation.presenter[k];
|
||||
//console.log(presenter.given_name);
|
||||
|
||||
presenters_list += '<li id="event_presenter_'+presenter.id+'" class="list-group-item">';
|
||||
presenters_list += '<strong class="list-group-item-heading">'+presenter.given_name+' '+presenter.family_name+'</strong>';
|
||||
|
||||
if (typeof presenter.file !== 'undefined') {
|
||||
console.log('Data in launcher object');
|
||||
console.log(launcher_tmp);
|
||||
} else {
|
||||
console.log('Missing data in launcher object');
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
document.getElementById('event_files_menu').innerHTML = '<h2>Event Files</h2>';
|
||||
document.getElementById('event_files_menu').innerHTML += '<ul class="list-group list-group-flush">';
|
||||
for (var i in launcher_tmp.event_file) {
|
||||
document.getElementById('event_files_menu').innerHTML += '<li id="menu_event_file_'+launcher_tmp.event_file[i].event_file_id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.event_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.event_file[i].event_file_filename+'">'+launcher_tmp.event_file[i].event_file_filename+'</li>';
|
||||
}
|
||||
document.getElementById('event_files_menu').innerHTML += '</ul>';
|
||||
|
||||
|
||||
document.getElementById('location_files_menu').innerHTML = '<h2>Location Files</h2>';
|
||||
document.getElementById('location_files_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
||||
for (var i in launcher_tmp.location_file) {
|
||||
document.getElementById('location_files_menu').innerHTML += '<li id="menu_event_location_file_'+launcher_tmp.location_file[i].event_file_id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.location_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.location_file[i].event_file_filename+'"><span class="fas fa-external-link-alt"></span> '+launcher_tmp.location_file[i].event_file_filename+'</li>';
|
||||
}
|
||||
document.getElementById('location_files_menu').innerHTML += '</ul>';
|
||||
|
||||
//document.getElementById('sessions_menu').innerHTML = '<h2>Sessions</h2>';
|
||||
//document.getElementById('sessions_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
||||
//let launcher_sessions = '';
|
||||
if (document.getElementById('launcher_sessions').innerHTML.length) {
|
||||
console.log('launcher_sessions already exists');
|
||||
document.getElementById('launcher_sessions').innerHTML = ''; // This needs to be reviewed.
|
||||
} else {
|
||||
console.log('launcher_sessions is empty');
|
||||
//document.getElementById('launcher_sessions').innerHTML = ''; // This needs to be reviewed.
|
||||
}
|
||||
for (var i in launcher_tmp.session) {
|
||||
// List sessions in menu
|
||||
//document.getElementById('sessions_menu').innerHTML += '<li id="menu_event_session_'+launcher_tmp.session[i].id+'" class="list-group-item btn btn-info d-flex justify-content-between align-items-center btn_view_session" data-session_id="'+launcher_tmp.session[i].id+'">'+launcher_tmp.session[i].name+'</li>';
|
||||
|
||||
// Create containers for each session
|
||||
let session_detail = '';
|
||||
|
||||
if (typeof(document.getElementById('detail_session_id_'+launcher_tmp.session[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher_tmp.session[i].id) != null) {
|
||||
//console.log('detail_session_id_xx already exists');
|
||||
} else {
|
||||
//console.log('Adding detail_session_id_xx');
|
||||
session_detail += '<div id="detail_session_id_'+launcher_tmp.session[i].id+'" class="container d-none session_detail" data-session_id="'+launcher_tmp.session[i].id+'">';
|
||||
}
|
||||
|
||||
|
||||
|
||||
var session_startdatetime = new Date(launcher_tmp.session[i].start_datetime);
|
||||
|
||||
session_detail += '<h2 class="session_title d-flex justify-content-between align-items-center">'+launcher_tmp.session[i].name+'<span class="badge badge-pill badge-info">'+dateFns.format(session_startdatetime, 'ddd h:mm A')+'</span>'+'</h2>';
|
||||
|
||||
|
||||
// *** Session files card section start
|
||||
let session_files_card = '';
|
||||
if (typeof launcher_tmp.session[i].file !== 'undefined') {
|
||||
session_files_card += '<div class="card">';
|
||||
session_files_card += '<div class="card-header">Session Files:</div>';
|
||||
session_files_card += '<div class="card-body">';
|
||||
|
||||
let files_list = '';
|
||||
files_list += '<ul class="list-group list-group-flush list-group-item-text">';
|
||||
for (var l in presenter.file) {
|
||||
let file = presenter.file[l];
|
||||
files_list += '<li id="event_presenter_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'"><span class="fas fa-external-link-alt"></span> ';
|
||||
files_list += file.event_file_filename;
|
||||
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||
files_list += '</li>';
|
||||
files_list += '<ul class="list-group list-group-flush">';
|
||||
for (var j in launcher_tmp.session[i].file) {
|
||||
let file = launcher_tmp.session[i].file[j];
|
||||
//console.log(file.event_file_filename);
|
||||
|
||||
files_list += '<li id="event_session_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'">';
|
||||
files_list += file.event_file_filename;
|
||||
files_list += '<span class="badge badge-pill badge-light">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||
files_list += '</li>';
|
||||
}
|
||||
files_list += '</ul>';
|
||||
presenters_list += files_list;
|
||||
} else {
|
||||
files_list = '<div>None here!</div>';
|
||||
presenters_list += files_list;
|
||||
}
|
||||
presenters_list +='</li>'; // End presenter's list group item (one presenter and their files)
|
||||
}
|
||||
presentations_list += presenters_list;
|
||||
|
||||
presentations_list += '</li>'; // close presentation files and presenters with files
|
||||
|
||||
}
|
||||
|
||||
presentations_list += '</ul>'; // end of presentations with files list
|
||||
|
||||
session_presentations_card += presentations_list;
|
||||
session_presentations_card += '</div>'; // for presentations card-body
|
||||
session_presentations_card += '</div> <!-- for card -->'; // for presentations card
|
||||
|
||||
|
||||
session_detail += session_presentations_card;
|
||||
//session_detail += '</div> <!-- for session_presentations -->'; // for session_presentations
|
||||
|
||||
//session_detail += '</div>'; // for card-group
|
||||
|
||||
}
|
||||
session_detail += '</div> <!-- End session detail for '+launcher_tmp.session[i].id+' -->';
|
||||
// *** Session presentations card section start
|
||||
|
||||
//document.getElementById('launcher_sessions').innerHTML += session_detail;
|
||||
|
||||
if (typeof(document.getElementById('detail_session_id_'+launcher_tmp.session[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher_tmp.session[i].id) != null) {
|
||||
document.getElementById('detail_session_id_'+launcher_tmp.session[i].id).innerHTML = session_detail;
|
||||
} else {
|
||||
document.getElementById('launcher_sessions').innerHTML += session_detail;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
document.getElementById('sessions_menu').innerHTML += '</ul>';
|
||||
|
||||
index_launcher_sessions('btn_view_session');
|
||||
|
||||
index_open_file_buttons('open_local_file');
|
||||
session_files_card += files_list;
|
||||
|
||||
|
||||
//const btn_session_{{ event_presentation.id }}_name = document.querySelector('button#presentation_{{ event_presentation.id }}_name');
|
||||
//btn_presentation_{{ event_presentation.id }}_name.onclick = display_hide_poster_for_type_id.bind(this, true, 'presentation', {{ event_presentation.id }});
|
||||
console.log('Rendering launcher finished.');
|
||||
|
||||
return true;
|
||||
session_files_card += '</div>'; // for card-body
|
||||
session_files_card += '</div> <!-- for session files card -->'; // for session files card
|
||||
} else {
|
||||
//session_files_card = 'no session files found';
|
||||
}
|
||||
// *** Session files card section end
|
||||
|
||||
session_detail += session_files_card;
|
||||
|
||||
// *** Session presentations card section start
|
||||
let session_presentations_card = '';
|
||||
if (typeof launcher_tmp.session[i].presentation !== 'undefined') {
|
||||
|
||||
session_presentations_card += '<div class="card">';
|
||||
session_presentations_card += '<div class="card-header">Presentations:</div>';
|
||||
session_presentations_card += '<div class="card-body">';
|
||||
|
||||
let presentations_list = '';
|
||||
presentations_list += '<ul class="list-group list-group-flush">';
|
||||
|
||||
let presentation = '';
|
||||
for (var j in launcher_tmp.session[i].presentation) {
|
||||
presentation = launcher_tmp.session[i].presentation[j];
|
||||
|
||||
//var session_presentation_startdatetime = new Date(launcher_tmp.session[i].presentation[j].start_datetime);
|
||||
|
||||
presentations_list += '<li id="event_presentation_'+presentation.id+'" class="list-group-item">';
|
||||
presentations_list += '<div class="list-group-item-heading d-flex justify-content-between align-items-center">';
|
||||
presentations_list += '<strong class="">'+presentation.name+'</strong>';
|
||||
presentations_list += '<span class="badge badge-pill badge-info">'+dateFns.format(presentation.start_datetime, 'h:mm a')+'</span>';
|
||||
presentations_list += '</div>';
|
||||
|
||||
presentations_list += '<div class="list-group-item-text">'; // Start presentation file list and presenters with files lists
|
||||
|
||||
if (typeof presentation.file !== 'undefined') {
|
||||
let files_list = '';
|
||||
files_list += '<ul class="list-group list-group-flush">';
|
||||
for (var k in presentation.file) {
|
||||
let file = presentation.file[k];
|
||||
//console.log(file.event_file_filename);
|
||||
|
||||
files_list += '<li id="event_presentation_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'"><span class="fas fa-external-link-alt"></span> ';
|
||||
files_list += file.event_file_filename;
|
||||
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||
files_list += '</li>';
|
||||
}
|
||||
files_list += '</ul>';
|
||||
presentations_list += files_list;
|
||||
} else {
|
||||
files_list = '<div>None here!</div>';
|
||||
presentations_list += files_list;
|
||||
}
|
||||
|
||||
let presenters_list = '';
|
||||
for (var k in presentation.presenter) {
|
||||
let presenter = presentation.presenter[k];
|
||||
//console.log(presenter.given_name);
|
||||
|
||||
presenters_list += '<li id="event_presenter_'+presenter.id+'" class="list-group-item">';
|
||||
presenters_list += '<strong class="list-group-item-heading">'+presenter.given_name+' '+presenter.family_name+'</strong>';
|
||||
|
||||
if (typeof presenter.file !== 'undefined') {
|
||||
let files_list = '';
|
||||
files_list += '<ul class="list-group list-group-flush list-group-item-text">';
|
||||
for (var l in presenter.file) {
|
||||
let file = presenter.file[l];
|
||||
files_list += '<li id="event_presenter_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'"><span class="fas fa-external-link-alt"></span> ';
|
||||
files_list += file.event_file_filename;
|
||||
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||
files_list += '</li>';
|
||||
}
|
||||
files_list += '</ul>';
|
||||
presenters_list += files_list;
|
||||
} else {
|
||||
files_list = '<div>None here!</div>';
|
||||
presenters_list += files_list;
|
||||
}
|
||||
presenters_list +='</li>'; // End presenter's list group item (one presenter and their files)
|
||||
}
|
||||
presentations_list += presenters_list;
|
||||
|
||||
presentations_list += '</li>'; // close presentation files and presenters with files
|
||||
|
||||
}
|
||||
|
||||
presentations_list += '</ul>'; // end of presentations with files list
|
||||
|
||||
session_presentations_card += presentations_list;
|
||||
session_presentations_card += '</div>'; // for presentations card-body
|
||||
session_presentations_card += '</div> <!-- for card -->'; // for presentations card
|
||||
|
||||
|
||||
session_detail += session_presentations_card;
|
||||
//session_detail += '</div> <!-- for session_presentations -->'; // for session_presentations
|
||||
|
||||
//session_detail += '</div>'; // for card-group
|
||||
|
||||
}
|
||||
session_detail += '</div> <!-- End session detail for '+launcher_tmp.session[i].id+' -->';
|
||||
// *** Session presentations card section start
|
||||
|
||||
//document.getElementById('launcher_sessions').innerHTML += session_detail;
|
||||
|
||||
if (typeof(document.getElementById('detail_session_id_'+launcher_tmp.session[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher_tmp.session[i].id) != null) {
|
||||
document.getElementById('detail_session_id_'+launcher_tmp.session[i].id).innerHTML = session_detail;
|
||||
} else {
|
||||
document.getElementById('launcher_sessions').innerHTML += session_detail;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
document.getElementById('sessions_menu').innerHTML += '</ul>';
|
||||
|
||||
index_launcher_sessions('btn_view_session');
|
||||
|
||||
index_open_file_buttons('open_local_file');
|
||||
|
||||
|
||||
//const btn_session_{{ event_presentation.id }}_name = document.querySelector('button#presentation_{{ event_presentation.id }}_name');
|
||||
//btn_presentation_{{ event_presentation.id }}_name.onclick = display_hide_poster_for_type_id.bind(this, true, 'presentation', {{ event_presentation.id }});
|
||||
console.log('Rendering launcher finished.');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Updated 2019-12-19 */
|
||||
function index_launcher_sessions(class_name) {
|
||||
console.log('Indexing launcher sessions with class name: '+class_name);
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } );
|
||||
}
|
||||
|
||||
return true;
|
||||
console.log('Indexing launcher sessions with class name: '+class_name);
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Updated 2019-12-19 */
|
||||
function view_session(session_id) {
|
||||
var class_elements = document.getElementsByClassName('launcher_sessions');
|
||||
console.log('*** View session ID: '+session_id);
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
//console.log('*** checking: '+class_elements[i].getAttribute('data-session_id'));
|
||||
if (class_elements[i].getAttribute('data-session_id') == session_id) {
|
||||
//console.log('show');
|
||||
class_elements[i].classList.remove('d-none');
|
||||
class_elements[i].classList.add('d-block');
|
||||
} else {
|
||||
//console.log('hide');
|
||||
class_elements[i].classList.remove('d-block');
|
||||
class_elements[i].classList.add('d-none');
|
||||
var class_elements = document.getElementsByClassName('launcher_sessions');
|
||||
console.log('*** View session ID: '+session_id);
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
//console.log('*** checking: '+class_elements[i].getAttribute('data-session_id'));
|
||||
if (class_elements[i].getAttribute('data-session_id') == session_id) {
|
||||
//console.log('show');
|
||||
class_elements[i].classList.remove('d-none');
|
||||
class_elements[i].classList.add('d-block');
|
||||
} else {
|
||||
//console.log('hide');
|
||||
class_elements[i].classList.remove('d-block');
|
||||
class_elements[i].classList.add('d-none');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -268,35 +268,35 @@ function view_session(session_id) {
|
||||
|
||||
/* Updated 2019-12-20 */
|
||||
function index_open_file_buttons(class_name) {
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
//class_elements[i].addEventListener( 'click', function() {open_local_file( this.getAttribute('data-filename')) } );
|
||||
|
||||
//let directory = 'file_cache/';
|
||||
|
||||
//directory_and_filename = path.join(directory, class_elements[i].getAttribute('data-filename'));
|
||||
|
||||
let file_path = path.join(host_file_cache_path, class_elements[i].getAttribute('data-hash_sha256'));
|
||||
let filename = class_elements[i].getAttribute('data-filename');
|
||||
|
||||
class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } );
|
||||
//ipcRenderer.send('open_local_file', this.getAttribute('data-filename')); // in render thread
|
||||
}
|
||||
|
||||
return true;
|
||||
var class_elements = document.getElementsByClassName(class_name);
|
||||
|
||||
for (var i = 0; i < class_elements.length; i++) {
|
||||
//class_elements[i].addEventListener( 'click', function() {open_local_file( this.getAttribute('data-filename')) } );
|
||||
|
||||
//let directory = 'file_cache/';
|
||||
|
||||
//directory_and_filename = path.join(directory, class_elements[i].getAttribute('data-filename'));
|
||||
|
||||
let file_path = path.join(host_file_cache_path, class_elements[i].getAttribute('data-hash_sha256'));
|
||||
let filename = class_elements[i].getAttribute('data-filename');
|
||||
|
||||
class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } );
|
||||
//ipcRenderer.send('open_local_file', this.getAttribute('data-filename')); // in render thread
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function format_bytes(bytes, decimals = 2) {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
|
||||
const k = 1024;
|
||||
const dm = decimals < 0 ? 0 : decimals;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
const k = 1024;
|
||||
const dm = decimals < 0 ? 0 : decimals;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
BIN
app/static/images/favicon.ico
Executable file
BIN
app/static/images/favicon.ico
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/static/images/oneskyit_logo.png
Normal file
BIN
app/static/images/oneskyit_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
BIN
app/static/images/site_background.png
Normal file
BIN
app/static/images/site_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
1
app/static/images/site_background.svg
Normal file
1
app/static/images/site_background.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.9 KiB |
BIN
app/static/images/site_background.webp
Normal file
BIN
app/static/images/site_background.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Reference in New Issue
Block a user