From 12dd9abd5fad9ac70d74984dad4ee29dd4fdaed7 Mon Sep 17 00:00:00 2001 From: Supremicus Date: Tue, 28 Oct 2014 10:51:55 +1000 Subject: [PATCH] config_notifications improvements * Changed notifier test buttons to not run if required field is missing * Required fields will now highlight input box and add an icon if field is missing when test is pushed * Changed Test Plex Media Server to Test Plex Client as it only tests the client and not the server * Styled config_notifications to match new config_general styling Wording corrections --- CHANGES.md | 6 +- gui/slick/css/dark.css | 4 + gui/slick/css/light.css | 4 + gui/slick/css/style.css | 4 + gui/slick/images/warning16.png | Bin 0 -> 3358 bytes .../default/config_notifications.tmpl | 1146 +++++++++-------- gui/slick/js/configNotifications.js | 350 +++-- 7 files changed, 912 insertions(+), 602 deletions(-) create mode 100644 gui/slick/images/warning16.png diff --git a/CHANGES.md b/CHANGES.md index 65e29848..41e32f39 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -### 0.x.x (2014-10-27 xx:xx:xx UTC) +### 0.x.x (2014-10-28 xx:xx:xx UTC) * Add Bootstrap for UI features * Change UI to resize fluidly on different display sizes, fixes the issue where top menu items would disappear on smaller screens. @@ -26,6 +26,10 @@ * Fix Layout "Poster" sort of Paused, Ended, and Continuing shows as they were random * Fix Layout "Simple" sort of tvrage "New" and "Returning" series by changing status column text to "Continuing" * Add dark spinner to "Add New Show" (searching indexers), "Add existing shows" (Loading Folders), Coming Eps and all config pages (when saving) +* Changed notifier test buttons to not run if required field is missing +* Required fields will now highlight input box and add an icon if field is missing when test is pushed +* Changed Test Plex Media Server to Test Plex Client as it only tests the client and not the server +* Styled config_notifications to match new config_general styling ### 0.2.1 (2014-10-22 06:41:00 UTC) diff --git a/gui/slick/css/dark.css b/gui/slick/css/dark.css index 5d0bf275..3c120571 100644 --- a/gui/slick/css/dark.css +++ b/gui/slick/css/dark.css @@ -1701,6 +1701,10 @@ div.metadataDiv .disabled { margin: 6px 4px 0px 0px; } +.warning { + border-color: #F89406; + background: url("../images/warning16.png") no-repeat right 5px center #fff; +} /* ======================================================================= manage*.tmpl diff --git a/gui/slick/css/light.css b/gui/slick/css/light.css index feac4096..046e7754 100644 --- a/gui/slick/css/light.css +++ b/gui/slick/css/light.css @@ -1673,6 +1673,10 @@ div.metadataDiv .disabled { margin: 6px 4px 0px 0px; } +.warning { + border-color: #F89406; + background: url("../images/warning16.png") no-repeat right 5px center #fff; +} /* ======================================================================= manage*.tmpl diff --git a/gui/slick/css/style.css b/gui/slick/css/style.css index a6b4d1a5..9fdd4cb4 100644 --- a/gui/slick/css/style.css +++ b/gui/slick/css/style.css @@ -1751,6 +1751,10 @@ div.metadataDiv .disabled { margin: 6px 4px 0px 0px; } +.warning { + border-color: #F89406; + background: url("../images/warning16.png") no-repeat right 5px center #fff; +} /* ======================================================================= manage*.tmpl diff --git a/gui/slick/images/warning16.png b/gui/slick/images/warning16.png new file mode 100644 index 0000000000000000000000000000000000000000..97a2ea22671c2bf4338b359ab27030fff797015e GIT binary patch literal 3358 zcmV+(4dL>MP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRF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% literal 0 HcmV?d00001 diff --git a/gui/slick/interfaces/default/config_notifications.tmpl b/gui/slick/interfaces/default/config_notifications.tmpl index 16ffd723..ff96f708 100644 --- a/gui/slick/interfaces/default/config_notifications.tmpl +++ b/gui/slick/interfaces/default/config_notifications.tmpl @@ -11,124 +11,136 @@ #if $varExists('header') -

