diff --git a/dashboard-ui/dlnaprofile.html b/dashboard-ui/dlnaprofile.html index 3936921353..a8eeb735d4 100644 --- a/dashboard-ui/dlnaprofile.html +++ b/dashboard-ui/dlnaprofile.html @@ -155,8 +155,57 @@ + diff --git a/dashboard-ui/scripts/dlnaprofile.js b/dashboard-ui/scripts/dlnaprofile.js index 8ad0194575..e6280d63d0 100644 --- a/dashboard-ui/scripts/dlnaprofile.js +++ b/dashboard-ui/scripts/dlnaprofile.js @@ -2,6 +2,9 @@ var currentProfile; + var currentSubProfile; + var isSubProfileNew; + function loadProfile(page) { Dashboard.showLoadingMsg(); @@ -60,6 +63,11 @@ profile.CodecProfiles = (profile.CodecProfiles || []); profile.MediaProfiles = (profile.MediaProfiles || []); + renderSubProfiles(page, profile); + } + + function renderSubProfiles(page, profile) { + renderDirectPlayProfiles(page, profile.DirectPlayProfiles); renderTranscodingProfiles(page, profile.TranscodingProfiles); renderContainerProfiles(page, profile.ContainerProfiles); @@ -67,6 +75,38 @@ renderMediaProfiles(page, profile.MediaProfiles); } + function editDirectPlayProfile(page, directPlayProfile, isNew) { + + currentSubProfile = directPlayProfile; + isSubProfileNew = isNew; + + var popup = $('#popupEditDirectPlayProfile', page).popup('open'); + + $('#selectDirectPlayProfileType', popup).val(directPlayProfile.Type || 'Video').selectmenu('refresh').trigger('change'); + $('#txtDirectPlayContainer', popup).val(directPlayProfile.Container || ''); + $('#txtDirectPlayAudioCodec', popup).val(directPlayProfile.AudioCodec || ''); + $('#txtDirectPlayVideoCodec', popup).val(directPlayProfile.VideoCodec || ''); + } + + function saveDirectPlayProfile(page) { + + currentSubProfile.Type = $('#selectDirectPlayProfileType', page).val(); + currentSubProfile.Container = $('#txtDirectPlayContainer', page).val(); + currentSubProfile.AudioCodec = $('#txtDirectPlayAudioCodec', page).val(); + currentSubProfile.VideoCodec = $('#txtDirectPlayVideoCodec', page).val(); + + if (isSubProfileNew) { + + currentProfile.DirectPlayProfiles.push(currentSubProfile); + } + + renderSubProfiles(page, currentProfile); + + currentSubProfile = null; + + $('#popupEditDirectPlayProfile', page).popup('close'); + } + function renderDirectPlayProfiles(page, profiles) { var html = ''; @@ -86,7 +126,7 @@ } html += '
  • '; - html += ''; + html += ''; html += '

    Container: ' + (profile.Container || 'All') + '

    '; @@ -101,7 +141,7 @@ html += '
    '; - html += 'Delete'; + html += 'Delete'; html += '
  • '; } @@ -112,9 +152,16 @@ $('.btnDeleteProfile', elem).on('click', function () { - var index = this.getAttribute('data-profileIndex'); + var index = this.getAttribute('data-profileindex'); deleteDirectPlayProfile(page, index); }); + + $('.lnkEditSubProfile', elem).on('click', function () { + + var index = parseInt(this.getAttribute('data-profileindex')); + + editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]); + }); } function deleteDirectPlayProfile(page, index) { @@ -160,7 +207,7 @@ html += ''; - html += 'Delete'; + html += 'Delete'; html += ''; } @@ -171,7 +218,7 @@ $('.btnDeleteProfile', elem).on('click', function () { - var index = this.getAttribute('data-profileIndex'); + var index = this.getAttribute('data-profileindex'); deleteTranscodingProfile(page, index); }); } @@ -218,7 +265,7 @@ html += ''; - html += 'Delete'; + html += 'Delete'; html += ''; } @@ -229,7 +276,7 @@ $('.btnDeleteProfile', elem).on('click', function () { - var index = this.getAttribute('data-profileIndex'); + var index = this.getAttribute('data-profileindex'); deleteContainerProfile(page, index); }); } @@ -278,7 +325,7 @@ html += ''; - html += 'Delete'; + html += 'Delete'; html += ''; } @@ -289,7 +336,7 @@ $('.btnDeleteProfile', elem).on('click', function () { - var index = this.getAttribute('data-profileIndex'); + var index = this.getAttribute('data-profileindex'); deleteCodecProfile(page, index); }); } @@ -345,7 +392,7 @@ html += ''; - html += 'Delete'; + html += 'Delete'; html += ''; } @@ -356,7 +403,7 @@ $('.btnDeleteProfile', elem).on('click', function () { - var index = this.getAttribute('data-profileIndex'); + var index = this.getAttribute('data-profileindex'); deleteMediaProfile(page, index); }); } @@ -440,6 +487,22 @@ }); + $('#selectDirectPlayProfileType', page).on('change', function () { + + if (this.value == 'Video') { + $('#fldDirectPlayVideoCodec', page).show(); + } else { + $('#fldDirectPlayVideoCodec', page).hide(); + } + + if (this.value == 'Photo') { + $('#fldDirectPlayAudioCodec', page).hide(); + } else { + $('#fldDirectPlayAudioCodec', page).show(); + } + + }); + }).on('pageshow', "#dlnaProfilePage", function () { var page = this; @@ -466,6 +529,16 @@ saveProfile(page, currentProfile); + return false; + }, + + onDirectPlayFormSubmit: function () { + + var form = this; + var page = $(form).parents('.page'); + + saveDirectPlayProfile(page); + return false; } };