From ea887dd8f62fa1968fdbd87232d742dd129d1e4f Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 12 Nov 2015 14:47:47 -0500 Subject: [PATCH] Disable publish checkbox for disconnected sources --- airtime_mvc/application/services/PublishService.php | 5 +++-- .../application/views/scripts/library/publish-dialog.phtml | 5 +++-- airtime_mvc/public/js/airtime/library/publish.js | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/services/PublishService.php b/airtime_mvc/application/services/PublishService.php index f883c5d5d..7e166451f 100644 --- a/airtime_mvc/application/services/PublishService.php +++ b/airtime_mvc/application/services/PublishService.php @@ -78,11 +78,12 @@ class Application_Service_PublishService { * @param int $fileId the ID of the file to check * * @return int 1 if the file has been published to SoundCloud, - * 0 if the file has yet to be published, or -1 if the - * file is in a pending state + * 0 if the file has yet to be published, + * -1 if the file is in a pending state */ private static function getSoundCloudPublishStatus($fileId) { $soundcloudService = new Application_Service_SoundcloudService(); + if (!$soundcloudService->hasAccessToken()) { return 2; } return ($soundcloudService->referenceExists($fileId)); } diff --git a/airtime_mvc/application/views/scripts/library/publish-dialog.phtml b/airtime_mvc/application/views/scripts/library/publish-dialog.phtml index 9c303b301..a297cc425 100644 --- a/airtime_mvc/application/views/scripts/library/publish-dialog.phtml +++ b/airtime_mvc/application/views/scripts/library/publish-dialog.phtml @@ -19,8 +19,9 @@
- -
+ + +
" diff --git a/airtime_mvc/public/js/airtime/library/publish.js b/airtime_mvc/public/js/airtime/library/publish.js index 4f1da13b7..d4b461851 100644 --- a/airtime_mvc/public/js/airtime/library/publish.js +++ b/airtime_mvc/public/js/airtime/library/publish.js @@ -16,7 +16,6 @@ var AIRTIME = (function (AIRTIME) { //AngularJS app var publishApp = angular.module(PUBLISH_APP_NAME, []) .controller('Publish', function ($scope, $http, mediaId, tab) { - $scope.publishSources = {}; $scope.publishData = {}; var sourceInterval; @@ -34,7 +33,7 @@ var AIRTIME = (function (AIRTIME) { .success(function (json) { $scope.sources = { toPublish: [], published: []}; $.each(json, function () { - if (this.status != 0) { + if (Math.abs(this.status) == 1) { $scope.sources.published.push(this); } else { $scope.sources.toPublish.push(this);