dlna server fixes

This commit is contained in:
Luke Pulverenti 2014-04-20 01:21:08 -04:00
parent 33ea7f3a39
commit 4cee826e91
9 changed files with 172 additions and 35 deletions

View File

@ -10,7 +10,8 @@
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="dlnasettings.html" data-role="button">${TabSettings}</a>
<a href="dlnasettings.html" data-role="button">${TabPlayTo}</a>
<a href="dlnaserversettings.html" data-role="button">${TabServer}</a>
<a href="dlnaprofiles.html" data-role="button" class="ui-btn-active">${TabProfiles}</a>
</div>
@ -43,6 +44,14 @@
</li>
</ul>
<ul data-role="listview" class="ulForm">
<li>
<label for="selectUser">User library:</label>
<select id="selectUser" data-mini="true"></select>
<div class="fieldDescription">Select which user library to display to the device. Leave empty to inherit the default setting.</div>
</li>
</ul>
<fieldset data-role="controlgroup">
<legend>Supported Media Types:</legend>
<input type="checkbox" data-mini="true" id="chkAudio" data-value="Audio" class="chkMediaType" />
@ -67,7 +76,7 @@
</div>
<div class="tabContent tabIdentification">
<p>Devices have two forms of identification, device properties and HTTP request headers. At least one form should be supplied.</p>
<p>Enter at least one identification criteria.</p>
<br />
<ul data-role="listview" class="ulForm">
<li>
@ -152,7 +161,7 @@
<br />
<ul data-role="listview" class="ulForm">
<li>
<button class="btnSave" style="display: none;" type="submit" data-theme="b" data-icon="check" data-mini="true">
<button class="btnSave" type="submit" data-theme="b" data-icon="check" data-mini="true">
Save
</button>
<button type="button" onclick="Dashboard.navigate('dlnaprofiles.html');" data-icon="delete" data-mini="true">
@ -302,7 +311,7 @@
<p>Define additional conditions that must be met in order for a file to be direct played.</p>
<!-- <div data-role="controlgroup" data-type="horizontal" data-mini="true">
<!-- <div data-role="controlgroup" data-type="horizontal" data-mini="true">
<input type="radio" name="radioContainerProfileTab" class="radioTabButton" id="radioContainerProfileInfo" value="tabContainerBasics">
<label for="radioContainerProfileInfo">Info</label>
<input type="radio" name="radioContainerProfileTab" class="radioTabButton" id="radioContainerProfileConditions" value="tabContainerConditions">
@ -327,7 +336,6 @@
</div>
<div class="tabContent tabContainerConditions" style="display: none;">
</div>
<p>

View File

@ -10,7 +10,8 @@
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="dlnasettings.html" data-role="button">${TabSettings}</a>
<a href="dlnasettings.html" data-role="button">${TabPlayTo}</a>
<a href="dlnaserversettings.html" data-role="button">${TabServer}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabProfiles}</a>
</div>

View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<title>DLNA</title>
</head>
<body>
<div id="dlnaServerSettingsPage" data-role="page" class="page type-interior adminPage dlnaPage">
<div data-role="content">
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="dlnasettings.html" data-role="button">${TabPlayTo}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabServer}</a>
<a href="dlnaprofiles.html" data-role="button">${TabProfiles}</a>
</div>
<form class="dlnaServerSettingsForm">
<ul data-role="listview" class="ulForm">
<li>
<label for="chkEnableServer">${LabelEnableDlnaServer}</label>
<input type="checkbox" id="chkEnableServer" data-mini="true" />
<div class="fieldDescription">${LabelEnableDlnaServerHelp}</div>
</li>
<li>
<label for="chkBlastAliveMessages">${LabelEnableBlastAliveMessages}</label>
<input type="checkbox" id="chkBlastAliveMessages" data-mini="true" />
<div class="fieldDescription">${LabelEnableBlastAliveMessagesHelp}</div>
</li>
<li>
<label for="txtBlastInterval">${LabelBlastMessageInterval}</label>
<input type="number" id="txtBlastInterval" data-mini="true" min="1" max="300" />
<div class="fieldDescription">${LabelBlastMessageIntervalHelp}</div>
</li>
<li>
<label for="selectUser">${LabelDefaultUser}</label>
<select id="selectUser" data-mini="true"></select>
<div class="fieldDescription">${LabelDefaultUserHelp}</div>
</li>
</ul>
<ul data-role="listview" class="ulForm">
<li>
<button type="submit" data-theme="b" data-icon="check">
${ButtonSave}
</button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete">
${ButtonCancel}
</button>
</li>
</ul>
</form>
</div>
</div>
<script type="text/javascript">
$('.dlnaServerSettingsForm').off('submit', DlnaServerSettingsPage.onSubmit).on('submit', DlnaServerSettingsPage.onSubmit);
</script>
</div>
</body>
</html>

