From 7751d4f2a0ec2985bfdf4edd20a9b653d37a1d05 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 25 Apr 2014 16:47:56 -0400 Subject: [PATCH] add new notification options --- dashboard-ui/advanced.html | 3 +- dashboard-ui/advancedpaths.html | 1 + dashboard-ui/advancedserversettings.html | 1 + dashboard-ui/encodingsettings.html | 1 + dashboard-ui/notificationsettings.html | 62 ++++++++++++++++++++ dashboard-ui/scripts/notificationsettings.js | 50 ++++++++++++++++ 6 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 dashboard-ui/notificationsettings.html create mode 100644 dashboard-ui/scripts/notificationsettings.js diff --git a/dashboard-ui/advanced.html b/dashboard-ui/advanced.html index e2a14873f..944cd40f0 100644 --- a/dashboard-ui/advanced.html +++ b/dashboard-ui/advanced.html @@ -11,6 +11,7 @@
${TabGeneral} + ${TabNotifications} ${TabPaths} ${TabServer} ${TabTranscoding} @@ -22,7 +23,7 @@
  • diff --git a/dashboard-ui/advancedpaths.html b/dashboard-ui/advancedpaths.html index 387d4e361..8a2cada31 100644 --- a/dashboard-ui/advancedpaths.html +++ b/dashboard-ui/advancedpaths.html @@ -11,6 +11,7 @@
    ${TabGeneral} + ${TabNotifications} ${TabPaths} ${TabServer} ${TabTranscoding} diff --git a/dashboard-ui/advancedserversettings.html b/dashboard-ui/advancedserversettings.html index 2791240a8..58f825ab5 100644 --- a/dashboard-ui/advancedserversettings.html +++ b/dashboard-ui/advancedserversettings.html @@ -11,6 +11,7 @@
    ${TabGeneral} + ${TabNotifications} ${TabPaths} ${TabServer} ${TabTranscoding} diff --git a/dashboard-ui/encodingsettings.html b/dashboard-ui/encodingsettings.html index 6527f4f0f..4f412d7d7 100644 --- a/dashboard-ui/encodingsettings.html +++ b/dashboard-ui/encodingsettings.html @@ -11,6 +11,7 @@
    ${TabGeneral} + ${TabNotifications} ${TabPaths} ${TabServer} ${TabTranscoding} diff --git a/dashboard-ui/notificationsettings.html b/dashboard-ui/notificationsettings.html new file mode 100644 index 000000000..d382775e9 --- /dev/null +++ b/dashboard-ui/notificationsettings.html @@ -0,0 +1,62 @@ + + + + ${TitleAdvanced} + + +
    + +
    +
    + + +
    + +
      +
    • + +
      + + + + + + + + + + + + +
      ${SendNotificationHelp}
      +
      +
    • +
    +
    +
      +
    • + + +
    • + +
    +
    +
    +
    + + +
    + + diff --git a/dashboard-ui/scripts/notificationsettings.js b/dashboard-ui/scripts/notificationsettings.js new file mode 100644 index 000000000..559620c27 --- /dev/null +++ b/dashboard-ui/scripts/notificationsettings.js @@ -0,0 +1,50 @@ +(function () { + + function reload(page) { + + ApiClient.getServerConfiguration().done(function (config) { + + 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'); + $('#chkPlayback', page).checked(notificationOptions.SendOnPlayback).checkboxradio('refresh'); + + }); + } + + 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.SendOnPlayback = $('#chkPlayback', page).checked(); + + ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); + }); + + } + + $(document).on('pageshow', "#notificationSettingsPage", function () { + + var page = this; + + reload(page); + }); + + window.NotificationSettingsPage = { + + onSubmit: function () { + + var page = $(this).parents('.page'); + save(page); + return false; + } + }; + +})(jQuery, window); \ No newline at end of file