diff --git a/exhibits/items_model.js b/exhibits/items_model.js
index fb55ecb..cc5fe8f 100644
--- a/exhibits/items_model.js
+++ b/exhibits/items_model.js
@@ -205,7 +205,26 @@ exports.update_item_record = async function (is_member_of_exhibit, item_id, data
if (data.kaltura.length > 0) {
data.media = data.kaltura;
data.is_kaltura_item = 1;
- } else if (data.repo_uuid.length > 0) {
+ }
+
+ if (data.kaltura.length === 0 && data.item_type !== 'audio') {
+ data.is_kaltura_item = 0;
+ }
+
+ if (data.kaltura.length === 0 && data.item_type !== 'video') {
+ data.is_kaltura_item = 0;
+ }
+
+ if (data.item_type === 'audio') {
+ data.is_kaltura_item = 1;
+ }
+
+ if (data.item_type === 'video') {
+ data.is_kaltura_item = 1;
+ }
+
+
+ if (data.repo_uuid.length > 0) {
data.media = data.repo_uuid;
data.is_repo_item = 1;
}
diff --git a/public/app/helper.module.js b/public/app/helper.module.js
index bbdbca0..f93dbe1 100644
--- a/public/app/helper.module.js
+++ b/public/app/helper.module.js
@@ -185,6 +185,8 @@ const helperModule = (function () {
document.querySelector('#item-type').value = item_type;
document.querySelector('#repo-item-metadata').innerHTML = `
${response.data.data.title} ${response.data.data.mime_type}
`;
+ document.querySelector('#is-repo-item').value = 1;
+ helperModule.clear_media_fields('repo_media');
} else {
document.querySelector('#repo-item-metadata').innerHTML = `Metadata record not found in repository.
`;
@@ -195,6 +197,36 @@ const helperModule = (function () {
}
};
+ /**
+ * Clears media fields
+ */
+ obj.clear_media_fields = function (type) {
+
+ if (type === 'uploaded_media') {
+ document.querySelector('#repo-uuid').value = '';
+ document.querySelector('#audio-video').value = '';
+ document.querySelector('#is-kaltura-item').value = 0;
+ document.querySelector('#is-repo-item').value = 0;
+ }
+
+ if (type === 'repo_media') {
+ document.querySelector('#audio-video').value = '';
+ document.querySelector('#is-kaltura-item').value = 0;
+ }
+
+ if (type === 'kaltura_media') {
+ document.querySelector('#repo-uuid').value = '';
+ document.querySelector('#is-repo-item').value = 0;
+ }
+
+ document.querySelector('#item-type').value = '';
+ document.querySelector('#item-mime-type').value = '';
+ document.querySelector('#item-media').value = '';
+ document.querySelector('#item-media-thumbnail-image-display').innerHTML = '';
+ document.querySelector('#item-media-filename-display').innerHTML = '';
+ document.querySelector('#item-media-trash').style.display = 'none';
+ };
+
/**
* Shows form - changes .card class to visible
*/
@@ -481,109 +513,44 @@ const helperModule = (function () {
}
};
- obj.init = function () {};
-
- return obj;
-
-}());
-
-/**
- * TODO: Remove - timeline items should not be reordered
- * Reorders timeline item list via drag and drop
- * @param event
- * @param id
- */
-/*
-obj.reorder_timeline_items = function (event, id) {
-
- try {
-
- const exhibit_id = helperModule.get_parameter_by_name('exhibit_id');
- const timeline_id = helperModule.get_parameter_by_name('timeline_id');
- const EXHIBITS_ENDPOINTS = endpointsModule.get_exhibits_endpoints();
- const tr_elem = Array.from(document.getElementsByTagName('tr'));
- let row;
- let children;
- let updated_order = [];
- let reorder_obj = {};
+ obj.check_bandwidth = function (cb) {
- tr_elem.forEach(tr => {
+ const URL = 'https://upload.wikimedia.org/wikipedia/commons/9/90/ODJBcard.JPG';
+ const FILE_SIZE = 55 // KB
+ // const URL = 'http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png';
+ // const FILE_SIZE = 238; // KB
+ let start = new Date().getTime();
+ let bandwidth;
+ let count = 10;
+ let i = 0;
- tr.addEventListener('dragstart', (event) => {
- row = event.target;
- });
-
- tr.addEventListener('dragover', (event) => {
-
- try {
+ (async function request() {
- let e = event;
- e.preventDefault();
-
- children = Array.from(e.target.parentNode.parentNode.children);
-
- if (children.indexOf(e.target.parentNode) > children.indexOf(row)) {
- // move down
- e.target.parentNode.after(row);
- } else {
- // move up
- e.target.parentNode.before(row);
- }
-
- } catch (error) {
- console.log(error);
- // document.querySelector('#message').innerHTML = ` ${error.message}
`;
- }
+ const response = await httpModule.req({
+ method: 'GET',
+ url: URL
});
- tr.addEventListener('drop', async (event) => {
+ if (response.status === 200) {
- try {
+ let x = new Date().getTime() - start;
+ let bw = Number(((FILE_SIZE / (x / 1000))));
+ bandwidth = ((bandwidth || bw) + bw) / 2;
+ i++;
- if (event.target.className === 'dropzone') {
- row.parentNode.removeChild(row);
- event.target.appendChild(row);
- }
+ if (i < count) {
+ start = new Date().getTime();
+ await request();
+ } else {
+ cb(bandwidth.toFixed(0));
+ }
+ }
- for (let i=0;i An error occurred while reordering items.`;
- }
+ return obj;
- } catch (error) {
- console.log(error);
- }
- });
- });
-
- } catch (error) {
- console.log(error);
- // document.querySelector('#message').innerHTML = ` ${error.message}
`;
- }
-};
-*/
\ No newline at end of file
+}());
diff --git a/public/app/items.add.standard.item.form.module.js b/public/app/items.add.standard.item.form.module.js
index 58d4ada..cac02f1 100644
--- a/public/app/items.add.standard.item.form.module.js
+++ b/public/app/items.add.standard.item.form.module.js
@@ -71,9 +71,11 @@ const itemsAddStandardItemFormModule = (function () {
if (response !== undefined && response.status === 201) {
document.querySelector('#message').innerHTML = ` Item record created
`;
+ const item_id = response.data.data;
setTimeout(() => {
- window.location.reload();
+ window.location.replace(`${APP_PATH}/items/standard/edit?exhibit_id=${uuid}&item_id=${item_id}`);
+ // window.location.reload();
// location.replace(`${APP_PATH}/items?exhibit_id=${uuid}`);
}, 900);
}
diff --git a/public/app/items.common.standard.item.form.module.js b/public/app/items.common.standard.item.form.module.js
index 8fdc9f1..b717d33 100644
--- a/public/app/items.common.standard.item.form.module.js
+++ b/public/app/items.common.standard.item.form.module.js
@@ -61,9 +61,9 @@ const itemsCommonStandardItemFormModule = (function () {
}
if (item.media_padding === true) {
- item.media_padding = 1;
- } else if (item.media_padding === false) {
item.media_padding = 0;
+ } else if (item.media_padding === false) {
+ item.media_padding = 1;
}
// item media
@@ -75,6 +75,8 @@ const itemsCommonStandardItemFormModule = (function () {
item.media_prev = document.querySelector('#item-media-prev').value;
item.kaltura = document.querySelector('#audio-video').value;
item.repo_uuid = document.querySelector('#repo-uuid').value;
+ item.is_repo_item = parseInt(document.querySelector('#is-repo-item').value);
+ item.is_kaltura_item = parseInt(document.querySelector('#is-kaltura-item').value);
if (item.media.length === 0 && item.kaltura.length === 0 && item.repo_uuid.length === 0) {
if (item.text.length === 0) {
@@ -168,6 +170,8 @@ const itemsCommonStandardItemFormModule = (function () {
if (response !== undefined && response.status === 204) {
+ document.querySelector('#item-type').value = '';
+ document.querySelector('#item-mime-type').value = '';
document.querySelector('#item-media').value = '';
document.querySelector('#item-media-thumbnail-image-display').innerHTML = '';
document.querySelector('#item-media-filename-display').innerHTML = '';
@@ -263,6 +267,11 @@ const itemsCommonStandardItemFormModule = (function () {
}, 1000);
document.querySelector('#repo-uuid-btn').addEventListener('click', await helperModule.get_repo_item_data);
+ document.querySelector('#audio-video').addEventListener('focusout', () => {
+ helperModule.clear_media_fields('kaltura_media');
+ document.querySelector('#is-kaltura-item').value = 1;
+ });
+
helperModule.show_form();
} catch (error) {
diff --git a/public/app/items.edit.standard.item.form.module.js b/public/app/items.edit.standard.item.form.module.js
index 8812e28..5c6f3dd 100644
--- a/public/app/items.edit.standard.item.form.module.js
+++ b/public/app/items.edit.standard.item.form.module.js
@@ -100,9 +100,9 @@ const itemsEditStandardItemFormModule = (function () {
}
if (record.media_padding === 1) {
- document.querySelector('#media-padding').checked = true;
- } else {
document.querySelector('#media-padding').checked = false;
+ } else {
+ document.querySelector('#media-padding').checked = true;
}
if (record.media.length > 0) {
@@ -143,6 +143,7 @@ const itemsEditStandardItemFormModule = (function () {
document.getElementById('upload-media-tab').setAttribute('aria-selected', 'false');
document.getElementById('import-repo-media-tab').setAttribute('aria-selected', 'true');
document.querySelector('#repo-uuid').value = record.media;
+ document.querySelector('#is-repo-item').value = 1;
await helperModule.get_repo_item_data();
}
@@ -157,6 +158,7 @@ const itemsEditStandardItemFormModule = (function () {
document.getElementById('upload-media-tab').setAttribute('aria-selected', 'false');
document.getElementById('import-audio-video-tab').setAttribute('aria-selected', 'true');
document.querySelector('#audio-video').value = record.media;
+ document.querySelector('#is-kaltura-item').value = 1;
let item_types = document.getElementsByName('item_type');
diff --git a/public/app/uploads.module.js b/public/app/uploads.module.js
index d0e7e87..e2760f8 100644
--- a/public/app/uploads.module.js
+++ b/public/app/uploads.module.js
@@ -167,6 +167,7 @@ const uploadsModule = (function () {
item_type = 'Unable to Determine Type';
}
+ helperModule.clear_media_fields('uploaded_media');
document.querySelector('#item-type').value = item_type;
document.querySelector('#item-mime-type').value = mime_type;
document.querySelector('.upload-error').innerHTML = '';
diff --git a/views/auth-landing.ejs b/views/auth-landing.ejs
index 65584a6..6e11223 100644
--- a/views/auth-landing.ejs
+++ b/views/auth-landing.ejs
@@ -17,5 +17,48 @@
+
+
+
+
<%- include('partials/footer.ejs'); %>
diff --git a/views/dashboard-item-standard-add-form.ejs b/views/dashboard-item-standard-add-form.ejs
index 3ffc82e..1ed0144 100644
--- a/views/dashboard-item-standard-add-form.ejs
+++ b/views/dashboard-item-standard-add-form.ejs
@@ -153,6 +153,7 @@
<%- include('partials/embed-item.ejs'); %>
<%- include('partials/media-padding.ejs'); %>
+
diff --git a/views/partials/tab-import-audio-video.ejs b/views/partials/tab-import-audio-video.ejs
index c9aa963..1cd60bf 100644
--- a/views/partials/tab-import-audio-video.ejs
+++ b/views/partials/tab-import-audio-video.ejs
@@ -27,6 +27,7 @@
value="video" />
+
\ No newline at end of file
diff --git a/views/partials/tab-import-repo-media.ejs b/views/partials/tab-import-repo-media.ejs
index 1ff1731..09c3b39 100644
--- a/views/partials/tab-import-repo-media.ejs
+++ b/views/partials/tab-import-repo-media.ejs
@@ -3,6 +3,7 @@