2015-10-15 20:17:42 -07:00
|
|
|
|
(function () {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function changeCollectionType(page, virtualFolder) {
|
2013-12-01 13:17:40 -07:00
|
|
|
|
|
2013-12-26 19:23:57 -07:00
|
|
|
|
Dashboard.alert({
|
2014-07-16 20:17:14 -07:00
|
|
|
|
message: Globalize.translate('HeaderChangeFolderTypeHelp'),
|
|
|
|
|
title: Globalize.translate('HeaderChangeFolderType')
|
2013-12-26 19:23:57 -07:00
|
|
|
|
});
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
2013-12-01 13:17:40 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
function addVirtualFolder(page) {
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 19:06:44 -07:00
|
|
|
|
require(['medialibrarycreator'], function (medialibrarycreator) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 19:06:44 -07:00
|
|
|
|
new medialibrarycreator().show({
|
2013-09-04 12:16:41 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
collectionTypeOptions: getCollectionTypeOptions(),
|
2015-10-26 11:12:20 -07:00
|
|
|
|
refresh: shouldRefreshLibraryAfterChanges(page)
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function (hasChanges) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
if (hasChanges) {
|
|
|
|
|
reloadLibrary(page);
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
});
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 20:17:42 -07:00
|
|
|
|
function editVirtualFolder(page, virtualFolder) {
|
|
|
|
|
|
|
|
|
|
require(['medialibraryeditor'], function (medialibraryeditor) {
|
|
|
|
|
|
|
|
|
|
new medialibraryeditor().show({
|
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
refresh: shouldRefreshLibraryAfterChanges(page),
|
2015-10-15 20:17:42 -07:00
|
|
|
|
library: virtualFolder
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function (hasChanges) {
|
2015-10-15 20:17:42 -07:00
|
|
|
|
|
|
|
|
|
if (hasChanges) {
|
|
|
|
|
reloadLibrary(page);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function deleteVirtualFolder(page, virtualFolder) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var msg = Globalize.translate('MessageAreYouSureYouWishToRemoveMediaFolder');
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
if (virtualFolder.Locations.length) {
|
|
|
|
|
msg += "<br/><br/>" + Globalize.translate("MessageTheFollowingLocationWillBeRemovedFromLibrary") + "<br/><br/>";
|
|
|
|
|
msg += virtualFolder.Locations.join("<br/>");
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
Dashboard.confirm(msg, Globalize.translate('HeaderRemoveMediaFolder'), function (confirmResult) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
if (confirmResult) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
2013-09-05 10:05:39 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
|
2015-10-26 11:12:20 -07:00
|
|
|
|
reloadLibrary(page);
|
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function renameVirtualFolder(page, virtualFolder) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
require(['prompt'], function (prompt) {
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
prompt({
|
|
|
|
|
text: Globalize.translate('LabelNewName'),
|
|
|
|
|
title: Globalize.translate('HeaderRenameMediaFolder'),
|
|
|
|
|
callback: function (newName) {
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
if (newName && newName != virtualFolder.Name) {
|
2015-10-13 12:22:45 -07:00
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
2015-10-15 10:21:18 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () {
|
2015-10-26 11:12:20 -07:00
|
|
|
|
reloadLibrary(page);
|
|
|
|
|
});
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-13 12:22:45 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function showCardMenu(page, elem, virtualFolders) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var card = $(elem).parents('.card')[0];
|
|
|
|
|
var index = parseInt(card.getAttribute('data-index'));
|
|
|
|
|
var virtualFolder = virtualFolders[index];
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var menuItems = [];
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
menuItems.push({
|
2015-10-15 12:04:51 -07:00
|
|
|
|
name: Globalize.translate('ButtonChangeContentType'),
|
2015-10-15 10:21:18 -07:00
|
|
|
|
id: 'changetype',
|
2015-10-15 22:36:16 -07:00
|
|
|
|
ironIcon: 'videocam'
|
2015-10-15 10:21:18 -07:00
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 21:46:41 -07:00
|
|
|
|
menuItems.push({
|
2015-10-15 22:36:16 -07:00
|
|
|
|
name: Globalize.translate('ButtonManageFolders'),
|
2015-10-15 21:46:41 -07:00
|
|
|
|
id: 'edit',
|
2015-10-15 22:36:16 -07:00
|
|
|
|
ironIcon: 'folder-open'
|
2015-10-15 21:46:41 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
menuItems.push({
|
|
|
|
|
name: Globalize.translate('ButtonRemove'),
|
|
|
|
|
id: 'delete',
|
|
|
|
|
ironIcon: 'remove'
|
|
|
|
|
});
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
menuItems.push({
|
|
|
|
|
name: Globalize.translate('ButtonRename'),
|
|
|
|
|
id: 'rename',
|
|
|
|
|
ironIcon: 'mode-edit'
|
|
|
|
|
});
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
require(['actionsheet'], function () {
|
|
|
|
|
|
|
|
|
|
ActionSheetElement.show({
|
|
|
|
|
items: menuItems,
|
|
|
|
|
positionTo: elem,
|
|
|
|
|
callback: function (resultId) {
|
|
|
|
|
|
|
|
|
|
switch (resultId) {
|
|
|
|
|
|
|
|
|
|
case 'changetype':
|
|
|
|
|
changeCollectionType(page, virtualFolder);
|
|
|
|
|
break;
|
2015-10-15 21:46:41 -07:00
|
|
|
|
case 'edit':
|
|
|
|
|
editVirtualFolder(page, virtualFolder);
|
|
|
|
|
break;
|
2015-10-15 10:21:18 -07:00
|
|
|
|
case 'rename':
|
|
|
|
|
renameVirtualFolder(page, virtualFolder);
|
|
|
|
|
break;
|
|
|
|
|
case 'delete':
|
|
|
|
|
deleteVirtualFolder(page, virtualFolder);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function reloadLibrary(page) {
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
2013-10-18 12:47:57 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getVirtualFolders().then(function (result) {
|
2015-10-15 10:21:18 -07:00
|
|
|
|
reloadVirtualFolders(page, result);
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-12-01 13:17:40 -07:00
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
function shouldRefreshLibraryAfterChanges(page) {
|
2013-10-18 12:47:57 -07:00
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
return $(page).is('#mediaLibraryPage');
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function reloadVirtualFolders(page, virtualFolders) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
virtualFolders.push({
|
2015-10-15 10:37:27 -07:00
|
|
|
|
Name: Globalize.translate('ButtonAddMediaLibrary'),
|
2015-10-15 10:21:18 -07:00
|
|
|
|
icon: 'add-circle',
|
|
|
|
|
Locations: [],
|
|
|
|
|
showType: false,
|
|
|
|
|
showLocations: false,
|
|
|
|
|
showMenu: false,
|
2015-10-15 19:06:44 -07:00
|
|
|
|
showNameWithIcon: true
|
2013-02-20 18:33:05 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
for (var i = 0, length = virtualFolders.length; i < length; i++) {
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var virtualFolder = virtualFolders[i];
|
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
html += getVirtualFolderHtml(page, virtualFolder, i);
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var divVirtualFolders = page.querySelector('#divVirtualFolders');
|
|
|
|
|
divVirtualFolders.innerHTML = html;
|
|
|
|
|
|
|
|
|
|
$('.btnCardMenu', divVirtualFolders).on('click', function () {
|
|
|
|
|
showCardMenu(page, this, virtualFolders);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.addLibrary', divVirtualFolders).on('click', function () {
|
|
|
|
|
addVirtualFolder(page);
|
|
|
|
|
});
|
|
|
|
|
|
2015-10-15 20:17:42 -07:00
|
|
|
|
$('.editLibrary', divVirtualFolders).on('click', function () {
|
|
|
|
|
var card = $(this).parents('.card')[0];
|
|
|
|
|
var index = parseInt(card.getAttribute('data-index'));
|
|
|
|
|
var virtualFolder = virtualFolders[index];
|
2015-10-15 22:36:16 -07:00
|
|
|
|
|
2015-10-16 10:06:31 -07:00
|
|
|
|
if (!virtualFolder.ItemId) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
require(['components/imageeditor/imageeditor'], function (ImageEditor) {
|
2015-10-15 22:36:16 -07:00
|
|
|
|
|
|
|
|
|
ImageEditor.show(virtualFolder.ItemId, {
|
|
|
|
|
theme: 'a'
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function (hasChanged) {
|
2015-10-15 22:36:16 -07:00
|
|
|
|
if (hasChanged) {
|
|
|
|
|
reloadLibrary(page);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2015-10-15 20:17:42 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCollectionTypeOptions() {
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
2013-10-18 12:47:57 -07:00
|
|
|
|
{ name: "", value: "" },
|
2014-08-24 08:48:06 -07:00
|
|
|
|
{ name: Globalize.translate('FolderTypeMovies'), value: "movies" },
|
|
|
|
|
{ name: Globalize.translate('FolderTypeMusic'), value: "music" },
|
|
|
|
|
{ name: Globalize.translate('FolderTypeTvShows'), value: "tvshows" },
|
2014-12-19 23:06:27 -07:00
|
|
|
|
{ name: Globalize.translate('FolderTypeBooks'), value: "books", message: Globalize.translate('MessageBookPluginRequired') },
|
|
|
|
|
{ name: Globalize.translate('FolderTypeGames'), value: "games", message: Globalize.translate('MessageGamePluginRequired') },
|
2014-08-24 08:48:06 -07:00
|
|
|
|
{ name: Globalize.translate('FolderTypeHomeVideos'), value: "homevideos" },
|
|
|
|
|
{ name: Globalize.translate('FolderTypeMusicVideos'), value: "musicvideos" },
|
|
|
|
|
{ name: Globalize.translate('FolderTypePhotos'), value: "photos" },
|
2014-12-27 23:21:39 -07:00
|
|
|
|
{ name: Globalize.translate('FolderTypeUnset'), value: "mixed", message: Globalize.translate('MessageUnsetContentHelp') }
|
2013-07-12 12:56:40 -07:00
|
|
|
|
];
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
}
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function getIcon(type) {
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "movies":
|
|
|
|
|
return "local-movies";
|
|
|
|
|
case "music":
|
|
|
|
|
return "library-music";
|
|
|
|
|
case "photos":
|
|
|
|
|
return "photo";
|
|
|
|
|
case "livetv":
|
|
|
|
|
return "live-tv";
|
|
|
|
|
case "tvshows":
|
|
|
|
|
return "live-tv";
|
|
|
|
|
case "games":
|
|
|
|
|
return "folder";
|
|
|
|
|
case "trailers":
|
|
|
|
|
return "local-movies";
|
|
|
|
|
case "homevideos":
|
|
|
|
|
return "video-library";
|
|
|
|
|
case "musicvideos":
|
|
|
|
|
return "video-library";
|
|
|
|
|
case "books":
|
|
|
|
|
return "folder";
|
|
|
|
|
case "channels":
|
|
|
|
|
return "folder";
|
|
|
|
|
case "playlists":
|
|
|
|
|
return "folder";
|
|
|
|
|
default:
|
|
|
|
|
return "folder";
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
function getVirtualFolderHtml(page, virtualFolder, index) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var html = '';
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 20:17:42 -07:00
|
|
|
|
var style = "";
|
|
|
|
|
|
2015-10-26 11:12:20 -07:00
|
|
|
|
if (page.classList.contains('wizardPage')) {
|
2015-10-15 20:17:42 -07:00
|
|
|
|
style += "min-width:33.3%;";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '<div class="card backdropCard" style="' + style + '" data-index="' + index + '">';
|
2013-09-04 12:16:41 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += '<div class="cardBox visualCardBox">';
|
|
|
|
|
html += '<div class="cardScalable">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += '<div class="cardPadder"></div>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 19:06:44 -07:00
|
|
|
|
html += '<div class="cardContent">';
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var imgUrl = '';
|
2015-10-15 10:37:27 -07:00
|
|
|
|
|
|
|
|
|
if (virtualFolder.PrimaryImageItemId) {
|
|
|
|
|
imgUrl = ApiClient.getScaledImageUrl(virtualFolder.PrimaryImageItemId, {
|
|
|
|
|
type: 'Primary'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
if (imgUrl) {
|
2015-10-15 20:17:42 -07:00
|
|
|
|
html += '<div class="cardImage editLibrary" style="cursor:pointer;background-image:url(\'' + imgUrl + '\');"></div>';
|
2015-10-15 19:06:44 -07:00
|
|
|
|
} else if (!virtualFolder.showNameWithIcon) {
|
2015-10-15 20:17:42 -07:00
|
|
|
|
html += '<div class="cardImage editLibrary iconCardImage" style="cursor:pointer;">';
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += '<iron-icon icon="' + (virtualFolder.icon || getIcon(virtualFolder.CollectionType)) + '"></iron-icon>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
// cardContent
|
|
|
|
|
html += "</div>";
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
// cardScalable
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 19:06:44 -07:00
|
|
|
|
if (!imgUrl && virtualFolder.showNameWithIcon) {
|
|
|
|
|
html += '<div class="cardImage iconCardImage addLibrary" style="position:absolute;top:0;left:0;right:0;bottom:0;font-size:140%;cursor:pointer;">';
|
|
|
|
|
|
|
|
|
|
html += '<div>';
|
|
|
|
|
html += '<iron-icon icon="' + (virtualFolder.icon || getIcon(virtualFolder.CollectionType)) + '" style="width:45%;height:45%;color:#888;"></iron-icon>';
|
|
|
|
|
|
|
|
|
|
if (virtualFolder.showNameWithIcon) {
|
|
|
|
|
html += '<div style="margin:1.5em 0;position:width:100%;font-weight:500;color:#444;">';
|
|
|
|
|
html += virtualFolder.Name;
|
|
|
|
|
html += "</div>";
|
|
|
|
|
}
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += '<div class="cardFooter">';
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
if (virtualFolder.showMenu !== false) {
|
|
|
|
|
html += '<div class="cardText" style="text-align:right; float:right;padding-top:5px;">';
|
|
|
|
|
html += '<paper-icon-button icon="' + AppInfo.moreIcon + '" class="btnCardMenu"></paper-icon-button>';
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += "<div class='cardText'>";
|
|
|
|
|
if (virtualFolder.showNameWithIcon) {
|
|
|
|
|
html += ' ';
|
|
|
|
|
} else {
|
|
|
|
|
html += virtualFolder.Name;
|
|
|
|
|
}
|
|
|
|
|
html += "</div>";
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var typeName = getCollectionTypeOptions().filter(function (t) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
return t.value == virtualFolder.CollectionType;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
})[0];
|
2013-09-05 10:05:39 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
typeName = typeName ? typeName.name : Globalize.translate('FolderTypeUnset');
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += "<div class='cardText'>";
|
|
|
|
|
if (virtualFolder.showType === false) {
|
|
|
|
|
html += ' ';
|
|
|
|
|
} else {
|
|
|
|
|
html += typeName;
|
|
|
|
|
}
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
if (virtualFolder.showLocations === false) {
|
|
|
|
|
html += "<div class='cardText'>";
|
|
|
|
|
html += ' ';
|
|
|
|
|
html += "</div>";
|
|
|
|
|
} else if (!virtualFolder.Locations.length) {
|
|
|
|
|
html += "<div class='cardText' style='color:#cc3333;'>";
|
|
|
|
|
html += Globalize.translate('NumLocationsValue', virtualFolder.Locations.length);
|
|
|
|
|
html += "</div>";
|
|
|
|
|
}
|
|
|
|
|
else if (virtualFolder.Locations.length == 1) {
|
|
|
|
|
html += "<div class='cardText'>";
|
|
|
|
|
html += virtualFolder.Locations[0];
|
|
|
|
|
html += "</div>";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
html += "<div class='cardText'>";
|
|
|
|
|
html += Globalize.translate('NumLocationsValue', virtualFolder.Locations.length);
|
|
|
|
|
html += "</div>";
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
// cardFooter
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
// cardBox
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
// card
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
return html;
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
pageClassOn('pageinit', "mediaLibraryPage", function () {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var page = this;
|
|
|
|
|
$('#selectCollectionType', page).on('change', function () {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var index = this.selectedIndex;
|
|
|
|
|
if (index != -1) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var name = this.options[index].innerHTML
|
|
|
|
|
.replace('*', '')
|
|
|
|
|
.replace('&', '&');
|
2013-09-05 10:05:39 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var value = this.value;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
$('#txtValue', page).val(name);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var folderOption = getCollectionTypeOptions().filter(function (i) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
return i.value == value;
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
})[0];
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
$('.collectionTypeFieldDescription', page).html(folderOption.message || '');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
pageClassOn('pageshow', "mediaLibraryPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
reloadLibrary(page);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})();
|
2014-03-16 12:39:58 -07:00
|
|
|
|
|
2014-07-10 21:27:46 -07:00
|
|
|
|
var WizardLibraryPage = {
|
|
|
|
|
|
|
|
|
|
next: function () {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2014-11-14 19:31:03 -07:00
|
|
|
|
var apiClient = ApiClient;
|
|
|
|
|
|
|
|
|
|
apiClient.ajax({
|
2014-07-10 21:27:46 -07:00
|
|
|
|
type: "POST",
|
2014-11-14 19:31:03 -07:00
|
|
|
|
url: apiClient.getUrl('System/Configuration/MetadataPlugins/Autoset')
|
2014-07-10 21:27:46 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function () {
|
2014-07-10 21:27:46 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
Dashboard.navigate('wizardsettings.html');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-16 12:39:58 -07:00
|
|
|
|
(function ($, document, window) {
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
pageIdOn('pageshow', "mediaLibraryPage", function () {
|
2015-01-20 13:19:54 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
// on here
|
|
|
|
|
$('.btnRefresh', page).taskButton({
|
|
|
|
|
mode: 'on',
|
2015-09-12 09:39:24 -07:00
|
|
|
|
progressElem: page.querySelector('.refreshProgress'),
|
2015-01-20 13:19:54 -07:00
|
|
|
|
taskKey: 'RefreshLibrary'
|
|
|
|
|
});
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
pageIdOn('pagebeforehide', "mediaLibraryPage", function () {
|
2015-01-20 13:19:54 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
// off here
|
|
|
|
|
$('.btnRefresh', page).taskButton({
|
|
|
|
|
mode: 'off'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-01-20 14:32:48 -07:00
|
|
|
|
})(jQuery, document, window);
|