Skip to content

Commit

Permalink
move recording editor to popup
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed May 10, 2016
1 parent 71b5617 commit 083535a
Show file tree
Hide file tree
Showing 22 changed files with 349 additions and 264 deletions.
2 changes: 1 addition & 1 deletion MediaBrowser.Dlna/Ssdp/SsdpHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ private void NotifyDevice(UpnpDevice dev, string type, bool logMessage)

var msg = new SsdpMessageBuilder().BuildMessage(header, values);

SendDatagram(msg, _ssdpEndp, new IPEndPoint(dev.Address, 0), true, 1);
SendDatagram(msg, _ssdpEndp, new IPEndPoint(dev.Address, 0), true, 2);
//SendUnicastRequest(msg, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IDbCommand cmd)

if (EnableJoinUserData(query))
{
whereClauses.Add("UserId=@UserId");
whereClauses.Add("(UserId is null or UserId=@UserId)");
}
if (query.IsCurrentSchema.HasValue)
{
Expand Down Expand Up @@ -2363,27 +2363,38 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IDbCommand cmd)
{
if (query.IsFavoriteOrLiked.Value)
{
whereClauses.Add("(IsFavorite=@IsFavoriteOrLiked or rating>=@UserRatingIsFavoriteOrLiked)");
cmd.Parameters.Add(cmd, "@IsFavoriteOrLiked", DbType.Boolean).Value = true;
cmd.Parameters.Add(cmd, "@UserRatingIsFavoriteOrLiked", DbType.Double).Value = UserItemData.MinLikeValue;
whereClauses.Add("IsFavorite=@IsFavoriteOrLiked");
}
else
{
whereClauses.Add("(IsFavorite=@IsFavoriteOrLiked or rating is null or rating<@UserRatingIsFavoriteOrLiked)");
cmd.Parameters.Add(cmd, "@IsFavoriteOrLiked", DbType.Boolean).Value = false;
cmd.Parameters.Add(cmd, "@UserRatingIsFavoriteOrLiked", DbType.Double).Value = UserItemData.MinLikeValue;
whereClauses.Add("(IsFavorite is null or IsFavorite=@IsFavoriteOrLiked)");
}
cmd.Parameters.Add(cmd, "@IsFavoriteOrLiked", DbType.Boolean).Value = query.IsFavoriteOrLiked.Value;
}

if (query.IsFavorite.HasValue)
{
whereClauses.Add("IsFavorite=@IsFavorite");
if (query.IsFavorite.Value)
{
whereClauses.Add("IsFavorite=@IsFavorite");
}
else
{
whereClauses.Add("(IsFavorite is null or IsFavorite=@IsFavorite)");
}
cmd.Parameters.Add(cmd, "@IsFavorite", DbType.Boolean).Value = query.IsFavorite.Value;
}

if (query.IsPlayed.HasValue)
{
whereClauses.Add("played=@IsPlayed");
if (query.IsPlayed.Value)
{
whereClauses.Add("(played=@IsPlayed)");
}
else
{
whereClauses.Add("(played is null or played=@IsPlayed)");
}
cmd.Parameters.Add(cmd, "@IsPlayed", DbType.Boolean).Value = query.IsPlayed.Value;
}

