2022-01-30 00:27:26 +03:00
|
|
|
import escapeHtml from 'escape-html';
|
2020-08-14 08:46:34 +02:00
|
|
|
import dom from '../../scripts/dom';
|
|
|
|
import layoutManager from '../layoutManager';
|
|
|
|
import dialogHelper from '../dialogHelper/dialogHelper';
|
|
|
|
import datetime from '../../scripts/datetime';
|
|
|
|
import loading from '../loading/loading';
|
|
|
|
import focusManager from '../focusManager';
|
|
|
|
import globalize from '../../scripts/globalize';
|
|
|
|
import shell from '../../scripts/shell';
|
|
|
|
import '../../elements/emby-checkbox/emby-checkbox';
|
|
|
|
import '../../elements/emby-input/emby-input';
|
|
|
|
import '../../elements/emby-select/emby-select';
|
2021-01-26 16:25:38 -05:00
|
|
|
import '../listview/listview.scss';
|
2020-08-14 08:46:34 +02:00
|
|
|
import '../../elements/emby-textarea/emby-textarea';
|
|
|
|
import '../../elements/emby-button/emby-button';
|
|
|
|
import '../../elements/emby-button/paper-icon-button-light';
|
2021-01-26 16:25:38 -05:00
|
|
|
import '../formdialog.scss';
|
2023-02-26 01:01:31 +02:00
|
|
|
import '../../styles/clearbutton.scss';
|
|
|
|
import '../../styles/flexstyles.scss';
|
2022-07-14 17:59:37 -04:00
|
|
|
import './style.scss';
|
2020-10-17 19:08:56 +01:00
|
|
|
import ServerConnections from '../ServerConnections';
|
2020-10-18 15:18:15 +01:00
|
|
|
import toast from '../toast/toast';
|
2023-05-01 10:04:13 -04:00
|
|
|
import { appRouter } from '../router/appRouter';
|
2020-11-25 00:17:24 -05:00
|
|
|
import template from './metadataEditor.template.html';
|
2020-07-17 17:43:39 +01:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
let currentContext;
|
|
|
|
let metadataEditorInfo;
|
|
|
|
let currentItem;
|
2020-07-17 17:43:39 +01:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function isDialog() {
|
|
|
|
return currentContext.classList.contains('dialog');
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function closeDialog() {
|
|
|
|
if (isDialog()) {
|
|
|
|
dialogHelper.close(currentContext);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function submitUpdatedItem(form, item) {
|
|
|
|
function afterContentTypeUpdated() {
|
|
|
|
toast(globalize.translate('MessageItemSaved'));
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
loading.hide();
|
|
|
|
closeDialog();
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const apiClient = getApiClient();
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
apiClient.updateItem(item).then(function () {
|
|
|
|
const newContentType = form.querySelector('#selectContentType').value || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if ((metadataEditorInfo.ContentType || '') !== newContentType) {
|
|
|
|
apiClient.ajax({
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
url: apiClient.getUrl('Items/' + item.Id + '/ContentType', {
|
|
|
|
ContentType: newContentType
|
|
|
|
}),
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
type: 'POST'
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
}).then(function () {
|
2019-01-10 15:39:37 +03:00
|
|
|
afterContentTypeUpdated();
|
2023-04-19 01:56:05 -04:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
afterContentTypeUpdated();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function getSelectedAirDays(form) {
|
|
|
|
const checkedItems = form.querySelectorAll('.chkAirDay:checked') || [];
|
|
|
|
return Array.prototype.map.call(checkedItems, function (c) {
|
|
|
|
return c.getAttribute('data-day');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAlbumArtists(form) {
|
|
|
|
return form.querySelector('#txtAlbumArtist').value.trim().split(';').filter(function (s) {
|
|
|
|
return s.length > 0;
|
|
|
|
}).map(function (a) {
|
|
|
|
return {
|
|
|
|
Name: a
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function getArtists(form) {
|
|
|
|
return form.querySelector('#txtArtist').value.trim().split(';').filter(function (s) {
|
|
|
|
return s.length > 0;
|
|
|
|
}).map(function (a) {
|
|
|
|
return {
|
|
|
|
Name: a
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function getDateValue(form, element, property) {
|
|
|
|
let val = form.querySelector(element).value;
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (!val) {
|
|
|
|
return null;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (currentItem[property]) {
|
|
|
|
const date = datetime.parseISO8601Date(currentItem[property], true);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const parts = date.toISOString().split('T');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
// If the date is the same, preserve the time
|
2023-05-04 23:45:03 -04:00
|
|
|
if (parts[0].startsWith(val)) {
|
2023-04-19 01:56:05 -04:00
|
|
|
const iso = parts[1];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
val += 'T' + iso;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
function onSubmit(e) {
|
|
|
|
loading.show();
|
|
|
|
|
|
|
|
const form = this;
|
|
|
|
|
|
|
|
const item = {
|
|
|
|
Id: currentItem.Id,
|
|
|
|
Name: form.querySelector('#txtName').value,
|
|
|
|
OriginalTitle: form.querySelector('#txtOriginalName').value,
|
|
|
|
ForcedSortName: form.querySelector('#txtSortName').value,
|
|
|
|
CommunityRating: form.querySelector('#txtCommunityRating').value,
|
|
|
|
CriticRating: form.querySelector('#txtCriticRating').value,
|
|
|
|
IndexNumber: form.querySelector('#txtIndexNumber').value || null,
|
|
|
|
AirsBeforeSeasonNumber: form.querySelector('#txtAirsBeforeSeason').value,
|
|
|
|
AirsAfterSeasonNumber: form.querySelector('#txtAirsAfterSeason').value,
|
|
|
|
AirsBeforeEpisodeNumber: form.querySelector('#txtAirsBeforeEpisode').value,
|
|
|
|
ParentIndexNumber: form.querySelector('#txtParentIndexNumber').value || null,
|
|
|
|
DisplayOrder: form.querySelector('#selectDisplayOrder').value,
|
|
|
|
Album: form.querySelector('#txtAlbum').value,
|
|
|
|
AlbumArtists: getAlbumArtists(form),
|
|
|
|
ArtistItems: getArtists(form),
|
|
|
|
Overview: form.querySelector('#txtOverview').value,
|
|
|
|
Status: form.querySelector('#selectStatus').value,
|
|
|
|
AirDays: getSelectedAirDays(form),
|
|
|
|
AirTime: form.querySelector('#txtAirTime').value,
|
|
|
|
Genres: getListValues(form.querySelector('#listGenres')),
|
|
|
|
Tags: getListValues(form.querySelector('#listTags')),
|
|
|
|
Studios: getListValues(form.querySelector('#listStudios')).map(function (element) {
|
|
|
|
return { Name: element };
|
|
|
|
}),
|
|
|
|
|
|
|
|
PremiereDate: getDateValue(form, '#txtPremiereDate', 'PremiereDate'),
|
|
|
|
DateCreated: getDateValue(form, '#txtDateAdded', 'DateCreated'),
|
|
|
|
EndDate: getDateValue(form, '#txtEndDate', 'EndDate'),
|
|
|
|
ProductionYear: form.querySelector('#txtProductionYear').value,
|
|
|
|
AspectRatio: form.querySelector('#txtOriginalAspectRatio').value,
|
|
|
|
Video3DFormat: form.querySelector('#select3dFormat').value,
|
|
|
|
|
|
|
|
OfficialRating: form.querySelector('#selectOfficialRating').value,
|
|
|
|
CustomRating: form.querySelector('#selectCustomRating').value,
|
|
|
|
People: currentItem.People,
|
|
|
|
LockData: form.querySelector('#chkLockData').checked,
|
|
|
|
LockedFields: Array.prototype.filter.call(form.querySelectorAll('.selectLockedField'), function (c) {
|
|
|
|
return !c.checked;
|
|
|
|
}).map(function (c) {
|
|
|
|
return c.getAttribute('data-value');
|
|
|
|
})
|
|
|
|
};
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
item.ProviderIds = Object.assign({}, currentItem.ProviderIds);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const idElements = form.querySelectorAll('.txtExternalId');
|
|
|
|
Array.prototype.map.call(idElements, function (idElem) {
|
|
|
|
const providerKey = idElem.getAttribute('data-providerkey');
|
|
|
|
item.ProviderIds[providerKey] = idElem.value;
|
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
item.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
|
|
|
|
item.PreferredMetadataCountryCode = form.querySelector('#selectCountry').value;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (currentItem.Type === 'Person') {
|
|
|
|
const placeOfBirth = form.querySelector('#txtPlaceOfBirth').value;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (currentItem.Type === 'Series') {
|
|
|
|
// 600000000
|
|
|
|
const seriesRuntime = form.querySelector('#txtSeriesRuntime').value;
|
|
|
|
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const tagline = form.querySelector('#txtTagline').value;
|
|
|
|
item.Taglines = tagline ? [tagline] : [];
|
|
|
|
|
|
|
|
submitUpdatedItem(form, item);
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getListValues(list) {
|
|
|
|
return Array.prototype.map.call(list.querySelectorAll('.textValue'), function (el) {
|
|
|
|
return el.textContent;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function addElementToList(source, sortCallback) {
|
|
|
|
import('../prompt/prompt').then(({ default: prompt }) => {
|
|
|
|
prompt({
|
|
|
|
label: 'Value:'
|
|
|
|
}).then(function (text) {
|
|
|
|
const list = dom.parentWithClass(source, 'editableListviewContainer').querySelector('.paperList');
|
|
|
|
const items = getListValues(list);
|
|
|
|
items.push(text);
|
|
|
|
populateListView(list, items, sortCallback);
|
2019-01-10 15:39:37 +03:00
|
|
|
});
|
2023-04-19 01:56:05 -04:00
|
|
|
});
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function removeElementFromList(source) {
|
|
|
|
const el = dom.parentWithClass(source, 'listItem');
|
|
|
|
el.parentNode.removeChild(el);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function editPerson(context, person, index) {
|
|
|
|
import('./personEditor').then(({ default: personEditor }) => {
|
|
|
|
personEditor.show(person).then(function (updatedPerson) {
|
|
|
|
const isNew = index === -1;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (isNew) {
|
|
|
|
currentItem.People.push(updatedPerson);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
populatePeople(context, currentItem.People);
|
2019-01-10 15:39:37 +03:00
|
|
|
});
|
2023-04-19 01:56:05 -04:00
|
|
|
});
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function afterDeleted(context, item) {
|
|
|
|
const parentId = item.ParentId || item.SeasonId || item.SeriesId;
|
2020-07-21 21:27:41 +02:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (parentId) {
|
|
|
|
reload(context, parentId, item.ServerId);
|
|
|
|
} else {
|
|
|
|
appRouter.goHome();
|
2020-07-21 21:27:41 +02:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function showMoreMenu(context, button, user) {
|
|
|
|
import('../itemContextMenu').then(({ default: itemContextMenu }) => {
|
|
|
|
const item = currentItem;
|
|
|
|
|
|
|
|
itemContextMenu.show({
|
|
|
|
item: item,
|
|
|
|
positionTo: button,
|
|
|
|
edit: false,
|
|
|
|
editImages: true,
|
|
|
|
editSubtitles: true,
|
|
|
|
sync: false,
|
|
|
|
share: false,
|
|
|
|
play: false,
|
|
|
|
queue: false,
|
|
|
|
user: user
|
|
|
|
}).then(function (result) {
|
|
|
|
if (result.deleted) {
|
|
|
|
afterDeleted(context, item);
|
|
|
|
} else if (result.updated) {
|
|
|
|
reload(context, item.Id, item.ServerId);
|
|
|
|
}
|
2020-07-21 21:27:41 +02:00
|
|
|
});
|
2023-04-19 01:56:05 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function onEditorClick(e) {
|
|
|
|
const btnRemoveFromEditorList = dom.parentWithClass(e.target, 'btnRemoveFromEditorList');
|
|
|
|
if (btnRemoveFromEditorList) {
|
|
|
|
removeElementFromList(btnRemoveFromEditorList);
|
|
|
|
return;
|
2020-07-21 21:27:41 +02:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const btnAddTextItem = dom.parentWithClass(e.target, 'btnAddTextItem');
|
|
|
|
if (btnAddTextItem) {
|
|
|
|
addElementToList(btnAddTextItem);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function getApiClient() {
|
|
|
|
return ServerConnections.getApiClient(currentItem.ServerId);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function bindAll(elems, eventName, fn) {
|
|
|
|
for (let i = 0, length = elems.length; i < length; i++) {
|
|
|
|
elems[i].addEventListener(eventName, fn);
|
2020-05-11 21:43:41 +02:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
2020-05-11 21:43:41 +02:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function init(context) {
|
|
|
|
context.querySelector('.externalIds').addEventListener('click', function (e) {
|
|
|
|
const btnOpenExternalId = dom.parentWithClass(e.target, 'btnOpenExternalId');
|
|
|
|
if (btnOpenExternalId) {
|
|
|
|
const field = context.querySelector('#' + btnOpenExternalId.getAttribute('data-fieldid'));
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const formatString = field.getAttribute('data-formatstring');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (field.value) {
|
|
|
|
shell.openUrl(formatString.replace('{0}', field.value));
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2020-05-11 22:23:08 +02:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
});
|
2020-05-11 22:23:08 +02:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (!layoutManager.desktop) {
|
|
|
|
context.querySelector('.btnBack').classList.remove('hide');
|
|
|
|
context.querySelector('.btnClose').classList.add('hide');
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
bindAll(context.querySelectorAll('.btnCancel'), 'click', function (event) {
|
|
|
|
event.preventDefault();
|
|
|
|
closeDialog();
|
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('.btnMore').addEventListener('click', function (e) {
|
|
|
|
getApiClient().getCurrentUser().then(function (user) {
|
|
|
|
showMoreMenu(context, e.target, user);
|
2019-01-10 15:39:37 +03:00
|
|
|
});
|
2023-04-19 01:56:05 -04:00
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('.btnHeaderSave').addEventListener('click', function () {
|
|
|
|
context.querySelector('.btnSave').click();
|
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#chkLockData').addEventListener('click', function (e) {
|
|
|
|
if (!e.target.checked) {
|
|
|
|
showElement('.providerSettingsContainer');
|
|
|
|
} else {
|
|
|
|
hideElement('.providerSettingsContainer');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
context.removeEventListener('click', onEditorClick);
|
|
|
|
context.addEventListener('click', onEditorClick);
|
|
|
|
|
|
|
|
const form = context.querySelector('form');
|
|
|
|
form.removeEventListener('submit', onSubmit);
|
|
|
|
form.addEventListener('submit', onSubmit);
|
|
|
|
|
|
|
|
context.querySelector('#btnAddPerson').addEventListener('click', function () {
|
|
|
|
editPerson(context, {}, -1);
|
|
|
|
});
|
|
|
|
|
|
|
|
context.querySelector('#peopleList').addEventListener('click', function (e) {
|
|
|
|
let index;
|
|
|
|
const btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson');
|
|
|
|
if (btnDeletePerson) {
|
|
|
|
index = parseInt(btnDeletePerson.getAttribute('data-index'), 10);
|
|
|
|
currentItem.People.splice(index, 1);
|
|
|
|
populatePeople(context, currentItem.People);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const btnEditPerson = dom.parentWithClass(e.target, 'btnEditPerson');
|
|
|
|
if (btnEditPerson) {
|
|
|
|
index = parseInt(btnEditPerson.getAttribute('data-index'), 10);
|
|
|
|
editPerson(context, currentItem.People[index], index);
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function getItem(itemId, serverId) {
|
|
|
|
const apiClient = ServerConnections.getApiClient(serverId);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (itemId) {
|
|
|
|
return apiClient.getItem(apiClient.getCurrentUserId(), itemId);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
return apiClient.getRootFolder(apiClient.getCurrentUserId());
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function getEditorConfig(itemId, serverId) {
|
|
|
|
const apiClient = ServerConnections.getApiClient(serverId);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (itemId) {
|
|
|
|
return apiClient.getJSON(apiClient.getUrl('Items/' + itemId + '/MetadataEditor'));
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
return Promise.resolve({});
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function populateCountries(select, allCountries) {
|
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += "<option value=''></option>";
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
for (let i = 0, length = allCountries.length; i < length; i++) {
|
|
|
|
const culture = allCountries[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
select.innerHTML = html;
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function populateLanguages(select, languages) {
|
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += "<option value=''></option>";
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
for (let i = 0, length = languages.length; i < length; i++) {
|
|
|
|
const culture = languages[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
select.innerHTML = html;
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function renderContentTypeOptions(context, metadataInfo) {
|
|
|
|
if (!metadataInfo.ContentTypeOptions.length) {
|
|
|
|
hideElement('#fldContentType', context);
|
|
|
|
} else {
|
|
|
|
showElement('#fldContentType', context);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const html = metadataInfo.ContentTypeOptions.map(function (i) {
|
|
|
|
return '<option value="' + i.Value + '">' + i.Name + '</option>';
|
|
|
|
}).join('');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const selectEl = context.querySelector('#selectContentType');
|
|
|
|
selectEl.innerHTML = html;
|
|
|
|
selectEl.value = metadataInfo.ContentType || '';
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function loadExternalIds(context, item, externalIds) {
|
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const providerIds = item.ProviderIds || {};
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
for (let i = 0, length = externalIds.length; i < length; i++) {
|
|
|
|
const idInfo = externalIds[i];
|
2020-03-22 13:08:10 -07:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const id = 'txt1' + idInfo.Key;
|
|
|
|
const formatString = idInfo.UrlFormatString || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
let fullName = idInfo.Name;
|
|
|
|
if (idInfo.Type) {
|
|
|
|
fullName = idInfo.Name + ' ' + globalize.translate(idInfo.Type);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const labelText = globalize.translate('LabelDynamicExternalId', escapeHtml(fullName));
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<div class="inputContainer">';
|
|
|
|
html += '<div class="flex align-items-center">';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const value = escapeHtml(providerIds[idInfo.Key] || '');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<div class="flex-grow">';
|
|
|
|
html += '<input is="emby-input" class="txtExternalId" value="' + value + '" data-providerkey="' + idInfo.Key + '" data-formatstring="' + formatString + '" id="' + id + '" label="' + labelText + '"/>';
|
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (formatString) {
|
|
|
|
html += '<button type="button" is="paper-icon-button-light" class="btnOpenExternalId align-self-flex-end" data-fieldid="' + id + '"><span class="material-icons open_in_browser" aria-hidden="true"></span></button>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '</div>';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '</div>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const elem = context.querySelector('.externalIds', context);
|
|
|
|
elem.innerHTML = html;
|
|
|
|
|
|
|
|
if (externalIds.length) {
|
|
|
|
context.querySelector('.externalIdsSection').classList.remove('hide');
|
|
|
|
} else {
|
|
|
|
context.querySelector('.externalIdsSection').classList.add('hide');
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Function to hide the element by selector or raw element
|
|
|
|
// Selector can be an element or a selector string
|
|
|
|
// Context is optional and restricts the querySelector to the context
|
|
|
|
function hideElement(selector, context, multiple) {
|
|
|
|
context = context || document;
|
|
|
|
if (typeof selector === 'string') {
|
|
|
|
const elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
|
|
|
|
|
|
|
Array.prototype.forEach.call(elements, function (el) {
|
|
|
|
if (el) {
|
|
|
|
el.classList.add('hide');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
selector.classList.add('hide');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Function to show the element by selector or raw element
|
|
|
|
// Selector can be an element or a selector string
|
|
|
|
// Context is optional and restricts the querySelector to the context
|
|
|
|
function showElement(selector, context, multiple) {
|
|
|
|
context = context || document;
|
|
|
|
if (typeof selector === 'string') {
|
|
|
|
const elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
|
|
|
|
|
|
|
Array.prototype.forEach.call(elements, function (el) {
|
|
|
|
if (el) {
|
|
|
|
el.classList.remove('hide');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
selector.classList.remove('hide');
|
|
|
|
}
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function setFieldVisibilities(context, item) {
|
|
|
|
if (item.Path && item.EnableMediaSourceDisplay !== false) {
|
|
|
|
showElement('#fldPath', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldPath', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Series' || item.Type === 'Movie' || item.Type === 'Trailer' || item.Type === 'Person') {
|
|
|
|
showElement('#fldOriginalName', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldOriginalName', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Series') {
|
|
|
|
showElement('#fldSeriesRuntime', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldSeriesRuntime', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Series' || item.Type === 'Person') {
|
|
|
|
showElement('#fldEndDate', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldEndDate', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'MusicAlbum') {
|
|
|
|
showElement('#albumAssociationMessage', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#albumAssociationMessage', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Movie' || item.Type === 'Trailer') {
|
|
|
|
showElement('#fldCriticRating', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldCriticRating', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Series') {
|
|
|
|
showElement('#fldStatus', context);
|
|
|
|
showElement('#fldAirDays', context);
|
|
|
|
showElement('#fldAirTime', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldStatus', context);
|
|
|
|
hideElement('#fldAirDays', context);
|
|
|
|
hideElement('#fldAirTime', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.MediaType === 'Video' && item.Type !== 'TvChannel') {
|
|
|
|
showElement('#fld3dFormat', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fld3dFormat', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Audio') {
|
|
|
|
showElement('#fldAlbumArtist', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldAlbumArtist', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Audio' || item.Type === 'MusicVideo') {
|
|
|
|
showElement('#fldArtist', context);
|
|
|
|
showElement('#fldAlbum', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldArtist', context);
|
|
|
|
hideElement('#fldAlbum', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Episode' && item.ParentIndexNumber === 0) {
|
|
|
|
showElement('#collapsibleSpecialEpisodeInfo', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#collapsibleSpecialEpisodeInfo', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Person'
|
2023-03-29 00:38:22 -04:00
|
|
|
|| item.Type === 'Genre'
|
|
|
|
|| item.Type === 'Studio'
|
|
|
|
|| item.Type === 'MusicGenre'
|
|
|
|
|| item.Type === 'TvChannel'
|
|
|
|
|| item.Type === 'Book') {
|
2023-04-19 01:56:05 -04:00
|
|
|
hideElement('#peopleCollapsible', context);
|
|
|
|
} else {
|
|
|
|
showElement('#peopleCollapsible', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Person' || item.Type === 'Genre' || item.Type === 'Studio' || item.Type === 'MusicGenre' || item.Type === 'TvChannel') {
|
|
|
|
hideElement('#fldCommunityRating', context);
|
|
|
|
hideElement('#genresCollapsible', context);
|
|
|
|
hideElement('#studiosCollapsible', context);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'TvChannel') {
|
2019-01-10 15:39:37 +03:00
|
|
|
showElement('#fldOfficialRating', context);
|
2023-04-19 01:56:05 -04:00
|
|
|
} else {
|
|
|
|
hideElement('#fldOfficialRating', context);
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
hideElement('#fldCustomRating', context);
|
|
|
|
} else {
|
|
|
|
showElement('#fldCommunityRating', context);
|
|
|
|
showElement('#genresCollapsible', context);
|
|
|
|
showElement('#studiosCollapsible', context);
|
|
|
|
showElement('#fldOfficialRating', context);
|
|
|
|
showElement('#fldCustomRating', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
showElement('#tagsCollapsible', context);
|
|
|
|
|
|
|
|
if (item.Type === 'TvChannel') {
|
|
|
|
hideElement('#metadataSettingsCollapsible', context);
|
|
|
|
hideElement('#fldPremiereDate', context);
|
|
|
|
hideElement('#fldDateAdded', context);
|
|
|
|
hideElement('#fldYear', context);
|
|
|
|
} else {
|
|
|
|
showElement('#metadataSettingsCollapsible', context);
|
|
|
|
showElement('#fldPremiereDate', context);
|
|
|
|
showElement('#fldDateAdded', context);
|
|
|
|
showElement('#fldYear', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'TvChannel') {
|
|
|
|
hideElement('.overviewContainer', context);
|
|
|
|
} else {
|
|
|
|
showElement('.overviewContainer', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Person') {
|
|
|
|
context.querySelector('#txtName').label(globalize.translate('LabelName'));
|
|
|
|
context.querySelector('#txtSortName').label(globalize.translate('LabelSortName'));
|
|
|
|
context.querySelector('#txtOriginalName').label(globalize.translate('LabelOriginalName'));
|
|
|
|
context.querySelector('#txtProductionYear').label(globalize.translate('LabelBirthYear'));
|
|
|
|
context.querySelector('#txtPremiereDate').label(globalize.translate('LabelBirthDate'));
|
|
|
|
context.querySelector('#txtEndDate').label(globalize.translate('LabelDeathDate'));
|
|
|
|
showElement('#fldPlaceOfBirth');
|
|
|
|
} else {
|
|
|
|
context.querySelector('#txtProductionYear').label(globalize.translate('LabelYear'));
|
|
|
|
context.querySelector('#txtPremiereDate').label(globalize.translate('LabelReleaseDate'));
|
|
|
|
context.querySelector('#txtEndDate').label(globalize.translate('LabelEndDate'));
|
|
|
|
hideElement('#fldPlaceOfBirth');
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.MediaType === 'Video' && item.Type !== 'TvChannel') {
|
|
|
|
showElement('#fldOriginalAspectRatio');
|
|
|
|
} else {
|
|
|
|
hideElement('#fldOriginalAspectRatio');
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Audio' || item.Type === 'Episode' || item.Type === 'Season') {
|
|
|
|
showElement('#fldIndexNumber');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Episode') {
|
|
|
|
context.querySelector('#txtIndexNumber').label(globalize.translate('LabelEpisodeNumber'));
|
|
|
|
} else if (item.Type === 'Season') {
|
|
|
|
context.querySelector('#txtIndexNumber').label(globalize.translate('LabelSeasonNumber'));
|
|
|
|
} else if (item.Type === 'Audio') {
|
|
|
|
context.querySelector('#txtIndexNumber').label(globalize.translate('LabelTrackNumber'));
|
2019-01-10 15:39:37 +03:00
|
|
|
} else {
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtIndexNumber').label(globalize.translate('LabelNumber'));
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
} else {
|
|
|
|
hideElement('#fldIndexNumber');
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Audio' || item.Type === 'Episode') {
|
|
|
|
showElement('#fldParentIndexNumber');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Episode') {
|
|
|
|
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelSeasonNumber'));
|
|
|
|
} else if (item.Type === 'Audio') {
|
|
|
|
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelDiscNumber'));
|
2019-01-10 15:39:37 +03:00
|
|
|
} else {
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelParentNumber'));
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
} else {
|
|
|
|
hideElement('#fldParentIndexNumber', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'BoxSet') {
|
|
|
|
showElement('#fldDisplayOrder', context);
|
|
|
|
hideElement('.seriesDisplayOrderDescription', context);
|
|
|
|
|
|
|
|
context.querySelector('#selectDisplayOrder').innerHTML = '<option value="SortName">' + globalize.translate('SortName') + '</option><option value="PremiereDate">' + globalize.translate('ReleaseDate') + '</option>';
|
|
|
|
} else if (item.Type === 'Series') {
|
|
|
|
showElement('#fldDisplayOrder', context);
|
|
|
|
showElement('.seriesDisplayOrderDescription', context);
|
|
|
|
|
|
|
|
let html = '';
|
|
|
|
html += '<option value="">' + globalize.translate('Aired') + '</option>';
|
|
|
|
html += '<option value="originalAirDate">' + globalize.translate('OriginalAirDate') + '</option>';
|
|
|
|
html += '<option value="absolute">' + globalize.translate('Absolute') + '</option>';
|
|
|
|
html += '<option value="dvd">DVD</option></option>';
|
|
|
|
html += '<option value="digital">' + globalize.translate('Digital') + '</option>';
|
|
|
|
html += '<option value="storyArc">' + globalize.translate('StoryArc') + '</option>';
|
|
|
|
html += '<option value="production">' + globalize.translate('Production') + '</option>';
|
|
|
|
html += '<option value="tv">TV</option>';
|
|
|
|
|
|
|
|
context.querySelector('#selectDisplayOrder').innerHTML = html;
|
|
|
|
} else {
|
|
|
|
context.querySelector('#selectDisplayOrder').innerHTML = '';
|
|
|
|
hideElement('#fldDisplayOrder', context);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function fillItemInfo(context, item, parentalRatingOptions) {
|
|
|
|
let select = context.querySelector('#selectOfficialRating');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
populateRatings(parentalRatingOptions, select, item.OfficialRating);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
select.value = item.OfficialRating || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
select = context.querySelector('#selectCustomRating');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
populateRatings(parentalRatingOptions, select, item.CustomRating);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
select.value = item.CustomRating || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const selectStatus = context.querySelector('#selectStatus');
|
|
|
|
populateStatus(selectStatus);
|
|
|
|
selectStatus.value = item.Status || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#select3dFormat', context).value = item.Video3DFormat || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
Array.prototype.forEach.call(context.querySelectorAll('.chkAirDay', context), function (el) {
|
|
|
|
el.checked = (item.AirDays || []).indexOf(el.getAttribute('data-day')) !== -1;
|
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
populateListView(context.querySelector('#listGenres'), item.Genres);
|
|
|
|
populatePeople(context, item.People || []);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
populateListView(context.querySelector('#listStudios'), (item.Studios || []).map(function (element) {
|
|
|
|
return element.Name || '';
|
|
|
|
}));
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
populateListView(context.querySelector('#listTags'), item.Tags);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const lockData = (item.LockData || false);
|
|
|
|
const chkLockData = context.querySelector('#chkLockData');
|
|
|
|
chkLockData.checked = lockData;
|
|
|
|
if (chkLockData.checked) {
|
|
|
|
hideElement('.providerSettingsContainer', context);
|
|
|
|
} else {
|
|
|
|
showElement('.providerSettingsContainer', context);
|
|
|
|
}
|
|
|
|
fillMetadataSettings(context, item, item.LockedFields);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtPath').value = item.Path || '';
|
|
|
|
context.querySelector('#txtName').value = item.Name || '';
|
|
|
|
context.querySelector('#txtOriginalName').value = item.OriginalTitle || '';
|
|
|
|
context.querySelector('#txtOverview').value = item.Overview || '';
|
|
|
|
context.querySelector('#txtTagline').value = (item.Taglines && item.Taglines.length ? item.Taglines[0] : '');
|
|
|
|
context.querySelector('#txtSortName').value = item.ForcedSortName || '';
|
|
|
|
context.querySelector('#txtCommunityRating').value = item.CommunityRating || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtCriticRating').value = item.CriticRating || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtIndexNumber').value = item.IndexNumber == null ? '' : item.IndexNumber;
|
|
|
|
context.querySelector('#txtParentIndexNumber').value = item.ParentIndexNumber == null ? '' : item.ParentIndexNumber;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtAirsBeforeSeason').value = ('AirsBeforeSeasonNumber' in item) ? item.AirsBeforeSeasonNumber : '';
|
|
|
|
context.querySelector('#txtAirsAfterSeason').value = ('AirsAfterSeasonNumber' in item) ? item.AirsAfterSeasonNumber : '';
|
|
|
|
context.querySelector('#txtAirsBeforeEpisode').value = ('AirsBeforeEpisodeNumber' in item) ? item.AirsBeforeEpisodeNumber : '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtAlbum').value = item.Album || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtAlbumArtist').value = (item.AlbumArtists || []).map(function (a) {
|
|
|
|
return a.Name;
|
|
|
|
}).join(';');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#selectDisplayOrder').value = item.DisplayOrder || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtArtist').value = (item.ArtistItems || []).map(function (a) {
|
|
|
|
return a.Name;
|
|
|
|
}).join(';');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
let date;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.DateCreated) {
|
|
|
|
try {
|
|
|
|
date = datetime.parseISO8601Date(item.DateCreated, true);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtDateAdded').value = date.toISOString().slice(0, 10);
|
|
|
|
} catch (e) {
|
2019-01-10 15:39:37 +03:00
|
|
|
context.querySelector('#txtDateAdded').value = '';
|
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
} else {
|
|
|
|
context.querySelector('#txtDateAdded').value = '';
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.PremiereDate) {
|
|
|
|
try {
|
|
|
|
date = datetime.parseISO8601Date(item.PremiereDate, true);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtPremiereDate').value = date.toISOString().slice(0, 10);
|
|
|
|
} catch (e) {
|
2019-01-10 15:39:37 +03:00
|
|
|
context.querySelector('#txtPremiereDate').value = '';
|
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
} else {
|
|
|
|
context.querySelector('#txtPremiereDate').value = '';
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.EndDate) {
|
|
|
|
try {
|
|
|
|
date = datetime.parseISO8601Date(item.EndDate, true);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtEndDate').value = date.toISOString().slice(0, 10);
|
|
|
|
} catch (e) {
|
2019-01-10 15:39:37 +03:00
|
|
|
context.querySelector('#txtEndDate').value = '';
|
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
} else {
|
|
|
|
context.querySelector('#txtEndDate').value = '';
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtProductionYear').value = item.ProductionYear || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtAirTime').value = item.AirTime || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const placeofBirth = item.ProductionLocations && item.ProductionLocations.length ? item.ProductionLocations[0] : '';
|
|
|
|
context.querySelector('#txtPlaceOfBirth').value = placeofBirth;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtOriginalAspectRatio').value = item.AspectRatio || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#selectLanguage').value = item.PreferredMetadataLanguage || '';
|
|
|
|
context.querySelector('#selectCountry').value = item.PreferredMetadataCountryCode || '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.RunTimeTicks) {
|
|
|
|
const minutes = item.RunTimeTicks / 600000000;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
context.querySelector('#txtSeriesRuntime').value = Math.round(minutes);
|
|
|
|
} else {
|
|
|
|
context.querySelector('#txtSeriesRuntime', context).value = '';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function populateRatings(allParentalRatings, select, currentValue) {
|
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += "<option value=''></option>";
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const ratings = [];
|
|
|
|
let rating;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
let currentValueFound = false;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
|
|
|
rating = allParentalRatings[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
ratings.push({ Name: rating.Name, Value: rating.Name });
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (rating.Name === currentValue) {
|
|
|
|
currentValueFound = true;
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
2023-04-19 01:56:05 -04:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (currentValue && !currentValueFound) {
|
|
|
|
ratings.push({ Name: currentValue, Value: currentValue });
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
for (let i = 0, length = ratings.length; i < length; i++) {
|
|
|
|
rating = ratings[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += "<option value='" + escapeHtml(rating.Value) + "'>" + escapeHtml(rating.Name) + '</option>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
select.innerHTML = html;
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function populateStatus(select) {
|
|
|
|
let html = '';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += "<option value=''></option>";
|
|
|
|
html += "<option value='Continuing'>" + globalize.translate('Continuing') + '</option>';
|
|
|
|
html += "<option value='Ended'>" + globalize.translate('Ended') + '</option>';
|
|
|
|
select.innerHTML = html;
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function populateListView(list, items, sortCallback) {
|
|
|
|
items = items || [];
|
|
|
|
if (typeof (sortCallback) === 'undefined') {
|
|
|
|
items.sort(function (a, b) {
|
|
|
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
items = sortCallback(items);
|
|
|
|
}
|
|
|
|
let html = '';
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
|
|
html += '<div class="listItem">';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<span class="material-icons listItemIcon live_tv" aria-hidden="true" style="background-color:#333;"></span>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<div class="listItemBody">';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<div class="textValue">';
|
|
|
|
html += escapeHtml(items[i]);
|
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<button type="button" is="paper-icon-button-light" data-index="' + i + '" class="btnRemoveFromEditorList autoSize"><span class="material-icons delete" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '</div>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
list.innerHTML = html;
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function populatePeople(context, people) {
|
|
|
|
const lastType = '';
|
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const elem = context.querySelector('#peopleList');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
for (let i = 0, length = people.length; i < length; i++) {
|
|
|
|
const person = people[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<div class="listItem">';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<span class="material-icons listItemIcon person" style="background-color:#333;"></span>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<div class="listItemBody">';
|
|
|
|
html += '<button style="text-align:left;" type="button" class="btnEditPerson clearButton" data-index="' + i + '">';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<div class="textValue">';
|
|
|
|
html += escapeHtml(person.Name || '');
|
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (person.Role && person.Role !== lastType) {
|
|
|
|
html += '<div class="secondary">' + person.Role + '</div>';
|
|
|
|
} else {
|
|
|
|
html += '<div class="secondary">' + globalize.translate(person.Type) + '</div>';
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '</button>';
|
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<button type="button" is="paper-icon-button-light" data-index="' + i + '" class="btnDeletePerson autoSize"><span class="material-icons delete" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '</div>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
elem.innerHTML = html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getLockedFieldsHtml(fields, currentFields) {
|
|
|
|
let html = '';
|
2023-05-04 11:27:15 -04:00
|
|
|
for (const field of fields) {
|
2023-04-19 01:56:05 -04:00
|
|
|
const name = field.name;
|
|
|
|
const value = field.value || field.name;
|
|
|
|
const checkedHtml = currentFields.indexOf(value) === -1 ? ' checked' : '';
|
|
|
|
html += '<label>';
|
|
|
|
html += '<input type="checkbox" is="emby-checkbox" class="selectLockedField" data-value="' + value + '"' + checkedHtml + '/>';
|
|
|
|
html += '<span>' + name + '</span>';
|
|
|
|
html += '</label>';
|
|
|
|
}
|
|
|
|
return html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function fillMetadataSettings(context, item, lockedFields) {
|
|
|
|
const container = context.querySelector('.providerSettingsContainer');
|
|
|
|
lockedFields = lockedFields || [];
|
|
|
|
|
|
|
|
const lockedFieldsList = [
|
|
|
|
{ name: globalize.translate('Name'), value: 'Name' },
|
|
|
|
{ name: globalize.translate('Overview'), value: 'Overview' },
|
|
|
|
{ name: globalize.translate('Genres'), value: 'Genres' },
|
|
|
|
{ name: globalize.translate('ParentalRating'), value: 'OfficialRating' },
|
|
|
|
{ name: globalize.translate('People'), value: 'Cast' }
|
|
|
|
];
|
|
|
|
|
|
|
|
if (item.Type === 'Person') {
|
|
|
|
lockedFieldsList.push({ name: globalize.translate('BirthLocation'), value: 'ProductionLocations' });
|
|
|
|
} else {
|
|
|
|
lockedFieldsList.push({ name: globalize.translate('ProductionLocations'), value: 'ProductionLocations' });
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.Type === 'Series') {
|
|
|
|
lockedFieldsList.push({ name: globalize.translate('Runtime'), value: 'Runtime' });
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
lockedFieldsList.push({ name: globalize.translate('Studios'), value: 'Studios' });
|
|
|
|
lockedFieldsList.push({ name: globalize.translate('Tags'), value: 'Tags' });
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += '<h2>' + globalize.translate('HeaderEnabledFields') + '</h2>';
|
|
|
|
html += '<p>' + globalize.translate('HeaderEnabledFieldsHelp') + '</p>';
|
|
|
|
html += getLockedFieldsHtml(lockedFieldsList, lockedFields);
|
|
|
|
container.innerHTML = html;
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function reload(context, itemId, serverId) {
|
|
|
|
loading.show();
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
Promise.all([getItem(itemId, serverId), getEditorConfig(itemId, serverId)]).then(function (responses) {
|
|
|
|
const item = responses[0];
|
|
|
|
metadataEditorInfo = responses[1];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
currentItem = item;
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const languages = metadataEditorInfo.Cultures;
|
|
|
|
const countries = metadataEditorInfo.Countries;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
renderContentTypeOptions(context, metadataEditorInfo);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
loadExternalIds(context, item, metadataEditorInfo.ExternalIdInfos);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
populateLanguages(context.querySelector('#selectLanguage'), languages);
|
|
|
|
populateCountries(context.querySelector('#selectCountry'), countries);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
setFieldVisibilities(context, item);
|
|
|
|
fillItemInfo(context, item, metadataEditorInfo.ParentalRatingOptions);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (item.MediaType === 'Video' && item.Type !== 'Episode' && item.Type !== 'TvChannel') {
|
|
|
|
showElement('#fldTagline', context);
|
|
|
|
} else {
|
|
|
|
hideElement('#fldTagline', context);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
loading.hide();
|
|
|
|
});
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function centerFocus(elem, horiz, on) {
|
|
|
|
import('../../scripts/scrollHelper').then((scrollHelper) => {
|
|
|
|
const fn = on ? 'on' : 'off';
|
|
|
|
scrollHelper.centerFocus[fn](elem, horiz);
|
|
|
|
});
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function show(itemId, serverId, resolve) {
|
|
|
|
loading.show();
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const dialogOptions = {
|
|
|
|
removeOnClose: true,
|
|
|
|
scrollY: false
|
|
|
|
};
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (layoutManager.tv) {
|
|
|
|
dialogOptions.size = 'fullscreen';
|
|
|
|
} else {
|
|
|
|
dialogOptions.size = 'small';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
dlg.classList.add('formDialog');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
html += globalize.translateHtml(template, 'core');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
dlg.innerHTML = html;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
if (layoutManager.tv) {
|
|
|
|
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
dialogHelper.open(dlg);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
dlg.addEventListener('close', function () {
|
2020-11-25 00:17:24 -05:00
|
|
|
if (layoutManager.tv) {
|
2023-04-19 01:56:05 -04:00
|
|
|
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
2020-11-25 00:17:24 -05:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
resolve();
|
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
currentContext = dlg;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
init(dlg);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
reload(dlg, itemId, serverId);
|
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
export default {
|
|
|
|
show: function (itemId, serverId) {
|
|
|
|
return new Promise(resolve => show(itemId, serverId, resolve));
|
|
|
|
},
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
embed: function (elem, itemId, serverId) {
|
|
|
|
return new Promise(function () {
|
|
|
|
loading.show();
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
elem.innerHTML = globalize.translateHtml(template, 'core');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
elem.querySelector('.formDialogFooter').classList.remove('formDialogFooter');
|
|
|
|
elem.querySelector('.btnClose').classList.add('hide');
|
|
|
|
elem.querySelector('.btnHeaderSave').classList.remove('hide');
|
|
|
|
elem.querySelector('.btnCancel').classList.add('hide');
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
currentContext = elem;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
init(elem);
|
|
|
|
reload(elem, itemId, serverId);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
focusManager.autoFocus(elem);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2020-07-17 17:43:39 +01:00
|
|
|
|