$header

+

$header

#else -

$title

+

$title

#end if
- +
- +

XBMC

A free and open source cross-platform media center and home entertainment system software with a 10-foot user interface designed for the living-room TV.

-
- +
-
-
-
-
-
-
-
-
-
-
Click below to test.
@@ -143,90 +155,105 @@
- +

Plex Media Server

Experience your media on a visually stunning, easy to use interface on your Mac connected to your TV. Your media library has never looked this good!

+

For sending notifications to Plex Home Theater (PHT) clients, use the XBMC notifier with port 3005.

-
-
-
-
-
-
-
-
-
Click below to test.
- +
@@ -236,58 +263,60 @@
- +

NMJ

The Networked Media Jukebox, or NMJ, is the official media jukebox interface made available for the Popcorn Hour 200-series.

-
-
-
-
-
Click below to test.
@@ -298,87 +327,88 @@
-
+
- +

NMJv2

The Networked Media Jukebox, or NMJv2, is the official media jukebox interface made available for the Popcorn Hour 300 & 400-series.

-
-
-
- - - - -
-
+
+ -
- -
-
Click below to test.
- - +
+ + +
+
Click below to test.
+ +
@@ -387,7 +417,7 @@
- +

Synology

The Synology DiskStation NAS.

Synology Indexer is the daemon running on the Synology NAS to build its media database.

@@ -395,15 +425,16 @@
- -
@@ -417,100 +448,109 @@
- +

Synology Notifier

Synology Notifier is the notification system of Synology DSM

- -
+
-
-
-
-
+
- +

pyTivo

pyTivo is both an HMO and GoBack server. This notifier will load the completed downloads to your Tivo.

- -
-
-
-
@@ -519,69 +559,77 @@
-
+
- -
-
+ +
+
- +

Growl

A cross-platform unobtrusive global notification system.

-
-
-
-
-
-
Click below to register and test Growl, this is required for Growl notifications to work.
@@ -595,55 +643,63 @@
- Prowl + Prowl

Prowl

A Growl client for iOS.

-
-
-
-
-
-
Click below to test.
@@ -667,39 +723,47 @@
- +

Libnotify

