define(['jQuery', 'fnchecked'], function ($) {
function loadMediaFolders(page, user, mediaFolders) {
var html = '';
html += '
' + Globalize.translate('HeaderLibraries') + '
';
html += '
';
for (var i = 0, length = mediaFolders.length; i < length; i++) {
var folder = mediaFolders[i];
var isChecked = user.Policy.EnableAllFolders || user.Policy.EnabledFolders.indexOf(folder.Id) != -1;
var checkedAttribute = isChecked ? ' checked="checked"' : '';
html += '';
}
html += '
';
$('.folderAccess', page).html(html).trigger('create');
$('#chkEnableAllFolders', page).checked(user.Policy.EnableAllFolders).trigger('change');
}
function loadChannels(page, user, channels) {
var html = '';
html += '
' + Globalize.translate('HeaderChannels') + '
';
html += '
';
for (var i = 0, length = channels.length; i < length; i++) {
var folder = channels[i];
var isChecked = user.Policy.EnableAllChannels || user.Policy.EnabledChannels.indexOf(folder.Id) != -1;
var checkedAttribute = isChecked ? ' checked="checked"' : '';
html += '';
}
html += '
';
$('.channelAccess', page).show().html(html).trigger('create');
if (channels.length) {
$('.channelAccessContainer', page).show();
} else {
$('.channelAccessContainer', page).hide();
}
$('#chkEnableAllChannels', page).checked(user.Policy.EnableAllChannels).trigger('change');
}
function loadDevices(page, user, devices) {
var html = '';
html += '
' + Globalize.translate('HeaderDevices') + '
';
html += '
';
for (var i = 0, length = devices.length; i < length; i++) {
var device = devices[i];
var checkedAttribute = user.Policy.EnableAllDevices || user.Policy.EnabledDevices.indexOf(device.Id) != -1 ? ' checked="checked"' : '';
html += '';
}
html += '