Expand Down
12 changes: 6 additions & 6 deletions MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@
<Content Include="dashboard-ui\components\recordingcreator\recordingcreator.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\recordingeditor\recordingeditor.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\recordingeditor\recordingeditor.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\remotecontrol.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -959,9 +965,6 @@
<Content Include="dashboard-ui\scripts\livetvchannel.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\livetvtimer.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\livetvrecordinglist.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand All @@ -974,9 +977,6 @@
<Content Include="dashboard-ui\scripts\livetvstatus.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\livetvtimer.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\editorsidebar.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<g id="notifications-off"><path d="M11.5 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zM18 10.5c0-3.07-2.13-5.64-5-6.32V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v.68c-.51.12-.99.32-1.45.56L18 14.18V10.5zm-.27 8.5l2 2L21 19.73 4.27 3 3 4.27l2.92 2.92C5.34 8.16 5 9.29 5 10.5V16l-2 2v1h14.73z" /></g>
<g id="expand-less"><path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" /></g>
<g id="expand-more"><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" /></g>
<g id="fiber-smart-record"><g><circle cx="9" cy="12" r="8" /><path d="M17 4.26v2.09c2.33.82 4 3.04 4 5.65s-1.67 4.83-4 5.65v2.09c3.45-.89 6-4.01 6-7.74s-2.55-6.85-6-7.74z" /></g></g>
</defs>
</svg>
</iron-iconset-svg>
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.2.67",
"_release": "1.2.67",
"version": "1.2.70",
"_release": "1.2.70",
"_resolution": {
"type": "version",
"tag": "1.2.67",
"commit": "47093f0f441935b5ccc02999f1981e2e274fb1dc"
"tag": "1.2.70",
"commit": "da1751d5ebd43e4681ef9a0834e08d094505e725"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,7 @@
// The dialog may have just been created and webComponents may not have completed initialiazation yet.
// Without this, seeing some script errors in Firefox

var delay = browser.animate ? 0 : 500;
if (!delay) {
focusManager.autoFocus(dlg);
return;
}
var delay = browser.animate ? 200 : 500;

setTimeout(function () {
focusManager.autoFocus(dlg);
Expand Down Expand Up @@ -266,7 +262,7 @@

function animateDialogOpen(dlg) {

var onAnimationFinish = function() {
var onAnimationFinish = function () {
};

if (!dlg.animationConfig || !dlg.animate) {
Expand Down Expand Up @@ -324,8 +320,12 @@
// Also not working well in samsung tizen browser, content inside not clickable
if (!dlg.showModal || browser.tv) {
dlg = document.createElement('div');
} else {
// Just go ahead and always use a plain div because we're seeing issues overlaying absoltutely positioned content over a modal dialog
dlg = document.createElement('div');
}

dlg.classList.add('focuscontainer');
dlg.classList.add('hide');

if (shouldLockDocumentScroll(options)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define([], function () {
function focus(element) {

var tagName = element.tagName;
if (tagName == 'PAPER-INPUT' || tagName == 'PAPER-DROPDOWN-MENU' || tagName == 'EMBY-DROPDOWN-MENU') {
if (tagName == 'PAPER-INPUT' || tagName == 'EMBY-DROPDOWN-MENU') {
element = element.querySelector('input') || element;
}

Expand All @@ -32,8 +32,8 @@ define([], function () {
}
}

var focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A', 'PAPER-BUTTON', 'PAPER-INPUT', 'PAPER-TEXTAREA', 'PAPER-ICON-BUTTON', 'PAPER-FAB', 'PAPER-CHECKBOX', 'PAPER-ICON-ITEM', 'PAPER-MENU-ITEM', 'PAPER-DROPDOWN-MENU', 'EMBY-DROPDOWN-MENU'];
var focusableContainerTagNames = ['BODY', 'PAPER-DIALOG', 'DIALOG'];
var focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A', 'PAPER-BUTTON', 'PAPER-INPUT', 'PAPER-TEXTAREA', 'PAPER-FAB', 'PAPER-CHECKBOX', 'PAPER-ICON-ITEM', 'PAPER-MENU-ITEM', 'EMBY-DROPDOWN-MENU'];
var focusableContainerTagNames = ['BODY', 'DIALOG'];
var focusableQuery = focusableTagNames.join(',') + ',.focusable';

function isFocusable(elem) {
Expand Down Expand Up @@ -102,6 +102,9 @@ define([], function () {
if (focusableContainerTagNames.indexOf(elem.tagName) != -1) {
return true;
}
if (elem.classList.contains('focuscontainer')) {
return true;
}

if (direction < 2) {
if (elem.classList.contains('focuscontainer-x')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-resizable-behavior",
"homepage": "https://github.com/PolymerElements/iron-resizable-behavior",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "dda1df6aaf452aedf3e52ff0cf69e72439452216"
},
"_source": "git://github.com/polymerelements/iron-resizable-behavior.git",
"_source": "git://github.com/PolymerElements/iron-resizable-behavior.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-resizable-behavior"
"_originalSource": "PolymerElements/iron-resizable-behavior"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514"
},
"_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.1.0",
"_target": "^1.0.0",
"_originalSource": "Polymer/polymer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
define(['dialogHelper', 'loading', 'jQuery', 'paper-checkbox', 'paper-input', 'emby-collapsible', 'paper-button', 'paper-icon-button-light'], function (dialogHelper, loading, $) {

var currentDialog;
var recordingUpdated = false;
var currentItemId;

function renderTimer(context, item) {

var programInfo = item.ProgramInfo || {};

$('.itemName', context).html(item.Name);

$('.itemEpisodeName', context).html(programInfo.EpisodeTitle || '');

$('.itemCommunityRating', context).html(LibraryBrowser.getRatingHtml(programInfo));

LibraryBrowser.renderGenres($('.itemGenres', context), programInfo);
LibraryBrowser.renderOverview(context.querySelectorAll('.itemOverview'), programInfo);

if (programInfo.ImageTags && programInfo.ImageTags.Primary) {

var imgUrl = ApiClient.getScaledImageUrl(programInfo.Id, {
maxWidth: 200,
maxHeight: 200,
tag: programInfo.ImageTags.Primary,
type: "Primary"
});

$('.timerPageImageContainer', context).css("display", "inline-block")
.html('<img src="' + imgUrl + '" style="max-width:200px;max-height:200px;" />');

} else {
$('.timerPageImageContainer', context).hide();
}

$('.itemMiscInfo', context).html(LibraryBrowser.getMiscInfoHtml(programInfo));

$('#txtPrePaddingMinutes', context).val(item.PrePaddingSeconds / 60);
$('#txtPostPaddingMinutes', context).val(item.PostPaddingSeconds / 60);

if (item.Status == 'New') {
$('.timerStatus', context).hide();
} else {
$('.timerStatus', context).show().html('Status:&nbsp;&nbsp;&nbsp;' + item.Status);
}

loading.hide();
}

function closeDialog(isSubmitted) {

recordingUpdated = isSubmitted;
dialogHelper.close(currentDialog);
}

function onSubmit(e) {

loading.show();

var form = this;

ApiClient.getLiveTvTimer(currentItemId).then(function (item) {

item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
ApiClient.updateLiveTvTimer(item).then(function () {
loading.hide();
require(['toast'], function (toast) {
toast(Globalize.translate('MessageRecordingSaved'));
closeDialog(true);
});
});
});

e.preventDefault();

// Disable default form submission
return false;
}

function init(context) {

context.querySelector('.btnCancel').addEventListener('click', function () {

closeDialog(false);
});

context.querySelector('form').addEventListener('submit', onSubmit);

context.querySelector('.btnHeaderSave').addEventListener('click', function (e) {

context.querySelector('.btnSave').click();
});
}

function reload(context, id) {

loading.show();
currentItemId = id;

ApiClient.getLiveTvTimer(id).then(function (result) {

renderTimer(context, result);
loading.hide();
});
}

function showEditor(itemId) {

return new Promise(function (resolve, reject) {

recordingUpdated = false;
loading.show();

var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/recordingeditor/recordingeditor.template.html', true);

xhr.onload = function (e) {

var template = this.response;
var dlg = dialogHelper.createDialog({
removeOnClose: true,
size: 'small'
});

dlg.classList.add('ui-body-b');
dlg.classList.add('background-theme-b');

dlg.classList.add('formDialog');

var html = '';

html += Globalize.translateDocument(template);

dlg.innerHTML = html;
document.body.appendChild(dlg);

dialogHelper.open(dlg);

currentDialog = dlg;

dlg.addEventListener('close', function () {

if (recordingUpdated) {
resolve();
} else {
reject();
}
});

init(dlg);

reload(dlg, itemId);
}

xhr.send();
});
}

return {
show: showEditor
};
});
Loading

0 comments on commit 083535a

Please sign in to comment.