View File

@ -10,7 +10,8 @@
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" class="ui-btn-active">${TabSettings}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabPlayTo}</a>
<a href="dlnaserversettings.html" data-role="button">${TabServer}</a>
<a href="dlnaprofiles.html" data-role="button">${TabProfiles}</a>
</div>
@ -32,6 +33,8 @@
<input type="number" id="txtClientDiscoveryInterval" data-mini="true" min="1" max="300" />
<div class="fieldDescription">${LabelEnableDlnaClientDiscoveryIntervalHelp}</div>
</li>
</ul>
<ul data-role="listview" class="ulForm">
<li>
<button type="submit" data-theme="b" data-icon="check">
${ButtonSave}
@ -41,7 +44,6 @@
</button>
</li>
</ul>
</form>
</div>

View File

@ -9,13 +9,17 @@
Dashboard.showLoadingMsg();
getProfile().done(function (result) {
var promise1 = getProfile();
var promise2 = ApiClient.getUsers();
currentProfile = result;
$.when(promise1, promise2).done(function (response1, response2) {
renderProfile(page, result);
currentProfile = response1[0];
renderProfile(page, currentProfile, response2[0]);
Dashboard.hideLoadingMsg();
});
}
@ -28,13 +32,7 @@
return $.getJSON(ApiClient.getUrl(url));
}
function renderProfile(page, profile) {
if (profile.ProfileType == 'User' || !profile.Id) {
$('.btnSave', page).show();
} else {
$('.btnSave', page).hide();
}
function renderProfile(page, profile, users) {
$('#txtName', page).val(profile.Name);
@ -62,6 +60,11 @@
profile.ContainerProfiles = (profile.ContainerProfiles || []);
profile.CodecProfiles = (profile.CodecProfiles || []);
profile.ResponseProfiles = (profile.ResponseProfiles || []);
var usersHtml = '<option></option>' + users.map(function (u) {
return '<option value="' + u.Id + '">' + u.Name + '</option>';
}).join('');
$('#selectUser', page).html(usersHtml).val(profile.UserId || '').selectmenu("refresh");
renderSubProfiles(page, profile);
}
@ -646,6 +649,8 @@
profile.Identification.ManufacturerUrl = $('#txtIdManufacturerUrl', page).val();
profile.Identification.SerialNumber = $('#txtIdSerialNumber', page).val();
profile.Identification.DeviceDescription = $('#txtIdDeviceDescription', page).val();
profile.UserId = $('#selectUser', page).val();
}
$(document).on('pageinit', "#dlnaProfilePage", function () {

View File

@ -0,0 +1,59 @@
(function ($, document, window) {
function loadPage(page, config, users) {
$('#chkEnableServer', page).checked(config.DlnaOptions.EnableServer).checkboxradio("refresh");
$('#chkBlastAliveMessages', page).checked(config.DlnaOptions.BlastAliveMessages).checkboxradio("refresh");
$('#txtBlastInterval', page).val(config.DlnaOptions.BlastAliveMessageIntervalSeconds);
var usersHtml = users.map(function (u) {
return '<option value="' + u.Id + '">' + u.Name + '</option>';
}).join('');
$('#selectUser', page).html(usersHtml).val(config.DlnaOptions.DefaultUserId || '').selectmenu("refresh");
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#dlnaServerSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getServerConfiguration();
var promise2 = ApiClient.getUsers();
$.when(promise1, promise2).done(function (response1, response2) {
loadPage(page, response1[0], response2[0]);
});
});
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.DlnaOptions.EnableServer = $('#chkEnableServer', form).checked();
config.DlnaOptions.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked();
config.DlnaOptions.BlastAliveMessageIntervalSeconds = $('#txtBlastInterval', form).val();
config.DlnaOptions.DefaultUserId = $('#selectUser', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
window.DlnaServerSettingsPage = {
onSubmit: onSubmit
};
})(jQuery, document, window);

View File

@ -16,7 +16,7 @@
html += '<a class="desktopHomeLink" href="index.html"><img src="css/images/mblogoicon.png" /></a>';
html += '<a class="viewMenuRemoteControlButton" href="nowplaying.html" data-role="button" data-icon="wireless" data-inline="true" data-iconpos="notext" title="Now Playing">Remote Control</a>';
html += '<a class="viewMenuRemoteControlButton" href="nowplaying.html" data-role="button" data-icon="play" data-inline="true" data-iconpos="notext" title="Now Playing">Remote Control</a>';
if (user.Configuration.IsAdministrator) {
html += '<a class="editorMenuLink" href="edititemmetadata.html" data-role="button" data-icon="edit" data-inline="true" data-iconpos="notext" title="Metadata Manager">Metadata Manager</a>';

View File

@ -499,7 +499,7 @@ var Dashboard = {
html += '<p><label for="chkEnableThemeSongs">Play theme songs</label><input onchange="ThemeSongManager.enabled(this.checked);" type="checkbox" id="chkEnableThemeSongs" data-mini="true" /></a>';
html += '<p><a data-mini="true" data-role="button" href="useredit.html?userId=' + user.Id + '" data-icon="user">Preferences</button></a>';
html += '<p><a data-mini="true" data-role="button" href="usersettings.html?userId=' + user.Id + '" data-icon="user">Preferences</button></a>';
html += '<p><button data-mini="true" type="button" onclick="Dashboard.logout();" data-icon="lock">Sign Out</button></p>';
html += '</form>';

View File

@ -16,35 +16,35 @@
<a href="#" data-role="button" class="ui-btn-active">${TabPreferences}</a>
</div>
<form id="userSettingsForm">
<ul data-role="listview" class="ulForm">
<li>
<input type="checkbox" id="chkDisplayMissingEpisodes" name="chkDisplayMissingEpisodes" />
<label for="chkDisplayMissingEpisodes">${LabelDisplayMissingEpisodesWithinSeasons}</label>
</li>
<li>
<input type="checkbox" id="chkDisplayUnairedEpisodes" name="chkDisplayUnairedEpisodes" />
<label for="chkDisplayUnairedEpisodes">${LabelUnairedMissingEpisodesWithinSeasons}</label>
</li>
</ul>
<h2>${HeaderDisplaySettings}</h2>
<div>
<input type="checkbox" id="chkDisplayMissingEpisodes" data-mini="true" />
<label for="chkDisplayMissingEpisodes">${LabelDisplayMissingEpisodesWithinSeasons}</label>
</div>
<div>
<input type="checkbox" id="chkDisplayUnairedEpisodes" data-mini="true" />
<label for="chkDisplayUnairedEpisodes">${LabelUnairedMissingEpisodesWithinSeasons}</label>
</div>
<br />
<h2>${HeaderVideoPlaybackSettings}</h2>
<ul data-role="listview" class="ulForm">
<li>
<label for="selectAudioLanguage">${LabelAudioLanguagePreference}</label>
<select name="selectAudioLanguage" id="selectAudioLanguage"></select>
<select id="selectAudioLanguage" data-mini="true"></select>
</li>
<li>
<label for="selectSubtitleLanguage">${LabelSubtitleLanguagePreference}</label>
<select name="selectSubtitleLanguage" id="selectSubtitleLanguage"></select>
<select id="selectSubtitleLanguage" data-mini="true"></select>
</li>
<li>
<input type="checkbox" id="chkForcedSubtitlesOnly" name="chkForcedSubtitlesOnly" />
<input type="checkbox" id="chkForcedSubtitlesOnly" data-mini="true" />
<label for="chkForcedSubtitlesOnly">${LabelDisplayForcedSubtitlesOnly}</label>
</li>
<li>
<button type="submit" data-theme="b" data-icon="check">
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
${ButtonOk}
</button>
<button type="button" onclick="history.back();" data-icon="delete">
<button type="button" onclick="history.back();" data-icon="delete" data-mini="true">
${ButtonCancel}
</button>
</li>