2013-02-20 18:33:05 -07:00
|
|
|
|
var MediaLibraryPage = {
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
addMediaLocation: function (virtualFolderIndex) {
|
2014-10-29 15:01:02 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
MediaLibraryPage.selectDirectory(function (path) {
|
2014-12-19 23:06:27 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
if (path) {
|
2014-12-19 23:06:27 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var virtualFolder = MediaLibraryPage.virtualFolders[virtualFolderIndex];
|
2014-12-19 23:06:27 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
MediaLibraryPage.lastVirtualFolderName = virtualFolder.Name;
|
2014-12-19 23:06:27 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges();
|
2014-12-19 23:06:27 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
ApiClient.addMediaPath(virtualFolder.Name, path, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
2014-10-29 15:01:02 -07:00
|
|
|
|
}
|
2015-10-15 10:21:18 -07:00
|
|
|
|
|
2014-10-29 15:01:02 -07:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
selectDirectory: function (callback) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var picker = new directoryBrowser();
|
2014-07-10 21:27:46 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
picker.show({
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
callback: callback
|
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
MediaLibraryPage.directoryPicker = picker;
|
2014-02-20 22:04:11 -07:00
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
},
|
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
deleteMediaLocation: function (button) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var folderIndex = button.getAttribute('data-folderindex');
|
|
|
|
|
var index = parseInt(button.getAttribute('data-index'));
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var virtualFolder = MediaLibraryPage.virtualFolders[folderIndex];
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
MediaLibraryPage.lastVirtualFolderName = virtualFolder.Name;
|
2014-01-30 14:23:54 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var location = virtualFolder.Locations[index];
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
Dashboard.confirm(Globalize.translate('MessageConfirmRemoveMediaLocation'), Globalize.translate('HeaderRemoveMediaLocation'), function (confirmResult) {
|
2013-07-06 10:20:53 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
if (confirmResult) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges();
|
2014-01-30 14:23:54 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
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 () {
|
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 10:21:18 -07:00
|
|
|
|
function processOperationResult(result) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
var page = $($.mobile.activePage)[0];
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
reloadLibrary(page);
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
function addVirtualFolder(page) {
|
2013-07-12 12:56:40 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
//$('#textEntryForm', popup).on('submit', function () {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
// if (callback) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
// if (showCollectionType) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
// var collectionType = $('#selectCollectionType', popup).val();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
// // The server expects an empty value for mixed
|
|
|
|
|
// if (collectionType == 'mixed') {
|
|
|
|
|
// collectionType = '';
|
|
|
|
|
// }
|
2014-01-29 22:20:18 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
// callback($('#txtValue', popup).val(), collectionType);
|
|
|
|
|
// } else {
|
|
|
|
|
// callback($('#txtValue', popup).val());
|
|
|
|
|
// }
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
// }
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
// return false;
|
|
|
|
|
//});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
require(['medialibraryeditor'], function (medialibraryeditor) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
new medialibraryeditor().show({
|
2013-09-04 12:16:41 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
collectionTypeOptions: getCollectionTypeOptions(),
|
|
|
|
|
refresh: shouldRefreshLibraryAfterChanges()
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-10-15 11:48:43 -07:00
|
|
|
|
}).done(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 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-15 10:21:18 -07:00
|
|
|
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges();
|
2013-09-05 10:05:39 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).done(processOperationResult);
|
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-15 10:21:18 -07:00
|
|
|
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges();
|
|
|
|
|
|
|
|
|
|
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).done(processOperationResult);
|
|
|
|
|
}
|
|
|
|
|
}
|
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({
|
|
|
|
|
name: Globalize.translate('ButtonChangeType'),
|
|
|
|
|
id: 'changetype',
|
|
|
|
|
ironIcon: 'folder'
|
|
|
|
|
});
|
2013-02-20 18:33:05 -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;
|
|
|
|
|
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-10-15 10:21:18 -07:00
|
|
|
|
ApiClient.getVirtualFolders().done(function (result) {
|
|
|
|
|
reloadVirtualFolders(page, result);
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-12-01 13:17:40 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
function shouldRefreshLibraryAfterChanges() {
|
2013-10-18 12:47:57 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
return $($.mobile.activePage).is('#mediaLibraryPage');
|
|
|
|
|
}
|
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,
|
|
|
|
|
showNameWithIcon: true,
|
|
|
|
|
color: 'green',
|
|
|
|
|
contentClass: 'addLibrary'
|
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];
|
|
|
|
|
|
|
|
|
|
html += getVirtualFolderHtml(virtualFolder, i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var divVirtualFolders = page.querySelector('#divVirtualFolders');
|
|
|
|
|
divVirtualFolders.innerHTML = html;
|
|
|
|
|
|
|
|
|
|
$('.btnCardMenu', divVirtualFolders).on('click', function () {
|
|
|
|
|
showCardMenu(page, this, virtualFolders);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.addLibrary', divVirtualFolders).on('click', function () {
|
|
|
|
|
addVirtualFolder(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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-15 10:21:18 -07:00
|
|
|
|
function getVirtualFolderHtml(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 11:48:43 -07:00
|
|
|
|
html += '<div class="card backdropCard" 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 10:21:18 -07:00
|
|
|
|
var contentClass = "cardContent";
|
|
|
|
|
if (virtualFolder.contentClass) {
|
|
|
|
|
contentClass += " " + virtualFolder.contentClass;
|
|
|
|
|
}
|
2013-09-05 10:05:39 -07:00
|
|
|
|
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += '<div class="' + contentClass + '">';
|
|
|
|
|
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) {
|
|
|
|
|
html += '<div class="cardImage" style="background-image:url(\'' + imgUrl + '\');"></div>';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<div class="cardImage iconCardImage">';
|
|
|
|
|
|
|
|
|
|
if (virtualFolder.color) {
|
|
|
|
|
html += '<div style="color:' + virtualFolder.color + ';cursor:pointer;">';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<div>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
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
|
|
|
|
if (virtualFolder.showNameWithIcon) {
|
2015-10-15 10:37:27 -07:00
|
|
|
|
html += '<div style="margin-top:1em;position:absolute;width:100%;font-weight:bold;">';
|
2015-10-15 10:21:18 -07:00
|
|
|
|
html += virtualFolder.Name;
|
|
|
|
|
html += "</div>";
|
|
|
|
|
}
|
|
|
|
|
html += "</div>";
|
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 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
|
|
|
|
|
|
|
|
|
}).done(function () {
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
lastResultElem: $('.lastRefreshResult', page),
|
|
|
|
|
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);
|