update translations

This commit is contained in:
Luke Pulverenti 2014-10-14 00:59:34 -04:00
parent 0910dce389
commit 101e365db4
8 changed files with 224 additions and 107 deletions

View File

@ -0,0 +1,151 @@
(function ($, window, document) {
function loadMediaFolders(page, user, mediaFolders) {
var html = '';
html += '<fieldset data-role="controlgroup">';
html += '<legend>' + Globalize.translate('HeaderMediaFolders') + '</legend>';
for (var i = 0, length = mediaFolders.length; i < length; i++) {
var folder = mediaFolders[i];
var id = 'mediaFolder' + i;
var checkedAttribute = user.Configuration.BlockedMediaFolders.indexOf(folder.Id) == -1 && user.Configuration.BlockedMediaFolders.indexOf(folder.Name) == -1 ? ' checked="checked"' : '';
html += '<input class="chkMediaFolder" data-foldername="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>';
}
html += '</fieldset>';
$('.mediaFolderAccess', page).html(html).trigger('create');
}
function loadChannels(page, user, channels) {
var html = '';
html += '<fieldset data-role="controlgroup">';
html += '<legend>' + Globalize.translate('HeaderChannels') + '</legend>';
for (var i = 0, length = channels.length; i < length; i++) {
var folder = channels[i];
var id = 'channels' + i;
var checkedAttribute = user.Configuration.BlockedChannels.indexOf(folder.Id) == -1 ? ' checked="checked"' : '';
html += '<input class="chkChannel" data-foldername="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>';
}
html += '</fieldset>';
$('.channelAccess', page).show().html(html).trigger('create');
if (channels.length) {
$('.channelAccessContainer', page).show();
} else {
$('.channelAccessContainer', page).hide();
}
}
function loadUser(page, user, loggedInUser, mediaFolders, channels) {
Dashboard.setPageTitle(user.Name);
loadChannels(page, user, channels);
loadMediaFolders(page, user, mediaFolders);
Dashboard.hideLoadingMsg();
}
function onSaveComplete(page) {
Dashboard.hideLoadingMsg();
Dashboard.alert(Globalize.translate('SettingsSaved'));
}
function saveUser(user, page) {
user.Configuration.BlockedMediaFolders = $('.chkMediaFolder:not(:checked)', page).map(function () {
return this.getAttribute('data-foldername');
}).get();
user.Configuration.BlockedChannels = $('.chkChannel:not(:checked)', page).map(function () {
return this.getAttribute('data-foldername');
}).get();
ApiClient.updateUser(user).done(function () {
onSaveComplete(page);
});
}
window.LibraryAccessPage = {
onSubmit: function () {
var page = $(this).parents('.page');
Dashboard.showLoadingMsg();
var userId = getParameterByName("userId");
ApiClient.getUser(userId).done(function (result) {
saveUser(result, page);
});
// Disable default form submission
return false;
}
};
$(document).on('pageshow', "#userLibraryAccessPage", function () {
var page = this;
Dashboard.showLoadingMsg();
var userId = getParameterByName("userId");
var promise1;
if (!userId) {
var deferred = $.Deferred();
deferred.resolveWith(null, [{
Configuration: {}
}]);
promise1 = deferred.promise();
} else {
promise1 = ApiClient.getUser(userId);
}
var promise2 = Dashboard.getCurrentUser();
var promise4 = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false }));
var promise5 = ApiClient.getJSON(ApiClient.getUrl("Channels"));
$.when(promise1, promise2, promise4, promise5).done(function (response1, response2, response4, response5) {
loadUser(page, response1[0] || response1, response2[0], response4[0].Items, response5[0].Items);
});
});
})(jQuery, window, document);

View File