The standard desktop notification API for Linux/*nix systems. This notifier will only function if the pynotify module is installed (Ubuntu/Debian package python-notify).

-
-
-
-
Click below to test.
@@ -713,59 +777,67 @@
- +

Pushover

Pushover makes it easy to send real-time notifications to your Android and iOS devices.

-
-
-
-
-
-
Click below to test.
@@ -778,49 +850,57 @@
- +

Boxcar

Universal push notification for iOS. Read your messages where and when you want them! A subscription will be sent if needed.

-
-
-
-
-
Click below to test.
@@ -833,49 +913,57 @@
- +

Boxcar2

Read your messages where and when you want them!

-
-
-
-
-
Click below to test.
@@ -888,53 +976,61 @@
- +

Notify My Android

Notify My Android is a Prowl-like Android App and API that offers an easy way to send notifications from your application directly to your Android device.

-
-
-
-
-
-
Click below to test.
@@ -959,49 +1055,57 @@
- +

Pushalot

Pushalot is a platform for receiving custom push notifications to connected devices running Windows Phone or Windows 8.

-
-
-
-
-
Click below to test.
@@ -1014,61 +1118,69 @@
- +

Pushbullet

Pushbullet is a platform for receiving custom push notifications to connected devices running Android and desktop Chrome browsers.

-
-
-
-
-
-
Click below to test.
@@ -1079,55 +1191,63 @@
-
- +
+
-
-
- +
+
+

Twitter

A social networking and microblogging service, enabling its users to send and read other users' messages called tweets.

- -
-
-
-
-
- + //-->
Click below to test.
@@ -1160,53 +1280,55 @@
- +

Trakt

trakt helps keep a record of what TV shows and movies you are watching. Based on your favorites, trakt recommends additional shows and movies you'll enjoy!

-
-
-
-
-
-
-
-
-
-
- - -
-
- - - - -
-
- - -
-
+
+
+ + +
+
+ +
+
+ +
+
+ +
+
Click below to test.
@@ -1274,124 +1408,132 @@
- +

Email

Allows configuration of email notifications on a per show basis.

-
-
-
-
-
-
- - -
-
- - -
-
- +
+
+ + +
+
+ + +
+
+
-
-
-
-
@@ -1405,7 +1547,7 @@
-

+

diff --git a/gui/slick/js/configNotifications.js b/gui/slick/js/configNotifications.js index 0eb03bbe..d430aa96 100644 --- a/gui/slick/js/configNotifications.js +++ b/gui/slick/js/configNotifications.js @@ -1,88 +1,168 @@ $(document).ready(function(){ var loading = ''; - $('#testGrowl').click(function(){ + $('#testGrowl').click(function () { + var growl_host = $.trim($('#growl_host').val()); + var growl_password = $.trim($('#growl_password').val()); + if (!growl_host) { + $('#testGrowl-result').html('Please fill out the necessary fields above.'); + $('#growl_host').addClass('warning'); + return; + } + $('#growl_host').removeClass('warning'); + $(this).prop('disabled', true); $('#testGrowl-result').html(loading); - var growl_host = $("#growl_host").val(); - var growl_password = $("#growl_password").val(); - $.get(sbRoot + "/home/testGrowl", {'host': growl_host, 'password': growl_password}, - function (data) { $('#testGrowl-result').html(data); }); - }); - - $('#testProwl').click(function() { - $('#testProwl-result').html(loading); - var prowl_api = $("#prowl_api").val(); - var prowl_priority = $("#prowl_priority").val(); - $.get(sbRoot + "/home/testProwl", {'prowl_api': prowl_api, 'prowl_priority': prowl_priority}, - function (data) { $('#testProwl-result').html(data); }); - }); - - $('#testXBMC').click(function() { - $("#testXBMC").attr("disabled", true); - $('#testXBMC-result').html(loading); - var xbmc_host = $("#xbmc_host").val(); - var xbmc_username = $("#xbmc_username").val(); - var xbmc_password = $("#xbmc_password").val(); - - $.get(sbRoot + "/home/testXBMC", {'host': xbmc_host, 'username': xbmc_username, 'password': xbmc_password}) + $.get(sbRoot + '/home/testGrowl', {'host': growl_host, 'password': growl_password}) .done(function (data) { - $('#testXBMC-result').html(data); - $("#testXBMC").attr("disabled", false); + $('#testGrowl-result').html(data); + $('#testGrowl').prop('disabled', false); }); }); - $('#testPLEX').click(function() { + $('#testProwl').click(function () { + var prowl_api = $.trim($('#prowl_api').val()); + var prowl_priority = $('#prowl_priority').val(); + if (!prowl_api) { + $('#testProwl-result').html('Please fill out the necessary fields above.'); + $('#prowl_api').addClass('warning'); + return; + } + $('#prowl_api').removeClass('warning'); + $(this).prop('disabled', true); + $('#testProwl-result').html(loading); + $.get(sbRoot + '/home/testProwl', {'prowl_api': prowl_api, 'prowl_priority': prowl_priority}) + .done(function (data) { + $('#testProwl-result').html(data); + $('#testProwl').prop('disabled', false); + }); + }); + + $('#testXBMC').click(function () { + var xbmc_host = $.trim($('#xbmc_host').val()); + var xbmc_username = $.trim($('#xbmc_username').val()); + var xbmc_password = $.trim($('#xbmc_password').val()); + if (!xbmc_host) { + $('#testXBMC-result').html('Please fill out the necessary fields above.'); + $('#xbmc_host').addClass('warning'); + return; + } + $('#xbmc_host').removeClass('warning'); + $(this).prop('disabled', true); + $('#testXBMC-result').html(loading); + $.get(sbRoot + '/home/testXBMC', {'host': xbmc_host, 'username': xbmc_username, 'password': xbmc_password}) + .done(function (data) { + $('#testXBMC-result').html(data); + $('#testXBMC').prop('disabled', false); + }); + }); + + $('#testPLEX').click(function () { + var plex_host = $.trim($('#plex_host').val()); + var plex_username = $.trim($('#plex_username').val()); + var plex_password = $.trim($('#plex_password').val()); + if (!plex_host) { + $('#testPLEX-result').html('Please fill out the necessary fields above.'); + $('#plex_host').addClass('warning'); + return; + } + $('#plex_host').removeClass('warning'); + $(this).prop('disabled', true); $('#testPLEX-result').html(loading); - var plex_host = $("#plex_host").val(); - var plex_username = $("#plex_username").val(); - var plex_password = $("#plex_password").val(); - $.get(sbRoot + "/home/testPLEX", {'host': plex_host, 'username': plex_username, 'password': plex_password}, - function (data) { $('#testPLEX-result').html(data); }); + $.get(sbRoot + '/home/testPLEX', {'host': plex_host, 'username': plex_username, 'password': plex_password}) + .done(function (data) { + $('#testPLEX-result').html(data); + $('#testPLEX').prop('disabled', false); + }); }); $('#testBoxcar').click(function() { + var boxcar_username = $.trim($('#boxcar_username').val()); + if (!boxcar_username) { + $('#testBoxcar-result').html('Please fill out the necessary fields above.'); + $('#boxcar_username').addClass('warning'); + return; + } + $('#boxcar_username').removeClass('warning'); + $(this).prop('disabled', true); $('#testBoxcar-result').html(loading); - var boxcar_username = $("#boxcar_username").val(); - $.get(sbRoot + "/home/testBoxcar", {'username': boxcar_username}, - function (data) { $('#testBoxcar-result').html(data); }); + $.get(sbRoot + '/home/testBoxcar', {'username': boxcar_username}) + .done(function (data) { + $('#testBoxcar-result').html(data); + $('#testBoxcar').prop('disabled', false); + }); }); - $('#testBoxcar2').click(function() { + $('#testBoxcar2').click(function () { + var boxcar2_accesstoken = $.trim($('#boxcar2_accesstoken').val()); + if (!boxcar2_accesstoken) { + $('#testBoxcar2-result').html('Please fill out the necessary fields above.'); + $('#boxcar2_accesstoken').addClass('warning'); + return; + } + $('#boxcar2_accesstoken').removeClass('warning'); + $(this).prop('disabled', true); $('#testBoxcar2-result').html(loading); - var boxcar2_accesstoken = $("#boxcar2_accesstoken").val(); - $.get(sbRoot + "/home/testBoxcar2", {'accesstoken': boxcar2_accesstoken}, - function (data) { $('#testBoxcar2-result').html(data); }); + $.get(sbRoot + '/home/testBoxcar2', {'accessToken': boxcar2_accesstoken}) + .done(function (data) { + $('#testBoxcar2-result').html(data); + $('#testBoxcar2').prop('disabled', false); + }); }); - $('#testPushover').click(function() { + $('#testPushover').click(function () { + var pushover_userkey = $('#pushover_userkey').val(); + var pushover_apikey = $('#pushover_apikey').val(); + if (!pushover_userkey || !pushover_apikey) { + $('#testPushover-result').html('Please fill out the necessary fields above.'); + if (!pushover_userkey) { + $('#pushover_userkey').addClass('warning'); + } else { + $('#pushover_userkey').removeClass('warning'); + } + if (!pushover_apikey) { + $('#pushover_apikey').addClass('warning'); + } else { + $('#pushover_apikey').removeClass('warning'); + } + return; + } + $('#pushover_userkey,#pushover_apikey').removeClass('warning'); + $(this).prop('disabled', true); $('#testPushover-result').html(loading); - var pushover_userkey = $("#pushover_userkey").val(); - var pushover_apikey = $("#pushover_apikey").val(); - $.get(sbRoot + "/home/testPushover", {'userKey': pushover_userkey, 'apiKey': pushover_apikey}, - function (data) { $('#testPushover-result').html(data); }); + $.get(sbRoot + '/home/testPushover', {'userKey': pushover_userkey, 'apiKey': pushover_apikey}) + .done(function (data) { + $('#testPushover-result').html(data); + $('#testPushover').prop('disabled', false); + }); }); $('#testLibnotify').click(function() { $('#testLibnotify-result').html(loading); - $.get(sbRoot + "/home/testLibnotify", + $.get(sbRoot + '/home/testLibnotify', function (data) { $('#testLibnotify-result').html(data); }); }); $('#twitterStep1').click(function() { $('#testTwitter-result').html(loading); - $.get(sbRoot + "/home/twitterStep1", function (data) {window.open(data); }) + $.get(sbRoot + '/home/twitterStep1', function (data) {window.open(data); }) .done(function () { $('#testTwitter-result').html('Step1: Confirm Authorization'); }); }); - $('#twitterStep2').click(function() { + $('#twitterStep2').click(function () { + var twitter_key = $.trim($('#twitter_key').val()); + if (!twitter_key) { + $('#testTwitter-result').html('Please fill out the necessary fields above.'); + $('#twitter_key').addClass('warning'); + return; + } + $('#twitter_key').removeClass('warning'); $('#testTwitter-result').html(loading); - var twitter_key = $("#twitter_key").val(); - $.get(sbRoot + "/home/twitterStep2", {'key': twitter_key}, + $.get(sbRoot + '/home/twitterStep2', {'key': twitter_key}, function (data) { $('#testTwitter-result').html(data); }); }); $('#testTwitter').click(function() { - $.get(sbRoot + "/home/testTwitter", + $.get(sbRoot + '/home/testTwitter', function (data) { $('#testTwitter-result').html(data); }); }); @@ -95,7 +175,7 @@ $(document).ready(function(){ $('#testNMJ-result').html(loading); var nmj_host = $('#nmj_host').val(); - $.get(sbRoot + "/home/settingsNMJ", {'host': nmj_host}, + $.get(sbRoot + '/home/settingsNMJ', {'host': nmj_host}, function (data) { if (data === null) { $('#nmj_database').removeAttr('readonly'); @@ -119,14 +199,23 @@ $(document).ready(function(){ }); }); - $('#testNMJ').click(function() { + $('#testNMJ').click(function () { + var nmj_host = $.trim($('#nmj_host').val()); + var nmj_database = $('#nmj_database').val(); + var nmj_mount = $('#nmj_mount').val(); + if (!nmj_host) { + $('#testNMJ-result').html('Please fill out the necessary fields above.'); + $('#nmj_host').addClass('warning'); + return; + } + $('#nmj_host').removeClass('warning'); + $(this).prop('disabled', true); $('#testNMJ-result').html(loading); - var nmj_host = $("#nmj_host").val(); - var nmj_database = $("#nmj_database").val(); - var nmj_mount = $("#nmj_mount").val(); - - $.get(sbRoot + "/home/testNMJ", {'host': nmj_host, 'database': nmj_database, 'mount': nmj_mount}, - function (data) { $('#testNMJ-result').html(data); }); + $.get(sbRoot + '/home/testNMJ', {'host': nmj_host, 'database': nmj_database, 'mount': nmj_mount}) + .done(function (data) { + $('#testNMJ-result').html(data); + $('#testNMJ').prop('disabled', false); + }); }); $('#settingsNMJv2').click(function() { @@ -138,7 +227,7 @@ $(document).ready(function(){ $('#testNMJv2-result').html(loading); var nmjv2_host = $('#nmjv2_host').val(); var nmjv2_dbloc; - var radios = document.getElementsByName("nmjv2_dbloc"); + var radios = document.getElementsByName('nmjv2_dbloc'); for (var i = 0; i < radios.length; i++) { if (radios[i].checked) { nmjv2_dbloc=radios[i].value; @@ -147,7 +236,7 @@ $(document).ready(function(){ } var nmjv2_dbinstance=$('#NMJv2db_instance').val(); - $.get(sbRoot + "/home/settingsNMJv2", {'host': nmjv2_host,'dbloc': nmjv2_dbloc,'instance': nmjv2_dbinstance}, + $.get(sbRoot + '/home/settingsNMJv2', {'host': nmjv2_host,'dbloc': nmjv2_dbloc,'instance': nmjv2_dbinstance}, function (data){ if (data == null) { $('#nmjv2_database').removeAttr('readonly'); @@ -163,38 +252,69 @@ $(document).ready(function(){ }); }); - $('#testNMJv2').click(function() { + $('#testNMJv2').click(function () { + var nmjv2_host = $.trim($('#nmjv2_host').val()); + if (!nmjv2_host) { + $('#testNMJv2-result').html('Please fill out the necessary fields above.'); + $('#nmjv2_host').addClass('warning'); + return; + } + $('#nmjv2_host').removeClass('warning'); + $(this).prop('disabled', true); $('#testNMJv2-result').html(loading); - var nmjv2_host = $("#nmjv2_host").val(); - - $.get(sbRoot + "/home/testNMJv2", {'host': nmjv2_host}, - function (data){ $('#testNMJv2-result').html(data); }); + $.get(sbRoot + '/home/testNMJv2', {'host': nmjv2_host}) + .done(function (data) { + $('#testNMJv2-result').html(data); + $('#testNMJv2').prop('disabled', false); + }); }); - - $('#testTrakt').click(function() { + + $('#testTrakt').click(function () { + var trakt_api = $.trim($('#trakt_api').val()); + var trakt_username = $.trim($('#trakt_username').val()); + var trakt_password = $.trim($('#trakt_password').val()); + if (!trakt_api || !trakt_username || !trakt_password) { + $('#testTrakt-result').html('Please fill out the necessary fields above.'); + if (!trakt_api) { + $('#trakt_api').addClass('warning'); + } else { + $('#trakt_api').removeClass('warning'); + } + if (!trakt_username) { + $('#trakt_username').addClass('warning'); + } else { + $('#trakt_username').removeClass('warning'); + } + if (!trakt_password) { + $('#trakt_password').addClass('warning'); + } else { + $('#trakt_password').removeClass('warning'); + } + return; + } + $('#trakt_api,#trakt_username,#trakt_password').removeClass('warning'); + $(this).prop('disabled', true); $('#testTrakt-result').html(loading); - var trakt_api = $("#trakt_api").val(); - var trakt_username = $("#trakt_username").val(); - var trakt_password = $("#trakt_password").val(); - - $.get(sbRoot + "/home/testTrakt", {'api': trakt_api, 'username': trakt_username, 'password': trakt_password}, - function (data) { $('#testTrakt-result').html(data); }); + $.get(sbRoot + '/home/testTrakt', {'api': trakt_api, 'username': trakt_username, 'password': trakt_password}) + .done(function (data) { + $('#testTrakt-result').html(data); + $('#testTrakt').prop('disabled', false); + }); }); - $('#testEmail').click(function () { var status, host, port, tls, from, user, pwd, err, to; status = $('#testEmail-result'); status.html(loading); - host = $("#email_host").val(); + host = $('#email_host').val(); host = host.length > 0 ? host : null; - port = $("#email_port").val(); + port = $('#email_port').val(); port = port.length > 0 ? port : null; - tls = $("#email_tls").attr('checked') !== undefined ? 1 : 0; - from = $("#email_from").val(); + tls = $('#email_tls').attr('checked') !== undefined ? 1 : 0; + from = $('#email_from').val(); from = from.length > 0 ? from : 'root@localhost'; - user = $("#email_user").val().trim(); - pwd = $("#email_password").val(); + user = $('#email_user').val().trim(); + pwd = $('#email_password').val(); err = ''; if (host === null) { err += '
  • You must specify an SMTP hostname!
  • '; @@ -212,40 +332,62 @@ $(document).ready(function(){ if (to === null || to.length === 0 || to.match(/.*@.*/) === null) { status.html('

    You must provide a recipient email address!

    '); } else { - $.get(sbRoot + "/home/testEmail", {host: host, port: port, smtp_from: from, use_tls: tls, user: user, pwd: pwd, to: to}, + $.get(sbRoot + '/home/testEmail', {host: host, port: port, smtp_from: from, use_tls: tls, user: user, pwd: pwd, to: to}, function (msg) { $('#testEmail-result').html(msg); }); } } }); - $('#testNMA').click(function() { + $('#testNMA').click(function () { + var nma_api = $.trim($('#nma_api').val()); + var nma_priority = $('#nma_priority').val(); + if (!nma_api) { + $('#testNMA-result').html('Please fill out the necessary fields above.'); + $('#nma_api').addClass('warning'); + return; + } + $('#nma_api').removeClass('warning'); + $(this).prop('disabled', true); $('#testNMA-result').html(loading); - var nma_api = $("#nma_api").val(); - var nma_priority = $("#nma_priority").val(); - $.get(sbRoot + "/home/testNMA", {'nma_api': nma_api, 'nma_priority': nma_priority}, - function (data) { $('#testNMA-result').html(data); }); + $.get(sbRoot + '/home/testNMA', {'nma_api': nma_api, 'nma_priority': nma_priority}) + .done(function (data) { + $('#testNMA-result').html(data); + $('#testNMA').prop('disabled', false); + }); }); $('#testPushalot').click(function () { + var pushalot_authorizationtoken = $.trim($('#pushalot_authorizationtoken').val()); + if (!pushalot_authorizationtoken) { + $('#testPushalot-result').html('Please fill out the necessary fields above.'); + $('#pushalot_authorizationtoken').addClass('warning'); + return; + } + $('#pushalot_authorizationtoken').removeClass('warning'); + $(this).prop('disabled', true); $('#testPushalot-result').html(loading); - var pushalot_authorizationtoken = $("pushalot_authorizationtoken").val(); - $.get(sbRoot + "/home/testPushalot", {'authorizationToken': pushalot_authorizationtoken}, - function (data) { $('#testPushalot-result').html(data); }); + $.get(sbRoot + '/home/testPushalot', {'authorizationToken': pushalot_authorizationtoken}) + .done(function (data) { + $('#testPushalot-result').html(data); + $('#testPushalot').prop('disabled', false); + }); }); - $('#testPushbullet').click(function () { - $('#testPushbullet-result').html(loading); - var pushbullet_api = $("#pushbullet_api").val(); - if($("#pushbullet_api").val() == '') { - $('#testPushbullet-result').html("You didn't supply a Pushbullet api key"); - $("#pushbullet_api").focus(); - return false; + $('#testPushbullet').click(function () { + var pushbullet_api = $.trim($('#pushbullet_api').val()); + if (!pushbullet_api) { + $('#testPushbullet-result').html('Please fill out the necessary fields above.'); + $('#pushbullet_api').addClass('warning'); + return; } - $.get(sbRoot + "/home/testPushbullet", {'api': pushbullet_api}, - function (data) { + $('#pushbullet_api').removeClass('warning'); + $(this).prop('disabled', true); + $('#testPushbullet-result').html(loading); + $.get(sbRoot + '/home/testPushbullet', {'api': pushbullet_api}) + .done(function (data) { $('#testPushbullet-result').html(data); - } - ); + $('#testPushbullet').prop('disabled', false); + }); }); function get_pushbullet_devices(msg){ @@ -323,4 +465,14 @@ $(document).ready(function(){ } // Load the per show notify lists everytime this page is loaded load_show_notify_lists(); + + // show instructions for plex when enabled + $('#use_plex').click(function() { + if ( $(this).is(':checked') ) { + $('.plexinfo').removeClass('hide'); + } else { + $('.plexinfo').addClass('hide'); + } + }); + });