make channel access opt-in rather than opt out

This commit is contained in:
Luke Pulverenti 2015-01-12 22:46:44 -05:00
parent 105aefc715
commit b0a735dccf
5 changed files with 40 additions and 20 deletions

View File

@ -761,10 +761,10 @@ var Dashboard = {
name: Globalize.translate('TabPlayback'),
href: "playbackconfiguration.html",
selected: page.hasClass('playbackConfigurationPage')
//}, {
// name: Globalize.translate('TabSync'),
// href: "syncactivity.html",
// selected: page.hasClass('syncConfigurationPage')
}, {
name: Globalize.translate('TabSync'),
href: "syncactivity.html",
selected: page.hasClass('syncConfigurationPage')
}, {
divider: true,
name: Globalize.translate('TabAutoOrganize'),

View File

@ -203,8 +203,7 @@
function isAvailable(item, user) {
return false;
//return item.SupportsSync;
return item.SupportsSync;
}
window.SyncManager = {
@ -226,7 +225,7 @@
Dashboard.getCurrentUser().done(function (user) {
if (user.Policy.EnableSync) {
$('.categorySyncButton', page).hide();
$('.categorySyncButton', page).show();
} else {
$('.categorySyncButton', page).hide();
}

View File

@ -31,7 +31,7 @@
html += '<fieldset data-role="controlgroup">';
html += '<legend>' + Globalize.translate('HeaderChannelAccess') + '</legend>';
html += '<legend>' + Globalize.translate('HeaderChannels') + '</legend>';
for (var i = 0, length = channels.length; i < length; i++) {
@ -39,9 +39,9 @@
var id = 'channels' + i;
var checkedAttribute = user.Policy.BlockedChannels.indexOf(folder.Id) == -1 ? ' checked="checked"' : '';
var checkedAttribute = user.Policy.EnableAllChannels || user.Policy.EnabledChannels.indexOf(folder.Id) != -1 ? ' checked="checked"' : '';
html += '<input class="chkChannel" data-foldername="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<input class="chkChannel" data-id="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>';
}
@ -54,6 +54,8 @@
} else {
$('.channelAccessContainer', page).hide();
}
$('#chkEnableAllChannels', page).checked(user.Policy.EnableAllChannels).checkboxradio('refresh').trigger('change');
}
function loadDevices(page, user, devices) {
@ -62,7 +64,7 @@
html += '<fieldset data-role="controlgroup">';
html += '<legend>' + Globalize.translate('HeaderSelectDevices') + '</legend>';
html += '<legend>' + Globalize.translate('HeaderDevices') + '</legend>';
for (var i = 0, length = devices.length; i < length; i++) {
@ -72,7 +74,7 @@
var checkedAttribute = user.Policy.EnableAllDevices || user.Policy.EnabledDevices.indexOf(device.Id) != -1 ? ' checked="checked"' : '';
html += '<input class="chkDevice" data-deviceid="' + device.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<input class="chkDevice" data-id="' + device.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + device.Name;
html += '<br/><span style="font-weight:normal;font-size: 90%;">' + device.AppName + '</span>';
@ -114,19 +116,21 @@
}).get();
user.Policy.BlockedChannels = $('.chkChannel:not(:checked)', page).map(function () {
user.Policy.EnableAllChannels = $('#chkEnableAllChannels', page).checked();
user.Policy.EnabledChannels = user.Policy.EnableAllChannels ?
[] :
$('.chkChannel:checked', page).map(function () {
return this.getAttribute('data-foldername');
return this.getAttribute('data-id');
}).get();
}).get();
user.Policy.EnableAllDevices = $('#chkEnableAllDevices', page).checked();
user.Policy.EnabledDevices = user.Policy.EnableAllDevices ?
[] :
$('.chkDevice:checked', page).map(function () {
return this.getAttribute('data-deviceid');
return this.getAttribute('data-id');
}).get();
@ -168,6 +172,16 @@
});
$('#chkEnableAllChannels', page).on('change', function () {
if (this.checked) {
$('.channelAccessListContainer', page).hide();
} else {
$('.channelAccessListContainer', page).show();
}
});
}).on('pageshow', "#userLibraryAccessPage", function () {
var page = this;

View File

@ -356,7 +356,6 @@
ConnectUsername: $('#txtConnectUsername', page).val(),
ExcludedLibraries: shareExcludes.join(','),
ExcludedChannels: channelsResult.Items.map(function (c) { return c.Id; }).join(','),
SendingUserId: Dashboard.getCurrentUserId(),
EnableLiveTv: false
}

View File

@ -24,9 +24,17 @@
<br />
<div class="channelAccessContainer" style="display:none;">
<div class="channelAccess">
<div class="ui-controlgroup-label">${HeaderChannelAccess}</div>
<div>
<label for="chkEnableAllChannels">${OptionEnableAccessToAllChannels}</label>
<input type="checkbox" id="chkEnableAllChannels" />
<div class="fieldDescription">${ChannelAccessHelp}</div>
</div>
<div class="channelAccessListContainer">
<br />
<div class="channelAccess">
</div>
</div>
<div class="fieldDescription">${ChannelAccessHelp}</div>
<br />
</div>
<br />