@ -38,62 +38,6 @@
$('#selectMaxParentalRating', page).html(html).selectmenu("refresh");
}
function loadMediaFolders(page, user, mediaFolders) {
var html = '';
html += '<fieldset data-role="controlgroup">';
html += '<legend>' + Globalize.translate('HeaderMediaFolders') + '</legend>';
for (var i = 0, length = mediaFolders.length; i < length; i++) {
var folder = mediaFolders[i];
var id = 'mediaFolder' + i;
var checkedAttribute = user.Configuration.BlockedMediaFolders.indexOf(folder.Id) == -1 && user.Configuration.BlockedMediaFolders.indexOf(folder.Name) == -1 ? ' checked="checked"' : '';
html += '<input class="chkMediaFolder" data-foldername="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>';
}
html += '</fieldset>';
$('.mediaFolderAccess', page).html(html).trigger('create');
}
function loadChannels(page, user, channels) {
var html = '';
html += '<fieldset data-role="controlgroup">';
html += '<legend>' + Globalize.translate('HeaderChannels') + '</legend>';
for (var i = 0, length = channels.length; i < length; i++) {
var folder = channels[i];
var id = 'channels' + i;
var checkedAttribute = user.Configuration.BlockedChannels.indexOf(folder.Id) == -1 ? ' checked="checked"' : '';
html += '<input class="chkChannel" data-foldername="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>';
}
html += '</fieldset>';
$('.channelAccess', page).show().html(html).trigger('create');
if (channels.length) {
$('.channelAccessContainer', page).show();
} else {
$('.channelAccessContainer', page).hide();
}
}
function loadUnratedItems(page, user) {
var items = [
@ -132,12 +76,10 @@
$('.blockUnratedItems', page).html(html).trigger('create');
}
function loadUser(page, user, loggedInUser, allParentalRatings, mediaFolders, channels) {
function loadUser(page, user, loggedInUser, allParentalRatings) {
Dashboard.setPageTitle(user.Name);
loadChannels(page, user, channels);
loadMediaFolders(page, user, mediaFolders);
loadUnratedItems(page, user);
populateRatings(allParentalRatings, page);
@ -172,18 +114,6 @@
user.Configuration.MaxParentalRating = $('#selectMaxParentalRating', page).val() || null;
user.Configuration.BlockedMediaFolders = $('.chkMediaFolder:not(:checked)', page).map(function () {
return this.getAttribute('data-foldername');
}).get();
user.Configuration.BlockedChannels = $('.chkChannel:not(:checked)', page).map(function () {
return this.getAttribute('data-foldername');
}).get();
user.Configuration.BlockUnratedItems = $('.chkUnratedItem:checked', page).map(function () {
return this.getAttribute('data-itemtype');
@ -242,13 +172,9 @@
var promise3 = ApiClient.getParentalRatings();
var promise4 = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false }));
$.when(promise1, promise2, promise3).done(function (response1, response2, response3) {
var promise5 = ApiClient.getJSON(ApiClient.getUrl("Channels"));
$.when(promise1, promise2, promise3, promise4, promise5).done(function (response1, response2, response3, response4, response5) {
loadUser(page, response1[0] || response1, response2[0], response3[0], response4[0].Items, response5[0].Items);
loadUser(page, response1[0] || response1, response2[0], response3[0]);
});
});

View File

@ -57,7 +57,7 @@
});
}
function getUserHtml(user) {
function getUserHtml(user, addConnectIndicator) {
var html = '';
@ -93,7 +93,7 @@
html += '<div class="cardImage" style="background-image:url(\'' + imgUrl + '\');">';
if (user.ConnectUserId) {
if (user.ConnectUserId && addConnectIndicator) {
html += '<div class="playedIndicator" title="' + Globalize.translate('TooltipLinkedToMediaBrowserConnect') + '"><div class="ui-icon-cloud ui-btn-icon-notext"></div></div>';
}
@ -128,18 +128,22 @@
return html;
}
function getUserSectionHtml(users) {
function getUserSectionHtml(users, addConnectIndicator) {
var html = '';
html += users.map(getUserHtml).join('');
html += users.map(function (u) {
return getUserHtml(u, addConnectIndicator);
}).join('');
return html;
}
function renderUsersIntoElement(elem, users) {
function renderUsersIntoElement(elem, users, addConnectIndicator) {
var html = getUserSectionHtml(users);
var html = getUserSectionHtml(users, addConnectIndicator);
elem.html(html).trigger('create');
@ -152,7 +156,7 @@
renderUsersIntoElement($('.localUsers', page), users.filter(function (u) {
return u.ConnectLinkType != 'Guest';
}));
}), true);
renderUsersIntoElement($('.connectUsers', page), users.filter(function (u) {
return u.ConnectLinkType == 'Guest';

View File

@ -12,7 +12,8 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" id="userProfileNavigation" style="display: none;" data-mini="true">
<a href="#" data-role="button" class="ui-btn-active">${TabProfile}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">${TabImage}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);" id="lnkParentalControl" style="display: none;">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
</div>
<p class="lnkEditUserPreferencesContainer">
@ -32,7 +33,7 @@
<div>${LabelConnectUserNameHelp}</div>
<div style="margin-top: .75em;"><a href="http://mediabrowser.tv/connect" target="_blank">${ButtonLearnMoreAboutMediaBrowserConnect}</a></div>
</div>
<br/>
<br />
</li>
<li id="fldIsAdmin" style="display: none;">
<input type="checkbox" id="chkIsAdmin" name="chkIsAdmin" />

View File

@ -11,7 +11,8 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" onclick="Dashboard.navigate('useredit.html', true);" data-role="button">${TabProfile}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabImage}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);" id="lnkParentalControl" style="display: none;">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
</div>
<div class="readOnlyContent">

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="userLibraryAccessPage" data-role="page" class="page type-interior userProfilesPage">
<div data-role="content">
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">${TabImage}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);" class="ui-btn-active">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
</div>
<form class="userLibraryAccessForm">
<div>
<div class="mediaFolderAccess">
</div>
<div class="fieldDescription">${LibraryAccessHelp}</div>
</div>
<br />
<div class="channelAccessContainer">
<div class="channelAccess">
</div>
<div class="fieldDescription">${ChannelAccessHelp}</div>
<br />
</div>
<br />
<ul data-role="listview" class="ulForm">
<li>
<button type="submit" data-theme="b" data-icon="check">
${ButtonSave}
</button>
</li>
</ul>
</form>
</div>
</div>
<script type="text/javascript">
$('.userLibraryAccessForm').off('submit', LibraryAccessPage.onSubmit).on('submit', LibraryAccessPage.onSubmit);
</script>
</div>
</body>
</html>

View File

@ -11,25 +11,12 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">${TabImage}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" class="ui-btn-active">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" class="ui-btn-active">${TabParentalControl}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
</div>
<form class="userParentalControlForm">
<div>
<div class="mediaFolderAccess">
</div>
<div class="fieldDescription">${LibraryAccessHelp}</div>
</div>
<br />
<div class="channelAccessContainer">
<div class="channelAccess">
</div>
<div class="fieldDescription">${ChannelAccessHelp}</div>
<br />
</div>
<br />
<ul data-role="listview" class="ulForm">
<li>
<label for="selectMaxParentalRating">${LabelMaxParentalRating}</label>
@ -49,9 +36,6 @@
<button type="submit" data-theme="b" data-icon="check">
${ButtonSave}
</button>
<a data-role="button" href="userprofiles.html" data-icon="delete" style="text-align:center;">
${ButtonCancel}
</a>
</li>
</ul>
</form>

View File

@ -11,12 +11,13 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" onclick="Dashboard.navigate('useredit.html', true);" data-role="button">${TabProfile}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">${TabImage}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);" id="lnkParentalControl" style="display: none;">${TabLibraryAccess}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabPassword}</a>
</div>
<div class="readOnlyContent">
<div data-role="collapsible" data-collapsed="false" class="passwordSection" style="display:none;">
<div data-role="collapsible" data-collapsed="false" class="passwordSection" style="display:none;margin-bottom: 2em;">
<h2>${HeaderPassword}</h2>
<div>
<br />