1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add new notification features

This commit is contained in:
Luke Pulverenti 2014-04-26 23:42:05 -04:00
parent b94fa3f72c
commit 28ea06a627
9 changed files with 320 additions and 812 deletions

View file

@ -2,44 +2,50 @@
function reload(page) {
ApiClient.getServerConfiguration().done(function (config) {
Dashboard.showLoadingMsg();
var notificationOptions = config.NotificationOptions;
$('#chkNewLibraryContent', page).checked(notificationOptions.SendOnNewLibraryContent).checkboxradio('refresh');
$('#chkFailedTasks', page).checked(notificationOptions.SendOnFailedTasks).checkboxradio('refresh');
$('#chkUpdates', page).checked(notificationOptions.SendOnUpdates).checkboxradio('refresh');
$('#chkServerRestartRequired', page).checked(notificationOptions.SendOnServerRestartRequired).checkboxradio('refresh');
$.getJSON(ApiClient.getUrl("Notifications/Types")).done(function (list) {
$('#chkVideoPlayback', page).checked(notificationOptions.SendOnVideoPlayback).checkboxradio('refresh');
$('#chkAudioPlayback', page).checked(notificationOptions.SendOnAudioPlayback).checkboxradio('refresh');
$('#chkGamePlayback', page).checked(notificationOptions.SendOnGamePlayback).checkboxradio('refresh');
var html = '<ul data-role="listview" data-inset="true">';
var lastCategory = "";
html += list.map(function (i) {
var itemHtml = '';
if (i.Category != lastCategory) {
lastCategory = i.Category;
itemHtml += '<li data-role="list-divider">';
itemHtml += i.Category;
itemHtml += '</li>';
}
itemHtml += '<li>';
itemHtml += '<a href="notificationsetting.html?type=' + i.Type + '">';
itemHtml += '<h3>' + i.Name + '</h3>';
if (i.Enabled) {
itemHtml += '<p style="color:#009F00;">Enabled</p>';
} else {
itemHtml += '<p style="color:#cc0000;">Disabled</p>';
}
itemHtml += '</a>';
itemHtml += '</li>';
return itemHtml;
}).join('');
html += '</ul>';
$('.notificationList', page).html(html).trigger('create');
Dashboard.hideLoadingMsg();
});
}
function save(page) {
ApiClient.getServerConfiguration().done(function (config) {
var notificationOptions = config.NotificationOptions;
notificationOptions.SendOnNewLibraryContent = $('#chkNewLibraryContent', page).checked();
notificationOptions.SendOnFailedTasks = $('#chkFailedTasks', page).checked();
notificationOptions.SendOnUpdates = $('#chkUpdates', page).checked();
notificationOptions.SendOnServerRestartRequired = $('#chkServerRestartRequired', page).checked();
notificationOptions.SendOnVideoPlayback = $('#chkVideoPlayback', page).checked();
notificationOptions.SendOnAudioPlayback = $('#chkAudioPlayback', page).checked();
notificationOptions.SendOnGamePlayback = $('#chkGamePlayback', page).checked();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
}
$(document).on('pageshow', "#notificationSettingsPage", function () {
var page = this;
@ -47,14 +53,4 @@
reload(page);
});
window.NotificationSettingsPage = {
onSubmit: function () {
var page = $(this).parents('.page');
save(page);
return false;
}
};
})(jQuery, window);